/* Training Room: a question card over a background that changes with the block.
 * rootClass: "tr-root". Everything is scoped under .game-app, like every board's stylesheet.
 *
 * The seven backgrounds are artwork, not CSS — they drop into web/bg/<id>.webp and need no code
 * change. Until they are there, each one falls back to its own gradient underneath, so the game
 * looks deliberate rather than broken. The gradients are a placeholder and nothing else.
 */

.game-app .tr-root { position: relative; height: 100%; min-height: 0; overflow: hidden; }

/* ---- the background ----
 * A flat-cartoon SVG scene per block, drawn in game.js. SVG rather than image files because
 * cartoon IS vector: crisp at any size, a couple of KB, and nothing to source. `slice` on the
 * viewBox makes it behave like background-size: cover.
 */
.game-app .tr-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.game-app .tr-scene {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  animation: tr-fade .45s ease-out;
}
@keyframes tr-fade { from { opacity: 0; } to { opacity: 1; } }
/* A light scrim only — the question now sits ON a surface, so it does not need the room
 * darkened to the point of being wallpaper. */
.game-app .tr-bg::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, rgba(8,11,18,.10) 0%, rgba(8,11,18,.46) 76%);
}

/* The foreground: drawn in FRONT of the question surface, and not clickable. Something between
 * you and the work is what makes it a room you are standing in rather than a picture of one. */
.game-app .tr-fg {
  position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden;
}

/* ---- the layout ---- */
.game-app .tr-wrap {
  position: relative; z-index: 1; height: 100%; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 16px;
}
.game-app .tr-head {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center;
}
.game-app .tr-block {
  font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
  color: rgba(255,255,255,.62);
}
.game-app .tr-gate { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; }
.game-app .tr-dots { display: inline-flex; gap: 5px; }
.game-app .tr-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: rgba(255,255,255,.18); box-shadow: inset 0 0 0 1px rgba(255,255,255,.22);
  transition: background .2s, box-shadow .2s;
}
.game-app .tr-dot.on { background: var(--accent, #5bc0a8); box-shadow: 0 0 10px rgba(91,192,168,.55); }
.game-app .tr-spare, .game-app .tr-left { font-size: .72rem; color: rgba(255,255,255,.52); }

/* ---- the surface the question is written ON ----
 * Not a window over the room: the card IS the blackboard, the page, the console screen. Each
 * room gives it a different material, and the foreground layer overlaps it.
 */
/* Big on purpose: this is the board on the wall, the sheet on the desk, the screen in the
 * cockpit — not a panel sitting on one. The question and everything you answer with go ON it. */
.game-app .tr-card {
  position: relative; flex: 1 1 auto; width: 100%; max-width: min(96%, 880px);
  min-height: clamp(240px, 50vh, 460px);
  display: flex; flex-direction: column; gap: 18px; align-items: center;
  justify-content: center;
  padding: clamp(22px, 4vh, 40px) clamp(22px, 4vw, 48px);
  overflow-y: auto; max-height: 100%;
  color: #f2f6fb;
  transition: background .4s ease, box-shadow .4s ease, border-color .4s ease;
}

/* a slate board, in its wooden frame, with the chalk rail along the bottom */
.game-app .tr-card[data-surface="board"] {
  background: #2f5d4a;
  border: 16px solid #4b3826; border-bottom-width: 26px; border-radius: 6px;
  box-shadow: inset 0 0 110px rgba(0,0,0,.34), 0 16px 40px rgba(0,0,0,.45);
}
/* the chalk, left on the rail */
.game-app .tr-card[data-surface="board"]::after {
  content: ""; position: absolute; left: 36px; bottom: -20px;
  width: 64px; height: 10px; border-radius: 5px; background: #f4f7f5;
  box-shadow: 0 1px 2px rgba(0,0,0,.4);
}
/* a sheet of paper, lying on whatever is under it */
.game-app .tr-card[data-surface="page"] {
  background: #f6efdd; color: #2b2419;
  border-radius: 3px 16px 3px 16px;
  box-shadow: 0 24px 50px rgba(0,0,0,.42), inset -18px 0 30px rgba(0,0,0,.06);
  transform: rotate(-.5deg);
}

/* The shared gameplay components (games/base blanks.js + slots.js) draw themselves from these
 * four variables, so re-pointing them here is the whole of making them legible on a light
 * surface — nothing in either component has to know about Training Room. */
.game-app .tr-card[data-surface="page"],
.game-app .tr-card[data-surface="card"],
.game-app .tr-card[data-surface="notice"] {
  --text: #2b2419;
  --muted: #7a6a52;
  --accent: #8a4b1f;
  --panel: rgba(43,36,25,.07);
}
.game-app .tr-card[data-surface="board"] { --text: #eef7f1; --muted: #9fc3b2; --accent: #ffe9a8; --panel: rgba(255,255,255,.07); }
.game-app .tr-card[data-surface="screen"] { --text: #d6f4ec; --muted: #6f9a93; --accent: #5bc0a8; --panel: rgba(91,192,168,.08); }
/* a lit console screen, bezel and all */
.game-app .tr-card[data-surface="screen"] {
  background: linear-gradient(180deg, #0e2a3a, #08161f);
  border: 12px solid #2b3147; border-radius: 16px;
  box-shadow: inset 0 0 70px rgba(91,192,168,.14), 0 0 0 2px rgba(91,192,168,.22),
              0 16px 40px rgba(0,0,0,.5);
}
/* a playing card, propped up */
.game-app .tr-card[data-surface="card"] {
  background: #f8f2e4; color: #2a2033;
  border: 8px solid #f8f2e4; border-radius: 18px;
  box-shadow: 0 0 0 3px #d8456b inset, 0 20px 44px rgba(0,0,0,.45);
}
/* a weathered notice, nailed up */
.game-app .tr-card[data-surface="notice"] {
  background: #e4d9bd; color: #2b2419;
  border-radius: 3px;
  box-shadow: 0 18px 40px rgba(0,0,0,.55);
  clip-path: polygon(0 1%, 3% 0, 97% 1%, 100% 0, 99% 99%, 96% 100%, 2% 99%, 0 100%);
}
.game-app .tr-card[data-surface="notice"]::before,
.game-app .tr-card[data-surface="notice"]::after {
  content: ""; position: absolute; top: 9px; width: 11px; height: 11px; border-radius: 50%;
  background: #6b5a44; box-shadow: inset 0 -2px 2px rgba(0,0,0,.4);
}
.game-app .tr-card[data-surface="notice"]::before { left: 16px; }
.game-app .tr-card[data-surface="notice"]::after { right: 16px; }

.game-app .tr-question {
  font-size: clamp(1.02rem, 2.4vh, 1.32rem); line-height: 1.4; text-align: center;
}
/* Chalk on the board; ink on a page. Written in the room's own medium. */
.game-app .tr-root[data-ink="chalk"] .tr-question {
  color: #eef7f1; font-weight: 500; text-shadow: 0 0 10px rgba(255,255,255,.20);
}
.game-app .tr-root[data-ink="glow"] .tr-question { color: #d6f4ec; }
.game-app .tr-input { width: 100%; display: flex; justify-content: center; }

/* multiple choice — written in the surface's own colour, so it belongs to the material */
.game-app .tr-choices { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.game-app .tr-choice {
  font: inherit; text-align: left; width: 100%; padding: 11px 14px;
  color: var(--text); background: var(--panel);
  border: 1px solid currentColor; border-color: color-mix(in srgb, currentColor 26%, transparent);
  border-radius: 10px; cursor: pointer;
  transition: background .12s, border-color .12s, transform .12s;
}
.game-app .tr-choice:hover:not(:disabled) {
  background: color-mix(in srgb, currentColor 12%, transparent);
  border-color: color-mix(in srgb, currentColor 48%, transparent);
}
.game-app .tr-choice:focus-visible { outline: none; border-color: var(--accent); }
.game-app .tr-choice:active:not(:disabled) { transform: scale(.995); }

/* a short typed answer */
.game-app .tr-box {
  font: inherit; font-size: 1.1rem; text-align: center; width: min(100%, 15ch);
  padding: 9px 12px; color: var(--text); background: var(--panel);
  border: none; border-bottom: 2px solid var(--accent); border-radius: 6px 6px 0 0;
}
.game-app .tr-box:focus {
  outline: none; background: color-mix(in srgb, var(--accent) 18%, transparent);
}
.game-app .tr-box::placeholder {
  color: var(--muted); font-size: .82rem; opacity: .85;
}

/* ---- feedback ---- */
.game-app .tr-feedback {
  width: 100%; text-align: center; font-size: .9rem; line-height: 1.45;
  padding: 9px 12px; border-radius: 10px;
}
.game-app .tr-feedback.tr-right {
  color: var(--text); background: color-mix(in srgb, #5bc0a8 24%, transparent);
}
.game-app .tr-feedback.tr-wrong {
  color: var(--text); background: color-mix(in srgb, #ff6b6b 22%, transparent);
}

.game-app .tr-actions { flex: 0 0 auto; }
.game-app .tr-submit {
  font: inherit; font-weight: 600; padding: 10px 26px; cursor: pointer;
  color: #06231d; background: var(--accent, #5bc0a8);
  border: none; border-radius: 999px; transition: filter .12s, transform .12s;
}
.game-app .tr-submit:hover:not(:disabled) { filter: brightness(1.07); }
.game-app .tr-submit:disabled { opacity: .55; cursor: default; }
.game-app .tr-done { font-size: 1.1rem; text-align: center; color: #f2f6fb; }

/* ---- the teacher panel's authoring preview ---- */
.tr-preview { display: flex; flex-direction: column; gap: 10px; }
.tr-preview-block {
  font-size: .72rem; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted, #8b98ad); margin-top: 6px;
}
.tr-preview-q { padding: 8px 10px; background: var(--panel, rgba(255,255,255,.04)); border-radius: 8px; }
.tr-preview-text { font-weight: 600; }
.tr-preview-options, .tr-preview-parts { margin: 6px 0 0 1.2em; padding: 0; }
.tr-preview-options li.right { color: var(--accent, #5bc0a8); font-weight: 600; }
.tr-preview-answer { margin-top: 4px; color: var(--accent, #5bc0a8); font-weight: 600; }
.tr-preview-note { margin-top: 4px; font-size: .86rem; color: var(--muted, #8b98ad); }
