/* ===== Menu ===== */
.fit-measure .btn { transform: none !important; transition: none !important; }
#scr-menu .corner-l, #scr-menu .corner-r { position: absolute; top: 2.5cqmin; z-index: 5; font-size: clamp(14px, 2.6cqmin, 26px); }
#scr-menu .corner-l { left: 2.5cqmin; } #scr-menu .corner-r { right: 2.5cqmin; }
.btn .ico { display: inline-flex; width: 1.3em; height: 1.3em; flex: none; }
.btn .ico svg { width: 100%; height: 100%; display: block; }
#scr-menu.active { display: flex; flex-direction: column; }
/* --ms (0..1) is set by menu.js resize(): it shrinks the whole menu (logo + buttons) until nothing is clipped or overlapped. */
.menu-stage { --ms: 1; position: relative; flex: 1 1 0; min-height: 0; display: grid; align-items: center; justify-items: center;
    font-size: calc(clamp(11px, 2.4cqmin, 26px) * var(--ms)); }
.landscape .menu-stage { grid-template-columns: minmax(0, 1fr) min(32em, 100%) minmax(0, 1fr); padding: 0 1cqw; }
.landscape .menu-stage.nobots { grid-template-columns: 0 min(32em, 100%) 0; }
.portrait .menu-stage { grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1fr) 22cqh; }
.portrait .menu-stage.nobots { grid-template-rows: minmax(0, 1fr) 0; }
.menu-stage.nobots .menu-bot { display: none; }
.menu-center { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(3.2cqmin * var(--ms)); width: 100%; min-width: 0; font-size: inherit; z-index: 2; }
.landscape .menu-center { grid-column: 2; }
.portrait .menu-center { grid-column: 1 / 3; grid-row: 1; padding: calc(5cqh * var(--ms)) 6cqw 0; justify-content: center; gap: calc(2.4cqh * var(--ms)); }
.menu-bot { position: relative; align-self: end; width: 100%; height: 78%; max-height: 100%; min-width: 0; }
.landscape .menu-bot.left { grid-column: 1; } .landscape .menu-bot.right { grid-column: 3; }
.portrait .menu-bot { grid-row: 2; height: 100%; }
.portrait .menu-bot.left { grid-column: 1; } .portrait .menu-bot.right { grid-column: 2; }
.menu-bot .bot-canvas { position: absolute; inset: 0; }
.menu-ground { position: absolute; left: 8%; right: 8%; bottom: 14%; height: 2%; border-radius: 1em; background: linear-gradient(90deg, transparent, rgba(255, 210, 63, .25), transparent); }
.menu-buttons { display: flex; flex-direction: column; gap: 1.2em; width: 100%; align-items: stretch; }
/* rows wrap instead of clipping: a button never gets narrower than its label */
.menu-buttons .row { display: flex; flex-wrap: wrap; gap: .8em; justify-content: center; }
.menu-buttons .row .btn { flex: 1 1 auto; min-width: max-content; }
.menu-buttons .row .btn > span { overflow: visible; max-width: none; }
.menu-buttons .row.main .btn { font-size: 1.7em; padding: .55em .4em; }
.menu-buttons .row.sub .btn { font-size: 1.05em; }
.portrait .menu-buttons { width: min(100%, 25em); }

/* logo */
.logo { position: relative; display: flex; flex-direction: column; align-items: center; width: 100%; }
.logo-heart-wrap { width: calc(clamp(70px, 24cqmin, 260px) * var(--ms, 1)); margin-bottom: -2.6cqmin; z-index: 1; animation: heartbeat 1.6s ease-in-out infinite; filter: drop-shadow(0 .5em .6em rgba(0, 0, 0, .5)); transform-origin: 50% 70%; }
.short .logo-heart-wrap { width: calc(clamp(60px, 20cqmin, 140px) * var(--ms, 1)); }
.logo-heart { width: 100%; display: block; overflow: visible; }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.09); } 24% { transform: scale(1); } 36% { transform: scale(1.05); } 48% { transform: scale(1); } }
.lh-gear.spin { animation: spin 12s linear infinite; } .lh-gear.spin-r { animation: spin 9s linear infinite reverse; }
.lh-right { animation: lhShake 3.2s ease-in-out infinite; transform-origin: 100px 90px; }
@keyframes lhShake { 0%, 90%, 100% { transform: translate(0, 0); } 93% { transform: translate(1.5px, -1px) rotate(.8deg); } 96% { transform: translate(-1px, 1px) rotate(-.6deg); } }
.logo-title { display: flex; flex-direction: column; align-items: center; line-height: .92; font-family: var(--font-display); text-transform: uppercase; z-index: 2; }
.lt { display: block; -webkit-text-stroke: .1em var(--ink); paint-order: stroke fill; letter-spacing: .02em; white-space: nowrap; }
.lt.l1 { font-size: calc(clamp(30px, 13.5cqmin, 160px) * var(--ms, 1)); color: var(--coral); transform: rotate(-4deg) translateX(-.1em); text-shadow: 0 .09em 0 var(--ink), 0 .16em .25em rgba(0, 0, 0, .5); animation: ltBob 3s ease-in-out infinite; }
.lt.l2 { font-size: calc(clamp(34px, 13.5cqmin, 160px) * var(--ms, 1)); color: var(--cyan); transform: rotate(-4deg) translateX(.2em); text-shadow: 0 .08em 0 var(--ink), 0 .16em .25em rgba(0, 0, 0, .5); animation: ltBob 3s ease-in-out infinite -1.5s; }
@keyframes ltBob { 50% { translate: 0 -.04em; } }
.portrait .lt.l1 { font-size: calc(clamp(30px, 18cqw, 160px) * var(--ms, 1)); } .portrait .lt.l2 { font-size: calc(clamp(34px, 18cqw, 160px) * var(--ms, 1)); }
.logo-tag { margin-top: 1.1em; font-weight: 800; color: var(--yellow); font-size: 1.15em; letter-spacing: .02em; text-shadow: 0 .1em 0 var(--ink); max-width: 100%; transform: rotate(-1.5deg); padding: .1em .6em; text-align: center; }
.short .logo-tag { margin-top: .5em; }

/* ===== Settings / language / howto / ledger modals ===== */
.modal { font-size: clamp(12px, 2.3cqmin, 34px); }
.modal .screen-title { font-size: 2.1em; text-wrap: balance; padding: 0 .4em; }
.portrait .modal .screen-title { font-size: 1.75em; }
.set-body { display: flex; flex-direction: column; gap: .55em; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: .8em; }
.set-label { font-weight: 800; font-size: 1.1em; flex: 1; min-width: 0; }
.set-row .btn { min-width: 7em; font-size: .95em; }
.set-row .btn .fit { max-width: 8em; }
.set-block { display: flex; flex-direction: column; gap: .4em; }
.set-hint { font-size: .85em; color: var(--text-dim); text-align: center; }
.set-ver { font-size: 12px; color: var(--text-dim); opacity: .6; text-align: center; letter-spacing: .04em; }
.lang-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6em; }
.portrait .lang-grid { grid-template-columns: repeat(2, 1fr); }
.lang-btn { font-size: 1.05em; }
.lang-btn.on { --c: var(--yellow); --cd: var(--yellow-d); --tc: var(--ink); }
.seg .len-lbl small { opacity: .7; }
.settings-modal, .ledger-modal, .howto-modal, .lang-modal { width: min(94%, 36em); }
.short .modal { padding: .7em 1em 1em; gap: .45em; }
.short .modal .x { min-width: 38px; min-height: 38px; top: -.75em; right: -.75em; }
.short .modal .screen-title { font-size: 1.6em; }
.short .set-body { gap: .4em; }

.howto-modal { width: min(94%, 40em); }
.howto-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; touch-action: pan-x; border-radius: 1em; min-height: 0; flex: 1; }
.howto-track::-webkit-scrollbar { display: none; }
.howto-card { flex: 0 0 100%; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; gap: .5em; padding: .5em .8em; min-width: 0; }
.short .howto-card { flex-direction: row; flex-wrap: wrap; justify-content: center; }
.howto-h { font-size: 1.7em; color: var(--yellow); text-shadow: 0 .08em 0 var(--ink); max-width: 100%; }
.howto-p { margin: 0; text-align: center; font-size: 1.05em; line-height: 1.3; text-wrap: balance; max-width: 26em; }
.howto-keys { text-align: center; font-size: .78em; color: var(--text-dim); }
@media (pointer: coarse) { .howto-keys { display: none; } }
.dots { display: flex; justify-content: center; gap: .5em; }
.dots i { width: .7em; height: .7em; border-radius: 50%; background: rgba(255, 255, 255, .25); transition: all .2s; }
.dots i.on { background: var(--yellow); transform: scale(1.3); }
.illu { width: 100%; height: 11em; position: relative; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at 50% 100%, rgba(155, 92, 255, .35), transparent 70%), rgba(12, 6, 26, .4); border-radius: 1em; border: .15em solid var(--ink); }
.short .illu { height: 6em; }
.mini-row { display: flex; gap: .8em; }
.mini-card { position: relative; width: 5em; height: 6em; border-radius: .8em; border: .18em solid var(--purple); background: linear-gradient(180deg, #4b2a82, #1b0e34); transform: rotate(var(--r)); box-shadow: 0 .25em 0 var(--ink); display: flex; align-items: center; justify-content: center; animation: miniFloat 2.4s ease-in-out infinite; }
.mini-card:nth-child(2) { animation-delay: -.8s; } .mini-card:nth-child(3) { animation-delay: -1.6s; }
@keyframes miniFloat { 50% { translate: 0 -.4em; } }
.mini-card canvas { width: 85%; height: auto; }
.mini-cost { position: absolute; top: -.5em; left: -.4em; background: var(--yellow); color: var(--ink); border: .14em solid var(--ink); border-radius: 1em; padding: 0 .5em; font-family: var(--font-display); }
.illu-arrow { width: 2.5em; margin-top: 3em; }
.mini-timer { position: absolute; right: .8em; bottom: .6em; display: flex; align-items: center; gap: .3em; font-family: var(--font-display); background: var(--ink); padding: .1em .6em .1em .3em; border-radius: 1em; color: var(--yellow); }
.mini-timer .ico { width: 1.3em; height: 1.3em; display: inline-flex; }
.mini-lvl { color: var(--green); }
.duel { display: flex; align-items: center; gap: 1em; }
.duel-bot canvas { width: 6em; height: 6em; animation: duelL 1.2s ease-in-out infinite; }
.duel-bot.r canvas { animation-name: duelR; }
@keyframes duelL { 50% { transform: translateX(.8em) rotate(8deg); } } @keyframes duelR { 50% { transform: translateX(-.8em) rotate(-8deg); } }
.duel-boom { width: 4.5em; animation: spin 6s linear infinite; }
.trophy-row { display: flex; gap: .4em; } .trophy-row .trophy { width: 2.6em; height: 2.6em; }
.trophy-row .trophy.got { animation: trophyBob 1.6s ease-in-out infinite; }
@keyframes trophyBob { 50% { transform: translateY(-.3em) rotate(4deg); } }
.illu3 { flex-direction: column; gap: .3em; } .crown-line { font-size: 1.8em; color: #fff; }

/* ledger */
.ledger-body { display: flex; flex-direction: column; gap: .8em; }
.ledger-sub { text-align: center; color: var(--text-dim); font-size: .95em; margin-top: -.6em; }
.ledger-vs { display: flex; align-items: center; justify-content: center; gap: 1em; }
.lv { text-align: center; min-width: 0; flex: 1; } .lv-n { font-size: 3.4em; line-height: 1; text-shadow: 0 .06em 0 var(--ink); }
.lv.p1 .lv-n { color: var(--t1); } .lv.p2 .lv-n { color: var(--t2); } .lv-l { font-size: .9em; color: var(--text-dim); }
.lv-mid { font-size: 1.6em; color: var(--yellow); }
.ledger-title { text-align: center; font-size: 1.3em; color: var(--yellow); background: rgba(12, 6, 26, .5); border: .12em solid var(--ink); border-radius: .8em; padding: .35em .6em; margin-top: .6em; transform: rotate(-1deg); min-height: 2.2em; display: flex; align-items: center; justify-content: center; }
.ledger-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5em; }
.ledger-stat { background: rgba(12, 6, 26, .45); border-radius: .8em; padding: .4em .6em; text-align: center; border: .1em solid rgba(255, 255, 255, .08); }
.ls-val { font-size: 1.8em; line-height: 1.1; } .ls-lbl { font-size: .85em; color: var(--text-dim); }
.ledger-stat.good .ls-val { color: var(--green); } .ledger-stat.bad .ls-val { color: #ff7d7d; }
.ledger-empty { text-align: center; color: var(--text-dim); font-size: .95em; }
.btn.small { font-size: .85em; }

/* ===== VS & Battle ===== */
.vs-canvas, .battle-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.vs-fight { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%) scale(0); font-size: clamp(40px, 22cqmin, 260px); color: var(--yellow); -webkit-text-stroke: .1em var(--ink); paint-order: stroke fill; text-shadow: 0 .06em 0 var(--ink), 0 0 .5em #ff7a1a; pointer-events: none; white-space: nowrap; }
.vs-fight.go { animation: fightPop .7s var(--ease-spring) forwards; }
@keyframes fightPop { 0% { transform: translate(-50%, -50%) scale(3) rotate(-12deg); opacity: 0; } 40% { transform: translate(-50%, -50%) scale(1) rotate(-4deg); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1.1) rotate(-4deg); opacity: 1; } }
.vs-round { position: absolute; left: 0; right: 0; top: 3cqh; text-align: center; font-size: clamp(14px, 4cqmin, 40px); color: var(--text); text-shadow: 0 .1em 0 var(--ink); }
.battle-pause { position: absolute; left: 50%; top: calc(max(8px, 1.2cqmin) + clamp(52px, 8.5cqmin, 90px)); transform: translateX(-50%); font-size: clamp(11px, 2.2cqmin, 22px); z-index: 5; width: 2.6em; height: 2.6em; opacity: .9; }
.battle-pause.pressed { transform: translateX(-50%) translateY(.28em) scale(.96); }
.battle-pause:hover:not(:disabled) { transform: translateX(-50%) translateY(-.1em) scale(1.03); }
.taunt { position: absolute; bottom: calc(2cqmin + env(safe-area-inset-bottom)); width: 3.4em; height: 3.4em; font-size: clamp(12px, 2.6cqmin, 26px); z-index: 5; opacity: .92; }
.btn.team1 { --c: var(--t1); --cd: var(--t1-d); --tc: var(--t1-tc); } .btn.team2 { --c: var(--t2); --cd: var(--t2-d); --tc: var(--t2-tc); }
.taunt.t1 { left: 2.5cqmin; } .taunt.t2 { right: 2.5cqmin; }
.taunt.pressed-pop { animation: popIn .3s var(--ease-spring); }

/* ===== Round result overlay ===== */
.rr { position: absolute; inset: 0; z-index: 40; pointer-events: auto; display: flex; flex-direction: column; align-items: center; font-size: clamp(12px, 2.4cqmin, 26px); animation: fadeIn .25s both; }
.rr.out { animation: fadeOut .2s both; }
@keyframes bannerIn { from { transform: rotate(-8deg) scale(0); opacity: 0; } }
.rr-fly { position: fixed; z-index: 50; opacity: 0; pointer-events: none; } .rr-fly svg { width: 100%; height: 100%; filter: drop-shadow(0 0 .5em var(--yellow)); }
.rr-side { display: flex; flex-direction: column; align-items: center; gap: .2em; min-width: 0; }
.rr-name { font-family: var(--font-display); max-width: 11em; font-size: 1.05em; } .rr-side.p1 .rr-name { color: var(--t1); } .rr-side.p2 .rr-name { color: var(--t2); }
.rr-trophies { display: flex; gap: .15em; } .rr-trophies .trophy { width: 1.9em; height: 1.9em; }
.rr-scraps { position: absolute; left: 0; right: 0; bottom: 14cqh; display: flex; justify-content: space-between; padding: 0 5%; pointer-events: none; }
.rr-scrap { display: flex; flex-direction: column; align-items: center; gap: .1em; padding: .3em .8em; max-width: 44%; background: var(--ink); border-radius: 1em; border: .15em solid var(--yellow-d); font-weight: 800; color: var(--yellow); animation: bannerIn .5s .6s var(--ease-spring) both; }
.rr-scrap > .ico { display: none; }
.rr-scrap small { color: var(--green); font-size: .75em; }
.rr-scrap.p1 { border-color: var(--t1); } .rr-scrap.p2 { border-color: var(--t2); }

/* ===== Match result ===== */
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.mr-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; padding: 2.5cqmin 3cqmin; gap: 1.2cqmin; z-index: 3; font-size: clamp(11px, 2.2cqmin, 34px); }
.mr-title { font-size: 3.4em; max-width: 90%; text-align: center; transform: rotate(-2deg); -webkit-text-stroke: .08em var(--ink); paint-order: stroke fill; text-shadow: 0 .09em 0 var(--ink), 0 .2em .3em rgba(0, 0, 0, .5); animation: bannerIn .7s var(--ease-spring) both; flex: none; line-height: 1.1; padding: .05em 0; }
.mr-title.team1 { color: var(--t1); } .mr-title.team2 { color: var(--t2); }
.mr-body { flex: 1; min-height: 0; width: 100%; max-width: 1100px; display: grid; gap: 2cqmin; }
.landscape .mr-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.portrait .mr-body { grid-template-rows: minmax(0, .8fr) minmax(0, 1.3fr); }
.mr-bots { position: relative; min-height: 0; display: flex; align-items: flex-end; justify-content: center; }
.mr-win { position: relative; width: 62%; height: 100%; animation: winHop 1.1s ease-in-out infinite; }
.mr-lose { position: relative; width: 38%; height: 62%; transform: rotate(-4deg); }
.mr-bots canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
@keyframes winHop { 50% { transform: translateY(-3%); } }
.mr-info { display: flex; flex-direction: column; gap: 1.2cqmin; justify-content: center; min-height: 0; min-width: 0; }
.mr-roast { font-size: 1.2em; font-weight: 800; text-align: center; color: var(--yellow); text-wrap: balance; padding: .5em .8em; background: rgba(12, 6, 26, .6); border: .12em solid var(--ink); border-radius: 1em; flex: none; line-height: 1.25; }
.mr-stats { background: rgba(12, 6, 26, .6); border-radius: 1em; padding: .5em .8em; border: .12em solid var(--ink); flex: none; }
.ms-title { text-align: center; font-size: 1em; color: var(--text-dim); } .ms-names { display: flex; justify-content: space-between; gap: 1em; font-family: var(--font-display); font-size: 1em; }
.ms-names .p1 { color: var(--t1); text-align: left; } .ms-names .p2 { color: var(--t2); text-align: right; } .ms-names span { flex: 1; min-width: 0; }
.ms-row { display: grid; grid-template-columns: 1fr 1.6fr 1fr; align-items: center; text-align: center; gap: .4em; padding: .1em 0; border-top: .08em solid rgba(255, 255, 255, .08); }
.ms-v { font-size: 1.6em; } .ms-v.p1 { color: var(--t1); } .ms-v.p2 { color: var(--t2); } .ms-l { color: var(--text-dim); font-size: .95em; }
.mr-ledger { background: rgba(12, 6, 26, .5); border-radius: 1em; padding: .4em .8em; flex: none; display: flex; flex-direction: column; gap: .2em; }
.mr-ledger-h { font-size: .8em; color: var(--text-dim); text-align: center; text-transform: uppercase; letter-spacing: .08em; }
.mr-ledger .lv-n { font-size: 2em; } .mr-ledger .ledger-title { font-size: 1em; margin-top: .2em; min-height: 1.8em; }
.mr-ledger .ledger-vs { gap: .6em; }
.mr-buttons { display: flex; gap: 1em; flex: none; } .mr-buttons .btn { flex: 1; min-width: 0; font-size: 1.3em; }
.short .mr-title { font-size: 2.2em; } .short .mr-info { gap: .5cqmin; } .short .mr-roast { font-size: 1em; padding: .3em .6em; }
.short .mr-ledger { padding: .2em .6em; } .short .mr-ledger .ledger-title, .short .mr-ledger-h { display: none; } .short .mr-ledger .lv-n { font-size: 1.5em; } .short .mr-ledger .lv-l { display: none; }
.short .mr-stats { padding: .3em .6em; } .short .ms-v { font-size: 1.3em; }
#stage.rr-open .battle-pause, #stage.rr-open .taunt { visibility: hidden; }

/* ----- battle report (round result) ----- */
.rr-report { width: 100%; margin-top: .5em; padding-top: .5em; border-top: .1em solid rgba(255, 255, 255, .12); flex: 0 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: .4em; }
.rp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: .2em .9em; min-height: 0; }
.rp-col { min-width: 0; display: flex; flex-direction: column; gap: .3em; }
.rp-weapons { display: flex; flex-direction: column; gap: .22em; }
.rw { display: flex; align-items: center; gap: .35em; min-width: 0; }
.rw-ico { flex: none; width: 1.7em; height: 1.7em; } .rw-ico canvas { width: 100%; height: 100%; display: block; }
.rw-bar { flex: 1; min-width: 0; height: .6em; border-radius: .3em; background: rgba(255, 255, 255, .1); overflow: hidden; }
.rw-bar i { display: block; height: 100%; border-radius: .3em; transform-origin: left; animation: rwGrow .7s 1.2s var(--ease-out) both; }
.rp-col.p1 .rw-bar i { background: var(--t1); } .rp-col.p2 .rw-bar i { background: var(--t2); }
@keyframes rwGrow { from { transform: scaleX(0); } }
.rw-num { flex: none; min-width: 2.4em; text-align: right; font-family: var(--font-display); font-size: .95em; color: #fff; font-weight: 400; }
.rp-total { font-size: .85em; color: var(--text-dim); font-weight: 700; }
.short .rr-report { gap: .25em; padding-top: .35em; margin-top: .3em; }

/* pause */
.pause-modal { width: min(90%, 24em); }
.pause-btns { display: flex; flex-direction: column; gap: .8em; }
.pause-btns .btn { font-size: 1.15em; } .pause-btns .btn.big { font-size: 1.5em; }
.pause-q { text-align: center; margin: 0; font-size: 1.2em; font-weight: 700; text-wrap: balance; }

/* short landscape phones: keep the whole ledger visible */
.short .ledger-grid { grid-template-columns: repeat(3, 1fr); gap: .3em; }
.short .ledger-stat { padding: .15em .3em; } .short .ls-val { font-size: 1.4em; } .short .ls-lbl { font-size: .75em; }
.short .ledger-body { gap: .4em; } .short .lv-n { font-size: 2.4em; } .short .ledger-title { margin-top: .2em; }

/* ===== Legal & Credits ===== */
.legal-row { display: flex; flex-direction: column; gap: .35em; align-items: stretch; }
.legal-row-lbl { font-weight: 800; font-size: 1.05em; }
.legal-btns { display: flex; gap: .4em; }
.legal-btns .btn { flex: 1 1 0; min-width: 0; padding: .45em .3em; }
.ol-legal { flex: none; width: 100%; max-width: 640px; margin: 0 auto; padding: 0 3cqmin 1.6cqmin; font-size: clamp(11px, 2cqmin, 20px); flex-direction: row; align-items: center; gap: .6em; }
.ol-legal .legal-row-lbl { display: none; }
.ol-legal .legal-btns { flex: 1; }
.set-body .legal-row { margin-top: .2em; }

.legal-modal, .credits-modal { width: min(94%, 42em); height: 96%; }
.legal-seg { flex: none; align-self: center; width: 9em; }
.legal-note { flex: none; text-align: center; font-size: .85em; color: var(--yellow); }
.legal-note[hidden] { display: none; }
.legal-body, .cr-scroll { flex: 1 1 0; touch-action: pan-y; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 0 .3em 0 0; user-select: text; }
.legal-body { font-weight: 500; font-size: .92em; line-height: 1.45; background: rgba(12, 6, 26, .4); border-radius: .8em; padding: .6em .9em .9em; outline: none; }
.legal-body h3 { margin: 1.1em 0 .25em; font-size: 1.1em; color: var(--yellow); }
.legal-body p { margin: .35em 0; overflow-wrap: anywhere; }
.legal-body ul { margin: .3em 0 .3em 1.2em; padding: 0; }
.legal-body li { margin: .2em 0; overflow-wrap: anywhere; }
.legal-updated { color: var(--text-dim); font-size: .9em; }
.short .legal-modal, .short .credits-modal { height: 98%; }

.cr-scroll { outline: none; background: rgba(12, 6, 26, .4); border-radius: .8em; text-align: center; scrollbar-width: none; }
.cr-scroll::-webkit-scrollbar { display: none; }
.cr-roll { min-height: 170%; display: flex; flex-direction: column; align-items: center; gap: .5em; padding: 1.2em 1em 4em; }
.cr-by { color: var(--text-dim); font-size: 1.1em; margin-top: .4em; }
.cr-name { text-transform: none; font-size: 2.6em; line-height: 1.05; color: var(--yellow); -webkit-text-stroke: .06em var(--ink); paint-order: stroke fill; text-shadow: 0 .08em 0 var(--ink); overflow-wrap: anywhere; }
.cr-roles { display: flex; flex-direction: column; gap: .15em; font-size: .95em; max-width: 24em; }
.cr-roles b { color: var(--cyan); font-size: 1.1em; }
.cr-studio { font-size: 1.9em; color: var(--coral); margin-top: 1.2em; letter-spacing: .04em; }
.cr-studio-sub { color: var(--text-dim); font-size: .85em; margin-top: -.4em; }
.cr-third { font-size: 1.3em; color: var(--purple); margin-top: 2.2em; }
.cr-sec { margin-top: .8em; }
.cr-sec h4 { margin: 0 0 .25em; font-size: .8em; text-transform: uppercase; letter-spacing: .14em; color: var(--text-dim); }
.cr-sec p { margin: .15em 0; font-size: .95em; overflow-wrap: anywhere; }
.cr-sec b { color: var(--text); }
.cr-thanks { margin-top: 3em; font-family: var(--font-display); font-size: 1.35em; line-height: 1.25; color: var(--yellow); max-width: 15em; text-wrap: balance; }
.credits-bot { width: 4.6em; margin: .4em 0; animation: crBob 2.2s ease-in-out infinite; transform-origin: 50% 100%; }
.credits-bot svg { display: block; width: 100%; height: auto; overflow: visible; }
.cb-eyes { animation: crBlink 4s infinite; transform-origin: 32px 28px; }
.cb-ant { animation: crAnt 1.6s ease-in-out infinite; transform-origin: 32px 14px; }
.cb-arm { animation: crWave 1.1s ease-in-out infinite; transform-origin: 46px 49px; }
@keyframes crBob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-.35em) rotate(2deg); } }
@keyframes crBlink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes crAnt { 0%, 100% { transform: rotate(-9deg); } 50% { transform: rotate(9deg); } }
@keyframes crWave { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-28deg); } }
@media (prefers-reduced-motion: reduce) { .credits-bot, .cb-eyes, .cb-ant, .cb-arm { animation: none; } }

/* ===== Pre-match setup (friendly matches) ===== */
#scr-setup.active { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.2em; padding: 3cqmin 4cqmin; font-size: clamp(11px, 2.5cqmin, 26px); }
.su-back { position: absolute; top: 2.5cqmin; left: 2.5cqmin; z-index: 5; font-size: clamp(14px, 2.6cqmin, 26px); }
.su-title { font-size: 2.6em; line-height: 1; flex: none; }
.su-mode { flex: none; font-size: 1.1em; padding: .25em 1em; border: .15em solid var(--ink); border-radius: 2em; color: #fff; box-shadow: 0 .18em 0 var(--ink); max-width: 90%; }
.su-mode.coral { background: linear-gradient(180deg, #ff7b93, var(--coral-d)); }
.su-mode.cyan { background: linear-gradient(180deg, #62d6f6, var(--cyan-d)); color: var(--ink); }
.su-grid { display: grid; gap: .9em; width: min(100%, 36em); min-height: 0; }
.landscape .su-grid { width: min(100%, 52em); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.su-grid > [hidden] { display: none; }
.su-card { background: var(--panel-2); border: .15em solid var(--ink); border-radius: 1.1em; padding: .7em .9em .9em; box-shadow: 0 .2em 0 var(--ink); display: flex; flex-direction: column; gap: .6em; min-width: 0; }
.su-h { font-weight: 800; font-size: 1.1em; text-align: center; color: var(--text); }
.su-row { display: flex; align-items: center; justify-content: space-between; gap: .8em; }
.su-row .su-h { text-align: left; flex: 1; min-width: 0; }
.su-row .btn { min-width: 6em; font-size: .95em; }
.su-seg { display: flex; gap: .6em; padding: .1em .1em .3em; }
.su-opt { flex: 1 1 0; min-width: 0; flex-direction: column; gap: .1em; padding: .5em .3em .55em; --c: #4a2d7c; --cd: #2e1a55; --tc: var(--text); }
.su-opt.on { --c: var(--yellow); --cd: var(--yellow-d); --tc: var(--ink); }
.su-val { font-size: 2.3em; line-height: 1; }
.su-lbl { font-size: .8em; max-width: 100%; }
.su-pips { display: flex; gap: .25em; margin: .15em 0 .1em; }
.su-pips i { width: .8em; height: .8em; border-radius: 50%; background: rgba(255, 255, 255, .22); border: .1em solid var(--ink); }
.su-pips i.on { background: currentColor; }
.su-opt:not(.on) .su-pips i.on { background: var(--yellow); }
.su-hint { text-align: center; font-size: .8em; color: var(--text-dim); font-weight: 600; }
.su-start { flex: none; width: min(100%, 14em); font-size: 1.7em; }
.short .su-grid, .short #scr-setup.active { gap: .5em; }
.short #scr-setup.active { gap: .5em; }
.short .su-title { font-size: 1.9em; }
.short .su-card { padding: .4em .7em .5em; gap: .3em; }
.short .su-val { font-size: 1.6em; }
.short .su-opt { padding: .3em .3em .35em; }
.short .su-hint { display: none; }
.short .su-start { font-size: 1.3em; }
.short .su-mode { display: none; }
.su-pips { align-self: center; } .su-pips i { flex: none; display: block; }
.portrait #scr-setup.active { font-size: clamp(12px, 4.3cqw, 24px); }
.landscape #scr-setup.active { font-size: clamp(11px, 3cqmin, 28px); }
.portrait .short #scr-setup.active { font-size: clamp(11px, 3cqmin, 20px); }
.btn > .su-pips { display: flex; }

/* ----- round result card (compact, winner colour as accent) ----- */
.rr { justify-content: flex-start; --acc: var(--purple); }
.rr-card { --acc: var(--purple); margin-top: clamp(.8em, 7cqh, 5em); width: min(94%, 33em); max-height: calc(100% - 14cqh - 4em); padding: .7em .9em .6em; display: flex; flex-direction: column; min-height: 0;
    background: linear-gradient(180deg, rgba(36, 18, 63, .97), rgba(16, 8, 34, .97)); border: .15em solid var(--ink); border-top: .35em solid var(--acc); border-radius: .9em;
    box-shadow: 0 .3em 0 var(--ink), 0 0 1.6em color-mix(in srgb, var(--acc) 45%, transparent), 0 1em 2em rgba(0, 0, 0, .5); animation: cardIn .45s var(--ease-spring) both; }
.rr-card.team1 { --acc: var(--t1); } .rr-card.team2 { --acc: var(--t2); }
@keyframes cardIn { from { transform: translateY(-1.2em) scale(.92); opacity: 0; } }
.rr-banner { display: flex; flex-direction: column; gap: .25em; min-width: 0; }
.rr-head { display: flex; align-items: center; gap: .55em; min-width: 0; }
.rr-badge { flex: none; padding: .05em .55em; border-radius: 1em; background: var(--acc); color: var(--ink); font-family: var(--font-display); font-size: .8em; line-height: 1.3; }
.rr-title { flex: 1; min-width: 0; font-size: 1.35em; line-height: 1.15; color: #fff; text-shadow: 0 .06em 0 var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rr-line { font-size: .85em; line-height: 1.25; color: var(--text-dim); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rr-score { margin-top: .6em; display: flex; justify-content: space-between; gap: 1em; width: 100%; }
.rr-side { flex: 1; align-items: stretch; }
.rr-side.p1 { align-items: flex-start; } .rr-side.p2 { align-items: flex-end; }
.rr-name { max-width: 100%; font-size: .9em; }
.rr-trophies .trophy { width: 1.6em; height: 1.6em; }
.short .rr-card { margin-top: 2cqh; padding: .4em .8em .35em; max-height: calc(100% - 12cqh - 3em); }
.short .rr-score { margin-top: .3em; } .short .rr-line { -webkit-line-clamp: 1; }
.rr-card.out { }

/* ----- one-time feedback dialog (ui/feedback.js): reuses the modal / button look ----- */
.fb-modal { width: min(92%, 30em); }
.fb-title { font-size: 1.35em; text-wrap: balance; }
.fb-title.fb-heart { font-size: 3em; line-height: 1; color: var(--coral); text-shadow: 0 .06em 0 var(--ink); }
.fb-body { display: flex; flex-direction: column; gap: .8em; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: .3em .5em .6em; margin: -.3em -.5em -.6em; }
.fb-faces { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6em; }
.fb-rate { flex-direction: column; gap: .25em; padding: .55em .25em; min-height: 5.4em; font-size: .95em; min-width: 0; }
.fb-rate .fb-lbl { max-width: 100%; }
.fb-emoji { display: block; font-size: 2.3em; line-height: 1; text-transform: none; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.fb-rate.fb-good { --c: var(--green); --cd: var(--green-d); --tc: var(--ink); }
.fb-rate.fb-bad { --c: var(--coral); --cd: var(--coral-d); --tc: #fff; }
.fb-text { text-align: center; margin: 0; font-size: 1.15em; font-weight: 700; text-wrap: balance; }
.fb-hint { text-align: center; margin: 0; font-size: .85em; color: var(--text-dim); }
.fb-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: .5em; }
.fb-chip { min-height: 44px; padding: .4em .9em; border: .18em solid var(--ink); border-radius: 2em; cursor: pointer; touch-action: none;
    background: linear-gradient(180deg, #5a3a92, #3b2268); color: var(--text); font-weight: 800; font-size: .95em; font-family: inherit;
    box-shadow: 0 .2em 0 var(--ink), inset 0 .1em 0 rgba(255, 255, 255, .2); transition: transform .12s var(--ease-spring); }
.fb-chip.on { background: linear-gradient(180deg, #ffe27a, var(--yellow-d)); color: var(--ink); transform: translateY(.1em); }
.fb-chip.pressed { transform: translateY(.18em) scale(.97); }
.fb-chip:focus-visible { outline: .22em solid #fff; outline-offset: .12em; }
.fb-btns { display: flex; justify-content: center; }
.fb-btns .btn { min-width: 8em; }
.short .fb-body { gap: .45em; }
.short .fb-title { font-size: 1.1em; }
.short .fb-title.fb-heart { font-size: 1.8em; }
.short .fb-rate { min-height: 4em; } .short .fb-emoji { font-size: 1.8em; }
.short .fb-chip { min-height: 44px; padding: .25em .7em; font-size: .85em; }
.short .fb-hint { display: none; }
.short .fb-btns .btn.big { font-size: 1.2em; padding: .4em 1.1em; }
.landscape:not(.short) .fb-modal { width: min(70%, 30em); }

/* ----- Settings > Graphics ----- */
.set-gfx { flex-wrap: wrap; }
.set-gfx .seg { flex: 1 1 100%; }
.set-gfx .seg .btn { min-width: 0; padding: .45em .2em; font-size: .8em; }
.set-gfx .seg .btn .fit { max-width: 100%; }

/* ----- LOCAL chooser: two big cards (VS BOT primary, 1v1). Stacked rows in portrait, side by side in landscape ----- */
.local-modal { width: min(92%, 27em); gap: .9em; padding-top: 1.2em; }
.landscape .local-modal { width: min(92%, 38em); }
.local-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: .7em; }
.landscape .local-cards { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.btn.local-card { --c: #4a2d7c; --cd: #2e1a55; --tc: var(--text); --ac: var(--coral); display: flex; flex-direction: row; align-items: center; gap: .9em; text-align: left;
    padding: .8em 1em; min-height: 6.4em; font-size: 1.1em; }
.btn.local-card.bot { --ac: var(--cyan); }
.btn.local-card.primary { --c: #5b3a98; --cd: #36206a; box-shadow: 0 .28em 0 var(--cd), 0 0 0 .14em var(--cyan), 0 .5em 1.1em rgba(53, 201, 238, .25); }
.btn.local-card > .lc-art { flex: none; width: 4.4em; height: 4.4em; display: grid; place-items: center; border-radius: .9em; background: rgba(12, 6, 26, .5); box-shadow: inset 0 .12em .4em rgba(0, 0, 0, .45); padding: .35em; }
.lc-art svg { width: 100%; height: 100%; display: block; }
.btn.local-card > .lc-txt { flex: 1 1 0; min-width: 0; max-width: none; display: flex; flex-direction: column; gap: .25em; }
.lc-name { font-size: 1.55em; line-height: 1; color: var(--ac); }
.lc-sub { font-size: .9em; font-weight: 800; opacity: .9; line-height: 1.15; white-space: normal; overflow: visible; text-wrap: balance; }
.landscape .btn.local-card { flex-direction: column; text-align: center; gap: .6em; padding: .9em .8em; }
.landscape .btn.local-card > .lc-art { width: 5.4em; height: 5.4em; }
.landscape .btn.local-card > .lc-txt { align-items: center; flex: none; max-width: 100%; }
.short .local-modal { gap: .5em; }
.short .btn.local-card { padding: .45em .7em; min-height: 0; }
.short .btn.local-card > .lc-art { width: 2.8em; height: 2.8em; }
.short.landscape .btn.local-card { flex-direction: row; text-align: left; }
.short.landscape .btn.local-card > .lc-txt { align-items: flex-start; flex: 1 1 0; }
.short .lc-name { font-size: 1.3em; }
.short .lc-sub { font-size: .8em; }

/* ----- "NEXT MATCH 5…" countdown on the result screen's main button (game/nextMatch.js): a thin bar runs down along its lower edge ----- */
.btn.nm-run::after { content: ''; position: absolute; left: 1em; right: 1em; bottom: .34em; height: .2em; border-radius: .2em; background: rgba(14, 8, 28, .55);
    transform-origin: left center; animation: nmRun 5s linear forwards; pointer-events: none; }
@keyframes nmRun { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .btn.nm-run::after { animation: none; display: none; } }
