:root {
  --bg: #0e1c2e;
  --bg-2: #12233a;
  --card: #1a3050;
  --text: #e8eef7;
  --text-dim: #93a7c4;
  --accent: #ffb03a;
  --accent-2: #ffd97a;
  --green: #3ddc84;
  --green-dark: #1e6b41;
  --red: #ff6b6b;
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(1rem + env(safe-area-inset-top)) 1rem
           calc(1rem + env(safe-area-inset-bottom));
}

header { text-align: center; padding: 0.5rem 0 1rem; }

h1 {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: linear-gradient(120deg, var(--accent-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle { color: var(--text-dim); font-size: 0.95rem; margin-top: 0.15rem; }

/* ---- power button ---- */

.power {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  background: none;
  border: none;
  color: var(--text);
  padding: 1.5rem 0 2rem;
}

.power-ring {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--bg-2), var(--card));
  border: 4px solid #2b4468;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.1s;
}

.power:active .power-ring { transform: scale(0.96); }

.power-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  transition: background 0.3s, box-shadow 0.3s;
}

.power-label { font-size: 1.3rem; font-weight: 700; }

.power-status { font-size: 0.85rem; color: var(--text-dim); }

.power[aria-pressed="true"] .power-ring {
  border-color: var(--green);
  box-shadow: 0 0 28px rgba(61, 220, 132, 0.45);
}

.power[aria-pressed="true"] .power-icon {
  background: var(--green);
  box-shadow: 0 0 14px rgba(61, 220, 132, 0.9);
}

.power:disabled { opacity: 0.75; }
.power:disabled .power-ring { border-color: #2b4468; }
.power:disabled .power-icon { background: var(--text-dim); }

/* ---- interval control ---- */

.controls {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.row-values { display: flex; align-items: baseline; gap: 0.3rem; }

.row-values input[type="number"] {
  width: 4.2rem;
  background: var(--bg);
  border: 1px solid #2b4468;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 600;
  text-align: center;
  padding: 0.45rem 0.2rem;
  border-radius: 10px;
  font-family: inherit;
}

.dash { color: var(--text-dim); }
.unit { color: var(--text-dim); font-size: 0.85rem; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--accent) var(--fill, 50%), #2b4468 var(--fill, 50%));
  outline: none;
  margin-top: 1rem;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--accent-2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--accent-2);
}

/* ---- sound bank ---- */

.soundbank h2 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.soundbank h2 span { color: var(--text); }

#soundList { list-style: none; }

#soundList li {
  background: var(--card);
  border-radius: 12px;
  padding: 0.7rem 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

#soundList li.loading { color: var(--text-dim); }

#soundList li.error { color: var(--red); font-size: 0.85rem; }

#soundList li .play {
  float: right;
  background: none;
  border: 1px solid #2b4468;
  color: var(--text);
  border-radius: 8px;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
}

#soundList li.playing { border: 1px solid var(--green); }

#soundList li.playing .play { color: var(--green); border-color: var(--green); }

/* ---- status footer ---- */

.status {
  margin-top: auto;
  padding-top: 1.2rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.status.running { color: var(--green); font-weight: 600; }
