@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700;800;900&family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');

:root {
  color-scheme: dark;
  --page: #090b18;
  --panel: #101326;
  --border: #252945;
  --text: #f3f1ff;
  --muted: #a1a7c5;
  --violet: #b69cff;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  font-family: "Geist", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body {
  min-width: 280px;
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(ellipse at 48% -20%, #262043 0, transparent 56%), var(--page);
  color: var(--text);
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid #e0d3ff; outline-offset: 4px; }
button:disabled { cursor: default; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.symbols { position: absolute; width: 0; height: 0; }
.shell { width: min(1120px, calc(100% - 64px)); margin: 0 auto; padding: 38px 0 48px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; }
.brand, .toolbar { display: flex; align-items: center; }
.brand { gap: 13px; }
.brand-mark, .prompt-mark { display: grid; place-items: center; color: #c8b2ff; background: #251a45; border: 1px solid #6345a2; }
.brand-mark { width: 45px; height: 45px; border-radius: 12px; box-shadow: inset 0 0 14px #7c49ec25, 0 0 19px #7c49ec20; }
.brand-mark svg { width: 25px; height: 25px; }
.brand-title, .brand-subtitle { display: block; }
.brand-title { font-size: 20px; font-weight: 900; line-height: 1.1; letter-spacing: -.035em; }
.brand-title span { color: var(--violet); }
.brand-subtitle { margin-top: 4px; color: var(--muted); font: 600 10px/1.1 var(--mono); letter-spacing: .26em; }
.toolbar { gap: 8px; }
.tool-button { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 9px; background: #121528; color: #c2c7e3; transition: background .15s, color .15s; }
.tool-button:hover:not(:disabled) { background: #251c43; color: #e2d2ff; }
.tool-button:disabled { opacity: .46; }
.tool-button svg { width: 18px; height: 18px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 242px; gap: 18px; align-items: start; }
.machine, .panel { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; }
.machine { overflow: hidden; box-shadow: 0 20px 65px #03041066; }
.machine-header { height: 48px; padding: 0 17px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font: 600 11px/1 var(--mono); letter-spacing: .12em; }
.stage-label { display: flex; align-items: center; gap: 9px; color: #cbb6ff; }
.stage-dot { width: 7px; height: 7px; background: #a477ff; border-radius: 50%; box-shadow: 0 0 11px #a477ffb0; }
.brick-label strong { color: #e5daff; }
.arena {
  position: relative;
  height: clamp(510px, 62vh, 640px);
  overflow: hidden;
  border-top: 1px solid var(--border);
  background-color: #0b0e20;
  background-image: radial-gradient(ellipse at 50% 2%, #251b45a6, transparent 62%), linear-gradient(#a18aff0c 1px, transparent 1px), linear-gradient(90deg, #a18aff0c 1px, transparent 1px);
  background-size: 100% 100%, 26px 26px, 26px 26px;
}
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.overlay { position: absolute; inset: 0; display: grid; align-items: center; justify-items: center; padding: 150px 12px 38px; pointer-events: none; }
.overlay[hidden] { display: none; }
.prompt { width: min(380px, 100%); text-align: center; }
.prompt-mark { margin: 0 auto 13px; width: 42px; height: 42px; border-radius: 11px; box-shadow: 0 0 25px #8c52f044; }
.prompt-mark svg { width: 24px; height: 24px; }
.prompt h1 { margin: 0; color: #f6f2ff; font-size: clamp(31px, 4vw, 52px); line-height: 1.02; letter-spacing: -.065em; font-weight: 900; text-shadow: 0 2px 24px #aa73ff3a; }
.prompt h1 span { color: #b89bff; }
.prompt p { margin: 10px 0 20px; color: #b8bad4; font-size: 14px; }
.play-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 165px; min-height: 45px; padding: 8px 16px; border-radius: 8px; border: 1px solid #c0a0ff; background: linear-gradient(180deg, #a27bfc, #8356e8); color: #0f0920; box-shadow: 0 0 24px #8d55f45c, inset 0 1px #ffffff42; font: 700 12px/1.2 var(--mono); letter-spacing: .075em; pointer-events: auto; transition: filter .15s, transform .15s; }
.play-button:hover { filter: brightness(1.15); transform: translateY(-1px); }
.play-button:active { transform: translateY(1px); }
.play-hint { margin-top: 11px; color: #a1a7c5; font: 11px/1.2 var(--mono); }
kbd { display: inline-flex; min-width: 23px; min-height: 23px; padding: 2px 6px; align-items: center; justify-content: center; border: 1px solid #343954; border-radius: 5px; background: #1a1e34; color: #d3d5ec; font: 500 10px/1 var(--mono); vertical-align: middle; }
.play-hint kbd { min-height: 18px; padding-inline: 4px; font-size: 9px; }
.sidebar { display: grid; gap: 14px; }
.panel { padding: 18px; }
.panel h2 { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font: 600 11px/1.2 var(--mono); letter-spacing: .14em; }
.panel h2 svg { width: 16px; height: 16px; color: var(--violet); }
.panel p { margin: 0; }
.score-panel .score { margin-top: 8px; color: #f5f0ff; font: 600 38px/1.1 var(--mono); letter-spacing: -.06em; text-shadow: 0 0 20px #9d64f54d; }
.divider { height: 1px; margin: 17px 0; background: var(--border); }
.score-panel .best { margin-top: 7px; color: #c0a7ff; font: 600 25px/1.1 var(--mono); letter-spacing: -.045em; }
.hearts { display: flex; gap: 8px; margin-top: 9px; }
.hearts svg { width: 24px; height: 24px; color: #ef72b3; fill: #ef72b3; filter: drop-shadow(0 0 5px #ef72b34c); }
.hearts svg.lost { color: #41445e; fill: transparent; filter: none; }
.controls-panel dl { display: grid; gap: 10px; margin: 16px 0 0; }
.controls-panel dl div { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.controls-panel dt { color: #d1d3e7; font-size: 12px; }
.controls-panel dd { margin: 0; white-space: nowrap; }
.controls-panel .touch-note { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 12px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 840px) {
  .shell { width: calc(100% - 36px); padding-top: 24px; }
  .layout { grid-template-columns: minmax(0, 1fr) 190px; gap: 12px; }
  .panel { padding: 14px; }
}
@media (max-width: 640px) {
  .shell { width: calc(100% - 24px); padding-top: 16px; padding-bottom: 22px; }
  .topbar { margin-bottom: 14px; }
  .brand { gap: 8px; }
  .brand-title { font-size: 16px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 9px; }
  .brand-mark svg { width: 21px; height: 21px; }
  .tool-button { width: 33px; height: 33px; }
  .toolbar { gap: 5px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .arena { height: clamp(375px, 57svh, 545px); }
  .machine-header { height: 36px; padding-inline: 12px; }
  .overlay { padding-top: 110px; padding-bottom: 28px; }
  .sidebar { grid-template-columns: 1fr 1fr; gap: 10px; }
  .controls-panel { grid-column: 1 / -1; }
  .controls-panel dl { grid-template-columns: 1fr 1fr; column-gap: 22px; }
  .score-panel .score { font-size: 29px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
