/* The training page (/training). Tokens and buttons come from board.css. */

:root {
  --tr-ok-bg: rgba(22, 101, 52, 0.08);
  --tr-touch: 48px;
}

.tr-wrap { max-width: 1180px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 64px; }
.tr-wrap.is-player { max-width: 1420px; }
.tr-wrap [tabindex="-1"]:focus { outline: none; }
.tr-wrap .btn { min-height: var(--tr-touch); padding: 0 24px; justify-content: center; }

.tr-eyebrow {
  display: inline-flex; align-items: center; gap: 12px; margin-bottom: 12px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.32em; text-transform: uppercase; color: var(--gold-dark);
}
.tr-eyebrow::before { content: ''; width: 24px; height: 1px; background: var(--gold); }
.tr-title, .tr-step-title {
  font-family: var(--font-display); font-weight: 500; letter-spacing: -0.02em; line-height: 1.08; color: var(--near-black);
}
.tr-title { font-size: clamp(38px, 6vw, 60px); margin-bottom: 14px; }
.tr-title em, .tr-step-title em, .tr-card-title em { color: var(--gold); font-style: italic; font-weight: 400; }
.tr-lead { font-size: 16px; line-height: 1.6; color: var(--mid-gray); max-width: 660px; }
.tr-hero { padding: 12px 0 28px; }

.tr-section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.tr-section-label { font-size: 11px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gray); }
.tr-count { font-size: 13px; font-weight: 600; color: var(--mid-gray); }

.tr-cards, .tr-questions { margin: 0; padding: 0; list-style: none; }
.tr-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 760px) { .tr-cards { grid-template-columns: 1fr; } }
.tr-card {
  display: flex; gap: 16px; height: 100%; padding: 18px 20px; color: inherit; text-decoration: none;
  background: var(--white); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  transition: border-color 0.15s var(--ease-out), transform 0.15s var(--ease-out);
}
.tr-card:hover { border-color: var(--gold); transform: translateY(-1px); }
.tr-card-num {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 1.5px solid var(--gold); font-family: var(--font-display); font-size: 18px; color: var(--gold-dark);
}
.tr-card.is-done .tr-card-num { background: var(--gold); color: var(--near-black); font-family: var(--font); font-weight: 700; }
.tr-card-body { display: flex; flex: 1; flex-direction: column; gap: 6px; min-width: 0; }
.tr-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 12px; color: var(--mid-gray); }
.tr-tag { padding: 3px 9px; border-radius: var(--radius-full); background: var(--gold-subtle); font-size: 11px; font-weight: 700; color: var(--gold-dark); }
.tr-card-title { font-family: var(--font-display); font-size: 24px; line-height: 1.15; color: var(--near-black); }
.tr-card-summary { font-size: 13px; line-height: 1.45; color: var(--mid-gray); }
.tr-bar { display: block; height: 4px; margin-top: 6px; overflow: hidden; border-radius: 4px; background: var(--off-white); }
.tr-bar span { display: block; height: 100%; background: var(--gold); }
.tr-all-done { margin-top: 20px; padding: 16px 18px; border-radius: 14px; background: var(--tr-ok-bg); font-weight: 600; color: var(--good); }

.tr-player-top { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.tr-back { display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; font-weight: 600; color: var(--mid-gray); text-decoration: none; white-space: nowrap; }
.tr-back:hover { color: var(--gold-dark); }
.tr-progress { flex: 1; height: 6px; overflow: hidden; border-radius: 6px; background: var(--light-gray); }
.tr-progress span { display: block; height: 100%; background: var(--gold); transition: width 0.3s var(--ease-out); }

.tr-player {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: auto 1fr;
  grid-template-areas: "stage text" "stage controls"; align-items: start; column-gap: 36px; row-gap: 14px;
}
.tr-player.is-phone { grid-template-columns: minmax(0, 460px) minmax(340px, 460px); justify-content: center; column-gap: 56px; }
.tr-player.is-text { grid-template-columns: minmax(0, 640px); grid-template-areas: "text" "controls"; justify-content: center; }
.tr-text { grid-area: text; display: flex; flex-direction: column; gap: 14px; }
.tr-stage { grid-area: stage; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.tr-controls { grid-area: controls; display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 859px) {
  .tr-player, .tr-player.is-phone, .tr-player.is-text { grid-template-columns: 1fr; grid-template-rows: auto; grid-template-areas: "text" "stage" "controls"; row-gap: 16px; }
  .tr-text { gap: 10px; }
  .tr-controls {
    position: sticky; bottom: 0; z-index: 5;
    margin: 0 calc(-1 * clamp(16px, 4vw, 40px));
    padding: 12px clamp(16px, 4vw, 40px) calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border-strong); background: var(--warm-white);
  }
  .tr-hint { display: none; }
}

.tr-frame {
  position: relative; max-width: 100%; overflow: hidden; border-radius: 14px;
  border: 1px solid var(--border-strong); background: var(--off-white); box-shadow: var(--shadow-elevated);
}
.tr-frame[data-viewport="phone"] { border-radius: 22px; outline: 5px solid var(--near-black); outline-offset: -1px; }
.tr-canvas { position: absolute; top: 0; left: 0; transition: transform 0.4s var(--ease-out), width 0.4s var(--ease-out), height 0.4s var(--ease-out); }
.tr-canvas img { display: block; width: 100%; height: 100%; max-width: none; }
.tr-hotspot {
  position: absolute; padding: 0; cursor: pointer; background: transparent;
  border: 3px solid var(--gold); border-radius: 10px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 0 0 9999px rgba(10, 10, 10, 0.42);
}
.tr-hotspot::after {
  content: ''; position: absolute; inset: -3px; border: 3px solid var(--gold); border-radius: inherit;
  pointer-events: none; animation: tr-pulse 1.8s ease-out infinite;
}
.tr-hotspot:hover { background: var(--gold-glow); }
.tr-hotspot:focus-visible { outline: 3px solid var(--white); outline-offset: 3px; }
.tr-marker {
  position: absolute; top: 0; left: 0; z-index: 1; translate: -50% -50%;
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4); font: 700 13px/1 var(--font); color: var(--near-black);
}
@keyframes tr-pulse { from { opacity: 0.9; transform: scale(1); } to { opacity: 0; transform: scale(1.12); } }
.tr-zoom {
  align-self: flex-end; min-height: 40px; padding: 0 14px; border: 0; background: transparent; cursor: pointer;
  font: 600 13px var(--font); color: var(--gold-dark); text-decoration: underline; text-underline-offset: 3px;
}

.tr-step-meta { display: flex; align-items: center; gap: 12px; font-size: 12.5px; font-weight: 600; color: var(--mid-gray); }
.tr-badge { padding: 5px 10px; border-radius: var(--radius-full); background: var(--gold-subtle); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-dark); }
.tr-step-title { font-size: clamp(26px, 3vw, 34px); }
.tr-body { font-size: 16.5px; line-height: 1.6; color: var(--dark-gray); }
.tr-body b, .tr-callout b { font-weight: 700; color: var(--near-black); }
.tr-callout { padding: 12px 14px; border-radius: 12px; font-size: 14.5px; line-height: 1.5; color: var(--dark-gray); }
.tr-callout span { display: block; margin-bottom: 4px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; }
.tr-tip { background: var(--gold-subtle); }
.tr-tip span { color: var(--gold-dark); }
.tr-warn { background: var(--late-bg); }
.tr-warn span { color: var(--late); }
.tr-nav { display: flex; gap: 10px; }
.tr-nav .btn { flex: 1; }
.tr-nav-center { justify-content: center; }
.tr-nav-center .btn { flex: 0 1 auto; }
.tr-hint { font-size: 12.5px; color: var(--gray); }

.tr-check { max-width: 720px; margin: 0 auto; }
.tr-check .tr-step-title { margin-bottom: 22px; }
.tr-questions { display: flex; flex-direction: column; gap: 22px; margin-bottom: 24px; }
.tr-q fieldset { margin: 0; padding: 0; border: 0; }
.tr-q legend { margin-bottom: 10px; padding: 0; font-size: 17px; font-weight: 700; line-height: 1.4; color: var(--near-black); }
.tr-options { display: flex; flex-direction: column; gap: 8px; }
.tr-option {
  min-height: var(--tr-touch); padding: 12px 16px; border: 1.5px solid var(--border-strong); border-radius: 14px;
  background: var(--white); font: 500 15px/1.4 var(--font); color: var(--dark-gray); text-align: left; cursor: pointer;
}
.tr-option:hover:not(:disabled) { border-color: var(--gold); }
.tr-option:disabled { cursor: default; }
.tr-option.is-right { border-color: var(--good); background: var(--tr-ok-bg); color: var(--near-black); }
.tr-option.is-right::before { content: '✓  '; font-weight: 700; color: var(--good); }
.tr-option.is-wrong { border-color: var(--late); background: var(--late-bg); color: var(--near-black); }
.tr-option.is-wrong::before { content: '✕  '; font-weight: 700; color: var(--late); }
.tr-why { margin-top: 10px; font-size: 14.5px; line-height: 1.5; color: var(--mid-gray); }
.tr-why:empty { display: none; }
.tr-q.got-right .tr-why b, .tr-q.got-retry .tr-why b { color: var(--good); }
.tr-q.got-wrong .tr-why b { color: var(--late); }

.tr-done { display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 560px; margin: 40px auto; text-align: center; }
.tr-done-check { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--gold); font-size: 32px; font-weight: 700; color: var(--near-black); }
.tr-done .tr-eyebrow::before { display: none; }
.tr-done .tr-lead { margin-bottom: 8px; }

@media (max-width: 720px) {
  .topbar .who { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .tr-hotspot::after { animation: none; opacity: 0.5; }
  .tr-canvas, .tr-progress span, .tr-card { transition: none; }
}
