:root { color-scheme: dark; --page: #1c2d25; --panel: #1a2521; --line: #3c4d3e; --text: #eeeade; --muted: #b0baac; --orange: #f69a58; --green: #a5b78c; --radius: 12px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; }
* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; background: var(--page); color: var(--text); }
button, input { font: inherit; }
button, a, summary, input { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .38; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, canvas:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
a { color: var(--muted); text-underline-offset: 4px; }
a:hover { color: var(--text); }
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }
kbd { font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; border: 1px solid #66725c70; padding: 2px 4px; border-radius: 4px; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The view keeps its proportions and the full arena; opening options never resizes it. */
.workspace, .play-area { width: 100%; height: 100dvh; min-width: 0; }
.play-area { position: relative; isolation: isolate; }
.stage { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; background: var(--page); }
canvas { display: block; width: min(100%, 160dvh); height: auto; aspect-ratio: 8/5; touch-action: none; cursor: crosshair; }
canvas:focus-visible { outline-offset: -3px; }

/* Small floating controls leave the game in the foreground. */
.arena-toolbar { position: absolute; z-index: 2; inset: 18px 22px auto; display: flex; align-items: center; justify-content: space-between; gap: 14px; pointer-events: none; }
.identity { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: #17241edb; border: 1px solid #52634670; border-radius: 10px; backdrop-filter: blur(10px); }
.identity-mark { display: grid; place-items: center; width: 34px; height: 34px; background: var(--orange); color: #1c2a23; font-size: 26px; font-weight: 900; line-height: 1; border-radius: 8px; transform: rotate(-4deg); }
h1 { font-size: 14px; letter-spacing: .17em; font-weight: 850; line-height: 1.2; }
.arena-name { display: flex; align-items: center; gap: 7px; margin-top: 6px; font: 8px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .06em; color: var(--muted); }
.status-dot { width: 5px; height: 5px; background: var(--green); border-radius: 50%; }
.separator { color: #71806b; }
#mode-label { color: var(--orange); }
.toolbar-actions { display: flex; align-items: center; gap: 4px; padding: 5px; background: #17241ee6; border: 1px solid #52634680; border-radius: 10px; backdrop-filter: blur(10px); pointer-events: auto; }
.toolbar-actions button { min-height: 36px; border: 1px solid transparent; border-radius: 6px; padding: 8px 11px; background: transparent; color: var(--muted); font-size: 11px; white-space: nowrap; }
.toolbar-actions button:hover:not(:disabled) { color: var(--text); background: #304034; }
.toolbar-actions button[aria-pressed=true] { color: var(--orange); background: #293a2e; }
.toolbar-actions kbd { margin-left: 5px; }
.toolbar-actions .options-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; margin-left: 4px; background: #e8c194; border-color: #e8c194; color: #243127; font-weight: 650; }
.toolbar-actions .options-button:hover { color: #243127; background: #f7d3a7; }
.options-button svg { width: 17px; height: 17px; }
.options-button kbd { margin: 0; border-color: #6b77576b; }
.scoreboard { position: absolute; z-index: 2; bottom: 22px; left: 22px; display: flex; gap: 22px; padding: 14px 18px; border: 1px solid #52634670; border-radius: 10px; background: #17241edb; backdrop-filter: blur(10px); pointer-events: none; }
.scoreboard > div { display: flex; flex-direction: column; gap: 7px; border-left: 1px solid #52634670; padding-left: 22px; }
.scoreboard > div:first-child { border: 0; padding: 0; }
.stat-label { font: 8px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; color: #b4bea9; }
.scoreboard > div > span:last-child { font: 18px ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 500; }
.scoreboard .health { color: var(--orange); font-size: 15px !important; white-space: nowrap; }
.play-footer { position: absolute; z-index: 2; bottom: 25px; right: 24px; display: flex; flex-direction: column; gap: 7px; align-items: flex-end; color: #becbb5; font-size: 10px; line-height: 1.7; pointer-events: none; }
.play-footer p > span { margin: 0 7px; color: #8d9d80; }
.technical { font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; }
.technical span { margin: 0 !important; }
.technical span:nth-child(even) { margin: 0 7px !important; }

.stage-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: #14241b80; backdrop-filter: blur(2px); }
.start-card { text-align: center; padding: 24px; max-width: 440px; }
.eyebrow { font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .13em; color: var(--orange); }
.start-card h2 { font-size: clamp(32px, 4vw, 54px); font-weight: 750; letter-spacing: -.055em; margin: 17px 0 14px; }
.start-card > p:not(.eyebrow):not(.overlay-hint) { line-height: 1.7; color: #d6ddca; font-size: 13px; }
.primary { display: inline-flex; justify-content: center; align-items: center; gap: 28px; background: var(--orange); color: #1c2b22; font-weight: 700; padding: 14px 21px; border-radius: 6px; border: 0; margin: 25px 0 16px; }
.primary:hover { background: #ffb47a; }
.overlay-hint { font-size: 11px; line-height: 1.6; color: #bac6b4; }
.stage[data-mode=paused] .stage-overlay { place-items: end center; padding: 0 14px 108px; background: none; backdrop-filter: none; pointer-events: none; }
.stage[data-mode=paused] .start-card { display: flex; align-items: center; gap: 18px; padding: 9px 11px 9px 18px; background: #15241fee; border: 1px solid #7e8d6477; border-radius: 8px; pointer-events: auto; }
.stage[data-mode=paused] .start-card p { display: none; }
.stage[data-mode=paused] .start-card h2 { font-size: 17px; letter-spacing: -.025em; margin: 0; }
.stage[data-mode=paused] .start-card .primary { margin: 0; padding: 8px 12px; font-size: 11px; }
.workspace:has(.juice-panel[open]) .stage[data-mode=paused] .stage-overlay { visibility: hidden; }

/* Native modal focus, Escape and inertness; only the panel body scrolls. */
.juice-panel { position: fixed; inset: 14px 14px 14px auto; margin: 0; width: min(390px, calc(100vw - 28px)); max-width: none; height: calc(100dvh - 28px); max-height: none; padding: 0; overflow: hidden; color: var(--text); background: var(--panel); border: 1px solid #667454; border-radius: 14px; box-shadow: 0 18px 70px #06110ba6, 0 2px 10px #08130a66; }
.juice-panel[open] { display: flex; flex-direction: column; }
.juice-panel::backdrop { background: #07120d40; }
.panel-header { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 21px 20px 18px; border-bottom: 1px solid var(--line); }
.panel-header h2 { font-size: 25px; margin-top: 7px; font-weight: 650; letter-spacing: -.04em; }
.panel-actions { display: flex; align-items: center; gap: 10px; }
.effect-count { font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; border: 1px solid #526346; border-radius: 5px; color: #c2cfb2; padding: 6px 7px; white-space: nowrap; }
.close-button { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid #52634680; border-radius: 6px; background: #26342a; }
.close-button:hover { background: #344633; }
.close-button svg { width: 20px; height: 20px; }
/* Keep absolute accessibility descriptions inside this scroll container. */
.panel-body { position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #637452 transparent; }
.panel-status { padding: 12px 20px; border-bottom: 1px solid var(--line); color: #c8d5b8; background: #24342a; font-size: 11px; line-height: 1.6; }
.panel-description { margin: 18px 20px 15px; font-size: 11px; color: var(--muted); line-height: 1.5; }
.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0 18px; }
.presets button { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 12px 3px; border: 1px solid var(--line); background: #223128; border-radius: 6px; font-size: 12px; font-weight: 600; }
.presets button span { font-size: 9px; color: var(--muted); font-weight: 400; }
.presets button:hover { border-color: #718366; }
.presets button[aria-pressed=true] { background: #e8c194; border-color: #e8c194; color: #273329; }
.presets button[aria-pressed=true] span { color: #45553d; }
.preset-note { min-height: 34px; margin: 12px 20px 17px; color: #c7cdbb; font-size: 11px; line-height: 1.65; }
.effect-groups { border-top: 1px solid var(--line); }
.effect-group { border-bottom: 1px solid var(--line); }
.effect-group > summary { display: flex; align-items: center; gap: 8px; padding: 15px 20px; cursor: pointer; list-style: none; font-size: 12px; font-weight: 550; }
.effect-group > summary::-webkit-details-marker { display: none; }
.effect-group > summary::after { content: '+'; margin-left: auto; color: #a6b697; font-size: 16px; font-weight: 400; }
.effect-group[open] > summary::after { content: '−'; }
.group-count { font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; color: #9aae8e; margin-left: 3px; }
.group-note { margin: -5px 20px 9px; font-size: 11px; line-height: 1.6; color: #aebaa6; }
.effect-list { margin: 0; padding: 0 13px 12px; list-style: none; }
.effect-row { display: flex; align-items: center; gap: 3px; border-radius: 5px; min-height: 36px; }
.effect-row:hover { background: #26372b; }
.effect-row label { display: flex; align-items: center; gap: 10px; cursor: pointer; flex: 1; min-width: 0; padding: 7px; font-size: 12px; }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--orange); flex-shrink: 0; cursor: pointer; }
.effect-row a { font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; padding: 10px 7px; color: #9eaf93; text-decoration: none; }
.effect-row a:hover { color: var(--orange); text-decoration: underline; }
.effect-row:has(input:disabled) label { color: #879680; cursor: default; }
.comfort { padding: 19px 20px; border-bottom: 1px solid var(--line); }
.comfort-choice { display: flex; align-items: center; gap: 10px; font-size: 12px; cursor: pointer; }
.comfort > p { color: #a7b59d; font-size: 11px; line-height: 1.7; margin: 9px 0 18px; }
.volume-label { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
input[type=range] { display: block; width: 100%; height: 27px; margin: 5px 0 4px; accent-color: var(--orange); cursor: pointer; }
#audio-status { color: #a7b59d; font-size: 10px; }
.about { padding: 17px 20px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); }
.about summary { cursor: pointer; color: #c9d0bc; width: fit-content; }
.about p { margin-top: 12px; line-height: 1.7; }
.about strong { color: var(--text); }
.panel-footer { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px 22px; font-size: 11px; line-height: 1.7; }
.panel-footer > span { font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; color: #a1b093; }

@media (max-width: 900px) {
  .play-footer { bottom: 18px; right: 18px; max-width: 280px; text-align: right; }
  .scoreboard { left: 18px; bottom: 18px; gap: 16px; padding: 13px 15px; }
  .scoreboard > div { padding-left: 16px; }
  .toolbar-actions kbd { display: none; }
}
@media (max-width: 700px) {
  .arena-toolbar { inset: 12px 14px auto; gap: 10px; }
  .identity { padding: 8px 10px; gap: 9px; }
  .identity-mark { width: 29px; height: 29px; font-size: 23px; }
  .arena-location, .separator { display: none; }
  .toolbar-actions button { padding: 8px; }
  .scoreboard { bottom: 68px; left: 50%; transform: translateX(-50%); }
  .play-footer { bottom: 16px; right: 14px; left: 14px; max-width: none; align-items: center; text-align: center; font-size: 9px; }
  .stage[data-mode=paused] .stage-overlay { padding-bottom: 151px; }
}
@media (max-width: 480px) {
  .arena-toolbar { inset: 10px 10px auto; gap: 6px; }
  .identity { padding: 8px; }
  .identity-mark { display: none; }
  h1 { font-size: 12px; letter-spacing: .1em; }
  .arena-name { font-size: 8px; }
  .toolbar-actions { gap: 1px; padding: 4px; }
  .toolbar-actions button { min-height: 36px; padding: 7px 6px; font-size: 10px; }
  .toolbar-actions .options-button { margin-left: 2px; }
  .options-button svg { display: none; }
  .scoreboard { width: calc(100% - 28px); gap: 10px; padding: 12px; justify-content: space-between; }
  .scoreboard > div { padding-left: 10px; }
  .scoreboard > div > span:last-child { font-size: 16px; }
  .scoreboard .health { font-size: 12px !important; }
  .stat-label { font-size: 7px; }
  .start-card { padding: 18px; }
  .start-card h2 { font-size: 34px; }
  .start-card > p:not(.eyebrow):not(.overlay-hint) { font-size: 12px; }
  .overlay-hint { font-size: 10px; }
  .juice-panel { inset: 8px 8px 8px auto; width: calc(100vw - 16px); height: calc(100dvh - 16px); }
  .panel-header { padding: 18px; gap: 8px; }
  .panel-header h2 { font-size: 24px; }
  .panel-actions { gap: 8px; }
}
@media (max-height: 500px) and (min-width: 701px) {
  .arena-toolbar { inset: 10px 14px auto; }
  .identity { padding: 6px 9px; }
  .identity-mark { width: 28px; height: 28px; font-size: 22px; }
  .scoreboard { bottom: 12px; left: 14px; padding: 9px 13px; gap: 15px; }
  .scoreboard > div { gap: 4px; padding-left: 15px; }
  .scoreboard > div:first-child { padding-left: 0; }
  .scoreboard > div > span:last-child { font-size: 15px; }
  .play-footer { bottom: 16px; right: 16px; }
  .technical { display: none; }
  .stage[data-mode=paused] .stage-overlay { padding-bottom: 79px; }
  .start-card h2 { margin: 10px 0 8px; font-size: 32px; }
  .primary { margin: 16px 0 10px; padding: 11px 18px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
