:root {
  color-scheme: dark;
  --page: #152326;
  --paper: #f2f1e2;
  --muted: #b7bbaa;
  --lime: #dcfa62;
  --violet: #d7befa;
  --line: #395256;
  font-family: system-ui, sans-serif;
  color: var(--paper);
  background: var(--page);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
button, a { -webkit-tap-highlight-color: transparent; }
button {
  color: inherit;
  background: #282e25;
  border: 1px solid #59604f;
  border-radius: 3px;
  font: inherit;
  min-height: 44px;
  cursor: pointer;
}
a { color: inherit; }
:focus-visible { outline: 3px solid white; outline-offset: 3px; }
.skip { position: absolute; z-index: 20; left: 10px; top: -50px; background: var(--page); padding: 10px; }
.skip:focus { top: 8px; }
.masthead, main, .footer { width: min(100% - 44px, 1600px); margin-inline: auto; }
.masthead {
  height: calc(68px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
h1 { margin: 0; font-size: clamp(26px, 3.2vw, 45px); letter-spacing: -.075em; font-weight: 950; line-height: 1; }
h1 em { color: var(--lime); font-style: normal; }
.mark { display: inline-flex; gap: .09em; transform: skewX(-23deg); margin: 0 .30em 0 .08em; vertical-align: .04em; }
.mark i { display: block; width: .105em; height: .53em; background: var(--lime); }
.mark i:first-child { opacity: .43; }
.mark i:nth-child(2) { opacity: .7; }
.rule-link { font-size: .88rem; padding: 13px 0; text-underline-offset: 4px; white-space: nowrap; color: var(--muted); }
#game {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: min(980px, max(510px, calc(100dvh - 90px)));
  overflow: hidden;
  border: 1px solid #638184;
  background: #203639;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
#court { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#game:focus-visible { outline: 2px solid #8a9a6b; outline-offset: 1px; }
.hud { position: absolute; z-index: 1; top: 9px; left: 0; width: 100%; display: grid; place-items: center; pointer-events: none; }
.scoreboard {
  display: grid;
  grid-template-columns: minmax(75px, 1fr) 70px minmax(75px, 1fr);
  align-items: stretch;
  background: #14252a;
  border: 1px solid #577276;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  box-shadow: 0 3px 0 #0e1e22ba;
}
.score { display: flex; padding: 5px 9px; gap: 9px; align-items: center; justify-content: space-between; font-size: .735rem; font-weight: 750; }
.score strong { font-family: "Arial Narrow", system-ui, sans-serif; font-size: 1.65rem; line-height: 1; }
.score.lime { color: var(--lime); border-top: 2px solid currentColor; }
.score.violet { color: var(--violet); border-top: 2px solid currentColor; }
.clock { display: grid; place-items: center; font-weight: 850; border-inline: 1px solid #52584a; }
.clock.overtime { background: #765834; color: #fff3d4; }
.utilities { position: absolute; z-index: 3; right: 9px; top: 9px; display: flex; gap: 5px; }
.utility { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; background: #1d221c; }
.pause-icon { width: 12px; height: 15px; border-left: 4px solid; border-right: 4px solid; }
.sound-icon { position: relative; width: 18px; height: 16px; }
.sound-icon::before { content: ""; position: absolute; inset: 1px 5px 1px 0; background: currentColor; clip-path: polygon(0 32%, 40% 32%, 90% 0, 90% 100%, 40% 68%, 0 68%); }
.sound-icon::after { content: ""; position: absolute; width: 8px; height: 12px; border-right: 2px solid; border-radius: 50%; top: 2px; right: 0; }
.utility[aria-pressed="false"] .sound-icon::after { transform: rotate(45deg); border-radius: 0; width: 1px; }
.notice {
  position: absolute;
  z-index: 2;
  top: 55px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 16px);
  padding: 7px 12px;
  color: #181c14;
  background: var(--lime);
  border-left: 4px solid #141813;
  font-size: .84rem;
  font-weight: 800;
  text-align: center;
  pointer-events: none;
}
.notice[data-tone="lilac"] { background: var(--violet); }
.notice[data-tone="gold"] { background: #ffe4a0; }
.practice-actions {
  position: absolute;
  top: 91px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  width: max-content;
  z-index: 3;
}
.practice-actions button { padding: 4px 11px; font-size: .85rem; background: #1d221c; }
#next-drill { background: var(--lime); border-color: var(--lime); color: #181c14; font-weight: 850; }
.controls {
  position: absolute;
  z-index: 2;
  bottom: 8px;
  inset-inline: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  pointer-events: none;
}
.drive { --team: var(--lime); display: flex; align-items: end; gap: 8px; pointer-events: auto; }
.controls[data-hand="right"]:not(:has(.second:not([hidden]))),
.controls[data-hand="right"]:not(:has(.second:not([hidden]))) .drive {
  flex-direction: row-reverse;
}
.drive.second { --team: var(--violet); order: 2; }
.drive.violet-drive { --team: var(--violet); }
.drive.lime-drive { --team: var(--lime); }
.pad { display: grid; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(2, 44px); gap: 2px; }
[data-drive] {
  color: var(--team);
  background: var(--drive-background, #233b3e);
  border-color: #739491;
  box-shadow: inset 0 -3px #112426;
  line-height: 1;
  padding: 0;
  font-size: .89rem;
}
[data-drive="up"] { grid-column: 2; }
[data-drive="left"] { grid-area: 2 / 1; }
[data-drive="down"] { grid-area: 2 / 2; }
[data-drive="right"] { grid-area: 2 / 3; }
.boost { width: 60px; height: 48px; font-size: .8rem; font-weight: 800; border-color: var(--team); }
[data-drive].held, [data-drive]:active { background: var(--team); color: #181c14; box-shadow: inset 0 -2px #17201155; }
#key-guide { font-size: .8rem; margin: 30px 0 0; color: #e0e3d4; order: 3; text-align: right; }
.overlay { position: absolute; z-index: 5; inset: 0; display: grid; place-items: end center; padding: 12px 12px 23px; pointer-events: none; }
.overlay.modal { place-items: center; background: #11150db5; padding: 10px; pointer-events: auto; }
#result.overlay { background: linear-gradient(180deg, #12160d3b, #11160d69 70%, #11160d97); }
.ticket {
  width: min(100%, 310px);
  padding: 14px;
  background: #1a1f17;
  border: 1px solid #828971;
  border-top: 4px solid var(--lime);
  box-shadow: 6px 6px 0 #11160eb5;
  pointer-events: auto;
}
.ticket-tag { margin: 0 0 3px; color: var(--muted); font-size: .8rem; font-weight: 700; }
.ticket-tag span { display: inline-block; vertical-align: .06em; width: .55em; height: .55em; margin-right: .5em; background: var(--lime); transform: skew(-18deg); }
.ticket-title { margin: 0 0 12px; font-size: clamp(29px, 4vw, 43px); font-weight: 950; line-height: .96; letter-spacing: -.07em; }
.rivals, .levels { display: flex; gap: 4px; }
.rivals button, .levels button, .settings button { flex: 1; font-size: .84rem; font-weight: 690; padding: 5px 6px; }
.rivals button[aria-pressed="true"], .levels button[aria-pressed="true"], .settings button[aria-pressed="true"] { color: var(--lime); background: #313b24; border-color: #a3b863; }
.levels { margin-top: 5px; }
.primary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 5px 14px;
  min-height: 49px;
  margin-top: 9px;
  color: #1a2012;
  background: var(--lime);
  border-color: var(--lime);
  font-size: 1.08rem;
  font-weight: 900;
}
.primary:hover { background: #edff9b; }
.primary:active { transform: translateY(2px); }
.fast-mark {
  display: block;
  width: 23px;
  height: 13px;
  transform: skewX(-23deg);
  background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 8px);
  opacity: .8;
}
.ticket-brand .ticket-title { color: #f5f4e3; }
.boost { --drive-background: #394d28; }
.violet-drive .boost, .second:not(.lime-drive) .boost { --drive-background: #3c3048; }
#result[data-winner="lilac"] .ticket { border-top-color: var(--violet); }
#result[data-winner="lilac"] .ticket-tag span { background: var(--violet); }
#result[data-winner="draw"] .ticket { border-top-color: #e8dfb9; }
#game[data-reduced="false"] #result:not([hidden]) .ticket { animation: settle .2s ease-out both; }
@keyframes settle { from { transform: translateY(8px); opacity: .78; } to { transform: translateY(0); opacity: 1; } }
.plain { display: block; width: 100%; margin-top: 7px; background: transparent; border-color: #555d4b; }
.menu-actions { display: grid; grid-template-columns: minmax(0, 2fr) minmax(70px, 1fr); gap: 5px; }
.menu-actions .primary, .menu-actions .plain { margin: 0; }
.menu-actions .plain { border-color: #737e5c; font-weight: 750; }
.pause-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 10px; }
.settings [data-act="hand"] { grid-column: 1 / -1; }
#result-detail { margin: 0; color: var(--muted); font-size: .92rem; }
.guide, .legal { max-width: 760px; margin: 54px auto; font-size: 1.03rem; line-height: 1.64; overflow-wrap: anywhere; }
.guide h2, .legal h2 { font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.1; letter-spacing: -.04em; margin: 1.8em 0 .45em; }
.guide h3 { font-size: 1.12rem; margin-bottom: .15em; }
.guide h3 + p { margin-top: 0; }
.guide p, .guide li, .legal p { color: #d2d5c6; }
.guide li + li { margin-top: .5em; }
.guide .independent { color: var(--muted); font-size: .92rem; }
.back-to-court { display: inline-flex; min-height: 44px; align-items: center; }
kbd { color: var(--lime); font: inherit; font-weight: 760; }
.footer { display: flex; flex-wrap: wrap; gap: 20px; padding: 19px 0 27px; border-top: 1px solid var(--line); font-size: .88rem; color: var(--muted); }
.language-links, .footer-info { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; }
.language-links { flex-basis: 100%; }
.language-links [aria-current="page"] { color: var(--lime); font-weight: 750; }
.footer-info > span { color: var(--paper); }
:root:not(:lang(en)) .masthead { gap: 10px; }
:root:not(:lang(en)) .masthead h1 { font-size: clamp(20px, 3.2vw, 45px); }
:root:not(:lang(en)) #menu .ticket-title { white-space: normal; font-size: clamp(22px, 2.45vw, 34px); }
:root:not(:lang(en)) .rivals button,
:root:not(:lang(en)) .levels button,
:root:not(:lang(en)) .menu-actions > button { min-width: 0; overflow-wrap: anywhere; }
:root:not(:lang(en)) .practice-actions { max-width: calc(100% - 12px); }
.legal { padding: 0 5px; }
.legal h1 { margin-bottom: 22px; }
@media (min-width: 681px) {
  #menu { padding-bottom: 20px; }
  #menu .ticket {
    width: min(100%, 721px);
    display: grid;
    grid-template-columns: minmax(165px, 1fr) minmax(215px, 1.5fr) minmax(178px, 1fr);
    align-items: center;
    gap: 5px 13px;
    padding: 11px 12px 11px 16px;
  }
  #menu .ticket-brand { grid-row: span 2; }
  #menu .ticket-title { font-size: 34px; margin: 0; white-space: nowrap; }
  #menu .rivals { grid-area: 1 / 2; }
  #menu .levels { grid-area: 2 / 2; margin: 0; }
  #menu .menu-actions { grid-area: 1 / 3 / span 2; align-self: stretch; }
  #menu .ticket:has(.levels[hidden]) { min-height: 94px; }
}
@media (max-width: 680px) and (orientation: portrait) {
  .masthead, main, .footer { width: calc(100% - 16px); }
  .masthead { height: calc(54px + env(safe-area-inset-top)); }
  #game { height: min(900px, max(510px, calc(100dvh - 56px - env(safe-area-inset-top) - env(safe-area-inset-bottom)))); }
  .hud { justify-items: start; padding-left: 7px; }
  .scoreboard { grid-template-columns: minmax(69px, 1fr) 55px minmax(69px, 1fr); }
  .score { padding-inline: 6px; gap: 6px; }
  .utilities { right: 6px; top: 7px; }
  #menu { padding: 8px 6px 5px; }
  #menu .ticket {
    position: relative;
    width: min(100%, 480px);
    display: grid;
    grid-template-columns: minmax(118px, .9fr) minmax(0, 1.25fr);
    gap: 4px 5px;
    padding: 5px;
  }
  #menu .ticket-brand { display: none; }
  #menu[data-record="true"] .ticket-brand {
    display: block;
    position: absolute;
    bottom: 100%;
    inset-inline-start: 2px;
    padding: 2px 6px;
    background: #1a1f17;
  }
  #menu .ticket-title { display: none; }
  #menu .levels { margin: 0; }
  #menu .ticket:has(.levels[hidden]) .rivals { grid-column: 1 / -1; }
  #menu .menu-actions { grid-column: 1 / -1; }
  .controls { inset-inline: 8px; gap: 4px; }
  .controls:has(.second:not([hidden])) { justify-content: space-between; }
  .controls:has(.second:not([hidden])) .drive { gap: 2px; flex-direction: row !important; }
  .controls:has(.second:not([hidden])) .second { flex-direction: row-reverse !important; }
  .controls:has(.second:not([hidden])) .pad { gap: 0; }
  .controls:has(.second:not([hidden])) .boost { width: 44px; }
  #key-guide { display: none; }
  .guide, .legal { margin-block: 36px; padding: 0 8px; }
}
@media (max-width: 425px) and (orientation: portrait) {
  .hud { top: 7px; }
  .scoreboard { grid-template-columns: 27px 38px 27px; }
  .score { justify-content: center; padding: 3px 0; }
  .score strong { font-size: 1.4rem; }
  .clock { font-size: .88rem; }
  .score span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #menu .ticket { grid-template-columns: minmax(131px, 1fr) minmax(0, 1.24fr); padding: 4px; }
  #menu .rivals button { padding-inline: 3px; font-size: .77rem; }
}
@media (orientation: portrait) {
  #game { --play-hud-space: 54px; --menu-hud-space: 54px; }
  #game[data-matchup="solo"] { --play-control-space: 126px; }
  #game[data-matchup="duel"] { --play-control-space: 79px; }
  #game[data-matchup="solo"] .controls { inset-inline: 0; bottom: 0; }
  #game[data-matchup="solo"] .drive {
    width: 100%;
    justify-content: space-between;
    align-items: end;
    padding: 4px 9px 8px;
    background: #12282d;
    border-top: 1px solid #537777;
  }
  #game[data-matchup="solo"] .pad {
    grid-template-columns: repeat(3, 56px);
    grid-template-rows: repeat(2, 56px);
    gap: 4px;
  }
  #game[data-matchup="solo"] .boost {
    width: clamp(68px, 21vw, 110px);
    height: 62px;
    font-size: .93rem;
  }
  #game[data-matchup="solo"] .pad button { font-size: 1.05rem; }
  #game:not([data-screen="tutorial"]) .notice {
    top: 9px;
    left: 10px;
    transform: none;
    max-width: calc(50% - 122px);
  }
  #game[data-screen="tutorial"] .notice { top: 52px; }
  #game[data-screen="tutorial"] .practice-actions { top: 87px; }
  #key-guide { display: none; }
}
@media (max-width: 680px) and (orientation: portrait) {
  #game { --menu-hud-space: 20px; }
  #game:not([data-screen="tutorial"]) .notice {
    top: 11px;
    left: 50%;
    transform: translateX(-50%);
    max-width: none;
  }
}
@media (min-width: 426px) and (max-width: 680px) and (orientation: portrait) {
  #game { --menu-hud-space: 52px; }
  .scoreboard { grid-template-columns: 40px 49px 40px; }
  .score { justify-content: center; padding-inline: 0; }
  .score span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
@media (min-width: 345px) and (max-width: 680px) and (max-height: 700px) and (orientation: portrait) {
  #game[data-matchup="solo"] { --play-control-space: 72px; }
  #game[data-matchup="solo"] .drive { padding-inline: 5px; gap: 0; align-items: center; }
  #game[data-matchup="solo"] .pad { grid-template: 56px / repeat(4, 56px); gap: 3px; }
  #game[data-matchup="solo"] .pad [data-drive] { grid-area: auto; }
  #game[data-matchup="solo"] .boost { width: 68px; height: 56px; }
}
@media (max-width: 380px) and (orientation: portrait) {
  .controls:has(.second:not([hidden])) { inset-inline: 3px; }
  .controls:has(.second:not([hidden])) .drive { gap: 0; }
  .controls:has(.second:not([hidden])) .boost { width: 44px; position: absolute; bottom: 46px; }
  .controls:has(.second:not([hidden])) .second .boost { right: 0; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .masthead, main, .footer { width: calc(100% - 16px); }
  .masthead { height: calc(44px + env(safe-area-inset-top)); }
  #game { height: max(288px, calc(100dvh - 48px - env(safe-area-inset-top) - env(safe-area-inset-bottom))); }
  .ticket { width: min(100%, 292px); padding: 10px; }
  .overlay { padding-bottom: 8px; }
  .ticket-title { margin-bottom: 7px; }
  .controls { inset-inline: 5px; bottom: 5px; }
  .controls:has(.second:not([hidden])) .drive { gap: 4px; }
  .controls:has(.second:not([hidden])) .drive.second { flex-direction: row-reverse; }
  #key-guide { max-width: 125px; }
}
@media (min-width: 561px) and (orientation: landscape) and (max-height: 465px) {
  #menu { place-items: end center; padding: 5px; }
  #menu .ticket {
    display: grid;
    grid-template-columns: minmax(132px, 1fr) minmax(170px, 1.2fr) minmax(155px, 1fr);
    padding: 5px;
    gap: 5px;
    width: min(100%, 560px);
  }
  #menu .ticket:has(.levels[hidden]) { min-height: 0; }
  #menu .ticket-brand { display: none; }
  #menu .rivals, #menu .levels, #menu .menu-actions { grid-row: 1; }
  #menu .rivals { grid-column: 1; }
  #menu .levels { grid-column: 2; }
  #menu .menu-actions { grid-column: 3; }
  #menu .levels { margin: 0; }
}
@media (min-width: 510px) and (orientation: landscape) {
  #game[data-matchup="duel"]:not([data-screen="menu"]) {
    --duel-hud-space: 34px;
    --duel-control-space: 44px;
  }
  #game[data-matchup="duel"] .hud { top: 2px; }
  #game[data-matchup="duel"] .scoreboard { box-shadow: 0 2px 0 #111810ba; }
  #game[data-matchup="duel"] .score { padding-block: 2px; }
  #game[data-matchup="duel"] .score strong { font-size: 1.375rem; }
  #game[data-matchup="duel"] .utilities { top: 1px; }
  #game[data-matchup="duel"] .notice {
    top: 4px;
    left: 8px;
    max-width: calc(50% - 126px);
    padding: 5px 9px;
    transform: none;
    text-align: left;
  }
  #game[data-matchup="duel"] .controls {
    bottom: 0;
    inset-inline: 0;
    height: var(--duel-control-space);
    padding-inline: 7px;
    background: #1d231c;
    box-shadow: 0 -1px 0 #59634e;
  }
  #game[data-matchup="duel"] .drive { gap: 5px; }
  #game[data-matchup="duel"] .drive.second { flex-direction: row-reverse; }
  #game[data-matchup="duel"] .pad {
    grid-template-columns: repeat(4, clamp(44px, 6vw, 58px));
    grid-template-rows: 44px;
  }
  #game[data-matchup="duel"] .pad [data-drive] { grid-area: auto; }
  #game[data-matchup="duel"] .boost { width: clamp(44px, 7vw, 60px); height: 44px; }
  #game[data-matchup="duel"] [data-drive]:focus-visible { outline-offset: -4px; }
  #game[data-matchup="duel"] #key-guide {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    white-space: nowrap;
  }
}
@media (min-width: 510px) and (orientation: landscape) and (max-height: 520px) {
  #game[data-matchup="solo"]:not([data-screen="menu"]) {
    --play-hud-space: 29px;
    --play-control-space: 51px;
  }
  #game[data-matchup="solo"]:not([data-screen="menu"]) .hud { top: 2px; }
  #game[data-matchup="solo"]:not([data-screen="menu"]) .score { padding-block: 2px; }
  #game[data-matchup="solo"]:not([data-screen="menu"]) .score strong { font-size: 1.375rem; }
  #game[data-matchup="solo"] .utilities { top: 1px; }
  #game[data-matchup="solo"] .controls {
    inset-inline: 0;
    bottom: 0;
    padding-inline: 7px;
    background: #12282d;
    box-shadow: 0 -1px 0 #537777;
  }
  #game[data-matchup="solo"] .drive { width: 100%; justify-content: space-between; }
  #game[data-matchup="solo"] .pad { grid-template: 44px / repeat(4, clamp(44px, 7vw, 62px)); }
  #game[data-matchup="solo"] .pad [data-drive] { grid-area: auto; }
  #game[data-matchup="solo"] .boost { width: clamp(64px, 10vw, 92px); height: 44px; }
  #game[data-matchup="solo"] [data-drive]:focus-visible { outline-offset: -4px; }
  #game[data-matchup="solo"] #key-guide { display: none; }
  #game[data-matchup="solo"]:not([data-screen="tutorial"]) .notice {
    top: 5px;
    left: 9px;
    max-width: calc(50% - 120px);
    padding: 5px 9px;
    transform: none;
  }
}
@media (min-width: 510px) and (orientation: landscape) and (max-height: 520px) {
  #game[data-matchup="duel"]:not([data-screen="menu"]) {
    --duel-hud-space: 27px;
    --play-control-space: 51px;
    height: max(288px, calc(100dvh - 44px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
  }
}
@media (max-width: 980px) and (orientation: landscape) {
  #game[data-matchup="duel"] #key-guide { display: none; }
}
@media (pointer: coarse) { #key-guide { display: none; } }
@media (max-width: 425px) and (orientation: portrait) {
  :root:not(:lang(en)) #menu .ticket { grid-template-columns: minmax(112px, 1fr) minmax(0, 1.8fr); }
  :root:not(:lang(en)) #menu .levels button { padding-inline: 3px; font-size: .75rem; }
  :root:not(:lang(en)) #game { --practice-hud-space: 151px; }
  :root:not(:lang(en)) #game[data-screen="tutorial"] .notice { line-height: 1.15; }
  :root:not(:lang(en)) #game[data-screen="tutorial"] .practice-actions { top: 98px; }
  :root:not(:lang(en)) .practice-actions button { padding-inline: 6px; font-size: .75rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
