:root {
  color-scheme: dark;
  --paper: #f5eedb;
  --muted: #c4cbb9;
  --ink: #17251e;
  --lime: #e2ed7c;
  --lilac: #ddc5f8;
  font: 16px/1.45 system-ui, sans-serif;
}
* { box-sizing: border-box }
[hidden] { display: none !important }
body { margin: 0; color: var(--paper); background: var(--ink); }
a { color: inherit; text-underline-offset: .23em }
button { font: inherit; color: var(--paper); cursor: pointer; min-width: 44px; min-height: 44px; border: 1px solid #87947b; background: #283a30; border-radius: 6px; }
button:hover { background: #385044; }
:focus-visible { outline: 3px solid white; outline-offset: 3px; }
.mast { max-width: 1480px; margin: auto; height: 75px; padding: 0 max(22px, env(safe-area-inset-right)) 0 max(22px, env(safe-area-inset-left)); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 11px; justify-self: start; text-decoration: none; font-weight: 850; font-size: .79rem; letter-spacing: .12em; white-space: nowrap; }
.brand i { display: block; width: 21px; height: 21px; border: 2px solid var(--lime); border-radius: 50%; position: relative; transform: rotate(-38deg); }
.brand i::before { content: ''; width: 25px; left: -4px; top: 8px; height: 2px; background: var(--lime); position: absolute; }
.mast h1 { margin: 0; font-size: clamp(1.6rem, 3.2vw, 2.45rem); font-weight: 950; letter-spacing: -.04em; line-height: 1; }
.rules-link { justify-self: end; font-size: .88rem; font-weight: 700; min-height: 44px; display: flex; align-items: center; gap: 9px; }
.rules-link span { color: var(--lime); }
body:has(.language-nav) .mast { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr); }
body:has(.language-nav) .mast h1 { text-align: center; font-size: clamp(1.4rem, 3vw, 2.45rem); text-wrap: balance; }
body:has(.language-nav) .rules-link { text-align: right; }
#game { --pad-size: clamp(45px, 8dvh, 60px); --deck-inset: max(12px, env(safe-area-inset-bottom)); width: min(calc(100% - max(44px, env(safe-area-inset-left) + env(safe-area-inset-right))), 1450px); height: clamp(365px, calc(100dvh - 90px), 920px); margin: 0 auto; position: relative; isolation: isolate; overflow: hidden; border-radius: 15px; background: #2a4738; touch-action: none; user-select: none; -webkit-touch-callout: none; }
#ring, .stitch, .overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.stitch { inset: 8px; width: auto; height: auto; border: 1px dashed #ded9a968; border-radius: 10px; pointer-events: none; }
.hud { z-index: 1; position: absolute; top: clamp(11px, 4%, 25px); left: 50%; width: min(86%, 830px); transform: translateX(-50%); display: grid; grid-template-columns: minmax(0, 1fr) minmax(77px, 120px) minmax(0, 1fr); align-items: start; gap: clamp(8px, 2.4vw, 24px); pointer-events: none; }
.status { position: relative; color: var(--lilac); padding: 9px 13px 10px; border-radius: 5px; background: #16271f; border: 1px solid #d5dbc272; min-width: 0; }
.status.lime { color: var(--lime); }
#game[data-mode=tutorial] .status.lime { color: #f0c891; }
.status div { font-size: .83rem; display: flex; justify-content: space-between; gap: 2px 6px; align-items: center; white-space: nowrap; }
.status span { overflow: hidden; text-overflow: ellipsis; }
meter { margin-top: 6px; width: 100%; height: 11px; display: block; border-radius: 2px; background: #354739; accent-color: currentColor; }
meter::-webkit-meter-bar { background: #354739; border: 0; border-radius: 2px; }
meter::-webkit-meter-optimum-value { background: currentColor; border-radius: 2px; }
meter::-moz-meter-bar { background: currentColor; border-radius: 2px; }
.status .damage { position: absolute; left: 0; top: calc(100% + 5px); padding: 3px 7px; border: 1px solid currentColor; border-radius: 4px; background: #16271f; font-variant-numeric: tabular-nums; }
.status.lime .damage { left: auto; right: 0; }
.damage meter { width: clamp(21px, 4vw, 42px); height: 5px; margin: 0 0 0 2px; }
.round { display: flex; align-items: center; flex-flow: column; min-width: 0; color: var(--paper); text-align: center; text-shadow: 0 2px 5px #111e16; line-height: 1.1; }
.round strong { font-weight: 950; font-size: clamp(1.8rem, 3vw, 2.65rem); font-variant-numeric: tabular-nums; }
.round span { font-size: .78rem; font-weight: 740; margin-top: 4px; }
.pause { position: absolute; z-index: 2; top: max(109px, 18%); right: 7%; width: 44px; padding: 0; font-size: 1.2rem; background: #17291f; }
.controls { position: absolute; z-index: 2; inset: auto 0 0; pointer-events: none; }
.deck { display: flex; align-items: end; justify-content: space-between; position: absolute; bottom: var(--deck-inset); left: 4%; right: 4%; color: var(--lilac); }
.deck.p2 { bottom: calc(var(--deck-inset) + var(--pad-size) + 7px); color: var(--lime); }
.motion, .moves { display: flex; gap: 5px; }
.deck button { width: clamp(45px, 10.4vw, 66px); height: var(--pad-size); line-height: 1; padding: 3px; background: #1b2c23; border-color: currentColor; color: inherit; box-shadow: inset 0 -3px #0005; pointer-events: auto; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 3px; }
.deck button[data-down], .deck button:active { background: currentColor; }
.deck button[data-down] > *, .deck button:active > * { color: var(--ink); }
.deck button b { font-size: 1.46rem; line-height: .9; }
.deck button span { font-size: .7rem; font-weight: 750; max-width: 100%; hyphens: auto; overflow-wrap: anywhere; }
.coach { position: absolute; z-index: 3; left: 50%; bottom: max(18%, calc(var(--pad-size) + var(--deck-inset) + 7px)); width: max-content; max-width: 90%; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; pointer-events: none; }
.coach p { margin: 0; padding: 8px 12px; border-radius: 4px; background: var(--paper); color: var(--ink); font-size: .88rem; text-align: center; font-weight: 770; }
.coach button { flex-shrink: 0; padding: 0 9px; font-size: .8rem; font-weight: 750; pointer-events: auto; }
#game[data-match=duel] .coach { bottom: max(18%, calc(var(--pad-size) * 2 + var(--deck-inset) + 12px)); }
.overlay { z-index: 4; display: grid; align-items: center; justify-items: start; padding: 4% 5%; pointer-events: none; }
.overlay.shaded { justify-items: center; background: #10191480; }
#end.overlay { align-items: start; padding-top: clamp(22px, 4vh, 52px); background: #111a1454; }
#end .ticket { max-width: min(91%, 530px); }
#end h2 { font-size: clamp(2rem, 4.1vw, 3.4rem); }
#result-note { margin: 6px 0; font-weight: 825; }
#result-exchange { margin: 0 0 12px; font-size: .92rem; }
@media (min-width: 650px) {
  #game[data-result-side=left] #end { justify-items: start; }
  #game[data-result-side=right] #end { justify-items: end; }
}
.ticket { max-width: 100%; width: max-content; padding: clamp(16px, 2.3vw, 31px); background: var(--paper); color: var(--ink); border-radius: 7px; border: 2px solid #12231a; outline: 1px dashed #17251e75; outline-offset: -8px; pointer-events: auto; box-shadow: 5px 7px #12231a; }
.ticket h2 { font-size: clamp(2.45rem, 5.2vw, 5.65rem); line-height: .88; letter-spacing: -.055em; margin: 0 0 19px; font-weight: 950; }
.ticket .eyebrow { font-weight: 850; font-size: .76rem; letter-spacing: .13em; margin: 0 0 12px; }
.ticket button { color: var(--ink); padding: 0 10px; border-color: var(--ink); background: transparent; font-size: .87rem; font-weight: 800; }
.ticket button:hover, .ticket button[aria-pressed=true] { background: #e0dfba; }
.ticket button:focus-visible { outline-color: #145a3b; }
.ticket .primary { display: flex; align-items: center; justify-content: space-between; gap: 15px; width: 100%; background: var(--lime); margin: 0 0 6px; padding: 0 13px; font-size: 1rem; text-align: left; }
.ticket .primary:hover { background: #eaf5a1; }
.ticket .primary span { font-size: 1.2rem; }
.menu-row { display: flex; gap: 5px; }
.menu-row button { flex: 1; white-space: nowrap; padding-inline: 8px; }
.menu-row button:last-child { flex: 0 0 44px; font-size: 1.15rem; }
.small-ticket { min-width: min(295px, 100%); max-width: min(92vw, 440px); text-align: center; }
.small-ticket h2 { font-size: clamp(2rem, 5vw, 4rem); line-height: .96; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin: 5px 0; }
.loadout, .arena-list { display: grid; gap: 5px; margin: 0 0 8px; }
.loadout { grid-template-columns: repeat(3, 1fr); }
.arena-list { grid-template-columns: 1fr 1fr; }
.arena-list button { width: 100%; }
.arena-list button:disabled { opacity: .63; cursor: default; }
.arena-list small { display: block; font-size: .73rem; }
.options button[aria-pressed=true]::before { content: '✓ '; }
.options button[aria-pressed=false]::before { content: '○ '; }
article, .legal, footer { width: min(calc(100% - 44px), 830px); margin: 0 auto; }
article { padding: clamp(32px, 6vw, 78px) 0; font-size: 1.07rem; }
.legal h1 { font-size: clamp(1.8rem, 5vw, 3.35rem); line-height: 1.05; letter-spacing: -.055em; }
article h2, .legal h2 { font-size: 1.3rem; line-height: 1.2; margin-top: 1.8em; }
#how { padding-top: clamp(12px, 2vw, 30px); }
.language-nav { display: flex; justify-content: center; flex-wrap: wrap; column-gap: 16px; row-gap: 0; padding: 4px 12px 0; color: var(--muted); font-size: .86rem; }
.language-nav a { display: inline-flex; min-height: 44px; align-items: center; padding-inline: 3px; }
.language-nav a[aria-current=page] { color: var(--lime); font-weight: 750; text-decoration: none; }
article li + li { margin-top: .55em; }
article kbd { border: 1px solid #97a597; border-radius: 4px; padding: 0 .28em; }
article dd { margin: 3px 0 16px; }
.legal { padding: clamp(26px, 5vw, 70px) 0; }
footer { display: flex; justify-content: space-between; gap: 10px 24px; flex-wrap: wrap; border-top: 1px dashed #899b86; color: var(--muted); padding: 14px 0 max(20px, env(safe-area-inset-bottom)); font-size: .9rem; }
footer nav { display: flex; flex-wrap: wrap; column-gap: 17px; }
footer a { display: inline-flex; min-height: 44px; align-items: center; }
footer > span { display: flex; align-items: center; }
@media (max-width: 590px) {
  .mast { height: 61px; padding-inline: max(10px, env(safe-area-inset-left)); gap: 8px; grid-template-columns: 1fr auto; }
  body:has(.language-nav) .mast { grid-template-columns: minmax(0, 1fr) auto; }
  body:has(.language-nav) .mast h1 { text-align: start; }
  .mast .brand { display: none; }
  .rules-link { font-size: .8rem; }
  #game { width: calc(100% - max(12px, env(safe-area-inset-left) + env(safe-area-inset-right))); height: clamp(360px, calc(100dvh - 73px), 950px); border-radius: 10px; }
  .stitch { inset: 5px; border-radius: 7px; }
  #menu.overlay { align-items: start; padding: 8% 7%; }
  #menu h2 { margin-bottom: 12px; }
  #end.overlay { padding-top: 9%; }
  #end h2 { font-size: clamp(1.95rem, 8.6vw, 3.1rem); }
  .ticket h2 { font-size: clamp(3.1rem, 12vw, 4.2rem); }
  .ticket h2 { hyphens: auto; overflow-wrap: anywhere; }
  html:not([lang=en]) #menu h2 { font-size: clamp(2.4rem, 11vw, 4.2rem); }
  html:lang(de) #menu h2 { font-size: clamp(2.2rem, 10vw, 4.2rem); }
  .menu-row button { white-space: normal; }
  .small-ticket h2 { font-size: clamp(2rem, 9.5vw, 3.1rem); }
  .options, .arena-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .loadout { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ticket button, .coach button { hyphens: auto; overflow-wrap: anywhere; }
  .coach button { max-width: 42%; }
  .hud { width: 92%; grid-template-columns: minmax(0, 1fr) clamp(67px, 22vw, 95px) minmax(0, 1fr); }
  .status { padding: 6px; }
  .status div { font-size: .72rem; }
  .round span { font-size: .68rem; }
  .pause { top: max(104px, 15%); right: 4%; }
  html:lang(fr) .deck [data-pad=kick] span { font-size: .62rem; text-wrap: balance; }
}
@media (min-width: 591px) and (orientation: portrait) {
  #menu.overlay { align-items: start; justify-items: center; padding-top: 7%; }
}
@media (min-width: 620px) and (orientation: landscape) {
  #game[data-match=duel] .deck { width: 44%; }
  #game[data-match=duel] .deck button { width: clamp(44px, 6vw, 60px); }
  .deck.p2 { left: auto; bottom: var(--deck-inset); }
  #game[data-match=duel] .coach { bottom: max(18%, calc(var(--pad-size) + var(--deck-inset) + 7px)); }
}
@media (max-height: 505px) and (orientation: landscape) {
  .mast { height: 47px; }
  #game { height: calc(100dvh - 55px); min-height: 260px; }
  .overlay { padding-block: 4px; }
  #end.overlay { padding-top: 6px; }
  .ticket { padding: 13px; }
  .ticket h2 { font-size: 2.15rem; margin-bottom: 8px; }
  .ticket .eyebrow { margin-bottom: 5px; }
  .small-ticket p { margin-block: 5px; }
  .pause { top: max(102px, 26%); }
}
@media (min-width: 780px) and (max-height: 505px) and (orientation: landscape) {
  #game[data-match=solo] .coach { bottom: var(--deck-inset); max-width: min(38%, calc(92% - 426px)); }
}
