/* ── Reset ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input  { font-family: inherit; }

/* ── Root variables (updated via JS on track change) ─────────────────── */
:root {
  --accent: #4cbbff;
  --bg:     #070f1a;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, 'PingFang SC', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  transition: background 0.5s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ── App shell ───────────────────────────────────────────────────────── */
#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 28px;
  padding-top:    max(env(safe-area-inset-top,    16px), 16px);
  padding-bottom: max(env(safe-area-inset-bottom, 16px), 16px);
}

/* ── Header ──────────────────────────────────────────────────────────── */
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-top: 8px;
  padding-bottom: 4px;
}

.title {
  font-size: 26px;
  font-weight: 300;
  letter-spacing: 5px;
  color: #edf2ef;
}

.subtitle {
  font-size: 12px;
  letter-spacing: 1.5px;
  margin-top: 5px;
  color: var(--accent);
  transition: color 0.5s;
}

.gear-btn {
  background: none;
  border: none;
  font-size: 20px;
  color: #3a4a5a;
  padding: 4px;
  margin-top: 4px;
  transition: opacity 0.2s;
}
.gear-btn:active { opacity: 0.5; }

/* ── Breathing circle ────────────────────────────────────────────────── */
.circle-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.circle-wrapper {
  width: 260px;
  height: 260px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.c-outer, .c-mid, .c-core {
  position: absolute;
  border-radius: 50%;
  background: var(--accent);
  transition: background 0.5s;
}
.c-outer { width: 200px; height: 200px; opacity: 0.12; }
.c-mid   { width: 148px; height: 148px; opacity: 0.25; }
.c-core  { width:  96px; height:  96px; opacity: 0.60; }

@keyframes breathe {
  0%, 100% { transform: scale(1);    }
  50%       { transform: scale(1.15); }
}

.circle-wrapper.playing .c-outer {
  animation: breathe 8s ease-in-out infinite;
}

.loading-text {
  color: #2e3e4e;
  font-size: 12px;
  margin-top: 16px;
  height: 16px; /* prevent layout shift when hidden */
}
.loading-text.hidden { visibility: hidden; }

/* ── Progress bar ────────────────────────────────────────────────────── */
.progress-section { margin-bottom: 28px; }

.progress-touch {
  height: 28px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
  margin-bottom: 8px;
}

.progress-track {
  width: 100%;
  height: 3px;
  background: #141e2b;
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  width: 0%;
  transition: background 0.5s;
  /* no width transition — real-time seek needs instant response */
}

.time-row { display: flex; justify-content: space-between; }
.time {
  color: #2a3a4a;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* ── Controls ────────────────────────────────────────────────────────── */
.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 32px;
}

.play-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, background 0.5s;
}
.play-btn:disabled { opacity: 0.55; cursor: default; }
.play-btn:not(:disabled):active { opacity: 0.7; }

.restart-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #111825;
  border: none;
  font-size: 22px;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, color 0.5s;
}
.restart-btn:active { opacity: 0.6; }

/* ── Track chips ─────────────────────────────────────────────────────── */
.track-groups {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 8px;
}

.group-row { display: flex; flex-direction: column; gap: 10px; }

.group-label {
  font-size: 10px;
  letter-spacing: 2px;
  color: #354050;
  text-transform: uppercase;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }

.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 18px;
  border-radius: 22px;
  border: 1px solid #1a2535;
  background: #0e1520;
  color: #5a6a7a;
  font-size: 14px;
  transition: opacity 0.2s;
}
.chip:active { opacity: 0.7; }

.chip-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

/* ── Settings sheet ──────────────────────────────────────────────────── */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.backdrop.open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-height: 82vh;
  overflow-y: auto;
  background: #0a1018;
  padding: 32px 24px;
  padding-bottom: max(env(safe-area-inset-bottom, 24px), 24px);
  border-radius: 16px 16px 0 0;
  z-index: 11;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}
.sheet.open { transform: translateY(0); }

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}
.sheet-title { color: #eee; font-size: 18px; font-weight: 600; }
.sheet-done  { background: none; border: none; color: #4cbbff; font-size: 16px; }

.sec-label {
  color: #556070;
  font-size: 11px;
  letter-spacing: 1.5px;
  margin-bottom: 12px;
  text-transform: uppercase;
}
.sec-desc {
  color: #3a4a5a;
  font-size: 12px;
  margin-bottom: 14px;
  margin-top: -6px;
}

.sheet-track-item {
  display: flex;
  align-items: center;
  background: #0e1520;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 10px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: opacity 0.2s;
}
.sheet-track-item:active { opacity: 0.7; }
.sheet-track-title { color: #bbb; font-size: 14px; font-weight: 500; }
.sheet-track-sub   { color: #3a4a5a; font-size: 12px; margin-top: 2px; }
.sheet-check       { font-size: 18px; font-weight: 700; margin-left: auto; }

.offset-row   { display: flex; align-items: center; margin-bottom: 10px; }
.offset-input {
  background: #0e1520;
  color: #eee;
  font-size: 24px;
  font-weight: 300;
  width: 80px;
  padding: 10px 14px;
  border-radius: 10px;
  text-align: center;
  border: 1px solid #1a2535;
  outline: none;
  -moz-appearance: textfield;
}
.offset-input::-webkit-outer-spin-button,
.offset-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.offset-unit { color: #3a4a5a; font-size: 16px; margin-left: 10px; }
.offset-hint { color: #2e3e4e; font-size: 12px; line-height: 1.6; }
