/* KodiLingo MVP — child-friendly, high-contrast, large-target styles.
   Accessibility floor (see docs/09 / 11): large fonts, big tap targets, keyboard-focusable
   buttons, visible focus rings, sufficient contrast. */
:root {
  --blue: #1565c0;
  --blue-dark: #0d47a1;
  --green: #2e7d32;
  --amber: #ef6c00;
  --red: #c62828;
  --bg: #f4f8ff;
  --card: #ffffff;
  --ink: #1a2533;
  --muted: #5b6b7e;
  --line: #d4e0f0;
}
* { box-sizing: border-box; }
html { font-size: 18px; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--blue); color: #fff; padding: 12px 20px;
}
.brand { font-size: 1.25rem; font-weight: 700; }
.brand small { font-weight: 400; opacity: .85; font-size: .8rem; margin-left: 6px; }
.teacher-link { color: #fff; text-decoration: none; font-weight: 600; opacity: .9; }
.teacher-link:hover { text-decoration: underline; }

.screen { max-width: 880px; margin: 0 auto; padding: 24px 18px 60px; }
.screen.wide { max-width: 1100px; }
.hidden { display: none !important; }
h1 { font-size: 1.7rem; margin: .2em 0 .4em; }
h2 { font-size: 1.25rem; margin: .2em 0 .5em; }
h3 { font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 8px; }
.muted { color: var(--muted); }
.note { color: var(--muted); font-size: .85rem; margin-top: 10px; }

/* buttons */
button { font: inherit; cursor: pointer; border-radius: 12px; border: 2px solid transparent; }
button:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.primary { background: var(--blue); color: #fff; padding: 12px 20px; font-weight: 700; }
.primary:hover { background: var(--blue-dark); }
.ghost { background: #fff; color: var(--blue-dark); border-color: var(--line); padding: 10px 16px; font-weight: 600; }
.ghost:hover { background: #eef4ff; }
.icon-btn { background: #fff; border: 2px solid var(--line); border-radius: 50%; width: 40px; height: 40px; margin-right: 10px; }
.back { margin-bottom: 8px; }

/* login */
.student-list { display: flex; flex-wrap: wrap; gap: 16px; margin: 20px 0; }
.student-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--card); border: 2px solid var(--line); border-radius: 18px;
  padding: 18px 22px; min-width: 150px;
}
.student-card:hover { border-color: var(--blue); transform: translateY(-2px); }
.student-card .avatar { font-size: 2.6rem; }
.student-card .uname { font-weight: 700; }
.student-card .pinhint { font-size: .75rem; color: var(--muted); }

/* hud */
.hud { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.hud-avatar { font-size: 1.8rem; }
.hud-name { font-weight: 700; }
.pill { background: #fff; border: 2px solid var(--line); border-radius: 999px; padding: 6px 14px; font-weight: 600; }

/* lesson cards */
.lesson-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.lesson-card { text-align: left; background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 16px; }
.lesson-card:hover { border-color: var(--blue); }
.lesson-card.done { border-color: var(--green); background: #f1fbf2; }
.lc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.lc-num { background: var(--blue); color: #fff; border-radius: 50%; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.lc-xp { color: var(--amber); font-weight: 700; }
.lc-check { color: var(--green); font-size: 1.4rem; font-weight: 700; }
.lc-title { font-size: 1.15rem; font-weight: 700; }
.lc-strand { font-size: .8rem; color: var(--muted); margin-top: 4px; }

/* play */
.panel { background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 18px; margin: 16px 0; }
.narration { display: flex; align-items: center; font-size: 1.05rem; }
.play-grid { display: flex; gap: 20px; flex-wrap: wrap; }
#maze { background: #fff; border: 2px solid var(--line); border-radius: 12px; touch-action: manipulation; }
.builder { flex: 1; min-width: 260px; }
.palette { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.block { padding: 12px 16px; font-weight: 700; color: #fff; border: none; }
.block-forward { background: #1565c0; }
.block-left { background: #6a1b9a; }
.block-right { background: #00838f; }
.program { list-style: none; margin: 0 0 14px; padding: 0; border: 2px dashed var(--line); border-radius: 12px; min-height: 60px; }
.program .empty { color: var(--muted); padding: 14px; }
.prog-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; margin: 6px; border-radius: 10px; color: #fff; font-weight: 600; }
.prog-item.block-forward { background: #1565c0; }
.prog-item.block-left { background: #6a1b9a; }
.prog-item.block-right { background: #00838f; }
.pi-ctrls button { background: rgba(255,255,255,.25); color: #fff; border: none; width: 32px; height: 32px; margin-left: 4px; border-radius: 8px; font-weight: 700; }
.pi-ctrls button:hover { background: rgba(255,255,255,.45); }
.play-controls { display: flex; gap: 10px; flex-wrap: wrap; }

/* english step */
.question { font-size: 1.1rem; font-weight: 600; }
.vocab { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip { background: #eef4ff; border: 2px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-weight: 600; color: var(--blue-dark); }
.chip:hover { background: #dde9ff; }
textarea { width: 100%; font: inherit; padding: 12px; border: 2px solid var(--line); border-radius: 12px; resize: vertical; }
textarea:focus-visible { outline: 3px solid var(--amber); border-color: var(--blue); }

/* feedback */
.feedback { min-height: 1.4em; font-weight: 600; margin-top: 12px; }
.feedback.good { color: var(--green); }
.feedback.bad { color: var(--red); }
.feedback.warn { color: var(--amber); }

/* reward */
.reward { text-align: center; }
.reward .badge { font-size: 4rem; }
.reward-xp { font-size: 2rem; font-weight: 800; color: var(--amber); margin: 4px 0; }

/* teacher tables */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 14px 0 20px; }
table.data { width: 100%; border-collapse: collapse; background: #fff; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 28px; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: .92rem; }
table.data th { background: #eef4ff; color: var(--blue-dark); }
table.data tr.struggling { background: #fff4ec; }
table.data tr.unsynced td { background: #fffbe6; }
.flag { color: var(--red); font-weight: 700; }
.ok { color: var(--green); font-weight: 600; }
code { background: #eef4ff; padding: 1px 6px; border-radius: 6px; font-size: .85em; }

@media (max-width: 560px) {
  html { font-size: 17px; }
  .play-grid { flex-direction: column; }
  #maze { width: 100%; height: auto; }
}
