/* ============================================================
   ITV tab
   ============================================================ */

.itv-setting {
  margin-top: var(--sp-5);
}

.itv-setting h3 {
  font-size: 16px;
  margin-bottom: var(--sp-2);
}

.itv-note {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
}

.itv-note + .field,
.field + .field {
  margin-top: var(--sp-4);
}

/* Toggle switch */
.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  margin-bottom: var(--sp-3);
  -webkit-tap-highlight-color: transparent;
}

.switch__label {
  font-weight: 700;
  font-size: 14.5px;
}

.switch__sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

.switch__track {
  position: relative;
  width: 50px;
  height: 30px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  border: 1px solid var(--line);
  transition: background 0.25s ease, border-color 0.25s ease;
  flex-shrink: 0;
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--text-2);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), background 0.25s ease;
}

.switch[aria-checked="true"] .switch__track {
  background: var(--cone);
  border-color: var(--cone);
}

.switch[aria-checked="true"] .switch__track::after {
  transform: translateX(20px);
  background: var(--cone-ink);
}

.switch[aria-checked="true"] .switch__label {
  color: var(--text);
}

/* Timeline of ITV reminders */
.itv-reminders {
  margin-top: var(--sp-4);
}

.itv-reminder {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.itv-reminder__day {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--text-2);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.itv-reminder.is-past .itv-reminder__day {
  color: var(--text-3);
  text-decoration: line-through;
  opacity: 0.6;
}

.itv-reminder.is-live .itv-reminder__day {
  background: var(--grad-cone);
  color: var(--cone-ink);
  box-shadow: var(--shadow-cone);
  animation: pulse-dot 1.8s ease-in-out infinite;
}

.itv-reminder.is-now .itv-reminder__day {
  background: color-mix(in srgb, var(--signal) 18%, var(--surface-2));
  color: var(--signal);
}

.itv-reminder__info {
  flex: 1;
}

.itv-reminder__info b {
  font-size: 14px;
  display: block;
}

.itv-reminder__info small {
  font-size: 12px;
  color: var(--text-3);
}

.itv-reminder__state {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.itv-reminder__state.is-hit {
  color: var(--road);
}

.itv-reminder__state.is-live {
  color: var(--amber);
}

.itv-reminder__state.is-now {
  color: var(--signal);
}

/* ============================================================
   Sheet / modal (add ITV date)
   ============================================================ */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sheet-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.sheet {
  width: 100%;
  max-width: var(--max-w);
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: var(--sp-5) var(--sp-5) calc(var(--sp-6) + var(--safe-b));
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.sheet-backdrop.is-open .sheet {
  transform: none;
}

.sheet__grip {
  width: 40px;
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  margin: 0 auto var(--sp-5);
}

.sheet__title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  margin-bottom: var(--sp-4);
}

/* ============================================================
   Toast
   ============================================================ */

.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-b) + var(--sp-4));
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  z-index: 90;
  max-width: calc(100% - 48px);
  width: max-content;
  padding: 12px 18px;
  border-radius: var(--r-md);
  background: var(--surface-3);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  font-size: 13.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.is-ok svg { color: var(--road); }
.toast.is-err svg { color: var(--signal); }
.toast svg { width: 17px; height: 17px; flex-shrink: 0; }

/* ============================================================
   Onboarding
   ============================================================ */

.onboarding {
  padding-top: var(--sp-6);
}

.onboarding__hero {
  font-family: var(--font-display);
  font-size: clamp(30px, 9vw, 42px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin: var(--sp-4) 0 var(--sp-3);
}

.onboarding__hero em {
  font-style: normal;
  color: var(--cone);
}

.onboarding__sub {
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: var(--sp-6);
}

.ob-steps {
  margin: var(--sp-5) 0;
}

.ob-step {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-3) 0;
}

.ob-step__num {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--cone);
  width: 30px;
  flex-shrink: 0;
  padding-top: 3px;
}

.ob-step b {
  font-family: var(--font-display);
  font-size: 15.5px;
  display: block;
  margin-bottom: 2px;
}

.ob-step p {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.5;
}

/* Desktop cosmetic constraint: cap read width */
@media (min-width: 720px) {
  body {
    background:
      var(--grad-radial),
      linear-gradient(180deg, var(--bg-grad-1) 0%, var(--bg-grad-2) 100%);
  }

  .app {
    border-left: 1px solid var(--line-soft);
    border-right: 1px solid var(--line-soft);
    min-height: 100vh;
  }
}

@media (max-width: 380px) {
  .tab-btn span {
    font-size: 10px;
  }

  .stats {
    gap: var(--sp-2);
  }
}