/* learn.css — layout and the hand/keyboard colours for the Learn page.
 *
 * typing.css already gives us the word colours (green/red/gold), the HUD, and
 * the roster. This file does two jobs on top of that:
 *   1. lay the page out as "lesson on the left, drill on the right" (typing.css
 *      centres a single overlay over a canvas; the Learn page has no canvas);
 *   2. colour the hands + keyboard picture and define how the next finger/key
 *      light up.
 *
 * Each finger has its own colour, used BOTH on the hand and on the keys that
 * finger owns — so a kid can see "the gold keys all belong to my index finger".
 */

:root {
  /* One hue per finger pair (left and right share a colour by role). */
  --f-pinky: #b98cf0;
  --f-ring: #6f8bf0;
  --f-middle: #46cf9c;
  --f-index: #e8b84a;
  --f-thumb: #9a96b8;
}

/* typing.css centres the whole body; the Learn page is a normal scrolling page
   instead (the nav bar already reserves space at the top). */
body { display: block; }

/* :not([hidden]) so this display rule doesn't override the hidden attribute —
   otherwise the login screen would stay visible after you pick a weaver. */
#login-screen:not([hidden]) {
  min-height: 78vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#learn-screen {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1rem 4rem;
  text-align: left;
}

#learn-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin-top: 1rem;
}
@media (max-width: 820px) {
  #learn-layout { flex-direction: column; }
}

/* ----- the lesson card ----- */

#lesson-card {
  flex: 0 0 320px;
  background: var(--panel);
  border-radius: 12px;
  padding: 1rem 1.2rem 1.2rem;
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  line-height: 1.5;
}
#lesson-card h2 { color: var(--gold); margin: 0 0 0.4rem; font-size: 1.4rem; }
#lesson-intro { color: var(--text); margin: 0 0 0.8rem; }
#lesson-steps { margin: 0 0 0.9rem; padding-left: 1.2rem; color: #cfc9ef; }
#lesson-steps li { margin-bottom: 0.5rem; }
#lesson-card .tip {
  color: var(--correct);
  background: rgba(111, 208, 140, 0.1);
  border-left: 3px solid var(--correct);
  padding: 0.5rem 0.7rem;
  border-radius: 0 6px 6px 0;
  margin: 0;
}

/* ----- the accuracy gate ----- */

#gate {
  margin-top: 1.1rem;
  border-top: 1px solid var(--pending);
  padding-top: 0.8rem;
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
}
#gate h3 { margin: 0 0 0.5rem; color: var(--pending); font-size: 0.95rem; font-weight: 600; }
.gate-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  padding: 0.18rem 0;
  color: var(--pending);
}
.gate-row strong { color: var(--text); }
.gate-row.met strong { color: var(--correct); }
.gate-row.met span:first-child::after { content: " ✓"; color: var(--correct); }

/* ----- the drill column ----- */

#drill {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

/* The shared typing overlay, but laid out in normal flow (not floating over a
   canvas). position:relative keeps the "+XP" float anchored to it. */
#typing-overlay {
  position: relative;
  left: auto;
  bottom: auto;
  transform: none;
  margin: 0.5rem auto 0;
  display: inline-block;
}

/* ----- the hint control ----- */

#hint-control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: 0.9rem;
}
.hint-label { color: var(--pending); margin-right: 0.2rem; }
.hint-mode {
  font: inherit;
  cursor: pointer;
  padding: 0.25rem 0.7rem;
  border-radius: 6px;
  border: 1px solid var(--pending);
  background: var(--panel);
  color: var(--text);
}
.hint-mode:hover { border-color: var(--gold); }
.hint-mode.active { background: var(--gold); border-color: var(--gold); color: var(--bg); }

/* ----- the hands + keyboard picture ----- */

#hand-keyboard { width: 100%; max-width: 640px; }
.hand-keyboard { width: 100%; height: auto; transition: opacity 0.4s ease; }

/* Default look: every shape is dim and tinted by its finger's colour. */
.hand-keyboard rect { fill-opacity: 0.22; stroke: #1c1b2e; stroke-width: 1.5; }
.hand-keyboard text {
  fill: var(--text);
  font-family: "Courier New", monospace;
  font-size: 16px;
  pointer-events: none;
}
.finger-label { fill: #e8e6f0; font-size: 13px; }
.wide-label { font-size: 12px; fill: var(--pending); }
.palm { fill: var(--f-thumb); }
.key-bump { fill: var(--text); fill-opacity: 0.9; stroke: none; }

/* The home-row keys are outlined so "where your fingers live" stands out. */
.home-key rect { stroke: var(--gold); stroke-opacity: 0.55; stroke-width: 2; }

/* Finger colours — used on the hand AND on every key that finger owns. */
.fz-L_pinky rect, .fz-R_pinky rect { fill: var(--f-pinky); }
.fz-L_ring rect, .fz-R_ring rect { fill: var(--f-ring); }
.fz-L_middle rect, .fz-R_middle rect { fill: var(--f-middle); }
.fz-L_index rect, .fz-R_index rect { fill: var(--f-index); }
.fz-thumb rect { fill: var(--f-thumb); }

/* Lit up: the next finger and its key glow at full strength. */
.finger-active rect, .key-active rect {
  fill-opacity: 1;
  stroke: #ffffff;
  stroke-width: 2.5;
}
.finger-active rect { filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.55)); }

/* The Shift partner (opposite-hand pinky) glows in a calmer, dashed style so
   it reads as "and also hold this", not "press this letter". */
.finger-shift rect, .key-shift rect {
  fill-opacity: 0.85;
  stroke: #ffffff;
  stroke-width: 2;
  stroke-dasharray: 5 4;
}

/* ----- the unlock cheer ----- */

#unlock-banner {
  margin: 1rem auto 0;
  max-width: 700px;
  padding: 0.8rem 1rem;
  background: var(--gold);
  color: var(--bg);
  border-radius: 8px;
  font-weight: bold;
  text-align: center;
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
}
