:root {
  --bg: #07090d;
  --panel: #10151d;
  --card: #151c26;
  --line: #283341;
  --text: #f0f4f9;
  --muted: #9aa8b9;
  --ice: #a8e2ff;
  --ok: #43e6b1;
  --warn: #e6b866;
  --danger: #f38d94;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }

#app { min-height: 100vh; padding: 20px 16px 40px; }
.wrap { max-width: 1280px; margin: 0 auto; }
.studio { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 16px; align-items: start; }
.preview-frame { width: 100%; aspect-ratio: 16 / 9; border: 1px solid var(--line); border-radius: 12px; background: #02040a; }
.presets, .checks { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.preset { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 999px; min-height: 36px; padding: 0 12px; }
.preset.on { border-color: var(--ice); color: var(--ice); box-shadow: 0 0 0 1px rgba(168, 226, 255, 0.35); }
.studio label, .card label { display: grid; gap: 6px; margin-top: 10px; color: var(--muted); font-size: 13px; }
.studio input, .studio select, .card input, .card select { min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); padding: 0 10px; }
@media (max-width: 980px) { .studio { grid-template-columns: 1fr; } }
.top {
  display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap;
  margin-bottom: 16px;
}
h1 { font-size: 20px; margin: 0; font-weight: 600; flex: 1 0 auto; }
.muted { color: var(--muted); }
.ice { color: var(--ice); }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.danger { color: var(--danger); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}
.panel { background: var(--panel); }

.login { max-width: 420px; margin: 12vh auto 0; text-align: center; }
.code {
  font-size: 40px; letter-spacing: 0.18em; margin: 18px 0 8px;
  font-variant-numeric: tabular-nums;
}
.clock {
  font-size: clamp(64px, 14vw, 112px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  margin: 8px 0 4px;
}
.level { font-size: 22px; color: var(--ice); margin: 0 0 12px; }

.grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 12px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.stat b { display: block; font-size: 18px; margin-top: 4px; font-weight: 600; }
.stat span { color: var(--muted); font-size: 12px; }

.actions, .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn, .chip, .ghost {
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #1b2430;
  padding: 0 14px;
}
.btn.primary { background: #12352c; border-color: #1f6b56; color: var(--ok); }
.btn.warn { background: #3a3018; border-color: #6d5724; color: var(--warn); }
.btn.danger { background: #3a2226; border-color: #6d3a40; color: var(--danger); }
.chip { min-width: 72px; }
.why { color: var(--warn); font-size: 13px; min-height: 18px; margin-top: 6px; }
.banner {
  border: 1px solid #6d3a40;
  background: #2a1619;
  color: var(--danger);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.row { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
button.event {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-top: 8px;
}
select, input[type="number"], input[type="text"], input[type="password"] {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 48px;
  padding: 0 12px;
  margin-top: 8px;
}
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.62);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: min(520px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  padding: 16px;
}
a { color: var(--ice); text-decoration: none; }

.nav { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:16px; }
.nav button { background:#151c26; border:1px solid #283341; color:#f0f4f9; min-height:40px; border-radius:12px; padding:0 12px; }
.preview-screen { background:#07090d center/cover no-repeat; position:relative; }
.preview-screen::after { content:""; position:absolute; inset:0; background:rgba(7,9,13,.72); }
.preview-screen > * { position:relative; z-index:1; }
h2 { font-size:16px; margin:8px 0; }

@media (max-width: 800px) {
  .grid, .stats { grid-template-columns: 1fr; }
  .btn, .chip { flex: 1 1 calc(50% - 8px); }
}
