:root {
  color-scheme: dark;
  --bg: #161a20;
  --panel: #20242d;
  --panel-alt: #2b313c;
  --line: #323b49;
  --line-2: #4a5565;
  --accent: #2fc6a3;
  --text: #f4f7fa;
  --muted: #aeb7c2;
  --danger: #f16d6d;
  --gold: #ffb454;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
}
button, input, textarea { font: inherit; }
button {
  min-height: 34px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 6px 14px;
  margin: 0 8px 8px 0;
  background: #35404e;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}
button:hover { border-color: var(--accent); color: #fff; }
button.primary { background: var(--accent); border-color: var(--accent); color: #081412; }
label { display: block; margin: 10px 0 0; color: var(--text); }
input[type="checkbox"] { accent-color: var(--accent); margin-right: 8px; }

.forge-shell {
  width: 100vw;
  height: 100vh;
  min-width: 1080px;
  display: grid;
  grid-template-columns: 44% 56%;
  background: radial-gradient(circle at 20% 10%, rgba(47,198,163,.12), transparent 32%), var(--bg);
}
.control-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 24px;
  border-right: 1px solid rgba(74,85,101,.6);
}
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.app-header p { margin: 4px 0 0; color: var(--muted); }
.hotkey-pill {
  border: 1px solid #404a58;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--panel-alt);
  font-weight: 800;
  white-space: nowrap;
}
.settings-grid {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  gap: 24px;
}
.panel-card {
  min-width: 0;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  background: var(--panel);
}
.panel-card h2 { margin: 0; font-size: 20px; }
.panel-card h3 { margin: 20px 0 0; font-size: 17px; }
.panel-card p { margin: 8px 0 16px; color: var(--muted); line-height: 1.55; }
.button-row { display: flex; flex-wrap: wrap; margin-bottom: 4px; }
.safety-note {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #141820;
  color: var(--muted);
  line-height: 1.5;
}
hr { border: 0; border-top: 1px solid #3a4553; margin: 22px 0 16px; }
.statusbar {
  min-height: 34px;
  display: flex;
  align-items: center;
  color: var(--muted);
}

.preview-stage {
  position: relative;
  overflow: hidden;
  min-height: 0;
  background:
    linear-gradient(180deg, rgba(17,23,35,.65), rgba(5,8,12,.9)),
    radial-gradient(circle at 50% 18%, rgba(47,198,163,.2), transparent 30%),
    #111820;
}
.game-scene {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, #253448 0%, #10151d 55%, #090c10 100%);
}
.game-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 72px 72px;
  opacity: .35;
}
.mountain {
  position: absolute;
  bottom: 22%;
  width: 54%;
  height: 38%;
  background: linear-gradient(145deg, #243544, #111a24);
  clip-path: polygon(0 100%, 16% 48%, 28% 72%, 45% 24%, 61% 70%, 76% 38%, 100% 100%);
  opacity: .82;
}
.mountain.one { left: -8%; }
.mountain.two { right: -10%; transform: scaleX(-1); opacity: .55; }
.lane {
  position: absolute;
  bottom: -8%;
  width: 16%;
  height: 70%;
  border: 1px solid rgba(47,198,163,.25);
  background: linear-gradient(180deg, rgba(47,198,163,.16), rgba(255,255,255,.04));
  transform: perspective(520px) rotateX(62deg);
  transform-origin: bottom center;
}
.lane-a { left: 34%; }
.lane-b { right: 34%; }
.player-card {
  position: absolute;
  left: 50%;
  bottom: 15%;
  translate: -50% 0;
  display: grid;
  place-items: center;
  width: 92px;
  height: 74px;
  border: 2px solid rgba(47,198,163,.8);
  border-radius: 18px;
  background: rgba(32,36,45,.86);
  box-shadow: 0 0 28px rgba(47,198,163,.28);
  font-weight: 900;
  letter-spacing: .18em;
}
.overlay-layer {
  position: absolute;
  inset: 0;
  opacity: 1;
  transition: opacity .22s ease, transform .22s ease;
}
.overlay-layer.hidden { opacity: 0; pointer-events: none; transform: scale(.985); }
.overlay-layer.click-through { pointer-events: none; }
.overlay-layer.click-through .overlay-topbar { outline: 2px dashed rgba(255,180,84,.65); }
.overlay-topbar {
  position: absolute;
  left: 50%;
  top: 18px;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(74,85,101,.55);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(32,36,45,.88);
  box-shadow: 0 18px 42px rgba(0,0,0,.22);
  backdrop-filter: blur(10px);
}
.overlay-topbar strong { margin: 0 8px 0 4px; }
.overlay-topbar button { min-height: 28px; padding: 3px 10px; margin: 0; }
.overlay-widget {
  position: absolute;
  width: 260px;
  min-height: 120px;
  border: 1px solid rgba(74,85,101,.72);
  border-radius: 10px;
  padding: 14px;
  background: rgba(32,36,45,.88);
  box-shadow: 0 20px 55px rgba(0,0,0,.28);
  backdrop-filter: blur(8px);
}
.overlay-widget h2 { margin: 0 0 10px; font-size: 16px; }
.overlay-widget p { margin: 0; color: #fff; line-height: 1.55; }
.overlay-widget span { display: block; margin-top: 8px; color: var(--muted); }
.performance-widget { left: 72px; top: 86px; }
.shortcuts-widget { left: 72px; top: 270px; width: 280px; }
.notes-widget { left: 380px; top: 86px; width: 320px; }
.shortcuts-widget button {
  display: block;
  width: 100%;
  text-align: left;
  margin: 0 0 8px;
  min-height: 32px;
}
.notes-widget textarea {
  width: 100%;
  min-height: 128px;
  resize: vertical;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 10px;
  background: #141820;
  color: var(--text);
  caret-color: var(--text);
}
.overlay-widget.disabled { display: none; }

@media (max-width: 1080px) {
  body { overflow: auto; }
  .forge-shell { min-width: 0; height: auto; min-height: 100vh; grid-template-columns: 1fr; }
  .control-panel { border-right: 0; border-bottom: 1px solid rgba(74,85,101,.6); }
  .preview-stage { min-height: 760px; }
}
@media (max-width: 760px) {
  .control-panel { padding: 16px; }
  .app-header { align-items: flex-start; flex-direction: column; }
  .settings-grid { grid-template-columns: 1fr; }
  .preview-stage { min-height: 720px; }
  .overlay-widget { width: min(260px, calc(100% - 24px)); left: 12px; }
  .performance-widget { top: 86px; }
  .shortcuts-widget { top: 262px; }
  .notes-widget { top: 442px; }
  .overlay-topbar { width: calc(100% - 24px); justify-content: center; flex-wrap: wrap; }
}