:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #071017;
  --panel: #0d1921;
  --panel-2: #101f29;
  --text: #f3f8fa;
  --muted: #91a6b0;
  --line: #21333d;
  --cyan: #5de1e6;
  --lime: #d6ff61;
  --danger: #ff806d;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 8% -10%, rgba(93,225,230,.11), transparent 28rem),
    radial-gradient(circle at 95% 12%, rgba(214,255,97,.055), transparent 25rem),
    var(--bg);
}

button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 76px;
  padding: 0 max(24px, calc((100vw - 1220px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(7,16,23,.82);
  border-bottom: 1px solid rgba(145,166,176,.14);
  backdrop-filter: blur(16px);
}

.brand { display: flex; align-items: center; gap: 12px; font-size: 16px; font-weight: 800; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.brand-mark {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  color: #071017;
  background: linear-gradient(135deg, var(--lime), var(--cyan));
  border-radius: 10px;
  font-size: 13px;
  font-weight: 950;
  letter-spacing: -.04em;
}

.dashboard { width: min(1220px, calc(100% - 40px)); margin: 0 auto; padding: 64px 0 80px; }
.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 34px; }
.kicker { margin: 0 0 8px; color: var(--cyan); font-size: 11px; font-weight: 900; letter-spacing: .18em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(36px, 5vw, 64px); line-height: .98; letter-spacing: -.055em; }
h2 { margin-bottom: 0; font-size: 21px; letter-spacing: -.025em; }
.lede { max-width: 700px; margin-bottom: 0; color: var(--muted); font-size: 17px; line-height: 1.6; }
.live-pill { padding: 9px 13px; display: flex; align-items: center; gap: 8px; color: #dfffa0; background: rgba(214,255,97,.08); border: 1px solid rgba(214,255,97,.2); border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.live-pill span, .status-dot { width: 7px; height: 7px; display: block; background: var(--lime); border-radius: 50%; box-shadow: 0 0 11px rgba(214,255,97,.8); }

.notice { margin: -10px 0 24px; padding: 13px 16px; border-radius: 11px; font-weight: 700; }
.notice.success { color: #e8ffb4; background: rgba(214,255,97,.09); border: 1px solid rgba(214,255,97,.2); }
.notice.error { color: #ffd5ce; background: rgba(255,128,109,.09); border: 1px solid rgba(255,128,109,.24); }

.stats-grid { display: grid; grid-template-columns: 1.35fr 1fr 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.stat, .panel { background: linear-gradient(145deg, rgba(255,255,255,.015), transparent 40%), var(--panel); border: 1px solid var(--line); border-radius: 17px; }
.stat { min-height: 126px; padding: 23px; display: flex; flex-direction: column; justify-content: space-between; }
.stat span { color: var(--muted); font-size: 12px; font-weight: 750; letter-spacing: .04em; }
.stat strong { overflow: hidden; font-size: clamp(22px, 2.8vw, 34px); letter-spacing: -.045em; text-overflow: ellipsis; white-space: nowrap; }
.stat small { color: var(--cyan); font-weight: 700; }

.content-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; }
.content-grid.lower { margin-top: 14px; grid-template-columns: 1fr 1fr; }
.panel { padding: 25px; }
.panel-head { min-height: 46px; margin-bottom: 21px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-head > span { color: var(--muted); font-size: 12px; }

.preview-stage { aspect-ratio: 16 / 8.4; overflow: hidden; background: #19333a; border: 1px solid rgba(93,225,230,.18); border-radius: 12px; }
.preview-stage iframe { width: 200%; height: 200%; border: 0; transform: scale(.5); transform-origin: left top; }
.hint { margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.full { grid-column: 1 / -1; }
label { display: grid; gap: 7px; color: #c4d2d7; font-size: 12px; font-weight: 750; }
input, select {
  width: 100%;
  height: 45px;
  padding: 0 13px;
  color: var(--text);
  background: #081219;
  border: 1px solid #263943;
  border-radius: 9px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
input:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(93,225,230,.11); }
input::placeholder { color: #58707b; }

.button {
  min-height: 43px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 850;
  cursor: pointer;
  transition: transform .16s ease, filter .16s ease, background .16s ease;
}
.button:hover { transform: translateY(-1px); filter: brightness(1.05); }
.button:active { transform: translateY(0); }
.button.primary { color: #061117; background: var(--lime); }
.button.secondary { color: var(--text); background: #18303b; border-color: #294652; }
.button.ghost { color: #b9c8ce; background: transparent; border-color: var(--line); }
.button.danger { color: #190806; background: var(--danger); }
.button.text-button { min-height: 34px; padding: 0; color: var(--muted); background: transparent; text-align: left; }
.button.small { min-height: 36px; padding: 0 13px; font-size: 12px; }
.copy-result { min-height: 18px; color: var(--cyan); font-size: 12px; font-weight: 700; }
.gps-panel { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.gps-panel h2 { margin-bottom: 7px; }
.gps-panel .hint { max-width: 670px; }
.gps-actions { min-width: 340px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gps-actions .text-button, .gps-actions .copy-result { grid-column: 1 / -1; text-align: right; }

.history-panel { margin-top: 14px; }
.history-list { display: grid; }
.history-row { min-height: 53px; display: grid; grid-template-columns: 28px 150px 1fr auto; align-items: center; gap: 12px; border-top: 1px solid rgba(145,166,176,.12); font-size: 13px; }
.history-row > span:nth-child(3) { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.history-row b { font-variant-numeric: tabular-nums; }
.history-icon { width: 22px; height: 22px; display: grid; place-items: center; color: var(--muted); background: #13232c; border-radius: 50%; font-weight: 900; }
.history-icon.winner { color: #071017; background: var(--lime); }
.empty { padding: 30px; color: var(--muted); text-align: center; border: 1px dashed #29404b; border-radius: 11px; }

.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.danger-zone h2 { margin-bottom: 8px; }
.danger-zone form { min-width: 190px; display: grid; gap: 13px; }
.check { grid-template-columns: auto 1fr; align-items: center; }
.check input { width: 16px; height: 16px; accent-color: var(--danger); }

.login-page { display: grid; place-items: center; padding: 24px; }
.login-card { width: min(430px, 100%); padding: 38px; background: var(--panel); border: 1px solid var(--line); border-radius: 19px; box-shadow: 0 24px 80px rgba(0,0,0,.3); }
.login-card .brand-mark { margin-bottom: 28px; }
.login-card h1 { font-size: 38px; }
.login-card .lede { margin-bottom: 26px; font-size: 14px; }
.stack { display: grid; gap: 16px; }

@media (max-width: 860px) {
  .dashboard { width: min(100% - 24px, 640px); padding-top: 38px; }
  .intro { align-items: flex-start; flex-direction: column; }
  .stats-grid, .content-grid, .content-grid.lower { grid-template-columns: 1fr; }
  .gps-panel { align-items: stretch; flex-direction: column; }
  .gps-actions { min-width: 0; }
  .history-row { grid-template-columns: 28px 1fr auto; padding: 10px 0; }
  .history-row > span:nth-child(3) { grid-column: 2 / -1; grid-row: 2; }
  .danger-zone { align-items: stretch; flex-direction: column; }
}

@media (max-width: 520px) {
  .topbar { height: 66px; padding: 0 14px; }
  .dashboard { width: calc(100% - 20px); }
  .panel, .stat { padding: 19px; }
  .form-grid { grid-template-columns: 1fr; }
  .full { grid-column: auto; }
  .live-pill { display: none; }
  .gps-actions { grid-template-columns: 1fr; }
  .gps-actions .text-button, .gps-actions .copy-result { grid-column: auto; text-align: left; }
}
