@import url("https://fonts.googleapis.com/css2?family=TikTok+Sans:opsz,wdth,wght@12..36,75..150,300..900&family=JetBrains+Mono:wght@500;600&display=swap");

:root {
  --brand: #2B2E31;
  --brand-deep: #1F2124;
  --brand-line: #3D4044;
  --white: #F5F0E8;
  --panel: #ECE5D9;
  --panel-2: #E4DCCE;
  --line: #E0D7C8;
  --line-strong: #C9BFAF;
  --ink: #232528;
  --muted: #55595D;
  --accent: #C2392F;
  --accent-ink: #A3302A;
  --tint: #EAE2D5;
  --success: #1B7A52;
  --success-bg: #E3F0E8;
  --warning: #8C6314;
  --warning-bg: #F7EDD8;
  --error: #B0322B;
  --error-bg: #F8E6E2;
  --line-dk: rgba(240,233,222,.2);
  --muted-dk: rgba(240,233,222,.74);

  --display: 'TikTok Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --body: 'TikTok Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --maxw: 1200px;
  --gutter: clamp(18px, 4vw, 48px);
  --bar: 64px;
  --shadow-float: 0 12px 32px rgba(31,33,36,.18);
  --tint-strong: #E0D6C6;
  --error-deep: #8F2923;
  --ring-soft: rgba(194,57,47,.22);
  --backdrop: rgba(31,33,36,.6);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%232B2E31' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");

  --btn: #C2392F;
  --btn-hover: #A8302A;
  --cream: #F0E9DE;
  --red-mark: #D94541;
}

h1, .h1, h2, .h2, h3, .h3 { text-transform: none; font-family: var(--display); font-weight: 800; font-stretch: 87.5%; }
h1, .h1 { font-size: clamp(30px, 4.4vw, 50px); letter-spacing: -.025em; line-height: 1.1; }
h2, .h2 { font-size: clamp(24px, 3vw, 34px); letter-spacing: -.02em; }
h3, .h3 { font-size: 19px; letter-spacing: -.01em; }
.figure { letter-spacing: -.03em; }
.btn { font-weight: 600; letter-spacing: .03em; font-size: 13px; }
.btn-sm { font-size: 11.5px; }
.text-link { font-weight: 600; letter-spacing: .03em; font-size: 12px; color: var(--accent-ink); }
.code { font-weight: 600; letter-spacing: 0; }
em.lift, .lift { font-style: normal; }

.topbar { background: var(--brand); border-bottom-color: var(--brand); color: var(--cream); }
.brand .brand-name { font-family: var(--body); font-weight: 600; font-size: 17px; letter-spacing: 0; }
.topbar .brand .brand-name, .footer .brand .brand-name { color: var(--cream); }
.brand .brand-sub { font-family: var(--body); font-weight: 600; color: var(--muted-dk); border-left-color: var(--line-dk); }
.nav a { color: var(--muted-dk); }
.nav a:hover { color: var(--cream); }
.nav a.is-active { color: var(--cream); border-bottom-color: var(--red-mark); }
.account, .account .name { color: var(--cream); }
.account .avatar { background: var(--cream); color: var(--brand); }
.topbar .dropdown-toggle svg { color: var(--muted-dk) !important; }
.menu-btn { border-color: var(--line-dk); color: var(--cream); }
.topbar .btn-outline { color: var(--cream); border-color: rgba(240,233,222,.5); }
.topbar .btn-outline:hover { background: rgba(240,233,222,.08); border-color: var(--cream); color: var(--cream); }
.topbar :focus-visible, .footer :focus-visible, .admin-rail :focus-visible, .tl :focus-visible { outline-color: var(--cream); }
.mobile-nav { background: var(--white); }
.footer { background: var(--brand); }
.footer a { color: var(--cream); }
.admin-rail a.is-active { border-left-color: var(--red-mark); }
.admin-main, .lesson-rail .rail-head { background: #FFFCF7; }
.btn-onbrand { background: var(--cream); border-color: var(--cream); }
.btn-onbrand:hover { background: #fff; border-color: #fff; }

.sheet-row.is-current { box-shadow: inset 4px 0 0 var(--btn); }
.rail-item.is-current { border-left-color: var(--btn); }

.badge-plate { width: 60px; height: 84px; position: relative; margin-left: 0; }
.badge.is-earned .badge-plate::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: 7px; height: 3px; background: var(--red-mark); }
.badge-icon svg { width: 30px; height: 30px; }
.badge-lg .badge-plate { width: 90px; height: 128px; }
.badge-lg .badge-icon svg { width: 46px; height: 46px; }

.is-caption { line-height: 1.42; }
.is-caption .cap { background: var(--brand); color: var(--cream); padding: .06em .28em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.is-caption .cap .lift { background: var(--btn); color: #fff; padding: 0 .2em; margin: 0 -.06em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

.tl { margin: 0; background: var(--brand); color: var(--cream); padding: 16px 20px 14px; font-family: var(--body); }
.tl-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.tl-name { font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: .02em; }
.tl-time { font-family: var(--mono); font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.tl-time span { color: var(--muted-dk); font-weight: 500; }
.tl-tracks { display: grid; grid-template-columns: 64px 1fr; gap: 0 10px; }
.tl-labels { display: grid; grid-template-rows: 22px 58px 20px; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .04em; color: var(--muted-dk); text-transform: uppercase; }
.tl-labels span { display: flex; align-items: center; }
.tl-labels span:first-child { align-items: flex-start; }
.tl-clips { list-style: none; margin: 0; padding: 0; display: flex; gap: 3px; min-width: 0; }
.tl-clip { flex: var(--min) 1 0; min-width: 0; display: grid; grid-template-rows: 22px auto; animation: tl-in .5s var(--ease) both; animation-delay: calc(var(--i) * 60ms); }
.tl-in { font-family: var(--mono); font-size: 11px; line-height: 12px; font-weight: 500; color: var(--muted-dk); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden;
  background-image: linear-gradient(90deg, rgba(240,233,222,.38) 1px, transparent 1px); background-size: calc(100% / var(--ticks)) 5px; background-repeat: repeat-x; background-position: 0 100%; }
.tl-lane { position: relative; min-width: 0; }
.tl-body { display: flex; flex-direction: column; justify-content: space-between; height: 58px; padding: 7px 0 5px; background: var(--cream); color: var(--brand); text-decoration: none; min-width: 0; }
a.tl-body:hover { background: #FFFAF2; text-decoration: none; }
.tl-title { display: flex; gap: 6px; align-items: baseline; padding: 0 8px; font-size: 12.5px; font-weight: 600; line-height: 1.25; min-width: 0; }
.tl-title b { font-family: var(--display); font-weight: 700; font-size: 11px; flex: 0 0 auto; }
.tl-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-segs { display: flex; gap: 2px; height: 9px; }
.tl-segs i { flex: var(--min) 1 0; background: rgba(43,46,49,.16); }
.tl-segs i.is-done { background: var(--brand); }
.tl-marks { display: flex; gap: 2px; height: 20px; }
.tl-marks s { flex: var(--min) 1 0; position: relative; }
.tl-marks i { position: absolute; left: 50%; top: 5px; width: 10px; height: 10px; margin-left: -5px; transform: rotate(45deg); border: 1.5px solid rgba(240,233,222,.5); }
.tl-marks i.is-passed { background: var(--red-mark); border-color: var(--red-mark); }
.tl-clip.is-locked .tl-body { background: transparent; outline: 1px dashed rgba(240,233,222,.4); outline-offset: -1px; color: var(--muted-dk); }
.tl-clip.is-locked .tl-segs i { background: rgba(240,233,222,.14); }
.tl-head { position: absolute; top: -10px; bottom: 0; width: 2px; margin-left: -1px; background: var(--red-mark); pointer-events: none; z-index: 2; animation: tl-play 1.1s var(--ease) .35s both; }
.tl-head::before { content: ""; position: absolute; top: 0; left: -5px; width: 12px; height: 10px; background: var(--red-mark); clip-path: polygon(0 0, 100% 0, 100% 60%, 50% 100%, 0 60%); }
.tl-cap { margin-top: 8px; font-size: 13px; color: var(--muted-dk); }
.tl-cap strong { color: var(--cream); font-weight: 600; }
@keyframes tl-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes tl-play { from { left: 0; } }
.tl + .sheet, .meter + .tl, .tl.mt-3 { margin-top: 24px; }

@media (max-width: 640px) {
  .tl { padding: 14px 14px 12px; }
  .tl-tracks { grid-template-columns: 1fr; }
  .tl-labels { display: none; }
  .tl-clips { flex-direction: column; gap: 6px; }
  .tl-clip { grid-template-rows: none; grid-template-columns: 62px 1fr; gap: 0 8px; }
  .tl-in { background: none; border-right: 1px solid rgba(240,233,222,.38); padding-top: 7px; }
  .tl-head { top: -3px; }
  .tl-head::before { display: none; }
}
.tl.is-vertical .tl-tracks { grid-template-columns: 1fr; }
.tl.is-vertical .tl-labels { display: none; }
.tl.is-vertical .tl-clips { flex-direction: column; gap: 6px; }
.tl.is-vertical .tl-clip { grid-template-rows: none; grid-template-columns: 62px 1fr; gap: 0 8px; }
.tl.is-vertical .tl-in { background: none; border-right: 1px solid rgba(240,233,222,.38); padding-top: 7px; }
.tl.is-vertical .tl-head { top: -3px; }
.tl.is-vertical .tl-head::before { display: none; }

.ccg__head { border-bottom: 1px solid var(--line); background: var(--panel); }
.ccg__head .code { display: block; margin-bottom: 6px; }
.ccg__head h1 { font-size: clamp(24px, 3vw, 34px); }
.ccg__facts { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 10px; }
.ccg__facts strong { color: var(--brand); }
.ccg__game { border: 1px solid var(--brand-line); background: var(--brand); color: var(--cream); }
.ccg__scene { position: relative; aspect-ratio: 2 / 1; overflow: hidden; background: #050506; border-bottom: 1px solid var(--brand-line); }
.ccg__canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }
.ccg__hud, .ccg__wallhud { position: absolute; top: 10px; left: 12px; right: 12px; display: flex; align-items: center; gap: 10px; font-family: var(--mono); text-transform: uppercase; letter-spacing: .18em; font-size: 11px; color: var(--muted-dk); }
.ccg__meter { display: flex; gap: 3px; margin-left: auto; }
.ccg__meter i { width: 16px; height: 6px; background: rgba(240,233,222,.16); }
.ccg__meter i.on { background: var(--cream); }
.ccg__meter.hot i.on { background: var(--red-mark); }
.ccg__stamp { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: 0; transform: scale(1.25); pointer-events: none; transition: opacity .22s var(--ease), transform .22s var(--ease); }
.ccg__stamp.show { opacity: 1; transform: scale(1); }
.ccg__stamp span { font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: clamp(22px, 7vw, 44px); line-height: .95; letter-spacing: -.02em; color: var(--cream); padding: .12em .35em; border: 3px solid var(--cream); text-shadow: .05em .04em 0 rgba(217,69,65,.85); box-shadow: .12em .1em 0 rgba(217,69,65,.85); transform: rotate(-4deg); }
.ccg__stamp.caught span { color: var(--red-mark); border-color: var(--red-mark); text-shadow: .05em .04em 0 rgba(240,233,222,.55); box-shadow: .12em .1em 0 rgba(240,233,222,.55); }
.ccg__panel { padding: clamp(16px, 3vw, 28px); background: var(--cream); color: var(--ink); }
.ccg__kicker { font-family: var(--mono); text-transform: uppercase; letter-spacing: .22em; font-size: 11px; font-weight: 600; color: var(--accent-ink); margin-bottom: 8px; }
.ccg__title { font-size: clamp(22px, 4vw, 30px); margin-bottom: 8px; }
.ccg__copy { color: var(--muted); max-width: 52ch; margin-bottom: 16px; font-size: 14.5px; line-height: 1.5; }
.ccg__actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.ccg__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; font-family: var(--mono); text-transform: uppercase; letter-spacing: .18em; font-size: 11px; color: var(--muted); }
.ccg__review { font-family: var(--body); text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 12px; color: var(--accent-ink); }
.ccg__question { font-family: var(--display); font-weight: 700; font-size: clamp(16px, 3.4vw, 20px); line-height: 1.3; letter-spacing: -.01em; color: var(--brand); margin-bottom: 14px; }
.ccg__answers { display: grid; gap: 8px; }
.ccg__answer { min-height: 48px; display: flex; align-items: center; gap: 14px; padding: 10px 14px; border: 1.5px solid var(--line-strong); background: #fff; text-align: left; font-family: var(--body); font-size: 15px; font-weight: 500; color: var(--ink); line-height: 1.35; cursor: pointer; transition: border-color .15s, background .15s, color .15s; }
.ccg__answer b { flex: 0 0 auto; font-family: var(--mono); font-weight: 600; letter-spacing: .1em; font-size: 11px; color: var(--muted); }
.ccg__answer:hover { border-color: var(--brand); }
.ccg__answer:disabled { cursor: default; opacity: .55; }
.ccg__answer.is-right { border-color: var(--success); background: var(--success-bg); opacity: 1; }
.ccg__answer.is-wrong { border-color: var(--error); background: var(--error-bg); color: var(--error-deep); opacity: 1; }
.ccg__why { margin-top: 14px; font-size: 14px; color: var(--muted); line-height: 1.5; }
.ccg__why strong { color: var(--brand); }
.ccg__why + .ccg__actions { margin-top: 14px; }
.ccg__table { margin-bottom: 14px; }
.ccg__table table { font-size: 13.5px; }
.ccg__table td:first-child { font-weight: 600; color: var(--brand); width: 40%; }
.ccg__result .quiz-result { border: 2px solid var(--brand); background: #fff; padding: 24px; text-align: center; }
.ccg__result .quiz-result .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.ccg__result .ccg__copy { margin: 14px auto 0; text-align: center; }
.ccg__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .ccg__stamp { transition: none; transform: none; } .ccg__stamp span { transform: none; } }

.ccg__wall { position: relative; overflow: hidden; padding: 38px 12px 0; background: #1a1714 repeating-linear-gradient(180deg, transparent 0 23px, rgba(240,233,222,.09) 23px 24px); border-bottom: 1px solid var(--brand-line); min-height: 120px; }
.ccg__wallhud { top: 12px; }
.ccg__score { margin-left: auto; letter-spacing: .1em; }
.ccg__score b { color: var(--cream); font-size: 14px; }
.ccg__wallnote { padding: 18px 8px 40px; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted-dk); }
.ccg__line { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding: 0 0 14px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.ccg__line::-webkit-scrollbar { display: none; }
.ccg__sus { flex: 0 0 min(72vw, 240px); scroll-snap-align: start; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 12px 14px; border: 1.5px solid rgba(240,233,222,.32); background: rgba(5,5,6,.55); color: var(--cream); text-align: left; cursor: pointer; font-family: var(--body); transition: border-color .15s, background .15s; }
.ccg__sus > b { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--muted-dk); }
.ccg__sus-fig { display: block; width: 54px; height: 72px; color: var(--cream); }
.ccg__sus-fig svg { width: 100%; height: 100%; }
.ccg__sus-title { font-family: var(--display); font-weight: 700; font-size: 13.5px; line-height: 1.3; }
.ccg__sus-facts { list-style: none; margin: 0; padding: 0; font-size: 12.5px; line-height: 1.4; color: rgba(240,233,222,.86); }
.ccg__sus-facts li { padding: 2px 0; }
.ccg__sus-facts b { font-weight: 600; color: var(--muted-dk); margin-right: 6px; }
.ccg__sus:hover { border-color: var(--cream); }
.ccg__sus:disabled { cursor: default; opacity: .55; }
.ccg__sus.is-right { border-color: #4EBE8A; background: rgba(27,122,82,.35); opacity: 1; }
.ccg__sus.is-wrong { border-color: var(--red-mark); background: rgba(217,69,65,.28); opacity: 1; }
.ccg__sus.is-wrong .ccg__sus-fig, .ccg__sus.is-wrong > b { color: var(--red-mark); }
.ccg__witness { border-left: 4px solid var(--brand); background: var(--tint); padding: 12px 16px; margin-bottom: 14px; font-size: 14px; }
.ccg__witness .up { display: block; margin-bottom: 4px; }
.ccg__ref-facts { list-style: none; margin: 6px 0 0; padding: 0; font-size: 13px; line-height: 1.45; }
.ccg__ref-facts b { font-weight: 600; margin-right: 6px; }
@media (min-width: 760px) { .ccg__line { flex-wrap: wrap; overflow: visible; } .ccg__sus { flex: 1 1 calc(33.333% - 8px); max-width: calc(33.333% - 6px); } }
