/* ICE Mobile Game — Canvas-style chrome + cards.
   Reference: canvas-copy/in-class-exercise-screen.png + canvas-copy/in-class-exercise-html
   (real GSB Canvas course page). The page chrome (top breadcrumb, left
   sidebar) and white question cards with borders + drop shadow are direct
   visual reproductions of that layout, scaled down for iPhone widths. */

:root {
  --red: #8B0000;             /* Canvas-ish red for titles (closer to reference) */
  --red-darker: #6B0000;
  --green: #1A7F37;
  --gray-text: #2D3B45;       /* Canvas body color */
  --gray-muted: #6B7780;
  --gray-hint: #8A949B;
  --gray-border: #C7CDD1;     /* card border */
  --gray-border-soft: #E0E3E5;
  --gray-bg: #FFFFFF;          /* ref: canvas common.css body{background:#fff} — page is WHITE not gray */
  --gray-bg-soft: #F8F9FA;
  --card-border: #B0B0B0;      /* ref: card borders are darker than the bg, visible against white */
  --cream: #FFFAD1;            /* saved-answer fill */
  --cream-border: #E8DC91;
  --bg: #FFFFFF;
  --top-bg: #FFFFFF;           /* Canvas breadcrumb is WHITE, not dark */
  --top-text-dark: #273540;    /* var(--ic-brand-font-color-dark) — current page */
  --top-text-link: #005e8a;    /* var(--ic-link-color) — ancestor crumbs */
  --top-text-sep: #6B7780;     /* "/" separator */
  --top-border: #E8EAEC;       /* 1px bottom border under breadcrumb */
  --side-bg: #FFFFFF;
  --side-active-bg: #F2F4F4;
  --side-active-bar: #8B0000;
  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.08), 0 0 1px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--gray-bg);
  color: var(--gray-text);
  font-family: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; font-size: 16px; }

/* ---------------------------------------------------------------- */
/* Canvas chrome — top breadcrumb bar                                 */
/* ---------------------------------------------------------------- */

.canvas-top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  height: 44px;
  background: var(--top-bg);
  color: var(--top-text-dark);
  padding: 0 6px;
  border-bottom: 1px solid var(--top-border);
}
.canvas-burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  color: var(--top-text-dark);
  width: 38px;
  height: 38px;
  padding: 0;
}
.canvas-burger:active { background: rgba(0,0,0,0.04); }
.canvas-crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  font-size: 14px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.canvas-crumb-course {
  color: var(--top-text-link);
  font-weight: 400;
  white-space: nowrap;
}
.canvas-crumb-sep {
  color: var(--top-text-sep);
  font-weight: 400;
  display: inline-block;
  transform: translateY(-1px);
}
.canvas-crumb-page {
  color: var(--top-text-dark);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------------------------------------------------------- */
/* Canvas chrome — body = sidebar + main                              */
/* ---------------------------------------------------------------- */

.canvas-body {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - 48px);
  min-height: calc(100dvh - 48px);
}
/* ref: canvas-copy/in-class-exercise-screen.png — sidebar has NO right border
   and is CONTINUOUS with the body (white bg, no visible boundary). */
.canvas-side {
  flex: 0 0 100px;
  width: 100px;
  background: #FFFFFF;
  padding: 12px 0 24px;
}
/* ref: "Fall 2025" small gray label at top */
.canvas-side-term {
  padding: 0 10px 8px;
  color: var(--gray-muted);
  font-size: 11px;
}
.canvas-side-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
/* ref: items render as plain text in link blue (#005e8a from
   variables-9dec...css --ic-link-color); active item is dark
   (#273540 from --ic-brand-font-color-dark) — no red bar, no bg highlight. */
.canvas-side-item {
  font-size: 12px;
  line-height: 1.3;
  padding: 6px 8px 6px 10px;
}
.canvas-side-item a {
  color: #005e8a;
  text-decoration: none;
  display: block;
}
.canvas-side-item a:active { background: rgba(0,0,0,0.03); }
.canvas-side-item.active a {
  color: #273540;
  font-weight: 600;
}

.canvas-main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px 10px 24px;
  background: #FFFFFF;
}

/* ---------------------------------------------------------------- */
/* Cards — each question and the team-info row are white cards       */
/* ---------------------------------------------------------------- */

.card {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 4px;
  box-shadow: var(--shadow-card);
  margin: 0 0 12px 0;
}
.card:last-child { margin-bottom: 0; }

/* Team-info card — Canvas reference layout:
     row 1: empty | Review[date] right
     ─── hairline divider ───
     row 2: Team#N + names left, Score right
   The two rows are visually separated by a 1px border so the date never
   overlaps the names. */
.team-card { padding: 0; }
.team-card-top-row {
  display: flex;
  justify-content: flex-end;
  padding: 8px 14px;
  border-bottom: 1px solid var(--gray-border-soft);
}
.team-card-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px 14px;
}
.team-card-left {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}
.team-names {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
}
/* ref: right column starts at top of card; score sits visually high
   (near vertical level of "Team #N"); date is in a bordered widget below. */
.team-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
  text-align: right;
  gap: 4px;
}
.team-num {
  color: var(--red);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;     /* tight box so cap-top sits at top of bounding box */
  white-space: nowrap;
  flex-shrink: 0;
}
.team-card .player {
  font-size: 14px;
  color: var(--red);
  font-weight: 400;
  line-height: 1.2;   /* tighter so first-line top aligns with team-num top */
  /* Word-boundary wrap only (not mid-char). */
  word-break: normal;
  overflow-wrap: normal;
}
/* Nudge the first player's leading whitespace so visible "E" cap-top
   matches "T" cap-top. Cap-height ratio for most fonts means visible
   cap of larger text starts a few px below bounding-box top. */
.team-names .player:first-child { margin-top: 2px; }
/* ref: date sits inside a bordered "select"-style widget (Canvas Review
   selector). Border ~1px, dark text (NOT muted gray), tight padding, with a
   dropdown arrow on the right. */
.team-card .date-widget {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 6px 2px 8px;
  border: 1px solid var(--gray-border);
  border-radius: 3px;
  background: #fff;
  white-space: nowrap;
}
.team-card .date-value {
  font-size: 12px;
  color: var(--gray-text);
  line-height: 1.3;
}
.team-card .date-arrow {
  font-size: 10px;
  color: var(--gray-muted);
  line-height: 1;
}
/* ref: Score row reads as one uniform piece. Label + value same color & weight,
   no two-tone (no gray label + bold black number). */
.team-card .score-row {
  font-size: 13px;
  color: var(--gray-text);
  white-space: nowrap;
  font-weight: 400;
}
.team-card .score-label { color: var(--gray-text); font-weight: 400; }
.team-card .score-value { color: var(--gray-text); font-weight: 400; }
.team-card .reconnect-pill {
  display: none;
  margin-top: 4px;
  font-size: 11px;
  color: #fff;
  background: var(--gray-muted);
  padding: 1px 6px;
}
.team-card.is-disconnected .reconnect-pill { display: inline-block; }

/* Banner card (waiting state) */
.banner-card {
  padding: 12px 14px;
  color: var(--gray-text);
  font-size: 14px;
  text-align: center;
}

/* Question card */
.question-card {
  padding: 16px;
}
.question-card .q-title {
  color: var(--red);
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 10px;
  line-height: 1.3;
}
.question-card .q-title-line {
  height: 1px;
  background: var(--gray-border-soft);
  margin: 0 0 12px;
}
.question-card .q-text {
  margin: 0 0 12px;
  color: var(--gray-text);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Multiple-choice as Canvas radio rows */
.choices-radio {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
}
.choices-radio li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 0;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  line-height: 1.4;
}
.choices-radio li[data-disabled="true"] { cursor: default; }
.choices-radio .radio {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border: 1px solid #6B7780;
  border-radius: 50%;
  background: #fff;
  margin-top: 2px;
  position: relative;
}
.choices-radio li[data-selected="true"] .radio::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2D3B45;
}
.choices-radio .letter {
  flex: 0 0 auto;
  font-weight: 600;
  color: var(--gray-text);
}
.choices-radio .text { flex: 1 1 auto; color: var(--gray-text); }
.choices-radio .mark { flex: 0 0 auto; font-size: 16px; line-height: 1.2; }
.choices-radio .mark.correct { color: var(--green); font-weight: 700; }
.choices-radio .mark.wrong { color: var(--red); font-weight: 700; }

/* Free-text form row */
.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 6px 0;
  font-size: 14px;
}
.form-row .label { font-weight: 700; color: var(--gray-text); }
.form-row .hint {
  font-size: 12px;
  color: var(--gray-hint);
  font-style: italic;
}
.form-row input[type="text"] {
  border: 1px solid var(--gray-border);
  border-radius: 0;
  padding: 4px 6px;
  background: #fff;
  outline: none;
  height: 28px;
  min-width: 80px;
  flex: 0 0 auto;
}
.form-row input[type="text"].filled { background: var(--cream); border-color: var(--cream-border); }
.form-row input[type="text"]:focus { border-color: #5B7B9A; }
.form-row input[type="text"]:disabled { color: var(--gray-text); -webkit-text-fill-color: var(--gray-text); opacity: 1; }
.form-row .mark.correct { color: var(--green); font-weight: 700; font-size: 16px; }
.form-row .mark.wrong { color: var(--red); font-weight: 700; font-size: 16px; }
.form-row .answer-box {
  border: 1px solid var(--gray-border);
  background: #fff;
  padding: 4px 6px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  min-width: 80px;
  font-size: 14px;
}

/* Submit button — Canvas-style small button */
.submit-row { margin-top: 12px; }
.submit-btn {
  padding: 6px 14px;
  background: #5B7B9A;
  color: #fff;
  border: 1px solid #4A6680;
  border-radius: 3px;
  font-size: 14px;
  font-weight: 600;
}
.submit-btn:disabled { background: #9FB1C2; border-color: #8FA1B2; cursor: not-allowed; }
.submit-btn:active:not(:disabled) { background: #4A6680; }
.submit-hint {
  font-size: 12px;
  color: var(--gray-hint);
  font-style: italic;
  margin: 6px 0 0;
}

/* Inline explanation (after close) */
.explanation {
  margin: 10px 0 0;
  padding: 8px 10px;
  background: var(--gray-bg-soft);
  border-left: 3px solid var(--gray-border);
  font-size: 13px;
  color: var(--gray-muted);
  line-height: 1.45;
  white-space: pre-wrap;
}

/* ---------------------------------------------------------------- */
/* Landing card                                                       */
/* ---------------------------------------------------------------- */

.landing-card { padding: 16px 14px; }
.landing-card h1 {
  color: var(--red);
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 6px;
}
.landing-card p { color: var(--gray-muted); margin: 0 0 14px; font-size: 14px; }
.landing-card label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-muted);
  margin: 10px 0 4px;
}
.landing-card input[type="text"] {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--gray-border);
  border-radius: 0;
  background: #fff;
  outline: none;
}
.landing-card input[type="text"]:focus { border-color: #5B7B9A; }
.landing-card button[type="submit"] {
  margin-top: 14px;
  padding: 8px 14px;
  background: #5B7B9A;
  color: #fff;
  border: 1px solid #4A6680;
  border-radius: 3px;
  font-size: 14px;
  font-weight: 600;
}
.landing-card button[type="submit"]:disabled { background: #9FB1C2; border-color: #8FA1B2; cursor: not-allowed; }
.landing-card button[type="submit"]:active:not(:disabled) { background: #4A6680; }

.banner {
  background: #FCF5F6;
  border: 1px solid #E8C4C9;
  color: #6B0F1E;
  padding: 8px 10px;
  margin: 0 0 14px;
  font-size: 13px;
}

/* ---------------------------------------------------------------- */
/* Final standings                                                    */
/* ---------------------------------------------------------------- */

.standings-card { padding: 18px 16px; }
.standings-card h2 { color: var(--red); text-align: center; font-size: 18px; margin: 0 0 14px; font-weight: 700; }
.standings-card ol { padding: 0; margin: 0; list-style: none; }
.standings-card li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--gray-border-soft);
  margin-bottom: 6px;
  font-size: 14px;
}
.standings-card li.podium { background: var(--cream); border-color: var(--cream-border); }
.standings-card li .pos { width: 24px; font-weight: 700; color: var(--gray-muted); }
.standings-card li.podium .pos { color: var(--red); }
.standings-card li .name { flex: 1; font-weight: 600; color: var(--gray-text); }
.standings-card li .score { font-weight: 700; }
.standings-card li .you { background: #5B7B9A; color: #fff; padding: 1px 6px; font-size: 11px; margin-left: 6px; }

/* ---------------------------------------------------------------- */
/* Winner modal                                                       */
/* ---------------------------------------------------------------- */

.winner-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
}
.winner-modal .panel {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 4px;
  padding: 20px 14px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.winner-modal h3 { color: var(--red); font-size: 18px; margin: 0 0 10px; }
.winner-reel-mask {
  height: 56px;
  position: relative;
  border-top: 2px solid var(--red);
  border-bottom: 2px solid var(--red);
  overflow: hidden;
  margin: 0 0 10px;
  z-index: 2;          /* keep reel above confetti pieces */
  background: #fff;     /* ensure mask reads as solid even with confetti behind */
}
.winner-reel { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.winner-reel-row { height: 56px; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; color: var(--gray-text); }
.winner-reel-row.final { color: var(--green); }
.winner-modal.is-done .winner-reel-row.final {
  background: rgba(26, 127, 55, 0.08);
  font-size: 17px;
}
.confetti-piece { z-index: 1; }
.winner-modal .dismiss {
  margin-top: 12px;
  padding: 6px 14px;
  background: var(--gray-bg-soft);
  border: 1px solid var(--gray-border);
  border-radius: 3px;
  color: var(--gray-text);
  font-weight: 600;
  display: none;
}
.winner-modal.is-done .dismiss { display: inline-block; }
.confetti-piece {
  position: absolute;
  top: -20px;
  width: 8px;
  height: 14px;
  background: var(--red);
  pointer-events: none;
  border-radius: 2px;
  animation: confetti-fall 1.6s linear forwards;
}
@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(220px) rotate(720deg); opacity: 0.2; }
}

/* ---------------------------------------------------------------- */
/* Admin (kept distinct, more usable than reference-perfect)          */
/* ---------------------------------------------------------------- */

#admin-login {
  padding: 60px 20px;
  max-width: 380px;
  margin: 0 auto;
}
#admin-login h1 { color: var(--red); font-size: 22px; margin: 0 0 16px; }
#admin-login input[type="password"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--gray-border);
  border-radius: 0;
  margin-bottom: 10px;
  outline: none;
}
#admin-login input[type="password"]:focus { border-color: #5B7B9A; }
#admin-login button {
  width: 100%;
  padding: 8px 14px;
  background: #5B7B9A;
  color: #fff;
  border: 1px solid #4A6680;
  border-radius: 3px;
  font-weight: 600;
}
#admin-login button:active { background: #4A6680; }
#admin-login .err { margin-top: 10px; color: var(--red); font-size: 13px; text-align: center; min-height: 18px; }
.shake { animation: shake 0.3s; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

#admin-dash { max-width: 720px; margin: 0 auto; padding: 12px; }
#admin-dash h1 { color: var(--red); font-size: 20px; margin: 0 0 6px; }
#admin-dash .top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--gray-bg-soft);
  border: 1px solid var(--gray-border);
  margin-bottom: 14px;
  font-size: 13px;
}
#admin-dash .pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #E5E5E5;
  color: var(--gray-text);
  border: 1px solid var(--gray-border);
}
#admin-dash .pill.idle { background: #E5E5E5; color: var(--gray-text); }
#admin-dash .pill.question_open { background: #FCE4C4; color: #6B3D08; border-color: #E5C490; }
#admin-dash .pill.question_closed { background: #DBE6F2; color: #1F3D5A; border-color: #B5C9DC; }
#admin-dash .pill.winner_selected { background: #D6EEDA; color: #0F4A1E; border-color: #A6D5B1; }
#admin-dash .pill.completed { background: #E6D7F2; color: #3F1A6B; border-color: #C0A2D6; }

#admin-dash section { margin: 14px 0; }
#admin-dash h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gray-muted); margin: 0 0 8px; font-weight: 700; }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; }
.btn {
  flex: 1 1 calc(50% - 6px);
  min-height: 38px;
  padding: 8px 10px;
  background: #5B7B9A;
  color: #fff;
  border: 1px solid #4A6680;
  border-radius: 3px;
  font-weight: 600;
  font-size: 13px;
}
.btn.secondary { background: var(--gray-bg-soft); color: var(--gray-text); border: 1px solid var(--gray-border); }
.btn.danger { background: #fff; color: var(--red); border: 1px solid var(--red); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: translateY(1px); }

table.teams {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
  border: 1px solid var(--gray-border);
}
table.teams th, table.teams td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--gray-border);
  text-align: left;
  vertical-align: middle;
}
table.teams th { font-size: 11px; text-transform: uppercase; color: var(--gray-muted); letter-spacing: 0.04em; background: var(--gray-bg-soft); }
table.teams td.num { font-weight: 700; color: var(--red); width: 28px; }
table.teams td.score { font-weight: 700; text-align: right; width: 50px; }
table.teams td.answer .right { color: var(--green); }
table.teams td.answer .wrong { color: var(--red); }
table.teams tr.is-winner { background: #F4F9F0; }

.q-list { list-style: none; padding: 0; margin: 0; }
.q-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--gray-border);
  margin-bottom: 6px;
}
.q-list li.is-active { border-color: var(--red); background: #FFF6F7; }
.q-list .grip { cursor: grab; font-size: 16px; color: var(--gray-muted); user-select: none; padding-top: 2px; }
.q-list .body { flex: 1; min-width: 0; }
.q-list .title { font-weight: 700; color: var(--red); font-size: 14px; }
.q-list .meta { font-size: 11px; color: var(--gray-muted); margin-top: 2px; }
.q-list .preview { font-size: 12px; color: var(--gray-text); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.q-list .actions { display: flex; gap: 4px; align-items: flex-start; flex-shrink: 0; }
.q-list .actions button { background: var(--gray-bg-soft); border: 1px solid var(--gray-border); color: var(--gray-text); border-radius: 0; padding: 3px 7px; font-size: 11px; }
.q-list .actions button.del { color: var(--red); border-color: #E5B0B6; }
.q-list .badge { display: inline-block; padding: 1px 6px; font-size: 10px; background: #DBE6F2; color: #1F3D5A; text-transform: uppercase; font-weight: 700; letter-spacing: 0.04em; border: 1px solid #B5C9DC; }
.q-list .badge.free { background: #FCE4C4; color: #6B3D08; border-color: #E5C490; }
.q-list .warning { margin-top: 4px; font-size: 11px; color: var(--red); }

/* Admin modals */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 60; display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 520px) { .modal-backdrop { align-items: center; padding: 24px; } }
.modal {
  width: 100%;
  max-width: 520px;
  background: #fff;
  border-radius: 4px 4px 0 0;
  padding: 16px;
  max-height: 95vh;
  overflow-y: auto;
}
@media (min-width: 520px) { .modal { border-radius: 4px; } }
.modal h3 { margin: 0 0 12px; color: var(--red); font-size: 16px; }
.modal label { display: block; font-size: 11px; color: var(--gray-muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 10px 0 4px; font-weight: 700; }
.modal input[type="text"], .modal textarea, .modal select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--gray-border);
  border-radius: 0;
  outline: none;
  font-size: 16px;
}
.modal input[type="text"]:focus, .modal textarea:focus, .modal select:focus { border-color: #5B7B9A; }
.modal textarea { min-height: 80px; resize: vertical; line-height: 1.4; }
.modal .choices-edit { display: flex; flex-direction: column; gap: 6px; }
.modal .choices-edit .row { display: flex; gap: 6px; align-items: center; }
.modal .choices-edit .row input[type="text"] { flex: 1; }
.modal .choices-edit .correct { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--gray-muted); white-space: nowrap; }
.modal .modal-actions { margin-top: 14px; display: flex; gap: 6px; }
.modal .modal-actions .btn { flex: 1; }
.modal .err { color: var(--red); font-size: 12px; margin-top: 8px; min-height: 16px; }

.confirm-modal .modal { text-align: center; padding-bottom: 14px; }
.confirm-modal .modal p { margin: 6px 0 14px; color: var(--gray-text); font-size: 14px; }

body { padding-bottom: env(safe-area-inset-bottom); }

/* Practice mode — small CTA link, results card */
.practice-cta {
  margin: 14px 0 0;
  font-size: 13px;
  text-align: center;
}
.practice-cta a {
  color: #005e8a;
  text-decoration: none;
}
.practice-cta a:hover { text-decoration: underline; }
.results-card {
  padding: 24px 16px;
  text-align: center;
}
.results-card h2 {
  color: var(--red);
  font-size: 22px;
  margin: 0 0 12px;
}
.results-score {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-text);
  margin: 0 0 8px;
}
.results-message {
  color: var(--gray-muted);
  font-size: 15px;
  margin: 0 0 18px;
}
.results-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}
.results-actions .submit-btn {
  text-align: center;
  text-decoration: none;
  display: inline-block;
}
.results-actions .submit-btn.secondary {
  background: var(--gray-bg-soft);
  color: var(--gray-text);
  border-color: var(--gray-border);
}

/* Joke placeholder pages (Assignments, Grades) */
.joke-card { padding: 24px 16px; }
.joke-card h1 {
  color: var(--red);
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 14px;
}
.joke-card .joke {
  color: var(--gray-text);
  font-size: 16px;
  line-height: 1.5;
  margin: 0;
}
