@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&display=swap");

/* Theme and layout variables */
:root {
  --midnight: #0b1f3b;
  --grey: #eceff2;
  --grey-2: #f7f8fa;
  --sage: #7fa78a;
  --sage-strong: #5f8e6a;
  --bg: linear-gradient(180deg, #f6f7f9, #eef2f5);
  --home-bg: #a7bfae;
  --card: #f4f6f2;
  --muted: #5b6470;
  --text: #0b1f3b;
  --accent: #0b1f3b;
  --border: rgba(11,31,59,0.08);
  --shadow: 0 8px 30px rgba(11,31,59,0.08);
  --radius: 12px;
}

/* Page shell */
html, body { height: 100%; }
body {
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  margin: 24px;
  background: var(--home-bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

body.booting {
  visibility: hidden;
}

/* Center content and give a soft card look to main content blocks */
body > h1,
#status,
#prompt,
textarea,
.saved-panel,
.row,
#trainingDebug {
  max-width: 880px;
  margin-left: auto;
  margin-right: auto;
}

/* Inputs and boxes */
textarea {
  width: 100%;
  height: 220px;
  font-size: 16px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
}

input[type="email"],
input[type="password"] {
  width: 100%;
  font-size: 16px;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--text);
  box-sizing: border-box;
}

.row { display: flex; gap: 10px; margin: 12px 0; align-items:center; }

button {
  padding: 10px 14px;
  font-size: 15px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fff, var(--grey-2));
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
  box-shadow: none;
  color: var(--text);
  position: relative;
}
button:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(12,15,20,0.04); }
button:active { transform: translateY(0); }
button:disabled { opacity: 0.6; cursor: not-allowed; filter: grayscale(10%); }

ul { padding-left: 18px; }
li { margin: 6px 0; }

.prompt { font-size: 22px; margin: 18px 0; line-height: 1.45; color: var(--text); }
.countdown { font-size: 18px; margin-bottom: 14px; color: var(--muted); }

/* Soft card header */
h1 {
  font-family: "Playfair Display", "Times New Roman", serif;
  font-weight: 700;
  margin: 10px 0 14px;
  font-size: 36px;
  text-align: center;
  letter-spacing: 0.02em;
  color: var(--midnight);
}
#brandMark,
.brand-mark {
  display: block;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 12px 0 0 0;
}
#status { margin-bottom: 8px; color: var(--muted); text-align:center; }

/* Title row with side images */
.title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: nowrap;
  max-width: 920px;
  margin: 0 auto;
}
.title-row h1 { margin: 10px 10px 14px; }
.title-figure {
  margin: 0;
  text-align: center;
  min-width: 70px;
}
.title-figure img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 18px rgba(12,15,20,0.06);
  display: block;
}
.title-figure figcaption {
  font-size: 10px;
  color: var(--muted);
  margin-top: 6px;
  letter-spacing: 0.02em;
}

.promo-box {
  max-width: 720px;
  margin: 6px auto 14px;
  padding: 6px 10px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  background: rgba(255,255,255,0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  letter-spacing: 0.01em;
}

.auth-shell {
  max-width: 420px;
  margin: 0 auto;
}

.auth-page {
  max-width: 420px;
  margin: 56px auto 0;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.auth-mode-title {
  text-align: center;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.auth-title {
  margin-bottom: 20px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-field {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-weight: 600;
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.password-toggle-btn {
  min-width: 64px;
  border-radius: 6px;
}

.auth-message {
  min-height: 20px;
  margin-bottom: 10px;
  text-align: center;
  color: var(--muted);
}

.auth-message.error {
  color: #8a1f1f;
}

.auth-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.auth-actions button,
.verify-actions button {
  border-radius: 6px;
}

.verify-actions button.is-cooling-down,
.verify-actions button:disabled {
  opacity: 0.45;
  filter: grayscale(20%);
}

.auth-actions button {
  flex: 1 1 150px;
}

.auth-text-btn {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--midnight);
  text-decoration: underline;
  justify-self: center;
  box-shadow: none;
}

.auth-switch-btn {
  margin-top: 2px;
}

.auth-text-btn:hover {
  transform: none;
  box-shadow: none;
}

.verify-card {
  text-align: center;
}

.verify-message {
  color: var(--text);
  line-height: 1.5;
}

.verify-email {
  margin-top: 10px;
  font-weight: 700;
  word-break: break-word;
}

.verify-note {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.verify-actions {
  margin-top: 16px;
}

/* Center top page controls and inputs on the home page */
body > button, body > label { display:block; margin: 10px auto; text-align:center; }
body > textarea { display:block; margin: 12px auto; }
#sentenceList { max-width: 880px; margin: 12px auto; }
#sentenceList {
  background: var(--midnight);
  color: #f5f7fa;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(11,31,59,0.2);
  margin-left: 8px;
  margin-right: 0;
}

/* Home flow groups */
.home-group {
  max-width: 880px;
  margin: 0 auto;
  text-align: center;
}
.home-group.is-hidden { display: none; }
.is-hidden { display: none !important; }
.home-group button { margin: 10px auto; }
.home-group label { display:block; margin: 10px auto; text-align:center; }
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 10px auto;
}

.btn-row-top {
  margin-top: 8px;
  margin-bottom: 12px;
}

.control-faded {
  opacity: 0.48;
  filter: saturate(0.85);
}

#startBtn.start-ready {
  border-color: #5f8e6a;
  background: linear-gradient(180deg, #ffffff, #eef7f0);
  box-shadow: 0 0 0 3px rgba(95,142,106,0.28), 0 8px 20px rgba(95,142,106,0.14);
}

.premium-locked {
  padding-right: 40px;
}

.premium-locked::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.85;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4.667 6V4.667a3.333 3.333 0 1 1 6.666 0V6' stroke='%230b1f3b' stroke-width='1.4' stroke-linecap='round'/%3E%3Crect x='3.333' y='6' width='9.334' height='7.333' rx='1.6' stroke='%230b1f3b' stroke-width='1.4'/%3E%3C/svg%3E");
}

.premium-locked:hover::before,
.premium-locked:focus-visible::before {
  content: attr(data-lock-message);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  background: rgba(11,31,59,0.94);
  color: #ffffff;
  padding: 8px 10px;
  border-radius: 6px;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.2;
  z-index: 5;
  pointer-events: none;
}
.btn-with-arrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 8px auto;
}
.btn-with-arrow.center {
  justify-content: center;
}
.arrow-hint {
  width: 36px;
  height: 36px;
  object-fit: contain;
  opacity: 0.85;
}
.arrow-hint.left {
  order: -1;
}
.arrow-hint.down {
  transform: rotate(90deg);
}
.chunks-arrow {
  max-width: 880px;
  margin: 6px auto 0;
  display: flex;
  justify-content: center;
}
.chunks-arrow img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  transform: rotate(90deg);
  opacity: 0.85;
}
.home-summary {
  font-size: 12px;
  color: var(--muted);
  margin: 8px auto 4px;
  max-width: 700px;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.6);
  min-width: 260px;
}
.summary-tick { margin-left: 8px; }


/* subtle focus for accessibility */
:focus { outline: 3px solid rgba(59,130,246,0.12); outline-offset: 2px }


/* Show sentence button and temporary sentence reveal */
.show-sentence-btn { padding: 8px 12px; font-size: 15px; border-radius: 10px; border: 1px solid var(--border); background: #fff; cursor: pointer; box-shadow: 0 6px 18px rgba(12,15,20,0.04); }
.show-sentence-btn:active { transform: translateY(0); }
.prompt-sentence { font-size: 22px; margin-top: 8px; color: var(--text); background: linear-gradient(180deg,#ffffff,#fbfdff); padding:10px 14px; border-radius:12px; border:1px solid rgba(15,23,42,0.03); box-shadow: var(--shadow); }

/* Test-mode chunk reveal styling */
.training .prompt-sentence {
  background: var(--midnight);
  color: #f5f7fa;
  border: 1px solid rgba(11,31,59,0.2);
  margin-left: 8px;
  margin-right: 0;
}



/* Saved attempts sliding panel */
.saved-toggle {
  position: fixed;
  right: 12px;
  top: 12px;
  transform: none;
  background: var(--grey-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  z-index: 1002;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(12,15,20,0.06);
}

.account-btn {
  position: fixed;
  left: 12px;
  top: 12px;
  background: var(--grey-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  z-index: 1002;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(12,15,20,0.06);
}

.account-panel {
  position: fixed;
  left: 12px;
  top: 56px;
  width: min(320px, calc(100vw - 24px));
  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(15,23,42,0.08);
  border-radius: 8px;
  box-shadow: 0 20px 40px rgba(12,15,20,0.12);
  padding: 14px;
  z-index: 1003;
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.account-panel.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.account-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.account-content {
  display: grid;
  gap: 12px;
}

.account-stat {
  display: grid;
  gap: 4px;
}

.account-label {
  font-size: 12px;
  color: var(--muted);
}

.account-value {
  font-size: 15px;
  color: var(--text);
  word-break: break-word;
}

.account-subvalue {
  font-size: 12px;
  color: var(--muted);
}

.account-logout-btn {
  width: 100%;
  border-radius: 6px;
}

.account-premium-btn {
  width: 100%;
  border-radius: 6px;
}

.account-premium-btn.is-loading,
.premium-actions button.is-loading {
  opacity: 0.55;
  cursor: wait;
}

.premium-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11,31,59,0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1200;
}

.premium-card {
  width: min(360px, 100%);
  background: rgba(255,255,255,0.98);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 24px 48px rgba(12,15,20,0.16);
  padding: 18px;
}

.premium-title {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.premium-copy {
  color: var(--muted);
  line-height: 1.5;
}

.premium-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.premium-actions .secondary {
  background: #ffffff;
}

.feature-screen {
  max-width: 880px;
  margin: 0 auto;
}

.feature-copy {
  color: var(--muted);
  margin: 0 auto 12px;
  max-width: 760px;
  line-height: 1.5;
  text-align: center;
}

.feature-controls {
  display: flex;
  justify-content: center;
  margin: 0 auto 12px;
}

.feature-field {
  display: grid;
  gap: 6px;
  min-width: 220px;
  color: var(--text);
  font-weight: 600;
}

.feature-select {
  font-size: 15px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}

.feature-status {
  margin: 10px auto 14px;
  max-width: 760px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.65);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-align: center;
}

.feature-textarea {
  min-height: 240px;
}

.feature-note {
  max-width: 760px;
  margin: 10px auto 0;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
}

.beta-tag {
  font-size: 0.6em;
  color: var(--muted);
  vertical-align: middle;
}

.speak-reveal-paragraph {
  max-width: 880px;
  margin: 14px auto 0;
  padding: 18px;
  border-radius: 12px;
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  line-height: 2;
  font-size: 20px;
}

.speak-word {
  display: inline-block;
  margin: 0 2px;
  padding: 0 4px;
  border-radius: 6px;
  transition: filter 140ms ease, background 140ms ease, color 140ms ease;
}

.speak-word.hidden {
  filter: blur(7px);
  color: rgba(11,31,59,0.25);
  background: rgba(11,31,59,0.08);
}

.speak-word.active {
  filter: blur(7px);
  color: rgba(11,31,59,0.32);
  background: rgba(95,142,106,0.16);
  border: 1px dashed rgba(95,142,106,0.4);
}

.speak-word.revealed {
  filter: none;
  color: var(--text);
  background: rgba(127,167,138,0.18);
}

/* Keep open state as a subtle rotate for affordance */
.saved-toggle.open { transform: rotate(180deg); }

.tutorial-toggle {
  position: fixed;
  right: 12px;
  top: 64px;
  transform: none;
  background: var(--grey-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  z-index: 1002;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(12,15,20,0.06);
}
.tutorial-toggle.open { transform: rotate(180deg); }
.tutorial-toggle.home { top: 44px; }

.home-saved-toggle {
  position: fixed;
  right: 12px;
  top: 104px;
  transform: none;
  background: var(--grey-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  z-index: 1002;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(12,15,20,0.06);
}
.home-saved-toggle.open { background: #ffffff; }

/* Fill-in-the-blanks panel */
.blanks-panel {
  margin: 10px auto 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: left;
}
.blanks-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.blanks-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.blanks-list {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  background: #ffffff8a;
}
.blanks-sentence {
  margin: 8px 0;
  line-height: 1.5;
}
.blank-word {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
.blank-word.selected {
  background: var(--sage);
  color: #0b1f3b;
  border-color: rgba(95,142,106,0.6);
}
.blanks-footer { margin-top: 10px; text-align: right; }
.blanks-scroll-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 8px 0 4px;
  font-size: 12px;
  color: var(--muted);
}
.blanks-scroll-hint img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  transform: rotate(90deg);
  opacity: 0.85;
}

/* Blanks test page */
.blanks-test,
.blanks-select {
  max-width: 880px;
  margin: 0 auto;
}
.blanks-test h1 { margin-top: 0; }
.blank-input {
  width: 120px;
  padding: 4px 6px;
  margin: 2px 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffffb0;
  color: var(--text);
}
.blank-input.correct { background: var(--sage); color: #0b1f3b; }
.blank-input.incorrect { background: #f3d6d6; color: #6a1d1d; }
.blank-input.revealed { background: var(--sage); color: #0b1f3b; }
.blank-input.incorrect.revealed { background: #f3d6d6; color: #6a1d1d; }
.blank-input.showing-mistake { background: #ffffffb0; color: var(--text); }
.blanks-help {
  margin: 4px auto 12px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  line-height: 1.4;
}

.saved-panel {
  position: fixed;
  right: 12px;
  top: 56px; /* place panel beneath the toggle */
  height: calc(100vh - 80px);
  width: 360px;
  max-width: 92%;
  background: var(--card);
  box-shadow: 0 20px 40px rgba(12,15,20,0.08);
  transform: translateX(110%);
  transition: transform 300ms cubic-bezier(.2,.9,.2,1);
  z-index: 1000;
  padding: 16px 16px 24px 16px;
  overflow-y: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.saved-panel.open { transform: translateX(0); }
.saved-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; }
.close-btn { background:transparent; border:none; font-size:18px; cursor:pointer; }

/* Tutorial pop-down panel */
.tutorial-panel {
  position: fixed;
  left: 50%;
  top: 8px;
  transform: translate(-50%, -120%);
  width: 360px;
  max-width: 92%;
  height: 50vh;
  background: var(--card);
  box-shadow: 0 20px 40px rgba(12,15,20,0.12);
  z-index: 1001;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px;
  transition: transform 260ms cubic-bezier(.2,.9,.2,1);
  display: flex;
  flex-direction: column;
}
.tutorial-panel.open { transform: translate(-50%, 0); }
.tutorial-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; }
.tutorial-panel video {
  width: 100%;
  height: 100%;
  flex: 1;
  border-radius: 10px;
  background: #000;
  object-fit: contain;
}
.tutorial-note {
  display: none;
}

/* Saved paragraphs bar on the home page */
.saved-paragraphs-bar {
  position: fixed;
  right: 12px;
  top: 148px;
  width: min(360px, calc(100vw - 24px));
  max-height: min(60vh, 520px);
  overflow-y: auto;
  padding: 12px;
  background: rgba(255,255,255,0.98);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 20px 40px rgba(12,15,20,0.12);
  z-index: 1002;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}
.saved-paragraphs-bar.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.saved-paragraph-empty {
  color: var(--muted);
  font-size: 14px;
  padding: 8px 6px;
}
.saved-paragraph-preview {
  display: grid;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid rgba(15,23,42,0.06);
}
.saved-paragraph-preview:first-child {
  padding-top: 0;
  border-top: none;
}
.saved-paragraph-main .name { font-weight:700; color:var(--text); margin-bottom:4px; }
.saved-paragraph-main .meta { font-size:12px; color:#8b8f98; margin-bottom:6px; }
.saved-paragraph-main .preview {
  font-size: 13px;
  color: #444;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
}
.saved-paragraph-preview .actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.saved-paragraph-preview .actions button {
  width: 100%;
  padding: 6px 4px;
  font-size: 12px;
  line-height: 1.2;
  border-radius: 8px;
}

.saved-list { font-size:14px; }
.saved-chunk { border-top: 1px solid rgba(15,23,42,0.04); padding-top:10px; margin-top:10px; }
.saved-chunk-title { font-weight:700; color: var(--muted); }
.saved-item { display:flex; justify-content:space-between; align-items:center; margin-top:10px; padding:8px; border-radius:10px; background: linear-gradient(180deg,#ffffff, #fbfcfd); border: 1px solid rgba(15,23,42,0.03); }
.saved-meta { color:var(--muted); font-size:12px; }
.saved-actions button { margin-left:6px; padding:6px 10px; font-size:13px; border-radius:8px; }

@media (max-width:520px) {
  .saved-panel { width: 320px; right: 8px; top: 8px; }
  .saved-toggle { padding: 8px 10px; }
  .account-btn { left: 8px; padding: 8px 10px; }
  .account-panel { left: 8px; width: min(320px, calc(100vw - 16px)); }
  .tutorial-toggle { top: 50px; padding: 8px 10px; }
  .tutorial-toggle.home { top: 8px; }
  .tutorial-panel { width: 320px; }
  .home-saved-toggle { top: 92px; padding: 8px 10px; }
  .saved-paragraphs-bar { right: 8px; width: min(320px, calc(100vw - 16px)); top: 134px; }
  h1 { font-size: 30px; }
  .title-row { gap: 10px; }
  .title-figure { min-width: 60px; }
  .title-figure img { width: 56px; height: 56px; }
}

/* Small styles for training controls */
#pauseBtn { background:#fff; border:1px solid var(--border); }
#learnAgainBtn { background: linear-gradient(180deg,#fffef6,#fff9e6); border:1px solid rgba(248,210,115,0.16); }
#goHomeBtn { background:#fff; border:1px solid var(--border); }

/* Recording status */
.rec-dot { width:12px; height:12px; border-radius:50%; background:#e2e8f0; display:inline-block; margin-right:8px; vertical-align:middle; box-shadow:0 6px 16px rgba(12,15,20,0.05); }
.rec-dot.on { background:#ef4444; box-shadow:0 6px 18px rgba(239,68,68,0.14); animation: blink 1s infinite; }
@keyframes blink { 0%,100%{opacity:1}50%{opacity:0.3} }
#recordStatus { font-size:14px; color:var(--muted); }

/* Keep numeric labels fixed width so sliders don't reflow */
#chunkSizeLabel, #memorizeTimeLabel {
  display:inline-block;
  min-width:2.2em; /* enough for 2 digits */
  text-align:right;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, 'Roboto Mono', 'Courier New', monospace;
}

/* Rounded and subtle range sliders */
input[type="range"] {
  vertical-align:middle;
  -webkit-appearance: none;
  width: 160px;
  height: 10px;
  background: linear-gradient(90deg, rgba(11,31,59,0.18), rgba(11,31,59,0.08));
  border-radius: 999px;
  outline: none;
}
input[type="range"]::-webkit-slider-runnable-track { height: 10px; border-radius: 999px; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; height:18px; width:18px; margin-top:-4px; background: var(--card); border: 2px solid var(--accent); border-radius: 50%; box-shadow: 0 6px 18px rgba(12,15,20,0.08); }
input[type="range"]:focus::-webkit-slider-thumb { box-shadow: 0 8px 22px rgba(11,31,59,0.18); }
input[type="range"]::-moz-range-track { height: 10px; border-radius: 999px; background: linear-gradient(90deg, rgba(59,130,246,0.18), rgba(99,102,241,0.12)); }
input[type="range"]::-moz-range-thumb { height:18px; width:18px; background: var(--card); border: 2px solid var(--accent); border-radius: 50%; }

/* Progress dots for chunks */
.progress-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 8px;
  vertical-align: middle;
  border: 1px solid rgba(15,23,42,0.12);
  background: #e5e7eb; /* not attempted */
}

.progress-dot.pass { background: var(--sage-strong); border-color: rgba(95,142,106,0.6); }
.progress-dot.fail { background: #ef4444; border-color: rgba(239,68,68,0.5); }

.progress-pill {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  margin: 8px auto 0 auto;
  max-width: 880px;
}

.progress-pill b { color: var(--text); }

/* Progress dots for chunks */
.progress-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 8px;
  vertical-align: middle;
  border: 1px solid rgba(15,23,42,0.12);
  background: #e5e7eb; /* not attempted */
}

.progress-dot.pass { background: #22c55e; border-color: rgba(34,197,94,0.5); }
.progress-dot.fail { background: #ef4444; border-color: rgba(239,68,68,0.5); }

.progress-pill {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  margin: 8px auto 0 auto;
  max-width: 880px;
}

.progress-pill b { color: var(--text); }
