body { font-family: 'Quicksand', sans-serif; }
[hidden] { display: none !important; }

:root {
  --sy-accent: #fb923c;
  --sy-accent2: #f59e0b;
  --sy-bg: #0b1020;
  --sy-panel: #0d1326;
  --sy-line: rgba(148, 163, 184, 0.22);
  --sy-text: #e2e8f0;
  --sy-dim: #94a3b8;
}

.sy-body { margin: 0; background: radial-gradient(1200px 700px at 50% -10%, #17203f 0%, var(--sy-bg) 60%); color: var(--sy-text); min-height: 100vh; -webkit-tap-highlight-color: transparent; }
/* Arcade games hide the floating bug pill (it covers controls); REPORT lives in Options and Pause. */
#beta-report-trigger { display: none !important; }

.sy-main { display: flex; justify-content: center; padding: 8px 8px calc(10px + env(safe-area-inset-bottom)); }
.sy-card { --cw: 300px; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; max-width: 760px; }

/* ---------- HUD ---------- */
.sy-hud { width: var(--cw); display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
.sy-hb { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.sy-hr { align-items: flex-end; }
.sy-lbl { font-size: 10px; font-weight: 700; letter-spacing: 0.14em; color: var(--sy-dim); }
.sy-val { font-size: 26px; font-weight: 700; color: #f8fafc; font-variant-numeric: tabular-nums; text-shadow: 0 0 14px rgba(251, 146, 60, 0.35); }
.sy-time { color: #f8fafc; }
.sy-time.low { color: #fca5a5; animation: syPulse 0.8s ease-in-out infinite; }
.sy-chip { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; padding: 5px 10px; border-radius: 999px; color: #1c1206; background: linear-gradient(180deg, #fdba74, var(--sy-accent)); box-shadow: 0 0 14px rgba(251, 146, 60, 0.4); white-space: nowrap; }
.sy-lamps { display: flex; gap: 5px; align-items: center; min-height: 24px; }
.sy-lamp { display: block; width: 11px; height: 17px; border-radius: 4px 4px 6px 6px; background: #1e293b; border: 1.5px solid #334155; position: relative; }
.sy-lamp::before { content: ''; position: absolute; left: 50%; top: -5px; width: 5px; height: 4px; transform: translateX(-50%); border-radius: 3px 3px 0 0; background: #334155; }
.sy-lamp.on { background: radial-gradient(circle at 50% 60%, #fef3c7, #fbbf24 55%, #f59e0b); border-color: #fcd34d; box-shadow: 0 0 10px rgba(251, 191, 36, 0.8); }
.sy-lamp.on::before { background: #fcd34d; }
.sy-lamps.last .sy-lamp.on { animation: syPulse 0.9s ease-in-out infinite; }
@keyframes syPulse { 50% { opacity: 0.45; } }

/* ---------- stage ---------- */
.sy-stage { position: relative; border-radius: 14px; overflow: hidden; background: var(--sy-bg); box-shadow: 0 0 0 1px var(--sy-line), 0 18px 50px rgba(0, 0, 0, 0.55); touch-action: none; user-select: none; -webkit-user-select: none; }
#syCanvas { display: block; touch-action: none; cursor: pointer; }

.sy-ov { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 10px; padding: 14px 14px 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; text-align: center; background: rgba(8, 12, 24, 0.84); }
/* Children of a scrolling flex column must not shrink: a child with its own overflow (the trophy list) would collapse to nothing. */
.sy-ov > * { flex-shrink: 0; }
.sy-ov > :first-child { margin-top: auto; }
.sy-ov > :last-child { margin-bottom: auto; }
.sy-start { background: linear-gradient(180deg, rgba(8, 12, 24, 0.9), rgba(8, 12, 24, 0.78)); }
/* Opaque: at 97% alpha the board ghosted through the option text. */
.sy-opts { background: var(--sy-panel); }
.sy-pause { background: rgba(8, 12, 24, 0.9); }
/* Hints laid over the canvas must let taps through. */
.sy-ready, .sy-count { pointer-events: none; background: transparent; justify-content: center; }
.sy-ready > :first-child, .sy-ready > :last-child { margin: 0; }
.sy-readybox { display: flex; flex-direction: column; gap: 6px; padding: 14px 20px; border-radius: 16px; background: rgba(8, 12, 24, 0.72); border: 1px solid var(--sy-line); animation: syPulse 1.8s ease-in-out infinite; }
.sy-readybox b { font-size: 22px; letter-spacing: 0.16em; color: var(--sy-accent); }
.sy-readybox span { font-size: 13px; font-weight: 600; color: var(--sy-text); }
.sy-count span { font-size: 96px; font-weight: 700; color: #fff; text-shadow: 0 0 30px rgba(251, 146, 60, 0.7); animation: syPop 0.7s ease-out; }
@keyframes syPop { from { transform: scale(1.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.sy-title { margin: 0; font-size: 34px; font-weight: 700; letter-spacing: 0.12em; color: #fff; text-shadow: 0 0 22px rgba(251, 146, 60, 0.55); }
.sy-tag { margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--sy-dim); }
.sy-h2 { margin: 0; font-size: 22px; letter-spacing: 0.14em; color: #fff; }
.sy-mdesc { margin: 0; min-height: 3.1em; font-size: 13px; line-height: 1.35; font-weight: 600; color: var(--sy-text); max-width: 290px; }
.sy-mbest { margin: 0; font-size: 11px; letter-spacing: 0.14em; font-weight: 700; color: var(--sy-accent); }
.sy-note { margin: 4px 0 0; font-size: 11px; font-weight: 600; color: var(--sy-dim); }

/* mode picker (radiogroup) */
.sy-modes { display: flex; gap: 8px; width: 100%; max-width: 300px; }
.sy-mode { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 11px 4px; border-radius: 12px; border: 1.5px solid var(--sy-line); background: rgba(30, 41, 59, 0.55); color: var(--sy-text); font: inherit; font-weight: 700; font-size: 13px; letter-spacing: 0.1em; cursor: pointer; transition: transform 0.12s, border-color 0.12s, background 0.12s; }
.sy-mode small { font-size: 9px; letter-spacing: 0.14em; color: var(--sy-accent); font-weight: 700; }
.sy-mode:hover { border-color: rgba(251, 146, 60, 0.6); }
.sy-mode.on { border-color: var(--sy-accent); background: rgba(251, 146, 60, 0.16); color: #fff; box-shadow: 0 0 16px rgba(251, 146, 60, 0.3); }
.sy-mode:focus-visible, .sy-btn:focus-visible, .sy-row:focus-visible, .sy-bbtn:focus-visible, .sy-lv:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.sy-btn { width: 100%; max-width: 260px; padding: 13px 16px; border-radius: 12px; border: 1.5px solid var(--sy-line); background: rgba(30, 41, 59, 0.7); color: #f1f5f9; font: inherit; font-size: 14px; font-weight: 700; letter-spacing: 0.14em; cursor: pointer; }
.sy-btn:active { transform: translateY(1px); }
.sy-primary { border: 0; color: #1c1206; background: linear-gradient(180deg, #fdba74, var(--sy-accent) 60%, var(--sy-accent2)); box-shadow: 0 6px 22px rgba(251, 146, 60, 0.38); }

/* options */
.sy-sec { width: 100%; max-width: 300px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.sy-seclbl { align-self: flex-start; font-size: 10px; font-weight: 700; letter-spacing: 0.16em; color: var(--sy-dim); }
.sy-rows { width: 100%; max-width: 300px; display: flex; flex-direction: column; gap: 6px; }
.sy-row { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--sy-line); background: rgba(30, 41, 59, 0.5); color: var(--sy-text); font: inherit; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; cursor: pointer; }
.sy-row b { color: var(--sy-accent); letter-spacing: 0.1em; }
.sy-row[aria-pressed=false] b { color: var(--sy-dim); }
.sy-liv { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; width: 100%; }
.sy-lv { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px; border-radius: 10px; border: 1.5px solid var(--sy-line); background: rgba(30, 41, 59, 0.5); color: var(--sy-text); font: inherit; font-size: 12px; cursor: pointer; }
.sy-lv small { font-size: 9px; letter-spacing: 0.1em; color: var(--sy-dim); font-weight: 700; }
.sy-lv.on { border-color: var(--sy-accent); background: rgba(251, 146, 60, 0.14); }
.sy-lv.on small { color: var(--sy-accent); }
.sy-lv.locked { opacity: 0.5; cursor: not-allowed; }
#trophy-list { width: 100%; max-width: 300px; max-height: 260px; overflow-y: auto; text-align: left; border-radius: 10px; border: 1px solid var(--sy-line); padding: 6px; background: rgba(15, 23, 42, 0.6); }

.sy-toast { position: absolute; left: 50%; bottom: 14px; transform: translate(-50%, 12px); max-width: 90%; padding: 8px 14px; border-radius: 999px; background: rgba(15, 23, 42, 0.95); border: 1px solid var(--sy-line); font-size: 12px; font-weight: 700; color: #f8fafc; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 5; }
.sy-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- bar ---------- */
.sy-bar { width: var(--cw); display: flex; gap: 8px; align-items: stretch; }
.sy-bbtn { flex: 1; white-space: nowrap; padding: 11px 6px; border-radius: 12px; border: 1.5px solid var(--sy-line); background: rgba(30, 41, 59, 0.6); color: #e2e8f0; font: inherit; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; cursor: pointer; }
.sy-bbtn:active { transform: translateY(1px); }
.sy-icon { flex: 0 0 46px; font-size: 18px; letter-spacing: 0; }
.sy-icon.off { color: #64748b; text-decoration: line-through; }

/* ---------- compact / tight / land ---------- */
.sy-card.compact .sy-hud { min-height: 38px; }
.sy-card.compact .sy-val { font-size: 22px; }
.sy-card.compact .sy-title { font-size: 28px; }
.sy-card.compact .sy-bbtn { padding: 9px 4px; }
.sy-card.tight .sy-bbtn { font-size: 11px; letter-spacing: 0.06em; }
.sy-card.tight .sy-title { font-size: 24px; letter-spacing: 0.08em; }
.sy-card.tight .sy-mode { font-size: 11px; padding: 9px 2px; }
.sy-card.tight .sy-chip { font-size: 10px; padding: 4px 8px; }
.sy-card.tight .sy-mdesc { font-size: 12px; }

.sy-card.land { display: grid; grid-template-columns: auto var(--side, 190px); grid-template-rows: auto 1fr auto; align-items: start; justify-content: center; column-gap: 12px; row-gap: 8px; }
.sy-card.land .sy-stage { grid-column: 1; grid-row: 1 / span 3; }
.sy-card.land .sy-hud { grid-column: 2; grid-row: 1; width: auto; flex-direction: column; align-items: stretch; gap: 6px; }
.sy-card.land .sy-hr { align-items: flex-start; }
.sy-card.land .sy-bar { grid-column: 2; grid-row: 3; width: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; align-self: end; }
.sy-card.land .sy-bbtn { padding: 9px 4px; }
.sy-card.land .sy-icon { font-size: 16px; }
.sy-card.land .sy-chip { align-self: flex-start; }
.sy-card.land .sy-title { font-size: 22px; }
.sy-card.land .sy-tag { display: none; }
.sy-card.land .sy-mdesc { font-size: 11px; min-height: 0; }
.sy-card.land .sy-mode { padding: 7px 2px; font-size: 11px; }
.sy-card.land .sy-btn { padding: 9px 12px; }

.sy-rm .sy-readybox, .sy-rm .sy-count span, .sy-rm .sy-lamps.last .sy-lamp.on, .sy-rm .sy-time.low { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .sy-readybox, .sy-count span, .sy-lamps.last .sy-lamp.on, .sy-time.low { animation: none; }
  .sy-toast, .sy-mode { transition: none; }
}
