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

:root {
  --bg-dark:       #0a0a0f;
  --bg-card:       #14141f;
  --accent:        #c8a44e;
  --accent-glow:   rgba(200, 164, 78, 0.3);
  --accent-bright: #e6c25c;
  --text-primary:  #f0ede6;
  --text-secondary:#8a8696;
  --text-muted:    #5a5666;
  --success:       #34d399;
  --success-glow:  rgba(52, 211, 153, 0.2);
  --error:         #f87171;
  --star-gold:     #fbbf24;
  --star-empty:    #2a2a3e;
  --radius:        16px;
  --radius-sm:     10px;
  --transition:    0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
}

.container {
  max-width: 420px;
  margin: 0 auto;
  padding: 0 20px 40px;
  position: relative;
}

/* ── Hero ──────────────────────────────────────────────────── */

.hero {
  position: relative;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  height: 180px;
  overflow: hidden;
}

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.70);
}

.hero-gradient {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(to top, var(--bg-dark) 0%, transparent 100%);
}

.hero-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ── Show card ─────────────────────────────────────────────── */

.show-card {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: -50px;
  position: relative;
  z-index: 2;
}

.show-art {
  width: 100px;
  height: 100px;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  border: 2px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.show-meta { flex: 1; min-width: 0; }

.show-title {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 3px;
}

.show-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 3px;
}

.show-network {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

/* ── Task card ─────────────────────────────────────────────── */

.task-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 20px;
}

.task-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.task-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #a8873a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.task-label {
  font-size: 0.92rem;
  font-weight: 600;
}

.task-sublabel {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.reward-pill {
  margin-left: auto;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--success);
  white-space: nowrap;
}

/* ── Audio player ──────────────────────────────────────────── */

.player-section { margin-top: 20px; }

.episode-selector {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text-primary);
  font-size: 0.82rem;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238a8696' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
  margin-bottom: 14px;
}

.episode-selector:focus { outline: none; border-color: var(--accent); }

.player-wrapper {
  background: #1a1a2e;
  border-radius: var(--radius-sm);
  padding: 16px;
}

.player-now-playing {
  font-size: 0.72rem;
  color: #bbb5c8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 8px;
}

.player-ep-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.waveform-bar {
  height: 4px;
  background: var(--star-empty);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
  position: relative;
}

.waveform-progress {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  border-radius: 2px;
  width: 0%;
  transition: width 0.5s linear;
}

.waveform-unlock-marker {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  background: var(--success);
  border-radius: 1px;
  opacity: 0.6;
}

.player-times {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-bottom: 16px;
}

.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.btn-skip {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-skip:active { transform: scale(0.9); }

.btn-play {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-bright));
  color: var(--bg-dark);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-play:active { transform: scale(0.92); }

.unlock-timer {
  text-align: center;
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.unlock-timer .time-remaining {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.unlock-timer.unlocked { color: var(--success); }

/* ── Review form ───────────────────────────────────────────── */

.review-section {
  margin-top: 24px;
  opacity: 0.35;
  pointer-events: none;
  transition: opacity 0.5s ease;
  position: relative;
}

.review-section.unlocked { opacity: 1; pointer-events: auto; filter: brightness(1.3); }
.review-section.unlocked .lock-overlay { display: none; }

.lock-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
}

.lock-icon { font-size: 1.6rem; opacity: 0.85; filter: brightness(1.5); }

.section-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-bottom: 12px;
}

.charts-hint {
  background: rgba(200,164,78,0.06);
  border: 1px solid rgba(200,164,78,0.12);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.4;
}

.charts-hint strong { color: var(--accent); font-weight: 600; }

.thought-starter {
  background: linear-gradient(135deg, rgba(200,164,78,0.08), rgba(200,164,78,0.03));
  border: 1px solid rgba(200,164,78,0.15);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.5;
  font-style: italic;
}

.thought-starter::before {
  content: '\201C';
  color: var(--accent);
  font-size: 1.4rem;
  line-height: 0;
  vertical-align: -0.3em;
  margin-right: 2px;
}

.star-rating {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
}

.star-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.15);
  background: transparent;
  cursor: pointer;
  font-size: 1.3rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.25);
}

.star-btn.active {
  border-color: var(--star-gold);
  background: rgba(251, 191, 36, 0.15);
  color: var(--star-gold);
  transform: scale(1.08);
}

.star-btn:active { transform: scale(0.9); }

.review-textarea {
  width: 100%;
  min-height: 120px;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  padding: 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
  transition: border-color var(--transition);
}

.review-textarea:focus { outline: none; border-color: var(--accent); }
.review-textarea::placeholder { color: var(--text-muted); }

.char-count {
  text-align: right;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

.char-count.valid { color: var(--success); }

.gibberish-warning {
  display: none;
  color: var(--star-gold);
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}

.gibberish-warning.visible { display: block; }

.btn-submit {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-bright));
  color: var(--bg-dark);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 16px;
  transition: var(--transition);
  letter-spacing: 0.02em;
}

.btn-submit:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-submit:not(:disabled):active { transform: scale(0.98); }

.btn-submit.loading { position: relative; color: transparent; }
.btn-submit.loading::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2.5px solid transparent;
  border-top-color: var(--bg-dark);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  top: 50%;
  left: 50%;
  margin: -11px 0 0 -11px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Success screen ────────────────────────────────────────── */

.success-screen {
  display: none;
  text-align: center;
  padding: 30px 10px;
}

.success-screen.visible { display: block; }

.success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--success-glow);
  border: 2px solid var(--success);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 16px;
}

.success-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 8px; }
.success-sub {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

/* ── Apple modal ───────────────────────────────────────────── */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.visible { display: flex; animation: fadeIn 0.3s ease; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-sheet {
  background: var(--bg-card);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 420px;
  max-height: 90dvh;
  overflow-y: auto;
  padding: 24px 20px 40px;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-handle {
  width: 36px;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.modal-charts-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.2);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--success);
  width: fit-content;
  margin: 0 auto 16px;
}

.modal-title { font-size: 1.2rem; font-weight: 700; text-align: center; margin-bottom: 8px; }
.modal-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.5;
  margin-bottom: 20px;
}

.review-quote {
  background: rgba(255,255,255,0.04);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 16px;
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 14px;
  font-style: italic;
}

.btn-copy {
  width: 100%;
  padding: 14px;
  border: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 16px;
}

.btn-copy.copied { border-color: var(--success); background: var(--success-glow); color: var(--success); }
.btn-copy:active { transform: scale(0.98); }

.how-to {
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 18px;
  text-align: center;
}

.how-to-title {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-bottom: 10px;
}

.how-to-steps { display: flex; justify-content: center; gap: 6px; align-items: center; }
.how-to-step  { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; }

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(200,164,78,0.15);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-text  { font-size: 0.68rem; color: var(--text-secondary); line-height: 1.3; text-align: center; }
.step-arrow { color: var(--text-muted); font-size: 0.9rem; margin-top: -16px; }

.btn-apple {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.btn-apple:active { transform: scale(0.98); }
.btn-apple svg { width: 20px; height: 20px; fill: white; }

.modal-dismiss {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
}

/* ── Device gate ───────────────────────────────────────────── */

.device-gate { display: none; text-align: center; padding: 80px 20px; }
.device-gate.visible { display: block; }
.device-gate-icon  { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }
.device-gate-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; }
.device-gate-sub   { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.5; }

/* ── Footer ────────────────────────────────────────────────── */

.powered-by {
  text-align: center;
  margin-top: 30px;
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.powered-by a { color: var(--text-secondary); text-decoration: none; }

/* ── Utilities ─────────────────────────────────────────────── */

.hidden { display: none !important; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.pulse { animation: pulse 2s ease-in-out infinite; }

.dev-toggle {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  background: rgba(255,0,0,0.15);
  border: 1px solid rgba(255,0,0,0.3);
  color: var(--error);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-family: monospace;
  display: none;
}

.dev-toggle.visible { display: block; }

@supports (-webkit-touch-callout: none) {
  .modal-sheet { -webkit-overflow-scrolling: touch; }
}
