:root {
  --bg: #080916;
  --panel: rgba(18, 22, 45, 0.78);
  --panel-strong: rgba(28, 34, 68, 0.92);
  --line: rgba(255, 255, 255, 0.12);
  --text: #eef3ff;
  --muted: #9da8c9;
  --accent: #7c5cff;
  --accent-2: #00e0ff;
  --danger: #ff5d7a;
  --ok: #50f5a7;
  --warn: #ffe06a;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  background: radial-gradient(circle at 15% 8%, rgba(124, 92, 255, 0.35), transparent 30%),
              radial-gradient(circle at 85% 18%, rgba(0, 224, 255, 0.22), transparent 34%),
              linear-gradient(135deg, #070817, #0b1024 54%, #090816);
  color: var(--text);
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  width: 44vmax;
  height: 44vmax;
  border-radius: 999px;
  filter: blur(90px);
  opacity: .18;
  pointer-events: none;
  z-index: -1;
}
.orb-a { left: -14vmax; top: 20vmax; background: #8d5cff; }
.orb-b { right: -16vmax; bottom: -16vmax; background: #00e0ff; }

.app-shell {
  width: min(1220px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 22px;
  align-items: end;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-2);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
}

h1, h2 { margin: 0; line-height: 1.1; }
h1 { font-size: clamp(32px, 6vw, 64px); letter-spacing: -0.06em; max-width: 820px; }
h2 { font-size: clamp(20px, 3vw, 30px); letter-spacing: -0.04em; }
.lead { max-width: 720px; color: var(--muted); font-size: 17px; line-height: 1.7; }
.muted { color: var(--muted); line-height: 1.6; }

.hero-card, .panel, .hud-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.035));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.hero-card {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 210px;
  border-radius: 22px;
  padding: 16px 18px;
}
.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--warn);
  box-shadow: 0 0 18px currentColor;
}
.status-dot.ok { background: var(--ok); }
.status-dot.bad { background: var(--danger); }
.hero-card small { display: block; color: var(--muted); margin-top: 3px; }

.grid-layout {
  display: grid;
  grid-template-columns: minmax(310px, 0.9fr) minmax(360px, 1.1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.panel {
  border-radius: 28px;
  padding: 22px;
  background-color: var(--panel);
}

.section-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.upload-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}
.field-label { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
input[type="text"], input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0,0,0,.22);
  color: var(--text);
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
}
input:focus { border-color: rgba(0, 224, 255, .55); box-shadow: 0 0 0 3px rgba(0, 224, 255, .1); }

.file-drop {
  min-height: 138px;
  border: 1px dashed rgba(255,255,255,.25);
  border-radius: 22px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
  cursor: pointer;
  background: rgba(255,255,255,.035);
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.file-drop:hover { transform: translateY(-2px); border-color: rgba(0,224,255,.65); background: rgba(0,224,255,.06); }
.file-drop input { display: none; }
.file-icon { font-size: 34px; color: var(--accent-2); filter: drop-shadow(0 0 16px rgba(0,224,255,.45)); }
.file-drop small { color: var(--muted); }

.primary-btn, .ghost-btn, .demo-btn, .difficulty-tabs button, .mode-tabs button {
  border: 0;
  border-radius: 16px;
  padding: 12px 18px;
  font-weight: 900;
  letter-spacing: .02em;
  color: var(--text);
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease, background .15s ease;
}
.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04101d;
  box-shadow: 0 18px 42px rgba(0, 224, 255, .18);
}
.ghost-btn, .difficulty-tabs button, .mode-tabs button {
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
}
.demo-btn {
  background: linear-gradient(135deg, rgba(255,224,106,.92), rgba(80,245,167,.86));
  border: 1px solid rgba(255,255,255,.14);
  color: #04101d;
  box-shadow: 0 18px 42px rgba(80,245,167,.12);
}
.primary-btn:hover, .ghost-btn:hover, .demo-btn:hover, .difficulty-tabs button:hover, .mode-tabs button:hover { transform: translateY(-1px); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }

.status-box {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(0,0,0,.2);
  color: var(--muted);
  padding: 12px 14px;
  line-height: 1.5;
  min-height: 48px;
}
.status-box.ok { color: var(--ok); }
.status-box.bad { color: var(--danger); }

.song-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  max-height: 380px;
  overflow: auto;
  padding-right: 4px;
}
.song-list.empty {
  color: var(--muted);
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 20px;
}
.song-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px;
  background: rgba(255,255,255,.045);
  cursor: pointer;
}
.song-card:hover, .song-card.active { border-color: rgba(0,224,255,.65); background: rgba(0,224,255,.065); }
.song-card strong { font-size: 17px; }
.song-meta, .diff-badges { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12px; }
.badge { border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px; background: rgba(0,0,0,.18); }

.game-panel { padding: 18px; }
.game-topbar {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 18px;
  padding: 6px 4px 16px;
}
.selector-stack { display: grid; gap: 8px; justify-items: end; }
.mode-tabs, .difficulty-tabs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.mode-tabs button { min-width: 90px; }
.mode-tabs button.active { background: linear-gradient(135deg, rgba(255,224,106,.94), rgba(80,245,167,.86)); color: #03101a; }
.difficulty-tabs button.active { background: linear-gradient(135deg, rgba(124,92,255,.9), rgba(0,224,255,.8)); color: #03101a; }

.canvas-wrap {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: radial-gradient(circle at 50% 10%, rgba(0,224,255,.08), transparent 28%), #040614;
}
canvas {
  display: block;
  width: 100%;
  height: min(70vh, 640px);
  min-height: 420px;
}
.center-prompt {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 8px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(4,6,20,.15), rgba(4,6,20,.62));
}
.center-prompt.hidden { opacity: 0; }
.center-prompt strong { font-size: clamp(26px, 5vw, 46px); letter-spacing: -0.05em; }
.center-prompt span { color: var(--muted); }

.hud-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 14px;
}
.hud-card {
  border-radius: 18px;
  padding: 12px 14px;
  background-color: rgba(255,255,255,.05);
}
.hud-card span { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; }
.hud-card strong { display: block; font-size: 24px; margin-top: 4px; }
.hud-card.combo-hot {
  border-color: rgba(255,224,106,.42);
  box-shadow: 0 18px 54px rgba(255,224,106,.12), inset 0 0 22px rgba(0,224,255,.06);
}
.hud-card.combo-hot strong {
  text-shadow: 0 0 18px rgba(255,224,106,.48), 0 0 32px rgba(0,224,255,.32);
}

.controls-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}
.offset-control {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  margin-left: auto;
}
.offset-control input { width: 180px; }

@media (max-width: 880px) {
  .hero, .grid-layout, .game-topbar { grid-template-columns: 1fr; display: grid; }
  .selector-stack { justify-items: stretch; }
  .hero-card { width: 100%; }
  .hud-grid { grid-template-columns: repeat(2, 1fr); }
  .offset-control { width: 100%; margin-left: 0; }
  .offset-control input { flex: 1; }
  canvas { min-height: 520px; }
}
