/* Minimalist theme inspired by Apple Watch face
   - Monochrome, high-contrast, rounded elements
   - Large readable numerals / headings
   - Subtle shadows and generous padding
*/
:root{
  --bg:#ffffff; /* page background - white */
  --panel:#f1f5f9; /* light panel */
  --muted:#475569; /* dark muted text */
  --accent:#0b0b0c; /* primary text (near-black) */
  --glass: rgba(2,6,23,0.03);
}

html,body{height:100%;}
body{
  background: radial-gradient(circle at 10% 10%, rgba(2,6,23,0.02), transparent 10%), var(--bg);
  color:var(--accent);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  padding-top:4.5rem; /* keep navbar spacing */
}

/* Navbar: translucent, compact */
.navbar{
  background: linear-gradient(180deg, rgba(2,6,23,0.02), transparent);
  backdrop-filter: blur(4px);
  border-bottom: 1px solid rgba(2,6,23,0.06);
}

.navbar-brand{
  font-weight:600;
  font-size:1.1rem;
  letter-spacing:0.06rem;
}

/* Link colors come from tokens.css (navbar rules there override for dark ground) */
.nav-link{
  font-weight:500;
  padding:0.45rem 0.6rem;
}

.nav-link:hover{
  background:transparent;
}

/* Profile image small, crisp */
.navbar .rounded-circle{border:1px solid rgba(2,6,23,0.06)}

/* Container: center content with roomy margins */
.container{
  /* Wider default container for practice page to give more horizontal room */
  max-width:1200px;
  padding-top:2.5rem;
}

/* Cards: minimal, rounded */
.card{
  background: linear-gradient(180deg, #fff, #fbfdff);
  border: 1px solid rgba(2,6,23,0.06);
  border-radius:14px;
  padding:1.25rem;
  box-shadow: 0 6px 18px rgba(2,6,23,0.06);
}

h1, h2, h3{font-weight:600;color:var(--accent)}

/* Typing area: keep monospaced but subtle */
.typing-area textarea{background:#ffffff;border-radius:10px;border:1px solid rgba(2,6,23,0.06);color:var(--accent);padding:1rem}

/* Buttons: primary — skinned by tokens.css (.btn-primary --bs-btn-* bridge) */

/* Passage block: light panel with dark text for high readability */
.passage-block{
  background: var(--bg-surface, #f8fafc);
  color: var(--accent);     /* dark text from theme */
  border: 1px solid var(--border-hairline, rgba(2,6,23,0.04));
  border-radius: 8px;
  padding: 0.9rem 1rem 4.25rem;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  min-height: 0;
  max-height: none;
  overflow: visible;
}

/* Passage type is set by base.css (.passage-block, #passage-block -> --font-passage,
   the Reading Room serif). The former typewriter override (Special Elite) was
   removed 2026-07-03 — a placeholder look that clashed with the brand. */

.passage-block code, .passage-block pre{background:transparent;color:inherit}

/* Typing input: small, centered, monospace for digit/character alignment */
.typing-input{
  /* Brand mono (IBM Plex Mono) — alignment without the old typewriter face */
  font-family: var(--font-mono);
  font-size: 1rem; /* match passage default */
  /* Allow the typing input to be wider for large viewports */
  max-width: 90ch;
  width: 36ch; /* wider default; JS may override per-word */
  padding: .45rem .6rem;
  border-radius:8px;
  border:2px solid color-mix(in srgb, var(--ink-900, #1b221e) 24%, transparent); /* visible but theme-neutral */
  background: var(--bg-inset, #f3f4f6);
  line-height: 1.9; /* match passage line-height for consistent spacing */
  color: var(--accent);
  box-sizing: border-box;
  box-shadow: 0 4px 10px rgba(2,6,23,0.04), inset 0 -2px 6px rgba(2,6,23,0.02);
}

/* Per-character spans inside passage — use letter-spacing (not padding) so all chars
   have uniform horizontal expansion regardless of format wrapper context, which prevents
   inconsistent selection-highlight box widths when selecting across formatted/unformatted runs */
.passage-block .char{padding:0;letter-spacing:0.12rem}

/* Format wrappers for **bold** and __underline__ runs in passage content */
.passage-block .fmt-b{font-weight:700}
.passage-block .fmt-ul{
  text-decoration:underline;
  text-decoration-skip-ink:none;
  text-underline-offset:3px;
  text-decoration-thickness:1.5px;
}
.passage-block .fmt-i{font-style:italic}
.passage-block .char.current{
  color: #000;
  background: var(--cursor-char-bg, #adb8b0); /* green-biased neutral — distinct from red/green feedback + user highlights */
  border-radius: 2px;
  /* The current character's own static accent underline was removed 2026-06-28: the cursor's
     underline indication is provided solely by the animated #enter-underline bar, so the two
     no longer overlap. NOTE: do NOT add `text-decoration: none` here — that would also suppress
     the content (.fmt-ul) underline of an __underline__ designation showing through the current
     character. We simply omit any text-decoration so the wrapper's content underline still shows. */
}
.passage-block .char.correct{background:var(--success-soft, #e2ece6)}
.passage-block .char.incorrect{background:var(--danger-soft, #f6e4e4)}

/* Styled moving box (callout / magnifier) that follows the current word.
   Single source of truth for the box's visual style (a conflicting duplicate
   in base.css was removed 2026-07-03). Slightly translucent paper well so the
   passage text reads through faintly underneath. */
.passage-block #moving-box{
  position: absolute; /* positioned by JS */
  pointer-events: none;
  display: none;
  z-index: 9999;
  background: color-mix(in srgb, var(--paper-200, #eceee9) 94%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--ink-900, #1b221e) 30%, transparent);
  box-shadow: none;
  border-radius: 10px;
  padding: 0 .25rem;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  font-family: inherit;
  font-size: inherit;
  color: var(--accent);
  white-space: nowrap;
  box-sizing: border-box;
  transition: left 0.06s linear, top 0.06s linear, width 0.08s ease;
  min-height: 2.2rem;
  min-width: 2.8rem;
}

.passage-block #moving-box .mb-text{
  display: inline-block;
  width: auto;
  text-align: left;
  padding-left: 0; /* remove extra inset so inner text aligns with anchor */
}

/* Cloned chars in the moving box — no padding; letter-spacing is inherited from the
   movingBox container (set by JS from the passage anchor char's computed style) */
#moving-box .char{
  padding: 0;
  display: inline-block;
  font-family: inherit;
  font-size: inherit;
  line-height: normal;
}

/* Inside the moving box, don't apply correct/incorrect shading — show typed text plainly */
#moving-box .char.correct,
#moving-box .char.incorrect{
  background: transparent !important;
  color: inherit !important;
}

#moving-box .char.typed-clone{ color: inherit !important; }

/* Hide cloned characters that haven't been typed yet, but preserve their width */
#moving-box .char.untyped{
  color: transparent !important;
  text-shadow: none !important;
}

/* Show typed clones normally */
#moving-box .char.typed-clone{ color: inherit; }

/* small pointer (optional) below the box */
.passage-block #moving-box::after{
  /* pointer removed per user request */
  display: none;
}

/* Passage controls (right side) */
.passage-controls{display:flex;align-items:flex-start}
.passage-controls .btn{min-width:44px}
.passage-controls .btn + .btn{margin-top:6px}

/* Responsiveness adjustments */
@media (max-width:768px){
  .container{padding:1rem;max-width:640px}
  .navbar-brand{font-size:1rem}
  .nav-link{padding:0.5rem}
}
