:root {
  color-scheme: light;
  --sa-yellow: #ffdc00;
  --sa-black: #171717;
  --sa-white: #fff;
  --sa-line: #dedede;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  color: var(--sa-black);
  background: #fff;
  font-family: system-ui, Arial, sans-serif;
}
button,
input,
select {
  font: inherit;
}
button {
  padding: 9px 14px;
  border: 1px solid #171717;
  border-radius: 8px;
  background: var(--sa-yellow);
  color: #171717;
  font-weight: 750;
  cursor: pointer;
}
button:hover:not(:disabled) {
  background: #f1cc00;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #2767cc;
  outline-offset: 2px;
}
a {
  color: #554600;
}
[hidden] {
  display: none !important;
}
.game-page {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}
#app {
  position: fixed;
  transform-origin: top left;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  background: #fff;
}
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
h1 {
  font-size: clamp(20px, 2.3vw, 34px);
  line-height: 1.15;
  margin: 0;
}
#fullscreen {
  flex-shrink: 0;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 3fr) minmax(260px, 1fr);
  gap: 14px;
  min-height: 0;
}
.side-panels {
  display: contents;
}
.menu-panel {
  min-width: 0;
  min-height: 0;
  padding: 20px;
  background: #fff;
  border: 2px solid var(--sa-yellow);
  border-top-width: 6px;
  border-radius: 12px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.intro-panel {
  grid-column: 1;
  grid-row: 1;
}
.leaderboard-panel {
  grid-column: 3;
  grid-row: 1;
}
.menu-panel h2 {
  font-size: clamp(19px, 1.5vw, 27px);
  line-height: 1.15;
  margin: 0 0 12px;
}
.menu-panel h3 {
  margin: 18px 0 6px;
  font-size: 17px;
}
.menu-panel p {
  font-size: 14px;
  line-height: 1.5;
  margin: 9px 0;
}
.menu-panel .eyebrow {
  margin: 0 0 12px;
  font-size: 11px;
  color: #5c4c00;
  font-weight: 800;
  letter-spacing: 1.6px;
}
.point-rules {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}
.point-rules span {
  padding: 9px;
  border: 1px solid #e5cc00;
  border-radius: 7px;
  background: #fffbdc;
  font-size: 13px;
}
.arena {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 2px solid var(--sa-yellow);
  border-radius: 12px;
  background: #f8f8f5;
}
#hud {
  display: flex;
  flex: 0 0 auto;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 40px;
  padding: 7px 10px;
  background: var(--sa-yellow);
  font-weight: 800;
}
#version {
  font-size: 11px;
  opacity: 0.65;
}
#comboStatus:empty {
  display: none;
}
#stage {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}
#playfield {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 16/9;
  background: #443d52;
  cursor: crosshair;
  touch-action: none;
}
.arena:has(.menu-screen:not([hidden])) #playfield {
  visibility: hidden;
}
.menu-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  min-height: 0;
  background: #fff;
}
.level-select {
  display: flex;
  flex: 0 0 auto;
  justify-content: center;
  gap: 8px;
}
.level-card {
  background: #20283c;
  color: #fff;
  border: 2px solid #4a526c;
  padding: 3px;
  display: grid;
  gap: 3px;
  width: 105px;
  flex: 0 0 105px;
  min-width: 0;
  font-size: 10px;
}
.level-card img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 3px;
}
.level-card.selected {
  border-color: #cf9b00;
  box-shadow: 0 0 0 2px #ffdc0066;
}
.notifications {
  flex: 0 0 auto;
  max-height: 25%;
  overflow: auto;
  padding: 8px 12px;
  text-align: center;
  border: 1px solid #171717;
  border-left: 6px solid var(--sa-yellow);
  background: #fff8c8;
  font-weight: 650;
  overflow-wrap: anywhere;
  overscroll-behavior: contain;
}
.notifications:not(:has(p:not(:empty))) {
  display: none;
}
.notifications p {
  margin: 4px 0;
  font-size: 13px;
  line-height: 1.35;
}
.notifications p:empty {
  display: none;
}
.level-preview {
  min-height: 0;
  flex: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #f4f4ef;
}
.level-preview img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}
.menu-actions {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 2px solid var(--sa-yellow);
}
.menu-actions button {
  font-size: 13px;
  flex: 1;
}
#eventbox {
  position: absolute;
  z-index: 5;
  top: 8px;
  left: 50%;
  width: min(85%, 620px);
  transform: translate(-50%, -140%);
  padding: 8px 12px;
  border: 2px solid var(--sa-yellow);
  border-radius: 10px;
  background: #ffdc00ed;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transition:
    opacity 0.15s,
    transform 0.15s;
}
#eventbox.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
#eventbox.jackpot {
  background: #fff0a5ee;
}
#eventtitle {
  font-size: clamp(12px, 1.5vw, 22px);
  font-weight: 900;
}
#eventdetail {
  margin-top: 3px;
  font-size: clamp(10px, 1vw, 15px);
  font-weight: 650;
}
#online .leaderboard-note {
  font-size: 12px;
  color: #4c4c4c;
}
#leaderboard {
  padding: 8px 10px 8px 36px;
  margin: 12px 0;
  max-height: 36vh;
  overflow: auto;
  border: 1px solid var(--sa-yellow);
  border-radius: 8px;
  background: #fffdf0;
  overscroll-behavior: contain;
}
#leaderboard li {
  padding: 6px 0;
  border-bottom: 1px solid #e7dc9b;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.leaderboard-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
}
.leaderboard-pagination button {
  padding: 6px 8px;
}
.profile-area {
  border-top: 2px solid var(--sa-yellow);
  padding-top: 14px;
  margin-top: 16px;
}
.profile-area label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
}
.name-row {
  display: flex;
  gap: 6px;
}
.name-row input {
  min-width: 0;
  width: 100%;
  padding: 9px;
  border: 1px solid #b9a600;
  border-radius: 7px;
  background: #fff;
  color: #171717;
}
.name-row button {
  padding: 8px;
  font-size: 13px;
}
#authProviders {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.oauth-button {
  display: inline-block;
  padding: 9px 10px;
  border: 1px solid #b9a600;
  border-radius: 8px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 750;
  color: #171717;
}
#authProviders button {
  font-size: 12px;
}
.legal-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  font-size: 13px;
  border-top: 2px solid var(--sa-yellow);
}
.language-control select {
  padding: 5px 8px;
  color: #171717;
  background: white;
  border: 1px solid #777;
  border-radius: 5px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.panel-tabs {
  display: none;
}
/* Compact landscape menu: central controls and one scrollable information pane. */
#app.is-compact {
  gap: 6px;
  padding: 8px;
}
.is-compact .app-header h1 {
  font-size: 19px;
}
.is-compact #fullscreen {
  padding: 6px 10px;
  font-size: 12px;
}
.is-compact .workspace {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 32%);
  gap: 8px;
}
.is-compact .arena {
  grid-column: 1;
}
.is-compact .side-panels {
  grid-column: 2;
  grid-row: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.is-compact .panel-tabs {
  display: flex;
  gap: 4px;
  padding-bottom: 5px;
}
.panel-tabs button {
  flex: 1;
  padding: 7px;
  font-size: 12px;
  background: #fff;
  border-color: #c6b200;
}
.panel-tabs button[aria-selected='true'] {
  background: var(--sa-yellow);
}
.is-compact .side-panels .menu-panel {
  flex: 1;
  padding: 12px;
}
.is-compact[data-panel='instructions'] .leaderboard-panel,
.is-compact[data-panel='scores'] .intro-panel {
  display: none;
}
.is-compact .menu-panel h2 {
  font-size: 19px;
}
.is-compact .menu-panel p {
  font-size: 12px;
}
.is-compact .menu-screen {
  padding: 8px;
  gap: 6px;
}
.is-compact .level-card {
  width: 90px;
  flex-basis: 90px;
  font-size: 9px;
}
.is-compact .level-card img {
  max-height: 42px;
}
.is-compact .notifications {
  padding: 4px 8px;
  max-height: 30%;
}
.is-compact .notifications p {
  font-size: 11px;
  margin: 2px 0;
}
.is-compact .menu-actions {
  padding-top: 6px;
  gap: 5px;
}
.is-compact .menu-actions button {
  font-size: 11px;
  padding: 7px;
}
.is-compact #hud {
  min-height: 28px;
  padding: 4px 6px;
  font-size: 12px;
}
.is-compact .legal-links {
  padding: 3px;
  font-size: 11px;
}
.is-compact .language-control select {
  padding: 3px 5px;
}
/* The CSS rotation is independent of device orientation locking support. */
#app.is-mobile {
  padding: 6px;
  padding-top: max(6px, env(safe-area-inset-top));
  padding-right: max(6px, env(safe-area-inset-right));
  padding-bottom: max(6px, env(safe-area-inset-bottom));
  padding-left: max(6px, env(safe-area-inset-left));
}
#app.is-rotated {
  padding-top: max(6px, env(safe-area-inset-right));
  padding-right: max(6px, env(safe-area-inset-bottom));
  padding-bottom: max(6px, env(safe-area-inset-left));
  padding-left: max(6px, env(safe-area-inset-top));
}
#app.is-mobile.is-playing {
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
}
.is-mobile.is-playing .app-header,
.is-mobile.is-playing .side-panels,
.is-mobile.is-playing > .legal-links {
  display: none;
}
.is-mobile.is-playing .workspace {
  grid-template-columns: minmax(0, 1fr);
}
.is-mobile.is-playing .arena {
  grid-column: 1;
  border: 0;
  border-radius: 0;
}
.is-mobile.is-playing #eventbox {
  top: 4px;
  padding: 4px 8px;
  max-width: 75%;
}
.is-mobile.is-playing #eventtitle {
  font-size: 12px;
}
.is-mobile.is-playing #eventdetail {
  font-size: 10px;
}
/* Legal documents remain readable, ordinary scrolling pages. */
.legal-page {
  min-height: 100dvh;
}
.legal-content {
  width: min(100%, 840px);
  margin: 24px auto;
  padding: 24px clamp(18px, 4vw, 48px);
  border: 2px solid var(--sa-yellow);
  border-radius: 12px;
  line-height: 1.65;
}
.legal-content h1 {
  margin: 18px 0;
}
.legal-content h2 {
  font-size: 1.2rem;
  margin-top: 26px;
}
.legal-content p {
  overflow-wrap: anywhere;
}
@media (prefers-reduced-motion: reduce) {
  #eventbox {
    transition: none;
  }
}
