/* VERDICT — screens (shell lane). Phone portrait first; PC from 900px. Tokens live in base.css. */

/* ================================================================ TITLE */

.screen-title { padding: 0; cursor: pointer; align-items: center; justify-content: center; text-align: center; }
.title-art { position: absolute; inset: 0; overflow: hidden; }
.title-paint { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.title-art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(80% 45% at 50% 100%, rgba(240,138,60,0.38), transparent 70%),
    linear-gradient(180deg, rgba(20,22,43,0.55) 0%, rgba(20,22,43,0.05) 35%, rgba(20,22,43,0.2) 65%, rgba(11,12,24,0.85) 100%);
}
.title-scale { position: absolute; left: 50%; top: 18%; width: min(118vw, 760px); transform: translateX(-50%); opacity: 0.9; }
.scale-svg { width: 100%; height: auto; overflow: visible; }
.ts-beam { transform-origin: 200px 18px; animation: sway 9s ease-in-out infinite; }
.ts-pan { transform-box: fill-box; }
.ts-fire { animation: flicker 2.6s ease-in-out infinite; transform-origin: 200px 292px; }
@keyframes sway { 0%, 100% { transform: rotate(-1.6deg); } 50% { transform: rotate(1.6deg); } }
@keyframes flicker { 0%, 100% { opacity: 0.85; transform: scale(1); } 40% { opacity: 1; transform: scale(1.06, 1.1); } 70% { opacity: 0.9; transform: scale(0.98, 1.02); } }
[data-motion="reduce"] .ts-beam, [data-motion="reduce"] .ts-fire { animation: none; }

.title-fig {
  position: absolute; bottom: -2%; width: min(58vw, 380px); aspect-ratio: 2 / 3;
  opacity: 0.0; filter: saturate(0.85) brightness(0.8);
  animation: fig-in 1.6s 0.3s var(--ease) forwards;
}
.title-fig img { width: 100%; height: 100%; object-fit: contain; object-position: bottom; }
.title-fig.left { left: -14%; }
.title-fig.right { right: -14%; transform: scaleX(-1); }
.title-fig::before {
  content: ""; position: absolute; inset: 30% 10% -5%; z-index: -1;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--fc) 60%, transparent), transparent);
  filter: blur(20px);
}
@keyframes fig-in { to { opacity: 0.55; } }
[data-motion="reduce"] .title-fig { animation: fade-to 1s forwards; }
@keyframes fade-to { to { opacity: 0.55; } }

.title-top { position: absolute; top: calc(var(--safe-t) + 10px); right: calc(var(--safe-r) + 12px); z-index: 3; }
.lang-btn { background: rgba(11,12,24,0.45); backdrop-filter: blur(4px); font-family: var(--font-body); }
.lang-btn svg { width: 18px; height: 18px; }

.title-center { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 34px; margin-top: 18vh; padding: 0 16px; }
.title-mark { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.title-kicker { color: var(--ash); opacity: 0.85; }
.title-word {
  font-size: clamp(3.2rem, 17vw, 7.5rem); letter-spacing: 0.14em; margin-right: -0.14em; font-weight: 700;
  background: linear-gradient(180deg, #fff2c8 0%, var(--gold) 38%, #b07a25 62%, #f6d58a 78%, #8a5a18 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 rgba(60,30,5,0.9)) drop-shadow(0 0 26px rgba(240,138,60,0.45));
  line-height: 1;
}
:lang(th) .title-word { letter-spacing: 0.04em; margin-right: 0; line-height: 1.25; font-size: clamp(2.4rem, 12vw, 5.5rem); }
.title-sub { font-size: clamp(1.05rem, 4.6vw, 1.6rem); color: var(--bone); font-style: italic; letter-spacing: 0.06em; text-shadow: 0 2px 10px rgba(0,0,0,0.7); }
:lang(th) .title-sub { font-style: normal; }
.title-tap {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  min-height: var(--touch); padding: 10px 26px;
  font-family: var(--font-display); font-size: 1.15rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--bone);
  border-top: 1px solid var(--line-warm); border-bottom: 1px solid var(--line-warm);
  text-shadow: 0 0 12px rgba(240,138,60,0.8);
  animation: breathe 2.4s ease-in-out infinite;
}
:lang(th) .title-tap { text-transform: none; letter-spacing: 0.05em; }
@keyframes breathe { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
[data-motion="reduce"] .title-tap { animation: none; opacity: 0.9; }
.title-foot { position: absolute; bottom: calc(var(--safe-b) + 14px); left: 0; right: 0; z-index: 2; color: var(--ash-dim); font-family: var(--font-display); font-style: italic; }

@media (min-width: 900px) {
  .title-scale { top: 8%; width: 760px; }
  .title-fig { width: 34vh; max-width: 420px; height: 76vh; width: auto; }
  .title-fig.left { left: 6%; }
  .title-fig.right { right: 6%; }
  .title-center { margin-top: 22vh; }
}

/* ================================================================ MODE SELECT */

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-bottom: 8px; }
.mode-notice { grid-column: 1 / -1; }
.plaque {
  position: relative; overflow: hidden; cursor: pointer; text-align: left;
  appearance: none; border: 0; border-radius: var(--radius);
  min-height: 108px; padding: 14px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 6px;
  background: var(--panel-solid); color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line), 0 6px 18px rgba(0,0,0,0.35);
  animation: plaque-in var(--t-mid) var(--ease) both; animation-delay: calc(var(--i) * 40ms);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast);
}
@keyframes plaque-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
[data-motion="reduce"] .plaque { animation-name: fade-in; }
.plaque:hover { box-shadow: inset 0 0 0 1px var(--line-warm), 0 0 24px rgba(240,138,60,0.18), 0 6px 18px rgba(0,0,0,0.35); }
.plaque:active { transform: scale(0.985); }
.plaque-bg { position: absolute; inset: 0; z-index: 0; }
.plaque-bg img { width: 100%; height: 100%; object-fit: cover; opacity: 0.5; transition: transform 6s ease-out, opacity var(--t-mid); }
.plaque:hover .plaque-bg img { transform: scale(1.06); opacity: 0.62; }
.plaque::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(20,22,43,0.1), rgba(11,12,24,0.88) 78%); }
.plaque > *:not(.plaque-bg) { position: relative; z-index: 2; }
.plaque-ic { width: 36px; height: 36px; color: var(--ember-hot); }
.plaque-ic svg { width: 100%; height: 100%; filter: drop-shadow(0 0 8px rgba(240,138,60,0.5)); }
.plaque-name { font-family: var(--font-display); font-size: 1.12rem; font-weight: 700; color: var(--bone); line-height: 1.2; }
.plaque-line { font-size: 0.82rem; color: var(--ash); line-height: 1.35; }
:lang(th) .plaque-line { line-height: 1.6; }
.plaque.hero { grid-column: 1 / -1; min-height: 190px; }
.plaque.hero .plaque-name { font-size: 1.6rem; }
.plaque.hero .plaque-line { font-size: 0.95rem; max-width: 36ch; }
.plaque.hero .plaque-bg img { opacity: 0.75; }
.plaque.hero { box-shadow: inset 0 0 0 1px var(--line-warm), 0 0 30px rgba(240,138,60,0.15), 0 8px 24px rgba(0,0,0,0.4); }
.plaque.minor { min-height: 76px; flex-direction: row; align-items: center; justify-content: flex-start; gap: 12px; }
.plaque.minor .plaque-ic { width: 28px; height: 28px; flex: 0 0 auto; color: var(--ash); }
.plaque.minor .plaque-line { display: none; }
@media (min-width: 900px) {
  .modes { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .plaque.hero { grid-column: 1 / 3; grid-row: span 2; min-height: 100%; }
  .plaque { min-height: 150px; }
  .plaque.minor { grid-column: span 2; min-height: 72px; }
  .plaque.minor .plaque-line { display: block; }
}

/* ================================================================ FIGHTER SELECT */

.screen-select { padding-bottom: calc(var(--safe-b) + 10px); }
.sel-layout { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.sel-stage {
  position: relative; flex: 0 0 34%; min-height: 200px; max-height: 330px;
  margin: 0 -16px; overflow: hidden;
  background:
    radial-gradient(60% 70% at 50% 100%, color-mix(in srgb, var(--fc) 70%, transparent), transparent 75%),
    radial-gradient(90% 60% at 50% 120%, rgba(240,138,60,0.35), transparent 70%);
}
.sel-stage::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 30%; background: linear-gradient(180deg, transparent, var(--night)); pointer-events: none; }
.sel-portrait { position: absolute; inset: 0; }
.sel-stand { position: absolute; left: 50%; bottom: -30%; height: 128%; width: auto; max-width: none; transform: translateX(-50%); object-fit: contain; filter: drop-shadow(0 0 18px rgba(0,0,0,0.6)); }
.sel-stand.pop { animation: stand-pop 380ms var(--ease) both; }
@keyframes stand-pop { from { opacity: 0; transform: translateX(-46%) scale(0.97); } to { opacity: 1; transform: translateX(-50%); } }
.sel-plate { position: absolute; left: 16px; bottom: 10px; z-index: 2; text-shadow: 0 2px 8px rgba(0,0,0,0.9); }
.sel-plate .name { font-size: 1.5rem; }
.side-gods .sel-plate .epithet, .sel-stage.side-gods .epithet { color: var(--gold); }
.sel-stage.side-humans .epithet { color: var(--ochre); }

.sel-center { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.sel-filters { display: flex; justify-content: center; }
.sel-gridwrap { flex: 1 1 auto; }
.sel-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.grid-head { grid-column: 1 / -1; font-family: var(--font-display); font-size: 0.8rem; letter-spacing: 0.16em; text-transform: uppercase; margin: 4px 0 -2px; opacity: 0.85; }
:lang(th) .grid-head { text-transform: none; letter-spacing: 0.02em; font-size: 0.9rem; }

.tile {
  position: relative; appearance: none; border: 0; padding: 0; cursor: pointer;
  aspect-ratio: 1; min-width: 0; min-height: var(--touch);
  border-radius: 5px; overflow: hidden;
  background: var(--fc, var(--indigo-2));
  box-shadow: inset 0 -3px 0 var(--side), 0 2px 6px rgba(0,0,0,0.45);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast), filter var(--t-fast);
}
.tile-img { width: 100%; height: 100%; object-fit: cover; }
.tile { container-type: inline-size; }
/* --wl = the name's longest word in letters (screen-select.js): a long word shrinks the font to fit the tile
 * (down to 7px); a name still too long wraps (Thai between words) instead of hiding behind an ellipsis */
.tile-name {
  position: absolute; left: 0; right: 0; bottom: 3px; padding: 0 2px;
  font-size: max(7px, min(0.56rem, calc((100cqi - 4px) / (var(--wl, 1) * 0.62)))); font-weight: 700; color: var(--bone); text-shadow: 0 1px 3px #000, 0 0 6px #000;
  white-space: normal; overflow-wrap: anywhere; text-align: center; line-height: 1.25;
}
.tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,0.65)); pointer-events: none; }
.tile-name { z-index: 1; }
.tile.on { transform: translateY(-2px) scale(1.06); z-index: 2; box-shadow: 0 0 0 2px var(--ember-hot), 0 0 16px rgba(240,138,60,0.7), inset 0 -3px 0 var(--side); }
.tile.locked { filter: grayscale(0.85) brightness(0.55); }
.tile-lock { position: absolute; top: 3px; right: 3px; width: 16px; height: 16px; z-index: 2; color: var(--ash); }
.tile-lock svg { width: 100%; height: 100%; }
.sel-note { text-align: center; margin: 8px 0 0; }
.sel-clock { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: var(--bone); min-width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; }
.sel-clock.low { color: var(--ember-hot); animation: breathe 1s ease-in-out infinite; }

.sel-side { flex: 0 0 auto; }
.sel-info { display: none; }
.sel-actions { display: flex; gap: 8px; }
.sel-actions .btn { min-height: 50px; }

@media (min-width: 900px) {
  .sel-layout { flex-direction: row; gap: 18px; }
  .sel-stage { flex: 0 0 30%; max-height: none; margin: 0; border-radius: var(--radius); }
  .sel-stand { bottom: -4%; height: 104%; }
  .sel-stage::after { height: 20%; }
  .sel-plate { display: none; }
  .sel-center { flex: 1 1 auto; max-width: 620px; }
  .sel-grid { gap: 8px; }
  .tile-name { font-size: max(7px, min(0.7rem, calc((100cqi - 4px) / (var(--wl, 1) * 0.62)))); }
  .sel-side { flex: 0 0 300px; display: flex; flex-direction: column; gap: 12px; }
  .sel-info { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; overflow-y: auto; padding: 14px 16px; border-radius: var(--radius); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
  .sel-info .badge { align-self: flex-start; }
  .sel-info .name { font-size: 1.7rem; }
  .sel-actions { flex-direction: column; }
}
.sel-origin { font-size: 0.92rem; margin: 6px 0 0; }
.sel-quote { font-family: var(--font-display); font-style: italic; color: var(--bone); border-left: 2px solid var(--side, var(--ember)); padding-left: 10px; }
:lang(th) .sel-quote { font-style: normal; }

/* fighter move rows (select + sheet) */
.fmove { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.fmove .k { color: var(--ash-dim); }
.fmove .v { color: var(--bone); font-weight: 600; text-align: right; }
.fmove.veiled .v { color: var(--ash-dim); letter-spacing: 0.2em; }

/* ================================================================ FIGHTER SHEET */

.fsheet { display: flex; flex-direction: column; min-height: 0; max-height: 100%; flex: 1 1 auto; gap: 10px; }
.fsheet-head { display: flex; gap: 12px; align-items: flex-end; }
.fsheet-portrait {
  flex: 0 0 112px; height: 140px; border-radius: var(--radius); overflow: hidden;
  background: radial-gradient(80% 80% at 50% 100%, color-mix(in srgb, var(--fc) 75%, transparent), rgba(11,12,24,0.6));
  box-shadow: inset 0 -3px 0 var(--side);
}
.fsheet-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.fsheet-title { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fsheet-title .badge { align-self: flex-start; }
.badge.second { --side: var(--ash-dim); margin-top: 2px; }
.fsheet-title .name { font-size: 1.55rem; }
.fsheet-quote { font-family: var(--font-display); font-style: italic; color: var(--bone); margin: 6px 0 0; font-size: 0.95rem; }
:lang(th) .fsheet-quote { font-style: normal; }
.fsheet-body { flex: 1 1 auto; }
.fsheet-origin { color: var(--bone); }
.fsheet-moves { margin: 4px 0 14px; }
.fsheet-h { font-size: 1.05rem; margin: 14px 0 6px; color: var(--side, var(--bone)); }
.fsheet-hidden.locked { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: var(--radius); background: rgba(0,0,0,0.25); box-shadow: inset 0 0 0 1px var(--line); color: var(--ash-dim); }
.veil-mark { width: 26px; height: 26px; flex: 0 0 auto; color: var(--ash-dim); }
.veil-mark svg { width: 100%; height: 100%; }
.fsheet-actions { display: flex; gap: 8px; flex: 0 0 auto; padding-top: 6px; }

/* ================================================================ VERSUS */

.screen-versus { padding: 0; cursor: pointer; overflow: hidden; }
.vs-arena { position: absolute; inset: 0; }
.vs-arena img { width: 100%; height: 100%; object-fit: cover; filter: brightness(0.45) saturate(0.8); }
.vs-half { position: absolute; inset: 0; overflow: hidden; }
.vs-half.foe { clip-path: polygon(0 0, 100% 0, 100% 46%, 0 58%); }
.vs-half.you { clip-path: polygon(0 58%, 100% 46%, 100% 100%, 0 100%); }
.vs-glow { position: absolute; inset: 0; }
.vs-half.foe .vs-glow { background: radial-gradient(70% 60% at 75% 20%, color-mix(in srgb, var(--fc) 80%, transparent), transparent 75%), linear-gradient(200deg, rgba(20,22,43,0.2), rgba(20,22,43,0.75)); }
.vs-half.you .vs-glow { background: radial-gradient(70% 60% at 25% 85%, color-mix(in srgb, var(--fc) 80%, transparent), transparent 75%), linear-gradient(20deg, rgba(20,22,43,0.2), rgba(20,22,43,0.75)); }
.vs-fig { position: absolute; height: 62%; aspect-ratio: 2 / 3; }
.vs-fig img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 0 24px rgba(0,0,0,0.7)); }
.vs-half.foe .vs-fig { right: -8%; top: -4%; transform: scaleX(-1); animation: vs-in-right 600ms 120ms var(--ease) both; }
.vs-half.you .vs-fig { left: -8%; bottom: -6%; animation: vs-in-left 600ms 120ms var(--ease) both; }
@keyframes vs-in-right { from { opacity: 0; translate: 40% 0; } to { opacity: 1; translate: 0 0; } }
@keyframes vs-in-left { from { opacity: 0; translate: -40% 0; } to { opacity: 1; translate: 0 0; } }
.vs-name { position: absolute; z-index: 2; text-shadow: 0 2px 10px #000; animation: fade-in 500ms 450ms both; }
.vs-name .name { font-size: clamp(1.5rem, 7vw, 2.6rem); line-height: 1.1; }
.vs-name .epithet { font-size: 1rem; }
.vs-half.foe .vs-name { left: 16px; top: calc(var(--safe-t) + 22%); max-width: 55%; }
.vs-half.you .vs-name { right: 16px; bottom: calc(var(--safe-b) + 16%); text-align: right; max-width: 55%; }
.vs-half.side-gods .epithet { color: var(--gold); }
.vs-half.side-humans .epithet { color: var(--ochre); }
.vs-slash {
  position: absolute; left: -5%; right: -5%; top: 52%; height: 6px; transform: rotate(-6.8deg); transform-origin: center;
  background: linear-gradient(90deg, transparent, var(--ember-hot) 20%, #fff3d0 50%, var(--ember-hot) 80%, transparent);
  box-shadow: 0 0 24px 6px rgba(240,138,60,0.7);
  animation: slash 500ms 300ms var(--ease) both;
}
@keyframes slash { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.vs-mark {
  position: absolute; left: 50%; top: 52%; width: 92px; height: 92px; margin: -46px 0 0 -46px; z-index: 3;
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
  background: radial-gradient(circle, #2a1406 0%, #14162b 70%);
  box-shadow: 0 0 0 3px var(--gold), 0 0 0 7px rgba(20,22,43,0.9), 0 0 40px 10px rgba(240,138,60,0.6);
  animation: mark-in 500ms 520ms cubic-bezier(.3,1.6,.5,1) both;
}
.vs-mark span { font-family: var(--font-display); font-weight: 700; font-size: 2.2rem; letter-spacing: 0.04em; color: var(--gold); text-shadow: 0 0 12px rgba(240,138,60,0.8); }
@keyframes mark-in { from { opacity: 0; transform: scale(2.2) rotate(-20deg); } to { opacity: 1; transform: none; } }
.vs-foot { position: absolute; left: 0; right: 0; bottom: calc(var(--safe-b) + 16px); text-align: center; z-index: 3; display: flex; flex-direction: column; gap: 4px; }
.vs-label { color: var(--bone); }
.vs-tap { color: var(--ash-dim); animation: breathe 2.4s ease-in-out infinite; }
[data-motion="reduce"] .vs-half .vs-fig, [data-motion="reduce"] .vs-mark, [data-motion="reduce"] .vs-slash { animation: fade-in 500ms both; }

@media (min-width: 900px) {
  .vs-half.foe { clip-path: polygon(54% 0, 100% 0, 100% 100%, 46% 100%); }
  .vs-half.you { clip-path: polygon(0 0, 54% 0, 46% 100%, 0 100%); }
  .vs-fig { height: 92%; }
  .vs-half.foe .vs-fig { right: 4%; top: auto; bottom: -4%; }
  .vs-half.you .vs-fig { left: 4%; bottom: -4%; }
  .vs-half.foe .vs-name { left: auto; right: 4%; top: auto; bottom: 14%; text-align: right; }
  .vs-half.you .vs-name { right: auto; left: 4%; bottom: 14%; text-align: left; }
  .vs-slash { left: 50%; right: auto; top: -5%; bottom: -5%; width: 6px; height: auto; transform: translateX(-50%) rotate(5deg); background: linear-gradient(180deg, transparent, var(--ember-hot) 20%, #fff3d0 50%, var(--ember-hot) 80%, transparent); }
  .vs-mark { top: 50%; width: 120px; height: 120px; margin: -60px 0 0 -60px; }
  .vs-mark span { font-size: 2.8rem; }
}

/* ================================================================ SCENE PLAYER */

.screen-scene { padding: 0; cursor: pointer; }
.sc-bg { position: absolute; inset: 0; overflow: hidden; background: var(--soot); }
.sc-paint {
  position: absolute; inset: -4%; width: 108%; height: 108%; max-width: none; object-fit: cover;
  opacity: 0; transition: opacity 900ms ease;
  animation: drift 38s ease-in-out infinite alternate;
}
.sc-paint.on { opacity: 1; }
.sc-paint.instant { transition: none; }
@keyframes drift { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.08) translate(-1.5%, 1%); } }
[data-motion="reduce"] .sc-paint { animation: none; }
.sc-shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(14,16,40,0.65) 0%, rgba(14,16,40,0) 22%, rgba(11,12,24,0) 50%, rgba(11,12,24,0.75) 78%, rgba(11,12,24,0.95) 100%),
    radial-gradient(70% 30% at 50% 104%, rgba(240,138,60,0.35), transparent 70%);
}
.sc-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 4;
  display: flex; align-items: center; gap: 6px;
  padding: calc(var(--safe-t) + 6px) calc(var(--safe-r) + 10px) 6px calc(var(--safe-l) + 6px);
}
.sc-title { color: var(--bone); opacity: 0.85; text-shadow: 0 1px 6px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sc-skip { background: rgba(11,12,24,0.45); backdrop-filter: blur(4px); font-family: var(--font-body); }
.sc-skip svg { width: 18px; height: 18px; }
.sc-top .btn.icon { background: rgba(11,12,24,0.35); }

.sc-fig { position: absolute; left: 0; right: 0; bottom: 0; top: 10%; z-index: 1; pointer-events: none; }
.sc-bust {
  position: absolute; bottom: -24vh; height: 84vh; aspect-ratio: 2 / 3;
  transition: opacity 400ms, filter 400ms, transform 400ms var(--ease);
  animation: bust-in 450ms var(--ease) both;
}
.sc-bust img { width: 100%; height: 100%; object-fit: contain; object-position: bottom; filter: drop-shadow(0 0 30px rgba(0,0,0,0.6)); }
.sc-bust::before { content: ""; position: absolute; inset: 20% 5% 0; z-index: -1; background: radial-gradient(closest-side, color-mix(in srgb, var(--fc) 55%, transparent), transparent); filter: blur(18px); }
.sc-bust.left { left: -22%; }
.sc-bust.right { right: -22%; }
.sc-bust.right img { transform: scaleX(-1); }
.sc-bust.left { --from: -30px; }
.sc-bust.right { --from: 30px; }
@keyframes bust-in { from { opacity: 0; transform: translateX(var(--from, 0)); } to { opacity: 1; transform: none; } }
[data-motion="reduce"] .sc-bust { animation: fade-in 400ms both; }
.sc-bust.dim { opacity: 0.45; filter: brightness(0.6) saturate(0.6); }
.sc-bust.out { opacity: 0; }
.sc-bust.from-fire img { filter: sepia(0.6) saturate(1.6) hue-rotate(-12deg) brightness(1.1) drop-shadow(0 0 30px rgba(240,138,60,0.9)); opacity: 0.85; }

.sc-box {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  margin: 0 calc(var(--safe-r) + 10px) calc(var(--safe-b) + 12px) calc(var(--safe-l) + 10px);
  min-height: 132px; padding: 22px 18px 18px;
  background: linear-gradient(180deg, rgba(26,28,54,0.92), rgba(14,15,32,0.95));
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(240,138,60,0.55), inset 0 0 0 1px var(--line), 0 10px 40px rgba(0,0,0,0.6);
}
.sc-plate {
  position: absolute; left: 14px; top: -15px;
  padding: 3px 14px; border-radius: 4px;
  font-family: var(--font-display); font-weight: 700; font-size: 1rem; letter-spacing: 0.03em;
  color: #1d1306; background: var(--gold);
  box-shadow: 0 3px 10px rgba(0,0,0,0.5);
}
.sc-plate.humans { background: var(--ochre); }
.sc-plate.teller { background: linear-gradient(90deg, var(--ember), var(--ember-hot)); color: #2a1406; }
.sc-plate.from-fire { background: linear-gradient(90deg, var(--coal), var(--ember)); color: var(--bone); }
.sc-text { font-size: 1.08rem; line-height: 1.6; color: var(--bone); min-height: 3.2em; }
:lang(th) .sc-text { line-height: 1.85; }
.narration .sc-text { font-family: var(--font-display); font-style: italic; color: var(--ash); text-align: center; }
:lang(th) .narration .sc-text { font-style: normal; }
.sc-more { position: absolute; right: 16px; bottom: 10px; width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 9px solid var(--ember); opacity: 0; }
.sc-more.on { opacity: 1; animation: bob 1s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }
[data-motion="reduce"] .sc-more.on { animation: none; }

.sc-firstline {
  position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 0 28px; text-align: center; background: radial-gradient(70% 50% at 50% 50%, rgba(11,12,24,0.75), rgba(11,12,24,0.35));
  animation: fade-in 900ms both;
}
.fl-label { color: var(--ember-hot); }
.fl-text {
  font-family: var(--font-display); font-size: clamp(1.4rem, 6vw, 2.4rem); line-height: 1.35; max-width: 26ch; font-style: italic;
  color: var(--gold); text-shadow: 0 0 22px rgba(240,138,60,0.55), 0 2px 0 rgba(60,30,5,0.9);
}
:lang(th) .fl-text { font-style: normal; line-height: 1.6; }
.sc-choice {
  position: absolute; left: 0; right: 0; bottom: calc(var(--safe-b) + 18px); z-index: 4;
  display: flex; flex-direction: column; gap: 10px; padding: 0 calc(var(--safe-r) + 16px) 0 calc(var(--safe-l) + 16px);
  max-width: 560px; margin: 0 auto;
}
.sc-choice .btn { min-height: 56px; }

@media (min-width: 900px) {
  .sc-box { left: 50%; right: auto; width: min(920px, 92vw); transform: translateX(-50%); margin: 0 0 calc(var(--safe-b) + 28px); padding: 26px 28px 22px; }
  .sc-text { font-size: 1.22rem; }
  .sc-bust { height: 96vh; bottom: -34vh; }
  .sc-bust.left { left: 6%; }
  .sc-bust.right { right: 6%; }
}

.log-list { max-height: 55vh; display: flex; flex-direction: column; gap: 10px; }
.log-item { font-size: 0.95rem; }
.log-item.narr { font-style: italic; color: var(--ash-dim); }
.log-who { font-family: var(--font-display); font-weight: 700; font-size: 0.85rem; color: var(--gold); }
.log-who.humans { color: var(--ochre); }
.log-who.teller { color: var(--ember); }

/* ================================================================ BRACKET */

.br-tabs { display: flex; }
.br-scroll { padding-top: 4px; }
.br-tree { display: block; }
.br-col { display: none; }
.br-tree[data-tab="0"] .br-col[data-r="0"], .br-tree[data-tab="1"] .br-col[data-r="1"],
.br-tree[data-tab="2"] .br-col[data-r="2"], .br-tree[data-tab="3"] .br-col[data-r="3"],
.br-tree[data-tab="3"] .br-col[data-r="4"] { display: block; }
.br-col-head { color: var(--ember-hot); margin: 4px 0 8px; display: none; }
.br-col-body { display: flex; flex-direction: column; gap: 10px; }
.br-pair { display: flex; flex-direction: column; gap: 6px; }
.br-match {
  border-radius: var(--radius); padding: 6px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line);
}
.br-match.mine { box-shadow: inset 0 0 0 1px var(--line-warm), 0 0 18px rgba(240,138,60,0.18); }
.br-slot { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 2px 4px; border-radius: 4px; }
.br-slot + .br-slot { border-top: 1px solid var(--line); }
.br-face { width: 36px; height: 36px; flex: 0 0 auto; border-radius: 4px; overflow: hidden; background: var(--fc, var(--indigo-2)); box-shadow: inset 0 -2px 0 var(--side, var(--line)); }
.br-face img { width: 100%; height: 100%; object-fit: cover; }
.br-face.unknown { display: flex; align-items: center; justify-content: center; color: var(--ash-dim); font-family: var(--font-display); background: rgba(0,0,0,0.3); }
.br-name { flex: 1 1 auto; min-width: 0; font-weight: 600; color: var(--bone); font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.br-slot.lost { opacity: 0.45; }
.br-slot.lost .br-name { text-decoration: line-through; text-decoration-color: rgba(178,58,42,0.8); }
.br-slot.won .br-name { color: var(--side); }
.br-slot.you .br-name::after { content: "  ●"; color: var(--ember); font-size: 0.7em; vertical-align: middle; }
.br-mark { width: 18px; height: 18px; color: var(--side); }
.br-mark svg { width: 100%; height: 100%; }
.br-line { font-size: 0.8rem; font-style: italic; color: var(--ash); padding: 4px 4px 2px; line-height: 1.4; }
:lang(th) .br-line { font-style: normal; line-height: 1.6; }
.br-crown .br-col-body { align-items: center; padding: 16px 0; }
.br-crown .br-slot { min-height: 56px; }
.br-crown .br-face { width: 52px; height: 52px; }
.br-pen { width: 44px; height: 44px; color: var(--ember); opacity: 0.6; }
.br-pen svg { width: 100%; height: 100%; }
.br-cta { flex: 0 0 auto; padding-top: 8px; }
.br-cta .btn { min-height: 54px; font-size: 1.12rem; }

@media (min-width: 900px) {
  .br-tabs { display: none; }
  .br-tree { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)) minmax(110px, 0.7fr); gap: 26px; min-height: 100%; align-items: stretch; }
  .br-col, .br-tree[data-tab] .br-col { display: flex !important; flex-direction: column; }
  .br-col-head { display: block; text-align: center; }
  .br-col-body { flex: 1 1 auto; justify-content: space-around; gap: 0; }
  .br-pair { position: relative; flex: 1 1 0; justify-content: space-around; gap: 8px; padding: 4px 0; }
  .br-pair:not(.solo)::after {
    content: ""; position: absolute; right: -14px; top: 25%; bottom: 25%; width: 12px;
    border: 1px solid var(--line-warm); border-left: 0; border-radius: 0 6px 6px 0;
  }
  .br-pair:not(.solo)::before { content: ""; position: absolute; right: -26px; top: 50%; width: 12px; border-top: 1px solid var(--line-warm); }
  .br-col[data-r="0"] .br-line { display: none; }
  .br-match:hover .br-line { display: block; }
  .br-name { font-size: 0.85rem; }
  .br-face { width: 30px; height: 30px; }
  .br-slot { min-height: 34px; }
}

/* ================================================================ CODEX */

.codex-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.cstat { text-align: center; padding: 10px 4px; border-radius: var(--radius); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.cstat-n { font-size: 1.4rem; color: var(--gold); }
.cstat-l { color: var(--ash-dim); line-height: 1.3; }
.codex-h { font-size: 1rem; margin: 16px 0 8px; letter-spacing: 0.06em; }
.codex-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 700px) { .codex-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .codex-grid { grid-template-columns: repeat(4, 1fr); } }
.codex-card {
  appearance: none; border: 0; cursor: pointer; text-align: left; color: var(--text);
  display: flex; align-items: center; gap: 10px; padding: 6px; min-height: 60px;
  border-radius: var(--radius); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line), inset 3px 0 0 var(--side);
  position: relative;
}
.codex-card:hover { box-shadow: inset 0 0 0 1px var(--line-warm), inset 3px 0 0 var(--side); }
.codex-card.unseen .codex-face { filter: grayscale(0.7) brightness(0.7); }
.codex-face { width: 48px; height: 48px; flex: 0 0 auto; border-radius: 4px; object-fit: cover; background: var(--fc); }
.codex-card-text { min-width: 0; }
.codex-card .name { font-family: var(--font-display); font-weight: 700; color: var(--bone); font-size: 0.95rem; line-height: 1.2; }
.codex-card .epithet { color: var(--side); font-style: italic; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
:lang(th) .codex-card .epithet { font-style: normal; }
.codex-marks { position: absolute; top: 4px; right: 4px; display: flex; gap: 3px; }
.cmark { font-size: 0.6rem; font-weight: 700; padding: 1px 5px; border-radius: 6px; background: rgba(0,0,0,0.5); text-transform: uppercase; letter-spacing: 0.05em; }

.as-btn {
  appearance: none; border: 0; cursor: pointer; color: var(--bone); width: 100%;
  display: flex; align-items: center; gap: 12px; padding: 8px 12px; min-height: 56px; margin: 4px 0 8px;
  border-radius: var(--radius); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line-warm);
  font-family: var(--font-display); font-weight: 600; font-size: 1rem; text-align: left;
}
.as-face { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; background: var(--fc); }
.as-btn span:nth-of-type(1) { flex: 1 1 auto; }
.as-change { color: var(--ember-hot); font-family: var(--font-body); }
.tale-list { display: flex; flex-direction: column; gap: 4px; }
.tale-row {
  appearance: none; border: 0; cursor: pointer; color: var(--bone); text-align: left;
  display: flex; align-items: center; gap: 10px; min-height: var(--touch); padding: 8px 12px;
  border-radius: var(--radius); background: rgba(35,38,74,0.55); box-shadow: inset 0 0 0 1px var(--line);
}
.tale-row:hover { background: rgba(46,50,96,0.7); }
.tale-row.locked { color: var(--ash-dim); letter-spacing: 0.1em; }
.tale-name { flex: 1 1 auto; }
.tale-ic { width: 18px; height: 18px; color: var(--ember); }
.tale-row.locked .tale-ic { color: var(--ash-dim); }
.tale-ic svg { width: 100%; height: 100%; }

.ending { display: flex; gap: 12px; padding: 10px; margin-bottom: 10px; border-radius: var(--radius); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.ending-paint { flex: 0 0 120px; aspect-ratio: 16 / 10; border-radius: 4px; overflow: hidden; }
.ending-paint img { width: 100%; height: 100%; object-fit: cover; }
.ending.locked .ending-paint img { filter: grayscale(1) brightness(0.6) blur(3px); }
.ending-paint { background: var(--indigo); }
.ending-text { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.ending-text h3 { font-size: 1.1rem; }
.ending.locked h3 { color: var(--ash-dim); letter-spacing: 0.2em; }

/* ================================================================ LOBBY */

.lobby { padding-bottom: 20px; }
.lobby-or { text-align: center; margin: 2px 0; }
.code-input { flex: 1 1 auto; min-width: 0; font-family: ui-monospace, Consolas, monospace; font-size: 1.4rem; letter-spacing: 0.35em; text-transform: uppercase; text-align: center; }
.code-tiles { display: flex; justify-content: center; gap: 8px; margin: 6px 0; }
.code-tile {
  width: 52px; height: 64px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 2.1rem; color: var(--gold);
  border-radius: 6px; background: linear-gradient(180deg, #2a2d58, #171933);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.4), inset 0 0 0 1px rgba(226,182,90,0.35), 0 0 14px rgba(240,138,60,0.2);
  text-shadow: 0 0 10px rgba(240,138,60,0.6);
}
.lobby-log { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.92rem; }
.lobby-log li { padding-left: 16px; position: relative; color: var(--ash); }
.lobby-log li::before { content: ""; position: absolute; left: 2px; top: 0.6em; width: 6px; height: 6px; border-radius: 50%; background: var(--ember); box-shadow: 0 0 6px var(--ember); }
.lobby-log li:last-child { color: var(--bone); }

/* ================================================================ RESULTS */

.screen-roundResult { align-items: center; justify-content: center; text-align: center; }
.rr-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 420px; width: 100%; animation: fade-in 400ms both; }
.rr-round { color: var(--ash-dim); }
.rr-word { font-size: clamp(2.2rem, 10vw, 3.4rem); }
.is-win .rr-word, .is-win .mr-word { color: var(--gold); text-shadow: 0 0 24px rgba(240,138,60,0.6); }
.is-loss .rr-word, .is-loss .mr-word { color: var(--ash); }
.rr-fig { width: 200px; height: 250px; border-radius: 50% 50% 8px 8px; overflow: hidden; background: radial-gradient(70% 70% at 50% 100%, color-mix(in srgb, var(--fc) 75%, transparent), transparent); }
.rr-fig img { width: 100%; height: 100%; object-fit: contain; object-position: bottom; }
.rr-who { color: var(--bone); margin: 0; }
.rr-score { display: flex; gap: 28px; justify-content: center; }
.rr-side { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pips { display: flex; gap: 6px; }
.pip { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--line); }
.pip.on { background: var(--ember); box-shadow: 0 0 10px var(--ember); }
.pip.foe.on { background: var(--ash); box-shadow: 0 0 6px rgba(255,255,255,0.3); }

.screen-matchResult { padding: 0; }
.mr-art { position: absolute; inset: 0; }
.mr-art img { width: 100%; height: 100%; object-fit: cover; filter: brightness(0.4) saturate(0.8); }
.mr-fig { position: absolute; left: 50%; top: calc(var(--safe-t) + 2%); height: 52%; aspect-ratio: 2 / 3; transform: translateX(-50%); animation: fade-in 700ms both; }
.mr-fig::before { content: ""; position: absolute; inset: 15% 0 0; z-index: -1; background: radial-gradient(closest-side, color-mix(in srgb, var(--fc) 70%, transparent), transparent); filter: blur(24px); }
.mr-fig img { width: 100%; height: 100%; object-fit: contain; object-position: bottom; }
.is-loss .mr-fig img { filter: grayscale(0.3); }
.mr-panel {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 28px calc(var(--safe-r) + 16px) calc(var(--safe-b) + 16px) calc(var(--safe-l) + 16px);
  background: linear-gradient(180deg, transparent, rgba(11,12,24,0.92) 22%);
}
.mr-kicker { color: var(--ash); }
.mr-word { font-size: clamp(2.6rem, 13vw, 4.4rem); line-height: 1; }
.mr-score { font-size: 1.6rem; color: var(--bone); }
.mr-line { margin: 0; max-width: 520px; width: 100%; font-family: var(--font-display); font-style: italic; color: var(--bone); padding: 6px 12px; border-left: 2px solid var(--side); text-align: left; display: flex; flex-direction: column; }
:lang(th) .mr-line { font-style: normal; }
.mr-line.loser { opacity: 0.7; font-size: 0.92rem; }
.mr-line-who { font-style: normal; font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--side); font-family: var(--font-body); font-weight: 700; }
.mr-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 6px; width: 100%; max-width: 520px; }
.mr-actions .btn:first-child { flex: 1 1 100%; min-height: 52px; }
.mr-actions .btn { flex: 1 1 40%; }
@media (min-width: 900px) {
  .mr-fig { left: 8%; transform: none; top: auto; bottom: 0; height: 92%; }
  .mr-panel { left: auto; right: 6%; top: 50%; bottom: auto; transform: translateY(-50%); width: 520px; background: rgba(11,12,24,0.75); border-radius: 10px; padding: 28px; box-shadow: inset 0 0 0 1px var(--line-warm); }
}

/* duel mount point */
.duel-stub { padding-bottom: 20px; }
.ds-arena { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.ds-arena > img { width: 100%; height: 100%; object-fit: cover; filter: brightness(0.55); }
.ds-faces { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 18px; }
.ds-face { display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 600; color: var(--bone); text-shadow: 0 1px 4px #000; }
.ds-face img { width: 72px; height: 72px; border-radius: 6px; object-fit: cover; background: var(--fc); box-shadow: 0 0 0 2px rgba(239,230,211,0.25); }
.ds-vs { color: var(--gold); font-size: 1.6rem; }

/* ================================================================ SETTINGS */

.settings { padding-bottom: 24px; }
.set-group h2 { font-size: 1.1rem; }
.set-row { display: flex; flex-direction: column; gap: 6px; padding: 6px 0; }
.set-label > div:first-child { color: var(--bone); font-weight: 600; }
.set-slider { display: flex; align-items: center; gap: 12px; }
.set-val { flex: 0 0 48px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ash); }
.set-msg { min-height: 1.4em; color: var(--ember-hot); margin: 0; }
@media (min-width: 700px) {
  .set-row { flex-direction: row; align-items: center; justify-content: space-between; gap: 18px; }
  .set-row > .set-label { flex: 1 1 auto; }
  .set-slider { flex: 0 0 260px; }
}

/* with the real title painting the pans sit at the sides: the flanking figures only dress the placeholder */
.title-art.has-art .title-fig { display: none; }
