/* Rope Rivals
 * Layout: full-bleed field-day sky; chunky "sticker" panels with ink outlines and hard shadows;
 * the arena is the hero on every screen. Single bright daytime look by design.
 */
:root {
  --ink: #1E1B2E;
  --ink-soft: #4A4763;
  --paper: #FFFFFF;
  --paper-2: #F2F6FC;
  --sky-top: #5DBDEB;
  --sky-bot: #CDEEFF;
  --grass: #63BE52;
  --grass-dk: #3F9A3B;
  --mud: #6E4524;
  --mud-lt: #8C5B32;
  --blaze: #FF5A36;
  --blaze-dk: #D23C1B;
  --blaze-lt: #FFE3DA;
  --wave: #2F7BFF;
  --wave-dk: #1B56C7;
  --wave-lt: #DDE9FF;
  --sun: #FFC93C;
  --sun-dk: #E9A800;
  --good: #1FA855;
  --bad: #E5383B;
  --rope-a: #E7BE76;
  --rope-b: #C68F45;

  --display: 'Lilita One', 'Arial Rounded MT Bold', 'Trebuchet MS', system-ui, sans-serif;
  --body: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --fs-xs: 12px; --fs-sm: 14px; --fs-md: 16px; --fs-lg: 20px; --fs-xl: 28px;
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --r: 18px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: var(--fs-md);
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky-top), var(--sky-bot) 70%);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; border-radius: 10px; }
[hidden] { display: none !important; }

/* ---------- shared bits ---------- */
.panel {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.btn {
  font-family: var(--display);
  font-size: var(--fs-lg);
  letter-spacing: .02em;
  padding: 12px 22px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--sun);
  box-shadow: 0 5px 0 var(--ink);
  transition: transform .08s, box-shadow .08s, background .15s;
}
.btn:hover { background: #FFD45E; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn-big { font-size: 26px; padding: 14px 34px; }
.btn-ghost { background: var(--paper); }
.btn-ghost:hover { background: var(--paper-2); }
.btn-blaze { background: var(--blaze); color: #fff; }
.btn-wave { background: var(--wave); color: #fff; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 42px; height: 42px; flex: none;
  border: 3px solid var(--ink); border-radius: 12px;
  background: var(--paper); box-shadow: 0 3px 0 var(--ink);
}
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }
.hint { color: var(--ink-soft); font-size: var(--fs-sm); margin: 0; }

/* ---------- screens ---------- */
.screen {
  position: fixed; inset: 0;
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
  padding-block: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-bottom, 0px));
}
.screen.active { display: block; animation: screenIn .35s ease-out; }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------- title ---------- */
.title-wrap {
  max-width: 1040px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding-block: 8px 24px;
}
.logo {
  margin: 4px 0 0;
  font-family: var(--display); font-weight: 400;
  font-size: clamp(54px, 11vw, 112px); line-height: .9;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0 .25em;
  text-align: center;
}
.logo .word { display: inline-flex; }
.logo .ch {
  display: inline-block;
  color: #fff;
  text-shadow:
    -3px -3px 0 var(--ink), 3px -3px 0 var(--ink), -3px 3px 0 var(--ink), 3px 3px 0 var(--ink),
    0 -3px 0 var(--ink), 0 3px 0 var(--ink), -3px 0 0 var(--ink), 3px 0 0 var(--ink),
    6px 8px 0 var(--ink);
  animation: letterDrop .7s cubic-bezier(.3, 1.6, .5, 1) both, letterBob 2.6s ease-in-out infinite;
  animation-delay: calc(var(--i) * 60ms), calc(var(--i) * 120ms + .8s);
}
.logo .w1 .ch { color: var(--blaze); }
.logo .w2 .ch { color: var(--wave); }
@keyframes letterDrop { from { transform: translateY(-80px) rotate(-12deg); opacity: 0; } }
@keyframes letterBob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-5px) rotate(-2deg); } }
.tagline { margin: 0; font-weight: 800; font-size: clamp(16px, 2.6vw, 21px); text-align: center; text-wrap: balance; }

.arena-demo { width: 100%; height: clamp(200px, 32vh, 290px); }
.title-actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }

.how { width: 100%; padding: 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.how-step { display: flex; gap: 12px; align-items: flex-start; }
.how-step b { font-family: var(--display); font-weight: 400; font-size: var(--fs-lg); display: block; margin-bottom: 2px; }
.how-step p { margin: 0; font-size: var(--fs-sm); color: var(--ink-soft); line-height: 1.45; }
.how-num {
  flex: none; width: 36px; height: 36px; display: grid; place-items: center;
  font-family: var(--display); font-size: 20px; color: #fff; background: var(--ink); border-radius: 50%;
}
.keys-demo { display: inline-flex; gap: 3px; vertical-align: middle; }
kbd {
  font-family: var(--display); font-size: 12px; min-width: 20px; padding: 1px 5px; text-align: center;
  border: 2px solid var(--ink); border-radius: 6px; background: var(--paper); box-shadow: 0 2px 0 var(--ink); color: var(--ink);
}

.crew { width: 100%; }
.crew h2 { font-family: var(--display); font-weight: 400; font-size: var(--fs-xl); margin: 6px 0 10px; text-align: center; }
.crew-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.crew-card {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px 10px; border: 3px solid var(--ink); border-radius: 16px; background: var(--paper);
  box-shadow: var(--shadow-sm); text-align: center;
  animation: popIn .5s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: calc(var(--i) * 45ms);
}
.crew-card .avatar { width: 64px; height: 92px; }
.crew-card b { font-family: var(--display); font-weight: 400; font-size: 15px; line-height: 1.1; }
.crew-card small { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
@keyframes popIn { from { transform: scale(.4); opacity: 0; } }

/* avatars outside the arena idle with a gentle bob */
.avatar { display: block; }
.avatar svg { width: 100%; height: 100%; display: block; overflow: visible; }
.avatar .char { animation: avatarBob 1.8s ease-in-out infinite; transform-origin: 50% 95%; }
.avatar .m-smile { display: inline; }
@keyframes avatarBob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-3px) rotate(-3deg); } }
.crew-card:hover .char, .pick-card:hover .char { animation: avatarHop .5s ease-in-out infinite alternate; }
@keyframes avatarHop { to { transform: translateY(-8px) rotate(-6deg); } }

/* ---------- setup ---------- */
.setup-wrap { max-width: 1040px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; padding-bottom: 24px; }
.setup-head { display: flex; align-items: center; gap: 14px; }
.setup-head h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(28px, 5vw, 40px); color: #fff;
  text-shadow: -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink), 4px 5px 0 var(--ink); }
.setup-count { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding: 14px 18px; }
.label { font-family: var(--display); font-size: var(--fs-lg); }
.stepper { display: inline-flex; align-items: center; border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; box-shadow: 0 3px 0 var(--ink); }
.stepper button { width: 46px; height: 44px; border: 0; background: var(--sun); font-family: var(--display); font-size: 26px; line-height: 1; }
.stepper button:disabled { background: var(--paper-2); color: #A9A6BD; cursor: not-allowed; }
.stepper output { min-width: 54px; text-align: center; font-family: var(--display); font-size: 26px; border-inline: 3px solid var(--ink); line-height: 44px; background: #fff; font-variant-numeric: tabular-nums; }

.teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: start; }
.vs-mid { align-self: center; font-family: var(--display); font-size: 36px; color: #fff;
  text-shadow: -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink), 3px 4px 0 var(--ink); }
.team-card { padding: 0 0 12px; overflow: hidden; min-width: 0; }
.team-card .team-top { padding: 12px 14px; display: flex; align-items: center; gap: 10px; border-bottom: 3px solid var(--ink); }
.team-0 .team-top { background: var(--blaze); }
.team-1 .team-top { background: var(--wave); }
.team-name {
  flex: 1; min-width: 0; font-family: var(--display); font-size: 24px; color: #fff; background: transparent;
  border: 0; border-bottom: 2px dashed rgba(255, 255, 255, .6); padding: 2px 0; outline: none;
}
.team-name:focus { border-bottom-color: #fff; }
.team-count { font-weight: 900; color: #fff; font-size: var(--fs-sm); white-space: nowrap; }
.plist { display: flex; flex-direction: column; gap: 10px; padding: 12px 12px 0; }
.p-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center;
  padding: 6px 8px 6px 6px; border: 2.5px solid var(--ink); border-radius: 14px; background: var(--paper-2);
  animation: popIn .35s cubic-bezier(.3, 1.6, .5, 1);
}
.team-0 .p-row { background: var(--blaze-lt); }
.team-1 .p-row { background: var(--wave-lt); }
.p-avatar { width: 56px; height: 64px; padding: 0; border: 2.5px solid var(--ink); border-radius: 12px; background: #fff; position: relative; overflow: hidden; }
.p-avatar .avatar { width: 100%; height: 100%; transform: translateY(6px) scale(1.15); }
.p-avatar::after { content: 'Change'; position: absolute; inset: auto 0 0; font-size: 10px; font-weight: 900; background: var(--ink); color: #fff; padding: 1px 0; opacity: 0; transition: opacity .15s; }
.p-avatar:hover::after, .p-avatar:focus-visible::after { opacity: 1; }
.p-fields { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.p-fields input {
  width: 100%; min-width: 0; font-weight: 800; font-size: 17px; padding: 7px 10px;
  border: 2.5px solid var(--ink); border-radius: 10px; background: #fff;
}
.p-fields small { font-size: 12px; font-weight: 800; color: var(--ink-soft); padding-left: 2px; }
.p-swap { width: 38px; height: 38px; border: 2.5px solid var(--ink); border-radius: 10px; background: #fff; display: grid; place-items: center; box-shadow: 0 2px 0 var(--ink); }
.p-swap svg { width: 18px; height: 18px; }
.p-swap:active { transform: translateY(2px); box-shadow: none; }

.setup-cats, .setup-opts { padding: 16px 18px; }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.setup-cats h3, .setup-opts h3 { margin: 0; font-family: var(--display); font-weight: 400; font-size: var(--fs-lg); }
.link-btn { border: 0; background: none; font-weight: 900; text-decoration: underline; text-underline-offset: 3px; padding: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 10px;
  border: 2.5px solid var(--ink); border-radius: 999px; background: #fff; font-weight: 900; font-size: 15px;
  box-shadow: 0 3px 0 var(--ink); transition: background .15s, color .15s, transform .1s;
}
.chip .ico { font-size: 18px; line-height: 1; }
.chip .tick { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ink); display: grid; place-items: center; background: #fff; }
.chip .tick svg { width: 11px; height: 11px; opacity: 0; }
.chip[aria-pressed="true"] { background: var(--c); color: #fff; }
.chip[aria-pressed="true"] .tick svg { opacity: 1; }
.chip:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

.setup-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px 24px; }
.opt-group { display: flex; flex-direction: column; gap: 8px; }
.seg { display: inline-flex; border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; box-shadow: 0 3px 0 var(--ink); align-self: flex-start; }
.seg button { border: 0; background: #fff; padding: 9px 14px; font-weight: 900; font-size: 15px; }
.seg button + button { border-left: 3px solid var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.switch { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 52px; height: 30px; border: 3px solid var(--ink); border-radius: 999px; background: var(--paper-2); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2.5px solid var(--ink); transition: transform .2s cubic-bezier(.3, 1.6, .5, 1); }
.switch input:checked + .track { background: var(--good); }
.switch input:checked + .track::after { transform: translateX(22px); }
.switch input:focus-visible + .track { outline: 3px solid var(--sun); outline-offset: 2px; }

.setup-foot { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.setup-msg { min-height: 1.4em; margin: 0; font-weight: 900; color: var(--bad); text-align: center; }

/* ---------- picker modal ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) var(--gutter-r) max(16px, env(safe-area-inset-bottom, 0px)) var(--gutter-l);
  background: rgba(30, 27, 46, .55);
  animation: fadeIn .2s ease-out;
  overflow-y: auto;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal { width: min(760px, 100%); padding: 18px; animation: modalIn .35s cubic-bezier(.3, 1.5, .5, 1); position: relative; }
@keyframes modalIn { from { transform: scale(.85) translateY(20px); opacity: 0; } }
.modal h3 { margin: 0 0 4px; font-family: var(--display); font-weight: 400; font-size: 26px; }
.modal-close { position: absolute; top: 12px; right: 12px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin-top: 14px; }
.pick-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px 10px; border: 3px solid var(--ink); border-radius: 16px; background: var(--paper-2);
  box-shadow: 0 3px 0 var(--ink); text-align: center;
}
.pick-card .avatar { width: 64px; height: 92px; }
.pick-card b { font-family: var(--display); font-weight: 400; font-size: 15px; line-height: 1.1; }
.pick-card small { font-size: 12px; color: var(--ink-soft); font-weight: 800; }
.pick-card.is-mine { background: var(--sun); }
.pick-card:disabled { cursor: not-allowed; opacity: .55; }
.pick-card .taken { position: absolute; top: 6px; left: 50%; transform: translateX(-50%) rotate(-6deg); background: var(--ink); color: #fff; font-size: 11px; font-weight: 900; padding: 2px 8px; border-radius: 999px; white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis; }

/* ---------- game layout ---------- */
.screen-game.active { display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.hud { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 10px; align-items: center; max-width: 1180px; width: 100%; margin: 0 auto; }
.hud-team {
  min-width: 0; display: flex; align-items: center; gap: 8px; padding: 6px 12px;
  border: 3px solid var(--ink); border-radius: 14px; color: #fff; box-shadow: var(--shadow-sm);
}
.hud-0 { background: var(--blaze); }
.hud-1 { background: var(--wave); justify-content: flex-end; text-align: right; }
.hud-name { font-family: var(--display); font-size: clamp(15px, 2.2vw, 22px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hud-pulls { font-weight: 900; font-size: 13px; white-space: nowrap; background: rgba(0, 0, 0, .22); padding: 2px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.hud-flags { font-weight: 900; font-size: 13px; white-space: nowrap; }
.hud-flags:empty { display: none; }
.hud-1 .hud-name { order: 3; }
.hud-1 .hud-pulls { order: 2; }
.hud-1 .hud-flags { order: 1; }
.hud-mid { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.hud-round { font-family: var(--display); font-size: 18px; color: #fff; white-space: nowrap;
  text-shadow: -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink); }
.meter { position: relative; width: clamp(80px, 14vw, 160px); height: 14px; border: 2.5px solid var(--ink); border-radius: 999px; background: linear-gradient(90deg, var(--blaze) 0 50%, var(--wave) 50% 100%); overflow: hidden; }
.meter::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--ink); transform: translateX(-1px); }
.meter-knot { position: absolute; top: 50%; left: 50%; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2.5px solid var(--ink); transform: translate(-50%, -50%); transition: left .7s cubic-bezier(.34, 1.56, .64, 1); }
.hud-tools { display: flex; gap: 8px; }

.arena-wrap { width: 100%; max-width: 1180px; margin: 0 auto; flex: none; }
.arena-game { height: clamp(190px, 33vh, 330px); }

.quiz { flex: 1; min-height: 0; width: 100%; max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding: 2px 6px 8px 2px; }
.q-card { padding: 12px 16px 14px; position: relative; flex: none; }
.q-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.q-cat { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 8px; border-radius: 999px; border: 2.5px solid var(--ink); background: var(--c, var(--ink)); color: #fff; font-weight: 900; font-size: 14px; }
.q-src { font-size: 12px; font-weight: 800; color: var(--ink-soft); margin-left: 8px; }
.q-timer { font-family: var(--display); font-size: 22px; font-variant-numeric: tabular-nums; min-width: 3ch; text-align: right; }
.q-card.hurry .q-timer { color: var(--bad); animation: pulse .5s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.18); } }
.timebar { height: 10px; margin: 10px 0 8px; border: 2.5px solid var(--ink); border-radius: 999px; overflow: hidden; background: var(--paper-2); }
.timebar > div { height: 100%; width: 100%; background: var(--good); transform-origin: left; transform: scaleX(1); }
.q-card.hurry .timebar > div { background: var(--bad); }
.q-body { display: flex; align-items: center; justify-content: center; gap: 16px; min-height: 56px; }
.q-text { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(19px, 2.6vw, 28px); line-height: 1.2; text-align: center; text-wrap: balance; }
.q-text.show { animation: qIn .45s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes qIn { from { transform: translateY(12px) scale(.96); opacity: 0; } }
.q-flag { width: clamp(84px, 12vw, 120px); flex: none; animation: qIn .5s cubic-bezier(.3, 1.4, .5, 1); }
.flag-svg { width: 100%; height: auto; display: block; filter: drop-shadow(3px 3px 0 var(--ink)); }

.pad { position: relative; border: 3px solid var(--ink); border-radius: var(--r); padding: 10px; box-shadow: var(--shadow-sm); min-width: 0; transition: transform .2s; }
.pad { flex: none; }
.pad.t0 { background: var(--blaze-lt); }
.pad.t1 { background: var(--wave-lt); }
.pad-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; min-width: 0; }
.pad-av { width: 36px; height: 42px; flex: none; border: 2.5px solid var(--ink); border-radius: 10px; background: #fff; overflow: hidden; }
.pad-av .avatar { width: 100%; height: 100%; transform: translateY(4px) scale(1.25); }
.pad-who { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.1; }
.pad-who b { font-family: var(--display); font-weight: 400; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pad-who small { font-size: 12px; font-weight: 800; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt {
  display: flex; align-items: center; gap: 8px; min-height: 48px; min-width: 0;
  padding: 7px 10px 7px 7px; text-align: left; font-weight: 800; font-size: 15px; line-height: 1.2;
  border: 2.5px solid var(--ink); border-radius: 12px; background: #fff; box-shadow: 0 3px 0 var(--ink);
  transition: transform .08s, box-shadow .08s, background .15s, opacity .2s;
  opacity: 0; transform: translateY(8px);
}
.opt span:last-child { min-width: 0; overflow-wrap: anywhere; }
.opts.show .opt { opacity: 1; transform: none; transition: opacity .25s, transform .3s cubic-bezier(.3, 1.6, .5, 1), background .15s, box-shadow .08s; transition-delay: calc(var(--i) * 70ms), calc(var(--i) * 70ms), 0s, 0s; }
.opt .key { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: var(--ink); color: #fff; font-family: var(--display); font-size: 15px; }
.pad.t0 .opt:hover:not(:disabled) { background: #FFF3EF; }
.pad.t1 .opt:hover:not(:disabled) { background: #F1F6FF; }
.opts.show .opt:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.opt:disabled { cursor: default; }
.opt.correct { background: var(--good) !important; color: #fff; animation: bounce .45s cubic-bezier(.3, 1.6, .5, 1); }
.opt.correct .key { background: #fff; color: var(--good); }
.opt.wrong { background: var(--bad) !important; color: #fff; animation: shake .4s; }
.opt.dim { opacity: .4 !important; }
@keyframes bounce { 40% { transform: scale(1.06); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.pad.winner { transform: translateY(-4px); box-shadow: 5px 8px 0 var(--ink); }

/* ---------- arena scene ---------- */
.arena {
  position: relative; overflow: hidden; isolation: isolate;
  border: 3px solid var(--ink); border-radius: 22px; box-shadow: var(--shadow);
  background: linear-gradient(180deg, #4FB3E6 0%, #A9DEF7 55%, #D8F2FF 100%);
  --ch: 72px; --chH: 104px; --feet: 30px; --win: 70px;
}
.arena .sun { position: absolute; top: 8%; right: 7%; width: 54px; height: 54px; border-radius: 50%; background: var(--sun); border: 3px solid var(--ink); z-index: 0; }
.arena .sun::before { content: ''; position: absolute; inset: -18px; border-radius: 50%; z-index: -1;
  background: repeating-conic-gradient(rgba(255, 214, 90, .75) 0 10deg, transparent 10deg 30deg); animation: spin 22s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
.cloud { position: absolute; width: 90px; height: 28px; background: #fff; border: 3px solid var(--ink); border-radius: 999px; z-index: 0; animation: drift linear infinite; }
.cloud::before, .cloud::after { content: ''; position: absolute; background: #fff; border: 3px solid var(--ink); border-bottom: 0; border-radius: 50% 50% 0 0; }
.cloud::before { width: 38px; height: 26px; left: 14px; top: -18px; }
.cloud::after { width: 30px; height: 20px; left: 44px; top: -12px; }
.cloud i { position: absolute; left: 6px; right: 6px; bottom: 2px; height: 14px; background: #fff; border-radius: 999px; }
@keyframes drift { from { transform: translateX(-160px) scale(var(--s, 1)); } to { transform: translateX(calc(100vw + 40px)) scale(var(--s, 1)); } }
.bunting { position: absolute; top: -2px; left: 0; right: 0; height: 30px; z-index: 1; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='30'%3E%3Cpath d='M0 3 Q32 10 64 3' fill='none' stroke='%231E1B2E' stroke-width='2.5'/%3E%3Cpath d='M4 4.5 L16 26 L28 7.5Z' fill='%23FF5A36' stroke='%231E1B2E' stroke-width='2.5' stroke-linejoin='round'/%3E%3Cpath d='M36 7.5 L48 26 L60 4.5Z' fill='%232F7BFF' stroke='%231E1B2E' stroke-width='2.5' stroke-linejoin='round'/%3E%3C/svg%3E") repeat-x;
  animation: sway 3s ease-in-out infinite alternate; transform-origin: top; }
@keyframes sway { to { transform: translateY(2px) skewX(2deg); } }
.hills { position: absolute; left: 0; right: 0; bottom: calc(var(--feet) + var(--ch) * .3); width: 100%; height: 38%; z-index: 0; }
.crowd { position: absolute; left: 0; right: 0; bottom: calc(var(--feet) + var(--ch) * .3 - 2px); height: calc(var(--ch) * .5); z-index: 1; pointer-events: none; }
.fan { position: absolute; bottom: 0; width: calc(var(--ch) * .22); height: calc(var(--ch) * .34); animation: fanBob 1.2s ease-in-out infinite; animation-delay: var(--d); }
.fan::before { content: ''; position: absolute; left: 10%; right: 10%; top: 0; aspect-ratio: 1; border-radius: 50%; background: var(--skin); border: 2px solid var(--ink); }
.fan::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 50%; border-radius: 40% 40% 0 0; background: var(--shirt); border: 2px solid var(--ink); border-bottom: 0; }
@keyframes fanBob { 50% { transform: translateY(-2px); } }
.arena.cheer .fan { animation: fanJump .35s ease-in-out 4 alternate; animation-delay: var(--d2); }
@keyframes fanJump { to { transform: translateY(-40%); } }
.fence { position: absolute; left: 0; right: 0; bottom: calc(var(--feet) + var(--ch) * .3 - 2px); height: calc(var(--ch) * .2); z-index: 1;
  background: repeating-linear-gradient(90deg, transparent 0 22px, #fff 22px 26px), linear-gradient(transparent 30%, #fff 30% 44%, transparent 44%);
  opacity: .9; pointer-events: none; }
.ground {
  position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--feet) + var(--ch) * .3); z-index: 2;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .07) 0 40px, transparent 40px 80px),
    linear-gradient(180deg, var(--grass), var(--grass-dk));
  border-top: 3px solid var(--ink);
}
.chalk { position: absolute; bottom: 0; top: 0; width: 6px; background: rgba(255, 255, 255, .9); transform: skewX(-10deg); }
.chalk-l { left: calc(50% - var(--win) - 3px); }
.chalk-r { left: calc(50% + var(--win) - 3px); }
.chalk-c { left: calc(50% - 2px); width: 4px; background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .8) 0 6px, transparent 6px 12px); }
.pole { position: absolute; bottom: calc(var(--feet) + var(--ch) * .12); width: 4px; height: calc(var(--chH) * .95); background: #fff; border: 2px solid var(--ink); border-radius: 3px; z-index: 2; }
.pole::after { content: ''; position: absolute; top: -2px; width: 30px; height: 20px; border: 2.5px solid var(--ink); animation: flap 1s ease-in-out infinite alternate; }
.pole-l { left: calc(50% - var(--win) - 2px); }
.pole-r { left: calc(50% + var(--win) - 2px); }
.pole-l::after { right: 2px; background: var(--blaze); clip-path: polygon(0 50%, 100% 0, 100% 100%); border: 0; }
.pole-r::after { left: 2px; background: var(--wave); clip-path: polygon(0 0, 100% 50%, 0 100%); border: 0; }
@keyframes flap { to { transform: scaleY(.8) skewY(4deg); } }
.mud {
  position: absolute; left: 50%; bottom: calc(var(--feet) - var(--ch) * .14); z-index: 3;
  width: calc(var(--ch) * 1.5); height: calc(var(--ch) * .34); transform: translateX(-50%);
  border-radius: 50%; border: 3px solid var(--ink);
  background: radial-gradient(ellipse at 45% 40%, var(--mud-lt), var(--mud) 70%);
}
.mud i { position: absolute; width: 8px; height: 8px; border-radius: 50%; border: 2px solid #4A2C14; background: var(--mud-lt); animation: bubble 2.4s ease-in infinite; }
.mud i:nth-child(1) { left: 25%; top: 30%; animation-delay: -.4s; }
.mud i:nth-child(2) { left: 55%; top: 45%; animation-delay: -1.3s; }
.mud i:nth-child(3) { left: 72%; top: 25%; animation-delay: -2s; }
@keyframes bubble { 0% { transform: scale(0); opacity: 0; } 60% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.3); opacity: 0; } }

.tug { position: absolute; left: 50%; bottom: 0; width: 0; height: 100%; z-index: 4; transition: transform .75s cubic-bezier(.34, 1.56, .64, 1); }
.rope {
  position: absolute; height: 10px; border: 2.5px solid var(--ink); border-radius: 6px; z-index: 5;
  background: repeating-linear-gradient(-60deg, var(--rope-a) 0 5px, var(--rope-b) 5px 9px);
  animation: ropeHum .5s ease-in-out infinite alternate;
}
@keyframes ropeHum { to { transform: translateY(1px); } }
.ribbon { position: absolute; left: -11px; width: 22px; height: 40px; z-index: 31; transform-origin: 50% 4px; animation: ribbonSway 1.2s ease-in-out infinite alternate; }
.ribbon svg { width: 100%; height: 100%; overflow: visible; display: block; }
@keyframes ribbonSway { from { transform: rotate(-8deg); } to { transform: rotate(8deg); } }

.fighter { position: absolute; bottom: var(--feet); width: var(--ch); height: var(--chH); }
.fighter .shadow { position: absolute; left: 12%; right: 12%; bottom: -5px; height: 9px; border-radius: 50%; background: rgba(20, 50, 20, .28); }
.fighter .body { position: absolute; inset: 0; }
.fighter.right .body { transform: scaleX(-1); }
.fighter .lean { width: 100%; height: 100%; transform-origin: 46% 97%; animation: tension 1.4s ease-in-out infinite; animation-delay: var(--d, 0s); }
.fighter svg { width: 100%; height: 100%; display: block; overflow: visible; }
.fighter .tag {
  position: absolute; left: 50%; bottom: calc(100% + 4px + var(--lift, 0px)); transform: translateX(-50%);
  font-weight: 900; font-size: 11px; line-height: 1; padding: 3px 7px; border-radius: 999px; white-space: nowrap; max-width: 110px;
  overflow: hidden; text-overflow: ellipsis; background: rgba(255, 255, 255, .85); border: 2px solid var(--ink); transition: transform .2s;
}
.fighter.left .tag { color: var(--blaze-dk); }
.fighter.right .tag { color: var(--wave-dk); }
.arena.compact .fighter:not(.is-up) .tag { display: none; }
.fighter.is-up .tag { background: var(--ink); color: #fff; font-size: 13px; padding: 4px 9px; transform: translateX(-50%) scale(1.05); z-index: 2; }
.fighter.is-up .tag::after { content: ''; position: absolute; left: 50%; top: 100%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--ink); }
.fighter.is-up .shadow { background: radial-gradient(rgba(255, 230, 120, .95), rgba(255, 230, 120, 0) 70%); height: 16px; bottom: -9px; left: -10%; right: -10%; }

/* SVG rig parts */
.char .leg, .char .arm, .char .head, .char .eyes, .char .flutter { transform-box: view-box; }
.char .leg-b { transform-origin: 48px 106px; }
.char .leg-f { transform-origin: 60px 106px; }
.char .arm-b { transform-origin: 60px 76px; transition: transform .3s; }
.char .arm-f { transform-origin: 48px 78px; transition: transform .3s; }
.char .head { transform-origin: 56px 62px; }
.char .eyes { transform-box: fill-box; transform-origin: center; animation: blink 4.2s infinite; animation-delay: var(--d, 0s); }
.char .flutter { transform-origin: 38px 33px; animation: flutter .5s ease-in-out infinite alternate; }
.char .blink-light { animation: lightBlink 1.1s steps(2) infinite; }
.char .m { display: none; }
.char .m-smile { display: inline; }
.char .sweat { opacity: 0; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
@keyframes flutter { from { transform: rotate(-6deg); } to { transform: rotate(8deg) scaleX(1.05); } }
@keyframes lightBlink { 50% { opacity: .35; } }

@keyframes tension { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(-11deg) translateX(-1px); } }
.fighter.is-pull .lean { animation: heave .95s cubic-bezier(.2, .8, .3, 1); }
@keyframes heave { 0% { transform: rotate(-8deg); } 25% { transform: rotate(-26deg) translateX(-9%); } 60% { transform: rotate(-19deg) translateX(-6%); } 100% { transform: rotate(-9deg); } }
.fighter.is-pull .leg-f { animation: stepF .2s ease-in-out 4 alternate; }
.fighter.is-pull .leg-b { animation: stepB .2s ease-in-out 4 alternate; animation-delay: .1s; }
@keyframes stepF { to { transform: rotate(-16deg); } }
@keyframes stepB { to { transform: rotate(14deg); } }
.fighter.is-pull .m-smile, .fighter.is-slip .m-smile, .fighter.is-win .m-smile, .fighter.is-lose .m-smile { display: none; }
.fighter.is-pull .m-strain { display: inline; }
.fighter.is-pull .sweat { animation: sweat .9s ease-out; }
@keyframes sweat { 0% { opacity: 0; transform: translate(0, 0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(-6px, 14px); } }
.fighter.is-slip .lean { animation: slip .8s cubic-bezier(.2, .8, .3, 1); }
@keyframes slip { 0% { transform: rotate(-8deg); } 30% { transform: rotate(10deg) translateX(10%); } 65% { transform: rotate(4deg) translateX(6%); } 100% { transform: rotate(-7deg); } }
.fighter.is-slip .m-shock { display: inline; }

.fighter.is-win .lean { animation: jump .5s ease-in-out infinite alternate; animation-delay: var(--d, 0s); }
@keyframes jump { from { transform: translateY(0) rotate(0); } to { transform: translateY(-22%) rotate(-4deg); } }
.fighter.is-win .arm-b { animation: waveB .4s ease-in-out infinite alternate; }
.fighter.is-win .arm-f { animation: waveF .4s ease-in-out infinite alternate-reverse; }
@keyframes waveB { from { transform: rotate(-100deg); } to { transform: rotate(-135deg); } }
@keyframes waveF { from { transform: rotate(-95deg); } to { transform: rotate(-125deg); } }
.fighter.is-win .m-grin { display: inline; }
.fighter.is-lose .lean { animation: fall .9s cubic-bezier(.5, 0, .7, 1) forwards; }
@keyframes fall { 0% { transform: rotate(-6deg); } 40% { transform: rotate(14deg) translateX(10%); } 100% { transform: rotate(78deg) translate(8%, 10%); } }
.fighter.is-lose .m-shock { display: inline; }
.fighter.is-lose .body { filter: saturate(.8); }

.float-txt {
  position: absolute; z-index: 40; pointer-events: none; transform: translateX(-50%);
  font-family: var(--display); font-size: clamp(22px, 3.4vw, 36px); color: #fff; white-space: nowrap;
  text-shadow: -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink), 3px 4px 0 var(--ink);
  animation: floatUp 1.4s cubic-bezier(.2, .9, .3, 1) forwards;
}
.float-txt.t0 { color: var(--blaze); }
.float-txt.t1 { color: var(--wave); }
.float-txt.power { color: var(--sun); font-size: clamp(26px, 4vw, 44px); }
.float-txt.meh { color: #fff; }
@keyframes floatUp { 0% { transform: translate(-50%, 20px) scale(.5); opacity: 0; } 20% { transform: translate(-50%, 0) scale(1.15); opacity: 1; } 75% { opacity: 1; } 100% { transform: translate(-50%, -40px) scale(1); opacity: 0; } }
.arena.shake { animation: arenaShake .35s; }
@keyframes arenaShake { 25% { transform: translate(-3px, 1px); } 50% { transform: translate(3px, -1px); } 75% { transform: translate(-2px, 0); } }

/* ---------- turn banner ---------- */
.turn-overlay { background: rgba(30, 27, 46, .35); padding: 0; cursor: pointer; overflow: hidden; }
.turn-band {
  position: relative; width: 100%; display: flex; align-items: center; justify-content: center; gap: clamp(14px, 4vw, 40px);
  padding-block: 22px; padding-left: max(16px, 6%); padding-right: max(16px, 6%);
  border-block: 4px solid var(--ink); color: #fff; animation: bandIn .45s cubic-bezier(.2, 1.2, .4, 1) both;
}
.turn-band.t0 { background: var(--blaze); --from: -100%; }
.turn-band.t1 { background: var(--wave); --from: 100%; }
@keyframes bandIn { from { transform: translateX(var(--from)); } }
.turn-band .avatar { width: clamp(84px, 14vw, 150px); height: clamp(122px, 20vw, 218px); flex: none; }
.turn-band .pop { flex: none; animation: popIn .5s .15s cubic-bezier(.3, 1.6, .5, 1) both; }
.flip { display: inline-block; transform: scaleX(-1); }
.turn-info { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.turn-info .eyebrow { font-weight: 900; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }
.turn-info b { font-family: var(--display); font-weight: 400; font-size: clamp(30px, 5.5vw, 60px); line-height: 1; text-shadow: 3px 4px 0 var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.turn-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.turn-tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 2.5px solid var(--ink); background: #fff; color: var(--ink); font-weight: 900; font-size: 13px; }
.turn-tag.warn { background: #FFE0E0; }
.turn-tag.q-cat { background: var(--c); color: #fff; }
.vs-skip { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; color: #fff; font-weight: 800; font-size: 13px; opacity: .85; margin: 0; }

/* ---------- pause + results ---------- */
.pause-card { width: min(420px, 100%); padding: 22px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.pause-card h3 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 34px; }
.pause-card .btn { width: 100%; }
.results { width: min(960px, 100%); padding: 0; overflow: hidden; }
.res-banner { padding: 18px 18px 14px; text-align: center; color: #fff; border-bottom: 3px solid var(--ink); }
.res-banner.t0 { background: var(--blaze); }
.res-banner.t1 { background: var(--wave); }
.res-banner h3 { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(32px, 6vw, 54px); line-height: 1; text-shadow: 3px 4px 0 var(--ink); animation: letterDrop .6s cubic-bezier(.3, 1.6, .5, 1) both; text-wrap: balance; }
.res-banner p { margin: 8px 0 0; font-weight: 800; }
.res-stage { display: flex; justify-content: center; align-items: flex-end; gap: 4px; padding: 14px 10px 6px; min-height: 120px; flex-wrap: wrap;
  background: linear-gradient(180deg, #E8F7FF, #fff); }
.res-stage .champ { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.res-stage .avatar { width: 70px; height: 100px; }
.res-stage .avatar .char { animation: champJump .55s ease-in-out infinite alternate; animation-delay: var(--d); }
.res-stage .avatar .arm-b { animation: waveB .4s ease-in-out infinite alternate; }
.res-stage .avatar .arm-f { animation: waveF .4s ease-in-out infinite alternate-reverse; }
.res-stage .avatar .m-smile { display: none; }
.res-stage .avatar .m-grin { display: inline; }
.res-stage small { font-weight: 900; font-size: 13px; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes champJump { to { transform: translateY(-14px) rotate(-4deg); } }
.res-body { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 14px; }
.table-scroll { overflow-x: auto; border: 3px solid var(--ink); border-radius: 14px; }
.res-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 15px; }
.res-table th, .res-table td { padding: 8px 9px; text-align: right; white-space: nowrap; }
.res-table th:first-child, .res-table td:first-child { text-align: left; }
.res-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; background: var(--ink); color: #fff; }
.res-table tr + tr td { border-top: 2px solid #E3E7EF; }
.res-table td:first-child { display: flex; align-items: center; gap: 8px; font-weight: 900; }
.dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); flex: none; }
.dot.t0 { background: var(--blaze); }
.dot.t1 { background: var(--wave); }
.mvp { font-size: 11px; font-weight: 900; background: var(--sun); border: 2px solid var(--ink); padding: 1px 6px; border-radius: 999px; }
.res-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

.toast { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 70; padding: 10px 16px;
  background: var(--ink); color: #fff; border-radius: 12px; font-weight: 800; font-size: 14px; max-width: calc(100% - 32px); text-align: center; animation: toastIn .3s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes toastIn { from { transform: translate(-50%, 30px); opacity: 0; } }

#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .teams { grid-template-columns: 1fr; }
  .vs-mid { justify-self: center; font-size: 28px; }
  .hud { grid-template-columns: 1fr 1fr auto; }
  .hud-mid { grid-column: 1 / -1; grid-row: 2; flex-direction: row; justify-content: center; gap: 10px; }
  .hud-tools { grid-column: 3; grid-row: 1; }
  .hud-flags { display: none; }
  .opt { min-height: 42px; font-size: 14px; padding: 5px 8px 5px 5px; }
  .opt .key { width: 24px; height: 24px; font-size: 13px; }
  .pad { padding: 8px; }
  .pad-who b { font-size: 16px; }
  .q-card { padding: 10px 12px 12px; }
  .timebar { margin: 8px 0 6px; }
  .icon-btn { width: 38px; height: 38px; }
  .screen-game.active { gap: 8px; }
  .arena-game { height: clamp(170px, 46vw, 250px); }
}
@media (max-width: 420px) {
  .opt { font-size: 13px; }
  .q-flag { width: 76px; }
  .hud-pulls { display: none; }
}
@media (max-height: 640px) and (min-width: 761px) {
  .arena-game { height: 170px; }
  .opt { min-height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .opts.show .opt { transition-delay: 0s !important; }
}

/* ---------- v2: specials, online, leaderboard ---------- */
.title-actions-sm .btn { font-size: 17px; padding: 10px 18px; }
.crew-card em, .pick-card em {
  font-style: normal; font-size: 11px; font-weight: 900; color: var(--ink); background: var(--paper-2);
  border: 2px solid var(--ink); border-radius: 999px; padding: 1px 7px; margin-top: 4px; white-space: nowrap;
}
.pick-card p { margin: 4px 2px 0; font-size: 11px; line-height: 1.3; color: var(--ink-soft); font-weight: 700; }
.custom-field { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; }
.custom-field input { width: 84px; font-weight: 900; font-size: 17px; padding: 6px 10px; border: 2.5px solid var(--ink); border-radius: 10px; background: #fff; }
.seg button { padding: 9px 13px; }

.special-btn {
  display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 6px; flex: none; min-width: 0; max-width: 55%;
  border: 2.5px solid var(--ink); border-radius: 12px; background: var(--sun); box-shadow: 0 3px 0 var(--ink); text-align: left;
}
.special-btn .sp-ico { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: #fff; border: 2px solid var(--ink); font-size: 18px; flex: none; }
.sp-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.sp-txt b { font-family: var(--display); font-weight: 400; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-txt small { font-size: 11px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.special-btn:disabled { background: var(--paper-2); color: #77738F; cursor: default; }
.special-btn.ready { animation: glowPulse 1.4s ease-in-out infinite; }
@keyframes glowPulse { 50% { box-shadow: 0 3px 0 var(--ink), 0 0 0 6px rgba(255, 201, 60, .5); } }
.special-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

.pad-fx { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 8px; }
.pad-fx:empty { display: none; }
.fx-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; border: 2px solid var(--ink); background: #fff; font-weight: 900; font-size: 12px; animation: popIn .3s cubic-bezier(.3, 1.6, .5, 1); }
.fx-badge.bad { background: #FFE0E0; }
.pad-note { margin: 8px 0 0; text-align: center; font-weight: 900; font-size: 14px; color: var(--ink-soft); }

.opt { position: relative; }
.opt.gone { opacity: .22 !important; text-decoration: line-through; }
.opt.polled { background: linear-gradient(90deg, rgba(255, 201, 60, .65) 0 var(--poll), #fff var(--poll)); }
.opt .poll { margin-left: auto; flex: none; font-size: 12px; font-weight: 900; padding: 2px 7px; border-radius: 999px; background: var(--ink); color: #fff; }
.opt.flash { animation: flashGlow 1s ease-out; }
@keyframes flashGlow { 0%, 55% { background: #FFF1B0; box-shadow: 0 3px 0 var(--ink), 0 0 0 7px rgba(255, 201, 60, .95); } }
.opt.picked { background: var(--paper-2); }
.q-card { position: relative; }
.time-pop { position: absolute; right: 14px; top: 40px; font-family: var(--display); font-size: 22px; color: var(--good); pointer-events: none; animation: timePop 1.3s ease-out forwards; }
@keyframes timePop { from { transform: translateY(10px) scale(.6); opacity: 0; } 25% { transform: none; opacity: 1; } to { transform: translateY(-16px); opacity: 0; } }
.hud-flags { font-size: 14px; white-space: nowrap; font-weight: 900; }

.tier-badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; border: 2px solid var(--ink); background: var(--tc, #8A8FA3); color: #fff; font-weight: 900; font-size: 12px; white-space: nowrap; }
.tier-badge small { font-weight: 800; opacity: .9; margin-left: 4px; }
.up { color: var(--good); font-weight: 900; }
.down { color: var(--bad); font-weight: 900; }

.online-wrap { max-width: 760px; }
.ol-card { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.ol-me { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; }
.ol-avatar { width: 72px; height: 84px; }
.ol-rank { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.ol-rank b { font-family: var(--display); font-weight: 400; font-size: 28px; line-height: 1; font-variant-numeric: tabular-nums; }
.ol-rank small { font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.ol-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ol-or { margin: 0; font-weight: 800; color: var(--ink-soft); font-size: 14px; }
.ol-room { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; }
.ol-room input { width: 116px; text-align: center; font-family: var(--display); font-size: 22px; letter-spacing: .15em; text-transform: uppercase; padding: 8px; border: 3px solid var(--ink); border-radius: 12px; background: #fff; }
.ol-status { display: flex; align-items: center; gap: 14px; padding: 14px; border: 3px dashed var(--ink); border-radius: 16px; background: var(--paper-2); }
.ol-status > div { flex: 1; min-width: 0; }
.ol-status b { font-family: var(--display); font-weight: 400; font-size: 22px; }
.ol-status .code { font-size: 34px; letter-spacing: .18em; }
.ol-status .hint { margin-top: 2px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--ink); border-top-color: var(--sun); animation: spin .9s linear infinite; flex: none; }
.ol-rules { text-align: center; }
.ol-offline { padding: 18px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.ol-offline h3 { margin: 0; font-family: var(--display); font-weight: 400; font-size: var(--fs-lg); }
.ol-offline p { margin: 0; }
.ol-offline ol { margin: 0; padding-left: 22px; line-height: 1.7; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--paper-2); border: 1.5px solid #CBD2E0; padding: 1px 5px; border-radius: 6px; font-size: .9em; }

.board-top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.tiers { display: flex; flex-wrap: wrap; gap: 6px; }
.board-panel { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.board-table .rank { font-family: var(--display); font-size: 18px; min-width: 2ch; text-align: right; }
.mini-av { width: 30px; height: 36px; border: 2px solid var(--ink); border-radius: 8px; background: #fff; overflow: hidden; flex: none; }
.mini-av .avatar { width: 100%; height: 100%; transform: translateY(3px) scale(1.25); }
.board-empty td { text-align: center !important; padding: 26px 10px !important; font-weight: 800; color: var(--ink-soft); display: table-cell !important; white-space: normal !important; }
.board-note { margin: 0; text-align: center; }
.board-foot { text-align: center; font-weight: 800; }
.danger { color: var(--bad); }
.res-table td .tier-badge { font-size: 11px; }

@media (max-width: 560px) {
  .board-table th:nth-child(2), .board-table td:nth-child(2), .board-table th:nth-child(6), .board-table td:nth-child(6) { display: none; }
  .opts { grid-template-columns: 1fr; gap: 6px; }
  .special-btn { max-width: 60%; padding-right: 8px; }
  .sp-txt b { font-size: 14px; }
  .ol-me { grid-template-columns: auto 1fr; }
  .ol-rank { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; text-align: left; gap: 8px; }
  .turn-band { flex-direction: column; gap: 8px; text-align: center; }
  .turn-info { align-items: center; }
  .turn-tags { justify-content: center; }
}

/* ---------- v3: ages, levels, AI and learning ---------- */
.p-picks { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.p-picks select, #ol-age, #ol-level {
  flex: 1 1 110px; min-width: 0; font-weight: 800; font-size: 13px; padding: 5px 8px;
  border: 2px solid var(--ink); border-radius: 9px; background: #fff; color: var(--ink);
}

.lvl-chip { display: inline-flex; align-items: center; padding: 3px 10px; margin-left: 6px; border-radius: 999px; border: 2px solid var(--ink); font-weight: 900; font-size: 12px; background: #fff; vertical-align: middle; }
.lvl-chip.l1 { background: #D7F5DF; }
.lvl-chip.l2 { background: #FFF1C7; }
.lvl-chip.l3 { background: #FFDCCB; }
.lvl-chip.l4 { background: #E9DCFF; }

.q-learn { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 2px dashed #D6DBE6; animation: qIn .4s cubic-bezier(.3, 1.4, .5, 1); }
.q-expl { margin: 0; flex: 1; min-width: 0; font-weight: 700; font-size: 15px; line-height: 1.4; }
.learn-btn {
  flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; font-weight: 900; font-size: 15px;
  border: 2.5px solid var(--ink); border-radius: 12px; background: var(--sun); box-shadow: 0 3px 0 var(--ink);
}
.learn-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.learn-btn kbd { font-size: 11px; }

.learn-overlay { z-index: 56; align-items: start; }
.learn-card { width: min(760px, 100%); padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; animation: modalIn .35s cubic-bezier(.3, 1.5, .5, 1); margin-block: auto; }
.learn-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.learn-tags { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.learn-q { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(20px, 3vw, 28px); line-height: 1.2; text-wrap: balance; display: flex; align-items: center; gap: 12px; }
.learn-flag { width: 72px; flex: none; }
.learn-answer { display: flex; flex-direction: column; gap: 6px; }
.ans { margin: 0; padding: 8px 12px; border: 2.5px solid var(--ink); border-radius: 12px; font-weight: 800; background: var(--paper-2); }
.ans.good { background: #D7F5DF; }
.ans.bad { background: #FFE0E0; }
.learn-body { font-size: 16px; line-height: 1.6; max-width: 68ch; }
.learn-body p { margin: 0 0 10px; }
.learn-headline { font-weight: 900; font-size: 18px; line-height: 1.4; }
.learn-body h4, .learn-ask h4 { margin: 16px 0 8px; font-family: var(--display); font-weight: 400; font-size: 19px; }
.learn-body ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.facts li { position: relative; padding-left: 26px; }
.facts li::before { content: '★'; position: absolute; left: 2px; top: 0; color: var(--sun-dk); }
.whynot li { display: flex; flex-direction: column; padding: 8px 12px; border-left: 4px solid var(--bad); background: #FFF6F6; border-radius: 0 10px 10px 0; }
.whynot b { font-weight: 900; }
.remember { margin-top: 14px; padding: 12px 14px; border: 2.5px solid var(--ink); border-radius: 14px; background: #FFF6D6; }
.remember p { margin: 4px 0 0; }
.learn-note { padding: 10px 12px; border-radius: 12px; background: #FFF1D6; border: 2px solid #E9A800; font-weight: 700; }
.read-more { display: inline-block; margin-top: 14px; font-weight: 900; color: var(--wave-dk); }
.skeleton { display: flex; flex-direction: column; gap: 10px; padding: 6px 0; }
.skeleton i { display: block; height: 14px; border-radius: 7px; background: linear-gradient(90deg, #E9EDF5 0%, #F6F8FC 50%, #E9EDF5 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skeleton i.short { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.learn-ask { border-top: 2px dashed #D6DBE6; padding-top: 4px; }
.ask-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.ask-chip { padding: 6px 12px; border: 2px solid var(--ink); border-radius: 999px; background: var(--wave-lt); font-weight: 800; font-size: 13px; text-align: left; }
.ask-chip:hover { background: #C9DCFF; }
.ask-thread { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.bubble { margin: 0; padding: 9px 13px; border-radius: 14px; max-width: 88%; line-height: 1.5; font-size: 15px; white-space: pre-wrap; }
.bubble.me { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.bubble.ai { align-self: flex-start; background: var(--paper-2); border: 2px solid #D6DBE6; border-bottom-left-radius: 4px; }
.bubble.err { background: #FFE0E0; border-color: var(--bad); }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-soft); animation: dot 1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 50% { transform: translateY(-4px); opacity: .5; } }
.ask-form { display: flex; gap: 8px; }
.ask-form input { flex: 1; min-width: 0; font-weight: 700; font-size: 15px; padding: 9px 12px; border: 2.5px solid var(--ink); border-radius: 12px; background: #fff; }
.ask-form .btn { font-size: 17px; padding: 8px 16px; }
.learn-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 2px solid #E3E7EF; padding-top: 12px; }
.learn-foot .hint { flex: 1; min-width: 200px; }

.review-list { margin: 0; padding: 6px 10px 10px; list-style: none; display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.review-list li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: var(--paper-2); }
.rv-mark { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 900; border: 2px solid var(--ink); }
.ok .rv-mark { background: var(--good); }
.miss .rv-mark { background: var(--bad); }
.rv-main { min-width: 0; }
.rv-q { margin: 0 0 2px; font-weight: 800; line-height: 1.3; }
.rv-learn { font-size: 15px; padding: 6px 12px; box-shadow: 0 3px 0 var(--ink); }

@media (max-width: 560px) {
  .q-learn { flex-direction: column; align-items: stretch; }
  .learn-card { padding: 14px; }
  .learn-flag { width: 54px; }
  .review-list li { grid-template-columns: auto 1fr; }
  .rv-learn { grid-column: 1 / -1; }
}

/* ---------- v4: learning first ---------- */
/* title: what you'll learn */
.value { width: 100%; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.value-head h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: var(--fs-xl); line-height: 1.1; text-wrap: balance; }
.value-head p { margin: 4px 0 0; font-weight: 700; color: var(--ink-soft); }
.value-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 10px; }
.value-grid li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 2.5px solid var(--ink); border-radius: 14px; background: var(--paper-2); }
.v-ico { flex: none; width: 38px; height: 38px; display: grid; place-items: center; font-size: 20px; line-height: 1; background: #fff; border: 2px solid var(--ink); border-radius: 10px; }
.value-grid b { display: block; font-weight: 900; line-height: 1.25; }
.value-grid small { display: block; margin-top: 2px; color: var(--ink-soft); font-weight: 700; font-size: 13px; line-height: 1.35; }
.value-sub { margin: 4px 0 0; font-family: var(--display); font-weight: 400; font-size: var(--fs-lg); }
.subjects { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.subject { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 2.5px solid var(--ink); border-left: 8px solid var(--c); border-radius: 14px; background: #fff; }
.s-ico { flex: none; font-size: 24px; line-height: 1.1; }
.subject b { display: block; font-weight: 900; line-height: 1.2; }
.subject small { display: block; margin-top: 2px; color: var(--ink-soft); font-weight: 700; font-size: 12.5px; line-height: 1.35; }
.subject em { display: inline-block; margin-top: 6px; padding: 1px 8px; font-style: normal; font-weight: 900; font-size: 11px; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper-2); }
.journal-strip { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 12px 14px; border: 3px solid var(--ink); border-radius: 14px; background: #FFF6D6; }
.js-stats { display: flex; align-items: center; gap: 10px; }
.js-ico { font-size: 26px; line-height: 1; }
.js-stats b { display: block; font-weight: 900; }
.js-stats small { color: var(--ink-soft); font-weight: 800; }
.journal-strip .btn { font-size: 17px; padding: 9px 16px; }

/* setup: what this match covers */
.opt-learn { grid-column: 1 / -1; }
.opt-learn .hint { max-width: 70ch; }
.match-plan { padding: 16px 18px; background: #F3FBF4; }
.match-plan h3 { margin: 0 0 10px; font-family: var(--display); font-weight: 400; font-size: var(--fs-lg); }
.plan { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); gap: 10px 18px; }
.plan li { display: flex; gap: 10px; align-items: flex-start; font-weight: 700; font-size: 15px; line-height: 1.4; }
.plan li > span { flex: none; font-size: 20px; line-height: 1.2; }

/* in-game reveal */
.q-ans { color: #137A3E; font-weight: 900; }
.q-more { color: var(--ink-soft); }

/* end-of-match recap and the journal */
.recap { border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; }
.recap-head { padding: 10px 14px; background: var(--sun); border-bottom: 3px solid var(--ink); }
.recap-head h4 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 21px; }
.recap-head .hint { color: var(--ink); font-weight: 700; }
.recap-cats, .j-subjects { display: flex; flex-wrap: wrap; gap: 6px; }
.recap-cats { padding: 10px 12px 0; }
.recap-cats:empty { display: none; }
.rc { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; font-weight: 800; font-size: 13px; border: 2px solid var(--ink); border-left: 6px solid var(--c); border-radius: 999px; background: #fff; }
.recap-list { max-height: 440px; }
.review-list li.miss { background: #FFF3F3; }
.rv-a { margin: 2px 0 0; font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.rv-a b { color: var(--ink); }
.rv-expl { margin: 4px 0 0; font-size: 14px; line-height: 1.45; }
.rv-flag { display: inline-block; width: 34px; margin-right: 4px; vertical-align: middle; }
.rv-flag svg { display: block; width: 100%; height: auto; }
.journal-card { display: flex; flex-direction: column; gap: 8px; }
.journal-card #journal-sub { padding-right: 48px; }
.j-head { margin: 10px 0 0; font-family: var(--display); font-weight: 400; font-size: 19px; }
.journal-card .review-list { padding: 0; max-height: none; overflow: visible; }
.j-foot { margin-top: 8px; text-align: center; font-weight: 800; }

@media (max-width: 560px) {
  .value { padding: 14px; }
  .match-plan { padding: 14px; }
  .journal-strip .btn { width: 100%; }
  .subjects { grid-template-columns: 1fr 1fr; gap: 8px; }
  .subject { flex-direction: column; gap: 4px; padding: 8px 10px; }
  .subject small { display: none; }
}
