:root {
  --bg: #0b1d2a;
  --card: #12293a;
  --ink: #e8f3fa;
  --muted: #8eaabd;
  --accent: #5cc8ff;
  --accent-ink: #062033;
  --line: #1f3d52;
  --ok: #4ade80;
  --warn: #fbbf24;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(32px + env(safe-area-inset-bottom));
}

header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
h1 { font-size: 1.3rem; margin: 0; letter-spacing: 0.02em; }
h2 { font-size: 1rem; margin: 0 0 8px; }

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

label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 0.9rem; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }

input:not([type]), input[type="text"], select {
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
label.inline select { width: auto; margin: 0; padding: 6px 8px; }

button {
  font: inherit;
  color: var(--ink);
  background: var(--line);
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  min-height: 44px;
  cursor: pointer;
}
button:disabled { opacity: 0.6; }
button.primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.big { flex: 1; font-size: 1.1rem; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.row.between { justify-content: space-between; margin-top: 0; }

.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 8px 0 0; }

.pill { font-size: 0.75rem; padding: 3px 10px; border-radius: 99px; }
.pill.on { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.pill.off { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }

.player .track { font-size: 1.15rem; font-weight: 600; }
.time { font-variant-numeric: tabular-nums; font-size: 1.6rem; margin: 10px 0 4px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }

.countdown {
  font-size: 4.5rem;
  font-weight: 700;
  text-align: center;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin: 8px 0;
}

#tracks { list-style: none; padding: 0; margin: 0 0 10px; }
#tracks li { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
#tracks li > button:first-child { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.small-btn { font-size: 0.8rem; min-height: 36px; padding: 6px 10px; }

.upload input { display: none; }
.upload span {
  display: inline-block;
  padding: 10px 14px;
  border: 1px dashed var(--accent);
  border-radius: 10px;
  color: var(--accent);
}

summary { cursor: pointer; font-weight: 600; }

.flash {
  height: 90px;
  border-radius: 12px;
  margin: 12px 0;
  background: var(--bg);
  border: 1px solid var(--line);
}
.flash.on { background: #fff; }

pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.72rem;
  color: var(--muted);
  max-height: 260px;
  overflow: auto;
}

.pocket-btn { width: 100%; margin-top: 10px; }

#pocket {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #000;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 25vh 16px calc(24px + env(safe-area-inset-bottom));
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#pocket[hidden] { display: none; }
#pocket .countdown { color: #2a5b78; }
.pocket-unlock { isolation: isolate; }
.pocket-info { text-align: center; color: #3c6680; font-variant-numeric: tabular-nums; font-size: 1.4rem; }
.pocket-unlock {
  position: relative;
  width: 100%;
  max-width: 420px;
  height: 64px;
  border: 1px solid #1f3d52;
  border-radius: 32px;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: #3c6680;
  font-size: 0.9rem;
}
.pocket-unlock i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #12293a; z-index: -1; }
.pocket-unlock span { position: relative; }

.button-link { color: var(--accent); text-decoration: none; padding: 10px 4px; }

.verdict { font-size: 1.1rem; font-weight: 600; padding: 12px; border-radius: 10px; }
.verdict.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.verdict.atencao { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.verdict.ruim, .verdict.erro { background: color-mix(in srgb, #f87171 18%, transparent); color: #f87171; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; text-align: center; }
.stats b { display: block; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: auto; display: block; }
#tracks li.active > button:first-child { background: color-mix(in srgb, var(--accent) 25%, var(--line)); font-weight: 600; }
