:root {
  color-scheme: dark;
  --field: #1b563d;
  --deep: #132d23;
  --black: #10251c;
  --paper: #f7e8ba;
  --lime: #def187;
  --pink: #f48aa8;
  --line: #90ad72;
  --muted: #d3ddad;
  --display: Impact, Haettenschweiler, "Arial Black", sans-serif;
  --body: "Trebuchet MS", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--field); }
body { margin: 0; color: var(--paper); font: 16px/1.53 var(--body); }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #fff3ae; outline-offset: 3px; }
.skip { position: fixed; z-index: 20; top: .5rem; left: .5rem; transform: translateY(-160%); padding: .6rem 1rem; background: var(--black); }
.skip:focus { transform: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.hero {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 113px minmax(0, 1fr);
  column-gap: clamp(14px, 2.3vw, 42px);
  align-items: start;
  padding: clamp(16px, 3.2vh, 36px) clamp(18px, 3vw, 58px) 25px clamp(14px, 2vw, 38px);
  background: radial-gradient(ellipse at 68% 12%, #337351 0, transparent 53%), var(--field);
}
.rail {
  height: max(450px, calc(100dvh - clamp(56px, 8vh, 92px)));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 18px 4px 11px;
  border-right: 1px solid #a9bd7470;
}
.wordmark { text-decoration: none; text-align: center; display: flex; flex-direction: column; align-items: center; padding-right: 8px; }
.wordmark-text {
  font: 900 italic clamp(20px, 2.3vw, 32px)/.93 var(--display);
  letter-spacing: -.025em; margin: 12px 0 0; color: var(--paper);
  text-transform: uppercase; text-shadow: 2px 3px #193c2d;
}
.wordmark-text span { display: block; font-size: 1.31em; color: var(--lime); }
.rail-link { font-weight: 700; font-size: 14px; text-underline-offset: .26em; padding: 11px 4px; white-space: nowrap; }
.cabinet {
  position: relative; isolation: isolate;
  width: 100%; height: max(450px, calc(100dvh - clamp(56px, 8vh, 92px)));
  display: grid; grid-template-rows: 76px minmax(0, 1fr) 78px;
  min-width: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none;
  border: 2px solid #a5b875; border-radius: 21px 21px 13px 13px;
  background: #19372b; box-shadow: 0 0 0 4px #163a2b, 0 12px 0 #113326, 0 22px 40px #0f33286b;
}
.hud {
  min-width: 0; display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr) auto;
  align-items: center; column-gap: clamp(8px,2.2vw,42px);
  padding: 6px clamp(8px,2vw,27px);
  border-bottom: 1px solid #a5b875;
  background: linear-gradient(180deg,#31533d,#213b30);
  box-shadow: inset 0 2px #cdd79539, inset 0 -3px #122b20;
  z-index: 2;
}
.corner { display: flex; align-items: center; gap: 12px; }
.corner-info { display: grid; grid-template-columns: auto auto; column-gap: 12px; row-gap: 3px; align-items: center; }
.corner-line { display: flex; gap: 7px; align-items: center; grid-column: 1 / -1; }
.corner-name { text-transform: uppercase; font-size: 19px; line-height: 1.07; font-weight: 900; letter-spacing: .06em; }
.corner-score, .corner-wear { color: var(--paper); font-size: 14px; line-height: 1; white-space: nowrap; }
.corner-score { font-variant-numeric: tabular-nums; }
.corner-score strong { font-size: 16px; }
.corner-wear { display: flex; align-items: center; gap: 4px; }
.moss .corner-line { justify-content: flex-end; }
.wear-track {
  position: relative; overflow: hidden; width: clamp(32px,6vw,88px); height: 8px;
  background: #10251c; border: 1px solid #a4ac7d; border-radius: 2px;
}
.wear-track i { display: block; width: var(--wear,0%); height: 100%; background: #aac39b; }
.wear-track::after { content: ''; position: absolute; inset: 0 auto 0 var(--pin-wear); width: 2px; background: #fff3bd; }
.wear-track.worn i { background: #f3bb70; }
[data-mode="menu"] :is(.corner-score,.corner-wear) { display: none; }
.ruby { color: var(--pink); }
.moss { color: var(--lime); justify-content: flex-end; text-align: right; }
.corner-mark { flex: 0 0 24px; height: 24px; background: currentColor; border: 3px solid #19352a; box-shadow: 0 0 0 1px currentColor; transform: rotate(45deg); }
.moss .corner-mark { border-radius: 50%; }
.fall-lamps { display: flex; gap: 5px; }
.moss .fall-lamps { justify-content: flex-end; }
.fall-lamps i { width: 12px; height: 6px; background: #123025; border: 1px solid currentColor; border-radius: 1px; }
.fall-lamps i.lit { background: currentColor; box-shadow: 0 0 8px currentColor; }
.timeplate {
  padding: 3px 14px 5px;
  text-align: center; min-width: 121px;
  border: 1px solid #879a63; background: #142b21; border-radius: 5px;
  box-shadow: inset 0 0 0 2px #243f2e;
}
.timeplate span { display: block; color: #d8dbaa; font-size: 14px; line-height: 1.1; font-weight: 800; white-space: nowrap; }
.timeplate strong { display: block; font: 800 24px/1.05 var(--body); font-variant-numeric: tabular-nums; color: var(--paper); }
.utilities { display: flex; gap: 7px; }
.square {
  display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; padding: 9px;
  border: 1px solid #82956a; border-radius: 6px;
  background: #193629; box-shadow: 0 2px #122c21;
}
.square svg, .pad svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.square:hover, .square:focus-visible { background: #315742; }
.stage { position: relative; overflow: hidden; background: #182f26; }
.stage canvas, .scene-edge { position: absolute; width: 100%; height: 100%; inset: 0; display: block; }
.scene-edge { pointer-events: none; box-shadow: inset 0 0 0 2px #112d21, inset 0 0 36px 2px #101f17a3; }
.flyer {
  position: absolute; left: clamp(16px,5%,76px); top: 8%; width: max-content;
  max-width: 240px; padding: 11px 16px 14px;
  background: #ead49c; color: #263a26; border: 2px solid #384b32; outline: 1px solid #e8d39b;
  transform: rotate(-4deg); box-shadow: 4px 6px #122e2385;
}
.flyer p { margin: 0; }
.flyer-title { font: 900 29px/1.07 var(--body); letter-spacing: -.05em; }
.flyer-title em { color: #80324c; font-style: normal; }
.deck {
  position: relative; z-index: 4;
  display: grid; align-items: center; padding: 7px 12px;
  border-top: 2px solid #9cad6c;
  background: linear-gradient(180deg,#2c4c38,#234332 65%,#1d3529);
  box-shadow: inset 0 3px #dfe0ab17;
}
.menu-buttons { display: flex; justify-content: center; align-items: center; gap: 12px; }
.primary, .secondary {
  min-height: 49px; padding: 8px 23px; border-radius: 5px; font-weight: 900; line-height: 1.1;
  background: #294834; border: 1px solid #9cb176; box-shadow: 0 4px #142b21;
}
.primary { background: var(--lime); color: #213622; border-color: #edf9ad; box-shadow: 0 4px #6f8548; font-size: 21px; min-width: 172px; }
.primary span { font-size: 15px; font-weight: 800; margin-left: 5px; }
.secondary { font-size: 16px; }
.primary:hover { background: #f0ffa8; }
.secondary:hover { background: #3a5b3e; }
.primary:active, .secondary:active, .pad:active, .pad.pushed { transform: translateY(3px); box-shadow: 0 1px #132f22; }
.pads { display: flex; gap: 18px; justify-content: center; width: 100%; }
.pad-set { display: grid; width: min(100%, 578px); grid-template-columns: repeat(6,minmax(0,1fr)); gap: 7px; }
.pad {
  min-width: 0; min-height: 51px; padding: 4px 2px;
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px;
  font-weight: 800; font-size: 15px; line-height: 1;
  border: 1px solid #92a876; border-radius: 5px; color: var(--paper);
  background: #304d36; box-shadow: 0 3px #142d21; touch-action: none;
}
.pad svg { width: 19px; height: 19px; }
.pad:hover { background: #426444; }
.pad kbd { font: 700 14px/1.05 var(--body); color: #e4e6b3; }
.pad.grip { border-color: #e796ac; background: #653148; }
.pad.grip.ready { background: #ffb3cb; color: #351d2a; border-color: #fff2dd; box-shadow: 0 3px #943b61, inset 0 0 0 1px #fff2dd; }
.pad.grip.ready kbd { color: inherit; }
.pad-set[data-side="1"] .grip { background: #465e33; border-color: #a9c46b; }
.pad-set[data-side="1"] .grip.ready { background: var(--lime); color: #14261a; border-color: #fff2dd; box-shadow: 0 3px #6f8548, inset 0 0 0 1px #fff2dd; }
[data-pad="left"] .pads { justify-content: flex-start; }
[data-pad="right"] .pads { justify-content: flex-end; }
[data-pad="left"] .pad-set, [data-pad="right"] .pad-set { width: min(90%,578px); }
.in-ring {
  position: absolute; bottom: 13px; left: 50%; transform: translateX(-50%);
  width: max-content; min-width: min(290px,calc(100% - 24px)); max-width: calc(100% - 22px);
  border: 1px solid #b2bf80; border-left: 4px solid var(--lime); border-radius: 4px;
  background: #193528; padding: 8px 11px; color: var(--paper); box-shadow: 0 3px 0 #10271eaa;
  text-align: center; pointer-events: none;
}
.callout-line { display: flex; align-items: baseline; justify-content: center; gap: 6px 12px; flex-wrap: wrap; line-height: 1.17; }
.callout-line strong { color: var(--lime); font-size: 16px; }
.callout-line span { font-size: 14px; }
#callout-hints { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; }
#callout-second-key { color: var(--muted); }
.timing { margin: 9px 0 2px; position: relative; height: 13px; background: repeating-linear-gradient(90deg,#314a32 0,#314a32 calc(33.333% - 2px),#94a472 calc(33.333% - 2px),#94a472 33.333%); border: 1px solid #a5b677; border-radius: 2px; }
.timing i { position: absolute; background: #899952; height: 100%; }
.timing.window-open i { background: #f5f8ac; }
.timing b { position: absolute; top: -3px; bottom: -3px; width: 3px; background: #fff5de; outline: 1px solid #1f382b; }
.result-ticket { position: absolute; left: 50%; top: 12%; transform: translateX(-50%) rotate(-2deg); width: max-content; max-width: calc(100% - 24px); min-width: min(340px,calc(100% - 24px)); text-align: center; color: #253925; background: #f3dfa9; border: 3px solid #243b2b; outline: 1px solid #e2d296; padding: 13px 22px 15px; box-shadow: 8px 10px #132d2266; }
.result-ticket p { margin: 0; font-size: 15px; line-height: 1.2; font-weight: 800; }
.result-ticket p:first-child { border-bottom: 1px solid #8b8b59; padding-bottom: 5px; letter-spacing: .07em; }
.result-ticket h2 { font: 900 clamp(32px, 5vw, 56px)/1.01 var(--body); margin: 7px 0 5px; letter-spacing: -.025em; text-transform: uppercase; }
.result-score { font: 900 23px/1.2 var(--body); margin: 3px 0 7px; }
.cabinet[data-mode="paused"] { touch-action: auto; }
.corner-panel { position: absolute; inset: 0; overflow: auto; overscroll-behavior: contain; touch-action: pan-y; background: #132f25ed; display: grid; place-items: center; padding: 7px 10px; }
.sheet-inner { width: min(100%,520px); text-align: center; }
.sheet-inner h2 { margin: 0 0 8px; font-size: clamp(21px,4vw,36px); line-height: 1.1; }
.option-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.option-grid button, .bind-header button, #bind-back {
  min-height: 44px; background: #294936; border: 1px solid #a1af7b; color: var(--paper); border-radius: 4px;
  padding: 5px 8px; font-size: 14px; font-weight: 800;
}
.option-grid button b { display: inline-block; margin-left: 3px; color: var(--lime); }
.bind-header { display: flex; justify-content: center; gap: 7px; }
#bind-note { margin: 6px 0; font-size: 14px; }
#bind-back { margin-top: 6px; }

.cabinet:fullscreen, .cabinet.simulated-fullscreen {
  width: 100%; height: 100dvh; max-height: none; min-height: 0; border-radius: 0; margin: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.cabinet.simulated-fullscreen { position: fixed; inset: 0; z-index: 40; }
html.locked { overflow: hidden; overscroll-behavior: none; }

.newsprint { background: #eaddae; color: #21392b; padding: clamp(28px,6vw,76px) max(20px, calc((100% - 1060px) / 2)); }
.newsprint header { border-top: 3px solid #284330; border-bottom: 1px solid #65774b; padding: 12px 0; margin-bottom: 23px; }
.newsprint header h1 { font-size: clamp(24px,4vw,51px); margin: 0; letter-spacing: -.035em; line-height: 1.08; }
.newsprint header p { max-width: 72ch; margin: 10px 0 0; }
.columns { columns: 2 300px; column-gap: 44px; column-rule: 1px solid #a8ad75; }
.columns section { break-inside: avoid; margin: 0 0 21px; }
.columns h2 { font-size: 20px; margin: 0 0 5px; line-height: 1.2; }
.columns p { margin: 0 0 9px; }
.columns ol { margin: 4px 0 12px; padding-left: 21px; }
.columns li + li { margin-top: 6px; }
.columns details { padding: 8px 0; border-top: 1px solid #b0b17a; }
.columns summary { cursor: pointer; font-weight: 800; }
.columns details p { margin: 5px 0 0; }
.newsprint :focus-visible { outline-color: #5b2c4a; }
.footer { padding: 20px clamp(14px,5vw,75px) 0; background: #143c2d; color: var(--lime); overflow: hidden; }
.footer nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.footer a { min-height: 44px; display: inline-flex; align-items: center; text-underline-offset: .26em; }
.language { border: 1px solid #82965a; border-radius: 2rem; padding: 4px 11px; }
.footer-name { white-space: nowrap; font: 900 italic clamp(48px,24.5vw,440px)/.88 var(--display); text-align: center; text-transform: uppercase; letter-spacing: -.055em; padding: 12px 0 0; }
.legal { width: min(850px,100%); margin: auto; padding: 32px clamp(18px,4vw,42px) 45px; }
.legal h1 { font-size: clamp(30px,5vw,54px); line-height: 1.05; }
.legal h2 { margin-bottom: 3px; }
.legal :is(p,li) { max-width: 73ch; }
.legal .primary { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

@media (max-width: 750px) and (orientation: portrait) {
  .hero { display: flex; flex-direction: column; gap: 9px; padding: 7px 7px 0; min-height: 100dvh; }
  .rail {
    order: 2; flex: none; width: calc(100% + 14px); margin-inline: -7px;
    height: calc(60px + env(safe-area-inset-bottom)); padding: 2px 13px env(safe-area-inset-bottom);
    background: #1a4935; box-shadow: 0 -4px 14px #132d2245; border: 0; border-top: 1px solid #94ab70;
    justify-content: space-between; flex-direction: row;
  }
  .wordmark { flex-direction: row; gap: 7px; min-height: 44px; }
  .wordmark svg { width: 32px; height: 32px; }
  .wordmark-text { margin: 0; font-size: 22px; white-space: nowrap; }
  .wordmark-text span { display: inline; font-size: 1em; }
  .rail-link { padding: 11px 4px; }
  .cabinet { height: calc(100dvh - 76px - env(safe-area-inset-bottom)); min-height: 405px; grid-template-rows: 72px minmax(0,1fr) 72px; border-radius: 15px 15px 8px 8px; box-shadow: 0 5px #143c2c; }
  .hud { padding: 4px 5px 4px 8px; column-gap: 7px; }
  .corner { gap: 6px; }
  .corner-info { grid-template-columns: auto; }
  .moss .corner-info { justify-items: end; }
  .corner-line { gap: 4px; }
  .corner-name { font-size: 14px; letter-spacing: .025em; }
  .corner-mark { display: none; }
  .fall-lamps { gap: 3px; }
  .fall-lamps i { width: 8px; }
  .wear-track { width: 30px; }
  .timeplate { width: 77px; min-width: 0; padding: 4px 5px; }
  .timeplate span { font-size: 14px; }
  .timeplate strong { font-size: 22px; }
  .utilities { gap: 4px; }
  .square { padding: 8px; }
  .deck { padding: 6px 6px 8px; }
  .pad-set { gap: 4px; }
  .pad { min-height: 49px; font-size: 14px; padding: 3px 0; }
  .pad kbd { display: none; }
  .menu-buttons { gap: 8px; }
  .primary { min-width: 0; padding: 8px 19px; }
  .secondary { padding: 8px 15px; }
  .pads:has(.pad-set[data-side="1"]:not([hidden])) { flex-direction: column; align-items: center; gap: 5px; }
  [data-pad="left"] .pads:has(.pad-set[data-side="1"]:not([hidden])) { align-items: flex-start; }
  [data-pad="right"] .pads:has(.pad-set[data-side="1"]:not([hidden])) { align-items: flex-end; }
  [data-pad="left"] .pad-set, [data-pad="right"] .pad-set { width: min(100%,max(284px,90%)); }
  .cabinet:is([data-mode="playing"],[data-mode="tutorial"]):has(.pad-set[data-side="1"]:not([hidden])) { grid-template-rows: 72px minmax(0,1fr) 108px; }
  .pads:has(.pad-set[data-side="1"]:not([hidden])) .pad { min-height: 44px; }
  .newsprint { scroll-margin-top: 8px; }

}
@media (max-height: 510px) and (orientation: landscape) {
  .hero { grid-template-columns: 77px minmax(0,1fr); column-gap: 9px; padding: 7px 9px 10px; }
  .rail, .cabinet { height: calc(100dvh - 20px); min-height: 304px; }
  .wordmark-text { font-size: 20px; }
  .rail { padding-top: 5px; }
  .cabinet { grid-template-rows: 56px minmax(0,1fr) 56px; }
  .hud { padding: 1px 7px; }
  .timeplate { padding: 2px 9px; min-width: 96px; }
  .timeplate strong { font-size: 20px; }
  .deck { padding: 3px 8px 5px; }
  .pad { min-height: 44px; }
  .pad kbd { display: none; }
  .primary, .secondary { min-height: 44px; }
  .flyer { padding: 6px 10px 8px; left: 13px; top: 8%; }
  .flyer-title { font-size: 20px; }
  .in-ring { bottom: auto; top: 9px; }
  .result-ticket { display: grid; grid-template-columns: auto auto; align-items: center; column-gap: 12px; top: 11px; padding: 6px 12px 8px; }
  .result-ticket p { grid-column: 1 / -1; }
  .result-ticket h2 { font-size: 31px; margin: 4px 0; }
  .result-score { font-size: 19px; margin: 2px 0; }
  .sheet-inner h2 { margin-bottom: 4px; }
  .option-grid { gap: 4px; }
  .corner-panel { place-items: start center; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; } }
.utilities { width: 95px; justify-content: flex-end; }
#game:focus-visible { outline-width: 2px; }
.pad-set[data-side="1"] .pad:not(.grip) { background-color: #3a5230; }
@media (max-width: 750px) and (orientation: portrait) {
  .utilities { width: 92px; }
  .result-ticket { top: 16%; }
}
@media (orientation: portrait) {
  .flyer { left: 18px; top: 19%; padding: 8px 12px 10px; }
  .flyer-title { font-size: 22px; }
}
@media (pointer: coarse) {
  .pad kbd { display: none; }
}
@media (pointer: coarse) and (max-height: 510px) and (orientation: landscape) {
  .hero { display: flex; flex-direction: column; gap: 6px; padding: 6px 7px 0; }
  .rail {
    order: 2; flex: none; width: calc(100% + 14px); margin-inline: -7px;
    height: calc(48px + env(safe-area-inset-bottom)); min-height: 0; padding: 0 13px env(safe-area-inset-bottom);
    justify-content: space-between; flex-direction: row; background: #1a4935;
    border: 0; border-top: 1px solid #94ab70;
  }
  .wordmark { flex-direction: row; gap: 7px; min-height: 44px; }
  .wordmark svg { width: 28px; height: 28px; }
  .wordmark-text { margin: 0; }
  .wordmark-text span { display: inline; font-size: 1em; }
  .cabinet { height: calc(100dvh - 60px - env(safe-area-inset-bottom)); min-height: 250px; }
  .pads:has(.pad-set[data-side="1"]:not([hidden])) { gap: 12px; }
  .pads:has(.pad-set[data-side="1"]:not([hidden])) .pad-set {
    max-width: calc((100% - 12px)/2); gap: 4px;
  }
  :is([data-pad="left"],[data-pad="right"]) .pads:has(.pad-set[data-side="1"]:not([hidden])) .pad-set {
    width: clamp(284px,45%,578px);
  }
}
.practice-link {
  min-height: 44px; margin-top: 5px; border: 1px solid #284733; border-radius: 4px;
  background: #ddea9a; color: #233d2c; padding: 5px 13px; font-weight: 900;
}


.rail-links { display: flex; align-items: center; flex-direction: column; }
.rail-language { white-space: normal; text-align: center; }
.footer-nav { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 24px; }
.footer .language-links, .footer .site-links { flex-wrap: wrap; justify-content: flex-start; column-gap: 14px; row-gap: 0; }
.language-links a[aria-current="page"] { font-weight: 900; text-decoration: none; }
.language-links:focus-visible { outline-offset: 4px; }
.site-links span { font-size: .88em; color: var(--muted); }
.columns table { width: 100%; margin: 8px 0 12px; border-collapse: collapse; font-size: .9em; line-height: 1.25; }
.columns th, .columns td { padding: .38em .32em; border-bottom: 1px solid #a8ad75; text-align: left; }
.columns th { hyphens: auto; overflow-wrap: anywhere; }
.timeplate span { text-transform: uppercase; }
.pad kbd, .option-grid button, .result-ticket, .callout-line { overflow-wrap: anywhere; }
.pad kbd { min-width: 0; max-width: 100%; }
.menu-buttons .secondary, .bind-header button { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 700px) and (orientation: portrait), (max-width: 730px) and (max-height: 520px) {
  .rail-links { flex-direction: row; gap: .45rem; }
  .rail-link { font-size: 13px; }
  .rail-language { white-space: nowrap; }
  html:not([lang="en"]) .pad { font-size: 13px; }
}

@media (max-width: 750px) and (orientation: portrait) {
  .timeplate span { font-size: 12px; white-space: normal; hyphens: auto; overflow-wrap: anywhere; }
  .corner-info { min-width: 0; max-width: 100%; }
  .corner-wear { flex-wrap: wrap; gap: 3px; font-size: 11px; }
  .corner-wear span { white-space: normal; overflow-wrap: anywhere; }
  .moss .corner-wear { justify-content: flex-end; }
  .wear-track { flex: none; }
  #menu-buttons [data-act="duel"] { white-space: nowrap; }
}

.cabinet[data-cup="true"] { touch-action: auto; }
.cup-board {
  position: absolute; inset: 0; display: grid; place-items: safe center; overflow: auto;
  padding: 10px; background: #193326b8; overscroll-behavior: contain; touch-action: pan-y;
}
.cup-paper {
  width: min(100%, 560px); padding: 13px 15px 15px; color: #233927; background: #f0dfab;
  border: 2px solid #6f794d; outline: 1px solid #e8daab; box-shadow: 5px 6px #183527;
}
.cup-paper h2 { margin: 0; font-size: 30px; line-height: 1; letter-spacing: -.025em; }
.cup-paper h3 { margin: 9px 0 5px; font-size: 17px; line-height: 1.15; }
.cup-paper p { margin: 6px 0 8px; font-size: 14px; line-height: 1.3; }
#cup-progress { font-weight: 800; border-bottom: 1px solid #9a9d6c; padding-bottom: 7px; }
.cup-stages, .cup-rivals, .cup-goals { display: grid; gap: 5px; }
.cup-stages { grid-template-columns: repeat(4,minmax(0,1fr)); }
.cup-rivals { grid-template-columns: repeat(3,minmax(0,1fr)); }
.cup-goals { grid-template-columns: repeat(auto-fit,minmax(min(100%,175px),1fr)); }
.cup-paper button {
  min-height: 44px; min-width: 0; padding: 4px 5px; font-size: 14px; font-weight: 800;
  line-height: 1.12; color: #243b27; background: #fff1c8; border: 1px solid #78834d;
  border-radius: 3px; overflow-wrap: anywhere;
}
.cup-paper button:hover:not(:disabled) { background: #faffb8; }
.cup-paper button:focus-visible { outline: 2px solid #812e4f; outline-offset: 1px; }
.cup-paper button[aria-pressed="true"] { background: #dbea88; border: 2px solid #425f3b; }
.cup-paper button:disabled { color: #535a3b; background: #e4d7a8; }
.cup-paper button span { margin-inline-start: .3em; }
.cup-goals button { text-align: start; padding-inline: 8px; }
#result-cup { margin-top: 6px; border-top: 1px solid #9a9d6c; padding-top: 6px; }
#result-buttons.has-next [data-act=restart] { background: #2e5038; color: var(--paper); min-width: 0; border-color: #9cb176; box-shadow: 0 4px #142b21; }
#result-buttons.has-next [data-act=restart]:hover { background: #3a5b3e; }
@media (max-width: 750px) and (orientation: portrait), (max-height: 510px) and (orientation: landscape) {
  #menu-buttons .primary, #cup-buttons .primary, #result-buttons.has-next .primary { min-width: 44px; }
  #menu-buttons button, #cup-buttons button:not(.square), #result-buttons.has-next button:not(.square) {
    min-height: 44px; padding: 6px 9px; font-size: 15px;
  }
}
@media (max-width: 370px) and (orientation: portrait) {
  .cup-board { padding: 6px; }
  .cup-paper { padding: 9px; }
  #result-buttons.has-next { gap: 4px; }
  #result-buttons.has-next button:not(.square) { padding-inline: 6px; }
}
@media (max-height: 510px) and (orientation: landscape) {
  .cup-board { align-items: safe center; padding-block: 5px; }
  .cup-paper { width: min(100%,690px); display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding-block: 6px; }
  .cup-paper h2 { font-size: 23px; }
  .cup-paper h3, .cup-paper p { margin-block: 0; align-self: center; }
  #cup-progress { padding: 0; border: 0; }
  #cup-stages, #cup-card, #quick-card { grid-column: 1 / -1; }
  #cup-card { display: grid; grid-template-columns: minmax(0,1.24fr) minmax(0,1fr); gap: 4px 10px; }
  #cup-stage { grid-area: 1 / 1; }
  #cup-rivals { grid-area: 2 / 1; }
  #cup-rival-note { grid-area: 3 / 1 / 4 / -1; }
  #cup-goal-note { grid-area: 1 / 2; }
  #cup-goals { grid-area: 2 / 2; grid-auto-flow: column; grid-auto-columns: minmax(0,1fr); grid-template-columns: none; }
  #quick-tiers { margin-block: 5px; }
}
