:root {
  --bg: #0b0d11;
  --panel: #14171e;
  --panel-2: #1b1f28;
  --line: #262b36;
  --ink: #e8ecf4;
  --muted: #8b94a6;
  --accent: #3b74f5;
  --accent-ink: #fff;
  --good: #34d399;
  --warn: #f59e0b;
  --bad: #f0637a;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

a { color: var(--accent); text-decoration: none; }

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 14px 14px calc(28px + env(safe-area-inset-bottom));
}

header.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px calc(12px + env(safe-area-inset-top));
  padding-top: max(12px, env(safe-area-inset-top));
  background: rgba(11, 13, 17, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.bar h1 { font-size: 15px; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
.bar .spacer { flex: 1; }
.bar a.link { color: var(--muted); font-size: 13px; font-weight: 600; }
.bar a.link:hover { color: var(--ink); }

.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bad); flex: none;
  transition: background 0.2s;
}
.dot.on { background: var(--good); }
.dot.wait { background: var(--warn); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

.card > h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 0 0 12px;
  font-weight: 700;
}

label.field { display: block; margin-bottom: 14px; }
label.field:last-child { margin-bottom: 0; }

.row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}
.row .name { font-size: 13px; color: var(--muted); font-weight: 600; }
.row .val { font-size: 14px; font-variant-numeric: tabular-nums; font-weight: 650; }

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 34px;
  background: transparent;
  margin: 0;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px; background: var(--panel-2);
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--ink); border: none; margin-top: -12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
input[type='range']::-moz-range-track { height: 6px; border-radius: 3px; background: var(--panel-2); }
input[type='range']::-moz-range-thumb {
  width: 30px; height: 30px; border-radius: 50%; background: var(--ink); border: none;
}

button, .btn {
  font: inherit;
  font-weight: 650;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: filter 0.12s, background 0.12s;
}
button:active, .btn:active { filter: brightness(1.35); }
button:disabled { opacity: 0.4; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.danger { color: var(--bad); }

.grid { display: grid; gap: 8px; }
.grid.c2 { grid-template-columns: 1fr 1fr; }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }

.playbtn {
  width: 100%;
  font-size: 21px;
  font-weight: 750;
  letter-spacing: 0.01em;
  padding: 24px 14px;
  border-radius: var(--radius);
}
.playbtn.playing { background: var(--bad); border-color: var(--bad); color: #fff; }

.track {
  height: 7px;
  border-radius: 4px;
  background: var(--panel-2);
  overflow: hidden;
  margin: 12px 0 8px;
  cursor: pointer;
}
.track .fill { height: 100%; width: 0; background: var(--accent); transition: width 0.25s linear; }

.times {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums;
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  font-size: 13px; font-weight: 600;
  padding: 9px 12px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

select, input[type='text'], input[type='password'], textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px;
}
textarea { resize: vertical; line-height: 1.6; }
select { -webkit-appearance: none; appearance: none; }

.hint { font-size: 12px; color: var(--muted); line-height: 1.5; }
.hint kbd {
  font: inherit; font-size: 11px; font-weight: 700;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 5px;
}

.toast {
  position: fixed;
  left: 50%; bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: var(--panel-2); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: all 0.2s; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
