:root {
  /* Base */
  --bg: #ffffff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface2: rgba(255, 255, 255, 0.52);
  --border: rgba(17, 17, 17, 0.10);

  /* Pastel Core Palette */
  --accent: #fbcfe8;
  /* soft pink */
  --accent-dim: rgba(251, 207, 232, 0.28);
  --accent2: #bfdbfe;
  /* sky blue */

  /* Lilac System */
  --lilac-50: #f5f3ff;
  --lilac-100: #ede9fe;
  --lilac-200: #ddd6fe;
  --lilac-400: #a78bfa;

  /* Text */
  --text: #111111;
  --text-dim: #6b7280;
  --text-muted: #9ca3af;

  /* Semantic */
  --danger: #ef4444;
  --success: #22c55e;

  /* Emotion colors */
  --happy: #34d399;
  --sad: #818cf8;
  --angry: #f87171;
  --fearful: #fb923c;
  --disgusted: #a3e635;
  --surprised: #fbbf24;
  --neutral: #94a3b8;

  /* Effects */
  --shadow-soft: 0 10px 30px rgba(17, 17, 17, 0.08);
  --shadow-card: 0 18px 50px rgba(17, 17, 17, 0.10);
}

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

/* Only real text-entry fields get the I-beam */
input:not([readonly]),
textarea,
[contenteditable="true"] {
  cursor: text;
}

/* Disabled state */
:disabled,
[disabled] {
  cursor: not-allowed !important;
}

/* Every interactive element gets pointer */
a[href],
button:not(:disabled),
[role="button"],
label,
select,
.genre-chip,
.tempo-opt,
.svc-card,
.tag-x,
.btn,
.btn-uniform,
.btn-primary,
.btn-ghost,
.icon-btn,
.ctrl-btn,
.fer-start-btn:not(:disabled),
.edit-chip,
.pipe-node,
.privacy-card,
#np-copy-btn,
#np-url-link,
#play-pause-btn {
  cursor: pointer;
}

html,
body {
  height: 100%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: var(--text);
  font-family: 'Crimson Pro', Georgia, serif;
  overflow: hidden;
}

/* Grain */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 200;
  opacity: 0.35;
}

/* ── Views ── */
.view {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s ease;
  transform: translateY(16px);
  z-index: 1;
}

.view.active {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.view.exit {
  opacity: 0;
  transform: translateY(-16px);
  pointer-events: none;
}

/* ────────────────────────────────────────────
       SURVEY VIEW  (full-screen step flow)
    ──────────────────────────────────────────── */
#view-survey {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  overflow: hidden;
}

#survey-progress {
  height: 2px;
  background: var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

#survey-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  width: 0%;
  transition: width 0.6s cubic-bezier(.4, 0, .2, 1);
}

#survey-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* Ambient top glow */
#survey-stage::after {
  content: '';
  position: absolute;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 500px;
  background: radial-gradient(ellipse, rgba(255, 255, 255, 0.38) 0%, rgba(221, 214, 254, 0.18) 42%, transparent 72%);
  pointer-events: none;
}

.s-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.s-screen.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.s-screen.s-exit {
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
}

.s-card {
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  border-radius: 20px;
  padding: 2.2rem 2.6rem;
  max-width: 560px;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.s-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.35;
}

.s-card-body {
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  padding-right: 3px;
}

.s-card-body::-webkit-scrollbar {
  width: 3px;
}

.s-card-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.step-label {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.3rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.step-label::before {
  content: '';
  width: 18px;
  height: 1px;
  background: var(--accent);
  opacity: 0.5;
}

.s-question {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  line-height: 1.35;
  margin-bottom: 0.5rem;
}

.s-question em {
  color: var(--accent);
  font-style: italic;
}

.s-sub {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-bottom: 1.8rem;
  line-height: 1.5;
}

.genre-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.8rem;
}

.genre-chip {
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  background: var(--surface2);
  border-radius: 9px;
  padding: 0.6rem 0.4rem;
  text-align: center;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.16s;
  color: var(--text-dim);
  user-select: none;
}

.genre-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

.genre-chip.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

.tempo-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.8rem;
}

.tempo-opt {
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  background: var(--surface2);
  border-radius: 11px;
  padding: 0.8rem 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  transition: all 0.16s;
}

.tempo-opt:hover {
  border-color: var(--accent2);
}

.tempo-opt.selected {
  border-color: var(--accent2);
  background: rgba(122, 140, 232, 0.1);
}

.tempo-icon {
  font-size: 1.25rem;
  width: 26px;
  text-align: center;
  flex-shrink: 0;
}

.tempo-label {
  font-size: 1rem;
  color: var(--text);
}

.tempo-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.svc-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.8rem;
}

.svc-card {
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  background: var(--surface2);
  border-radius: 11px;
  padding: 0.9rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  transition: all 0.16s;
}

.svc-card:hover {
  border-color: rgba(232, 201, 122, 0.4);
}

.svc-card.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.svc-card.primary .svc-priority {
  display: block;
}

.svc-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.svc-name {
  font-size: 0.95rem;
}

.svc-priority {
  margin-left: auto;
  font-size: 0.65rem;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(232, 201, 122, 0.3);
  border-radius: 100px;
  padding: 0.12rem 0.45rem;
  display: none;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
  min-height: 4px;
}

.tag {
  background: var(--accent-dim);
  border: 1px solid rgba(232, 201, 122, 0.25);
  color: var(--accent);
  border-radius: 100px;
  padding: 0.28rem 0.7rem;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  animation: pop .18s ease;
}

@keyframes pop {
  from {
    transform: scale(.85);
    opacity: 0
  }

  to {
    transform: scale(1);
    opacity: 1
  }
}

.tag-x {
  cursor: pointer;
  opacity: 0.55;
  font-size: 0.7rem;
}

.tag-x:hover {
  opacity: 1;
}

input[type=text],
input[type=password],
input[type=email] {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  border-radius: 9px;
  padding: 0.8rem 1rem;
  font-family: 'Crimson Pro', serif;
  font-size: 1rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.18s;
  margin-bottom: 0.75rem;
}

input:focus {
  border-color: var(--accent);
}

input::placeholder {
  color: var(--text-muted);
}

.cred-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
}

.btn-row {
  display: flex;
  gap: 0.65rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.btn {
  font-family: 'Crimson Pro', serif;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  border-radius: 9px;
  padding: 0.65rem 1.7rem;
  cursor: pointer;
  transition: all 0.16s;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: #111111;
  font-weight: 500;
}

.btn-primary:hover {
  background: #f5ddec;
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  color: var(--text-dim);
}

.btn-ghost:hover {
  border-color: var(--text-dim);
  color: var(--text);
}

.btn-text {
  background: transparent;
  color: var(--text-dim);
  padding: 0.65rem 1rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  border: none;
}

.btn-text:hover {
  color: var(--text);
}

/* summary */
.sum-section {
  margin-bottom: 1.4rem;
}

.sum-title {
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.65rem;
}

.sum-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  border-radius: 9px;
  padding: 0.65rem 0.9rem;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}

.sum-sub {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.sum-badge {
  display: inline-block;
  background: rgba(122, 140, 232, 0.12);
  border: 1px solid rgba(122, 140, 232, 0.25);
  color: var(--accent2);
  border-radius: 100px;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  margin-top: 3px;
}

/* welcome */
.welcome-title {
  font-family: 'Playfair Display', serif;
  font-size: 2.6rem;
  line-height: 1.1;
  text-align: center;
  margin-bottom: 0.9rem;
}

.welcome-title span {
  color: var(--accent);
  font-style: italic;
}

.welcome-sub {
  text-align: center;
  font-size: 1.05rem;
  color: var(--text-dim);
  max-width: 360px;
  line-height: 1.6;
  margin-bottom: 2.2rem;
}

/* ────────────────────────────────────────────
       MAIN APP VIEW
    ──────────────────────────────────────────── */
#view-app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: 260px 1fr;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
}

/* Top bar */
#topbar {
  grid-column: 1/-1;
  height: 52px;
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: relative;
  z-index: 10;
}

.app-logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  color: var(--accent);
  font-style: italic;
  letter-spacing: 0.03em;
}

.app-logo span {
  color: var(--text);
  font-style: normal;
  font-size: 0.75rem;
  margin-left: 0.3rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#topbar-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  border-radius: 100px;
  padding: 0.3rem 0.75rem;
  font-family: 'Crimson Pro', serif;
  font-size: 0.78rem;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s;
  flex-shrink: 0;
}

.dot.on {
  background: var(--accent);
  box-shadow: 0 0 7px var(--accent);
  animation: blink 2s infinite;
}

.dot.red {
  background: var(--danger);
}

@keyframes blink {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: 0.4
  }
}

.icon-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.16s;
  font-family: 'Crimson Pro', serif;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Left panel — FER */
#left-panel {
  grid-row: 2;
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

#polar-panel {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 0 0 0.75rem;
}

.panel-hdr {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0.8rem 1rem 0.55rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.panel-hdr .dot {
  width: 5px;
  height: 5px;
  background: var(--accent2);
  animation: none;
}

/* Camera */
.video-wrap {
  position: relative;
  background: #ffffff;
  aspect-ratio: 4/3;
  flex-shrink: 0;
}

#fer-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#fer-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.scan-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  pointer-events: none;
}

.scan-line.on {
  opacity: 0.5;
  animation: scan 2.2s ease-in-out infinite;
}

@keyframes scan {
  0% {
    top: 0%
  }

  100% {
    top: 100%
  }
}

.no-face {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(239, 68, 68, 0.10);
  border: 1px solid rgba(239, 68, 68, 0.28);
  color: #ef4444;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  padding: 0.22rem 0.55rem;
  border-radius: 100px;
  opacity: 0;
  transition: opacity 0.3s;
  white-space: nowrap;
  pointer-events: none;
}

.no-face.visible {
  opacity: 1;
}

.fer-loading {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  z-index: 5;
  transition: opacity 0.4s;
}

.fer-loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.spin {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.fer-load-txt {
  font-size: 0.62rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-align: center;
  padding: 0 1rem;
}

/* Top expression label */
.fer-readout {
  padding: 0.7rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.fer-top {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-style: italic;
  color: var(--accent);
  transition: color 0.3s;
}

.fer-pct {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Expression bars */
.expr-bars {
  padding: 0.5rem 0;
  overflow-y: auto;
  flex: 1;
}

.expr-row {
  padding: 0.4rem 0.9rem;
  display: grid;
  grid-template-columns: 72px 1fr 36px;
  align-items: center;
  gap: 0.6rem;
}

.expr-name {
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.expr-row.top .expr-name {
  color: var(--text);
}

.bar-track {
  background: var(--surface2);
  border-radius: 3px;
  height: 6px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 3px;
  width: 0%;
  transition: width 0.35s ease;
}

.expr-val {
  font-size: 0.68rem;
  text-align: right;
  color: var(--text-dim);
}

.expr-row.top .expr-val {
  color: var(--text);
}

/* FER start btn */
.fer-start-btn {
  display: block;
  width: calc(100% - 1.6rem);
  margin: 0 0.8rem 0.8rem;
  padding: 0.6rem;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: 'Crimson Pro', serif;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s;
  flex-shrink: 0;
  text-align: center;
}

.fer-start-btn:hover {
  background: var(--accent-dim);
}

.fer-start-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── Center/right: player ── */
#center-panel {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 1rem 1.2rem;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

/* YT player wrapper (center panel) */
#yt-player-wrap {
  width: 100%;
  max-width: 560px;
  aspect-ratio: 16/9;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: var(--shadow-card);
}

/* Floating YouTube player — real size, slides up from bottom */
#yt-player-container {
  position: fixed;
  bottom: -280px;
  right: 20px;
  width: 400px;
  height: 225px;
  z-index: 50;
  border-radius: 10px;
  overflow: hidden;
  transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
}

#yt-player-container.visible {
  bottom: 60px;
}

#yt-player-container #yt-player {
  width: 100%;
  height: 100%;
}

#yt-player-container #yt-player iframe {
  width: 100% !important;
  height: 100% !important;
}

/* Mood glow bg */
#mood-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 40%, rgba(251, 207, 232, 0.28) 0%, rgba(191, 219, 254, 0.18) 42%, transparent 70%);
  transition: background 1.5s ease;
}

/* Now Playing card */
#now-playing {
  position: relative;
  z-index: 1;
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  border-radius: 16px;
  padding: 1rem 1.4rem 1.2rem;
  max-width: 460px;
  width: 100%;
  text-align: center;
}

#np-mood-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: var(--accent-dim);
  border: 1px solid rgba(232, 201, 122, 0.25);
  color: var(--accent);
  border-radius: 100px;
  padding: 0.28rem 0.75rem;
  margin-bottom: 0.75rem;
}

#np-thumb {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  object-fit: cover;
  margin: 0 auto 0.7rem;
  display: block;
  background: var(--surface2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

#np-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#np-artist {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.7rem;
}

#np-source {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

/* Progress */
#np-bar-wrap {
  background: var(--surface2);
  border-radius: 4px;
  height: 3px;
  margin-bottom: 0.7rem;
  overflow: hidden;
}

#np-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.5s linear;
  border-radius: 4px;
}

/* Controls */
#np-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}

.ctrl-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.16s;
  color: var(--text-dim);
}

.ctrl-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.ctrl-btn.play-btn {
  width: 44px;
  height: 44px;
  font-size: 1.1rem;
  background: var(--accent);
  border-color: var(--accent);
  color: #111111;
}

.ctrl-btn.play-btn:hover {
  background: #f5ddec;
}

#np-skip-reason {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-style: italic;
}

/* URL row */
#np-url-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
}

#np-url {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: 'Crimson Pro', monospace;
  min-width: 0;
}

#np-url:focus {
  color: var(--text);
}

#np-copy-btn,
#np-url-link {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.1rem 0.3rem;
  border-radius: 5px;
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
  line-height: 1;
}

#np-copy-btn:hover,
#np-url-link:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

#np-copy-btn.copied {
  color: var(--success);
}

/* Idle state */
#idle-state {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 380px;
}

#idle-state .idle-icon {
  font-size: 2.8rem;
  margin-bottom: 0.75rem;
}

#idle-state h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

#idle-state p {
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ── Bottom player bar ── */
#player-bar {
  grid-column: 1/-1;
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 52px;
}

#pb-info {
  flex: 1;
  min-width: 0;
}

#pb-title {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#pb-artist {
  font-size: 0.75rem;
  color: var(--text-dim);
}

#pb-mood {
  font-size: 0.72rem;
  color: var(--text-dim);
  white-space: nowrap;
}

#pb-auto-badge {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: rgba(122, 140, 232, 0.12);
  border: 1px solid rgba(122, 140, 232, 0.25);
  color: var(--accent2);
  border-radius: 100px;
  padding: 0.18rem 0.5rem;
  white-space: nowrap;
}

/* YouTube player — visible but behind our UI overlay */
#yt-player-wrap {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
}

#yt-player {
  width: 100%;
  height: 100%;
}

#yt-player iframe {
  width: 100% !important;
  height: 100% !important;
}

/* Our UI overlay sits on top of the player */
#now-playing-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0.64) 50%, rgba(255, 255, 255, 0.18) 100%);
  border-radius: 12px;
  padding: 1.5rem;
  pointer-events: none;
}

#now-playing-overlay>* {
  pointer-events: all;
}

/* ── Toast ── */
#toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  border-radius: 10px;
  padding: 0.65rem 1.2rem;
  font-size: 0.85rem;
  color: var(--text);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 500;
  white-space: nowrap;
  pointer-events: none;
}

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

/* ── Survey edit modal ── */
#survey-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

#survey-modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

#survey-modal {
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  border-radius: 16px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

#survey-modal h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

.edit-section {
  margin-bottom: 1.2rem;
}

.edit-label {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.edit-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.edit-chip {
  font-size: 0.82rem;
  padding: 0.28rem 0.65rem;
  border-radius: 100px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  background: var(--surface2);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
}

.edit-chip.on {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}


/* ===== Preview page styles ===== */

:root {
  /* Applied pastel MusWM palette */
  --clr-ink: #111111;
  --clr-bg: #ffffff;
  --clr-border: #d1d5db;

  --clr-lilac-50: #f5f3ff;
  --clr-lilac-100: #ede9fe;
  --clr-lilac-200: #ddd6fe;
  --clr-lilac-400: #a78bfa;

  --clr-soft-pink: #fbcfe8;
  --clr-sky: #bfdbfe;

  --clr-red: #ef4444;
  --clr-green: #22c55e;
  --clr-blue: #7DD3FC;

  --clr-neon-pink: #ff00cc;
  --clr-neon-green: #39ff14;

  --card-badge-bg: #f9fafb;
  --card-badge-border: #e5e7eb;
  --card-info-bg: #ffffff;
  --card-info-border: #d1d5db;

  /* Existing semantic names remapped to preserve the page structure */
  --navy: var(--clr-bg);
  --navy-mid: var(--clr-lilac-100);
  --navy-deep: var(--clr-sky);
  --gold: var(--clr-blue);
  --gold-dim: rgba(37, 99, 235, 0.10);
  --gold-glow: rgba(37, 99, 235, 0.08);
  --mint: var(--clr-lilac-200);
  --mint-dim: rgba(221, 214, 254, 0.30);
  --text: var(--clr-ink);
  --text-dim: #4b5563;
  --border: rgba(209, 213, 219, 0.95);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: linear-gradient(135deg, var(--clr-soft-pink) 0%, var(--clr-sky) 100%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Animated grid background ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(167, 139, 250, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(167, 139, 250, 0.18) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* ── Glow orbs ── */
.orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(80px);
  z-index: 0;
}

.orb-1 {
  width: 600px;
  height: 600px;
  background: rgba(251, 207, 232, 0.45);
  top: -200px;
  right: -100px;
}

.orb-2 {
  width: 400px;
  height: 400px;
  background: rgba(191, 219, 254, 0.55);
  bottom: -100px;
  left: -100px;
}

/* ── Layout ── */
.page {
  position: relative;
  z-index: 1;
}

/* ── HERO ── */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 4rem 2rem;
  text-align: center;
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--gold-dim);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.4rem 1rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 2.5rem;
  animation: fadeUp 0.8s ease both;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  animation: blink 2s infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: 0.3
  }
}

.hero-title {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2.8rem, 6vw, 5rem);
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 0.5rem;
  animation: fadeUp 0.8s 0.1s ease both;
}

.hero-title em {
  color: var(--gold);
  font-style: italic;
}

.hero-subtitle {
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 2rem;
  animation: fadeUp 0.8s 0.2s ease both;
}

/* ── Hero feature pills ── */
.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin-bottom: 2rem;
  animation: fadeUp 0.8s 0.2s ease both;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(167, 139, 250, 0.30);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-strong, #111111);
  white-space: nowrap;
  backdrop-filter: blur(6px);
  cursor: default;
}

.hero-pill-icon {
  font-size: 0.9rem;
  line-height: 1;
}

/* Ghost secondary button */
.btn-ghost-outline {
  background: rgba(255,255,255,0.35) !important;
  border: 1.5px solid rgba(167,139,250,0.40) !important;
}
.btn-ghost-outline::after {
  background: rgba(255,255,255,0.25) !important;
}
.btn-ghost-outline:hover::after {
  background: rgba(255,255,255,0.40) !important;
}

.hero-desc {
  max-width: 640px;
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-dim);
  margin-bottom: 3rem;
  animation: fadeUp 0.8s 0.3s ease both;
}

.hero-desc strong {
  color: var(--text);
}

.hero-cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  animation: fadeUp 0.8s 0.4s ease both;
}

/* Uniform CTA buttons */
.btn-uniform {
  position: relative;
  z-index: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 220px;
  padding: 0.9rem 2.2rem;
  border: none;
  border-radius: 12px;
  overflow: hidden;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  color: #111111;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.btn-uniform::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1.5px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #f97316);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  z-index: -1;
}

.btn-uniform::after {
  content: "";
  position: absolute;
  inset: 1.5px;
  border-radius: 10.5px;
  background: linear-gradient(135deg, var(--clr-soft-pink), var(--clr-lilac-200));
  z-index: -2;
}

.btn-uniform:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(167, 139, 250, 0.35);
}

.btn-uniform:hover::after {
  background: linear-gradient(135deg, var(--clr-lilac-100), var(--clr-soft-pink));
}

/* Scroll cue */
.scroll-cue {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-dim);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: fadeUp 1s 1s ease both;
}

.scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--gold), transparent);
  animation: scrollLine 2s infinite;
}

@keyframes scrollLine {
  0% {
    transform: scaleY(0);
    transform-origin: top;
  }

  50% {
    transform: scaleY(1);
    transform-origin: top;
  }

  51% {
    transform: scaleY(1);
    transform-origin: bottom;
  }

  100% {
    transform: scaleY(0);
    transform-origin: bottom;
  }
}

/* ── DATA PRIVACY SECTION ── */
.section {
  padding: 5rem 2rem;
  max-width: 960px;
  margin: 0 auto;
}

.section-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.section-title {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  color: var(--text);
  margin-bottom: 1.5rem;
  line-height: 1.2;
}

.section-title em {
  color: var(--gold);
  font-style: italic;
}

/* Privacy cards */
.privacy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2.5rem;
}

.privacy-card {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.75rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
  backdrop-filter: blur(10px);
}

.privacy-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.privacy-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
}

.privacy-card:hover::before {
  opacity: 1;
}

.privacy-icon {
  width: 44px;
  height: 44px;
  background: var(--gold-dim);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.privacy-card h3 {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.6rem;
}

.privacy-card p {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.6;
}

/* ── PROTOTYPE STATUS SECTION ── */
.status-banner {
  background: rgba(245, 243, 255, 0.76);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  margin-top: 4rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
  backdrop-filter: blur(10px);
}

.status-banner::after {
  content: 'PROTOTYPE';
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--gold);
  background: var(--gold-dim);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.25rem 0.65rem;
}

.status-banner h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.4rem;
  color: var(--gold);
  margin-bottom: 1rem;
}

.status-rows {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}

@media (max-width: 600px) {
  .status-rows {
    grid-template-columns: 1fr;
  }
}

.status-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.status-indicator.done {
  background: var(--clr-green);
  box-shadow: 0 0 6px var(--clr-green);
}

.status-indicator.partial {
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold);
}

.status-indicator.planned {
  background: var(--text-dim);
}

.status-row-text {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.status-row-text strong {
  color: var(--text);
  display: block;
  font-size: 0.9rem;
}

/* ── PIPELINE SECTION ── */
.pipeline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;

  justify-content: center;
  /* yatay ortala */
  align-items: center;
  /* dikey hizalama */

  max-width: 800px;
  /* genişliği sınırla */
  margin: 2rem auto 0;
  /* section ortasına al */
}

/* ─────────────────────────────
   PIPELINE NODES
───────────────────────────── */

.pipeline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  align-items: center;
  max-width: 900px;
  margin: 2rem auto 0;
}

.pipe-node {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0.5rem 1rem;
  border-radius: 10px;

  background: #F0F8FF;           /* aliceblue */
  border: 1px solid #D6EAF8;     /* uyumlu açık border */

  font-size: 0.75rem;
  font-weight: 500;
  color: #111111;
  background-color: aliceblue !important;
  transition: all 0.2s ease;
}

.pipe-node.active {
  background: #E6F2FF;           /* biraz daha koyu aliceblue */
  border-color: #A78BFA;         /* lilac accent */
}

.pipe-node:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

.pipe-arrow {
  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 0.85rem;
  color: #4b5563;
  opacity: 0.9;
}

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dim);
  position: relative;
  z-index: 1;
}

footer a {
  color: var(--gold);
  text-decoration: none;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── DIVIDER ── */
.divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  max-width: 960px;
  margin: 0 auto;
}

/* Consent highlight box */
.consent-box {
  background: var(--mint-dim);
  border: 1px solid var(--card-info-border);
  border-left: 3px solid var(--clr-lilac-400);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-top: 2rem;
  font-size: 0.875rem;
  color: var(--text-dim);
  line-height: 1.7;
}

.consent-box strong {
  color: var(--mint);
}



/* =========================================================
   Shared consistency layer for moodMap preview + app
   ========================================================= */
:root {
  --clr-ink: #111111;
  --clr-bg: #ffffff;
  --clr-border: #d1d5db;
  --clr-lilac-50: #f5f3ff;
  --clr-lilac-100: #ede9fe;
  --clr-lilac-200: #ddd6fe;
  --clr-lilac-400: #a78bfa;
  --clr-soft-pink: #fbcfe8;
  --clr-sky: #bfdbfe;
  --clr-mint: #a7f3d0;
  --clr-coral: #fdba74;
  --clr-blue: #7dd3fc;

  --bg: #ffffff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface2: rgba(255, 255, 255, 0.52);
  --border: rgba(209, 213, 219, 0.95);
  --accent: var(--clr-soft-pink);
  --accent-dim: rgba(251, 207, 232, 0.28);
  --accent2: var(--clr-sky);
  --lilac-50: var(--clr-lilac-50);
  --lilac-100: var(--clr-lilac-100);
  --lilac-200: var(--clr-lilac-200);
  --lilac-400: var(--clr-lilac-400);
  --text: var(--clr-ink);
  --text-dim: #4b5563;
  --text-muted: #9ca3af;
  --danger: #ef4444;
  --success: #22c55e;
  --happy: #34d399;
  --sad: #818cf8;
  --angry: #f87171;
  --fearful: #fb923c;
  --disgusted: #a3e635;
  --surprised: #fbbf24;
  --neutral: #94a3b8;
  --navy: var(--clr-bg);
  --navy-mid: var(--clr-lilac-100);
  --navy-deep: var(--clr-sky);
  --gold: var(--clr-blue);
  --gold-dim: rgba(125, 211, 252, 0.18);
  --gold-glow: rgba(125, 211, 252, 0.12);
  --mint: var(--clr-mint);
  --mint-dim: rgba(167, 243, 208, 0.22);
  --card-badge-bg: #f9fafb;
  --card-badge-border: #e5e7eb;
  --card-info-bg: #ffffff;
  --card-info-border: #d1d5db;
  --shadow-soft: 0 10px 30px rgba(17, 17, 17, 0.08);
  --shadow-card: 0 18px 50px rgba(17, 17, 17, 0.10);
}

body.preview-page {
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  background: linear-gradient(135deg, var(--clr-soft-pink) 0%, var(--clr-sky) 100%);
  color: var(--text);
}

body.app-page {
  height: 100%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--clr-soft-pink) 0%, var(--clr-sky) 100%);
  color: var(--text);
}

body.preview-page::before,
body.app-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(167, 139, 250, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(167, 139, 250, 0.18) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* Unified CTA used by preview.html */
.btn-uniform {
  position: relative;
  z-index: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 220px;
  padding: 0.9rem 2.2rem;
  border: none;
  border-radius: 12px;
  overflow: hidden;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  color: #111111;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.btn-uniform::before {
  content: '';
  position: absolute;
  inset: 0;
  padding: 1.5px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--clr-blue), var(--clr-coral));
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  z-index: -1;
}

.btn-uniform::after {
  content: '';
  position: absolute;
  inset: 1.5px;
  border-radius: 10.5px;
  background: linear-gradient(135deg, var(--clr-soft-pink), var(--clr-lilac-200));
  z-index: -2;
}

.btn-uniform:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(167, 139, 250, 0.35);
}

.btn-uniform:hover::after {
  background: linear-gradient(135deg, var(--clr-lilac-100), var(--clr-soft-pink));
}

/* ────────────────────────────────────────────
   CONTRAST OVERRIDES — shared design consistency
   Use pastel colors for surfaces, borders, glows, and fills;
   use dark text for readability on pastel UI elements.
──────────────────────────────────────────── */
:root {
  --text-strong: #111111;
  --text-medium: #374151;
  --text-soft: #6b7280;
  --accent-readable: #374151;
  --accent-border: var(--lilac-400);
  --accent-fill-soft: rgba(251, 207, 232, 0.38);
  --accent-fill-hover: rgba(221, 214, 254, 0.46);
}

/* Global readable text mapping */
body,
button,
a,
input,
textarea,
select {
  color: var(--text-strong);
}

/* Never use pale pink/lilac as primary text on pale surfaces */
.btn,
.btn-primary,
.btn-ghost,
.btn-text,
.btn-uniform,
.fer-start-btn,
.icon-btn,
.ctrl-btn,
.status-pill,
.genre-chip,
.tempo-opt,
.svc-card,
.tag,
.sum-badge,
.edit-chip,
.pipe-node,
.hero-badge,
.section-label,
.privacy-icon,
#np-mood-badge,
#pb-auto-badge {
  color: var(--text-strong) !important;
}

/* Softer secondary text remains readable */
.s-sub,
.hero-desc,
.hero-subtitle,
.tempo-desc,
.sum-sub,
.fer-pct,
.expr-name,
.expr-val,
#np-artist,
#np-source,
#np-skip-reason,
#pb-artist,
#pb-mood,
footer,
.privacy-card p,
.status-row-text,
.consent-box {
  color: var(--text-medium) !important;
}

/* Labels: retain accent structure with readable text */
.step-label,
.sum-title,
.edit-label,
.panel-hdr,
.cred-label,
.section-label {
  color: var(--text-medium) !important;
}

.step-label::before,
.section-label::after {
  background: rgba(55, 65, 81, 0.28) !important;
}

/* Emphasis: use readable blue/cyan only for large display accents */
.hero-title em,
.section-title em,
.status-banner h3,
.app-logo,
.fer-top,
.welcome-title span,
.s-question em {
  color: #2563eb !important;
}

/* Buttons: high contrast text on pastel fills */
.btn-primary,
.ctrl-btn.play-btn {
  background: linear-gradient(135deg, var(--accent), var(--lilac-200)) !important;
  border-color: var(--accent-border) !important;
  color: var(--text-strong) !important;
}

.btn-primary:hover,
.ctrl-btn.play-btn:hover {
  background: linear-gradient(135deg, var(--lilac-100), var(--accent)) !important;
  color: var(--text-strong) !important;
}

.btn-ghost,
.icon-btn,
.ctrl-btn,
.fer-start-btn {
  background: rgba(255, 255, 255, 0.42) !important;
  border: 1px solid var(--accent-border) !important;
  color: var(--text-strong) !important;
  box-shadow: var(--shadow-soft);
}

.btn-ghost:hover,
.icon-btn:hover,
.ctrl-btn:hover,
.fer-start-btn:hover {
  background: linear-gradient(135deg, var(--accent-fill-soft), var(--accent-fill-hover)) !important;
  border-color: #2563eb !important;
  color: var(--text-strong) !important;
}

.fer-start-btn:disabled,
.btn-primary:disabled {
  opacity: 0.55 !important;
  color: var(--text-medium) !important;
  cursor: not-allowed;
}

/* Survey chips and selected states */
.genre-chip,
.tempo-opt,
.svc-card,
.edit-chip {
  color: var(--text-medium) !important;
}

.genre-chip.selected,
.tempo-opt.selected,
.svc-card.selected,
.edit-chip.on {
  background: linear-gradient(135deg, rgba(251, 207, 232, 0.46), rgba(221, 214, 254, 0.48)) !important;
  border-color: var(--accent-border) !important;
  color: var(--text-strong) !important;
}

/* Tags and pills */
.tag,
.sum-badge,
.svc-priority,
#np-mood-badge,
#pb-auto-badge,
.status-pill,
.hero-badge {
  background: rgba(255, 255, 255, 0.46) !important;
  border-color: rgba(167, 139, 250, 0.55) !important;
  color: var(--text-strong) !important;
}

/* Data/privacy cards */
.privacy-card:hover,
.status-banner:hover {
  border-color: var(--accent-border) !important;
}

.privacy-card::before,
.status-banner::after {
  color: var(--text-strong) !important;
}

.privacy-card h3,
.status-row-text strong,
.consent-box strong {
  color: var(--text-strong) !important;
}

/* Pipeline nodes */
.pipe-node.active {
  background: var(--clr-soft-pink);
  border-color: var(--clr-lilac-400);
  color: #111;
}

/* Links */
footer a,
#np-url-link,
#np-copy-btn {
  color: #1d4ed8 !important;
}

footer a:hover,
#np-url-link:hover,
#np-copy-btn:hover {
  color: #111111 !important;
  background: rgba(251, 207, 232, 0.42) !important;
}

/* Inputs */
input[type=text],
input[type=password],
input[type=email],
#np-url {
  color: var(--text-strong) !important;
}

input::placeholder {
  color: var(--text-soft) !important;
}

/* Progress / active indicators remain colorful but not text-dependent */
#survey-progress-fill,
#np-bar,
.scan-line,
.scroll-line {
  background: linear-gradient(90deg, #7dd3fc, #fdba74) !important;
}

.dot.on,
.status-indicator.partial {
  background: #7dd3fc !important;
  box-shadow: 0 0 7px rgba(125, 211, 252, 0.75) !important;
}

/* Mobile: preserve button readability */
@media (max-width: 600px) {

  .btn-uniform,
  .btn,
  .fer-start-btn {
    color: var(--text-strong) !important;
  }

  /* Hero: tighter vertical spacing on small screens */
  .hero {
    padding: 3rem 1.25rem 2.5rem;
    min-height: auto;
  }

  .hero-title {
    font-size: clamp(2rem, 8vw, 2.8rem);
    margin-bottom: 1.25rem;
  }

  /* Pills stack naturally — each pill self-contained, no mid-phrase breaks */
  .hero-pills {
    gap: 0.5rem;
    margin-bottom: 1.5rem;
  }

  .hero-pill {
    font-size: 0.75rem;
    padding: 0.4rem 0.85rem;
  }

  .hero-desc {
    font-size: 0.95rem;
    margin-bottom: 2rem;
  }

  /* CTA buttons full-width on mobile */
  .hero-cta {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 320px;
    gap: 0.75rem;
  }

  .btn-uniform {
    min-width: unset;
    width: 100%;
    text-align: center;
  }

  /* Pipeline wraps gracefully */
  .pipeline {
    gap: 0.4rem;
  }

  .pipe-node {
    font-size: 0.7rem;
    padding: 0.4rem 0.75rem;
  }

  /* Privacy grid single column */
  .privacy-grid {
    grid-template-columns: 1fr;
  }
}

/* ══════════════════════════════════════════════════════
   MOOD SCORE WIDGET (FER panel)
══════════════════════════════════════════════════════ */
#fer-score-wrap {
  margin: 0.75rem 0 0.5rem;
  padding: 0.7rem 0.9rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.fer-score-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.fer-score-lbl {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex: 1;
}

.fer-score-num {
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
  min-width: 2.4rem;
  text-align: right;
}

.fer-score-band {
  font-size: 0.68rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.fer-score-track {
  width: 100%;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.3rem;
}

.fer-score-fill {
  height: 100%;
  width: 50%;
  background: var(--neutral, #94a3b8);
  border-radius: 3px;
  transition: width 0.4s ease, background 0.4s ease;
}

.fer-score-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.6rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* ══════════════════════════════════════════════════════
   PLAYER CONTROLS — Stop button
══════════════════════════════════════════════════════ */
.ctrl-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  font-size: 1rem;
  color: var(--text);
  transition: all 0.15s;
}

.ctrl-btn:hover {
  background: var(--surface);
  border-color: var(--accent);
}

/* ══════════════════════════════════════════════════════
   WELCOME SPLIT LAYOUT — "What to Expect"
══════════════════════════════════════════════════════ */
.welcome-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: start;
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
}

.welcome-left {
  text-align: center;
  padding-top: 1rem;
}

.welcome-right {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.3rem 1.4rem;
}

.expect-title {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.expect-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.expect-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.expect-icon {
  font-size: 1.1rem;
  line-height: 1.4;
  flex-shrink: 0;
  width: 1.5rem;
  text-align: center;
}

.expect-item strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.expect-item p {
  font-size: 0.76rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 0;
}

/* Mobile: stack columns */
@media (max-width: 600px) {
  .welcome-split {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 0.5rem 0.75rem;
  }
  .welcome-left { padding-top: 0; }
}

/* ══════════════════════════════════════════════════════
   POLAR H9 PANEL
══════════════════════════════════════════════════════ */
#polar-panel {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface2);
}

.polar-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.polar-metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.polar-metric-lbl {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.polar-metric-val {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
}

.polar-stress-low    { color: #22d3a5; }
.polar-stress-medium { color: #f59e0b; }
.polar-stress-high   { color: #ef4444; }
.polar-stress-unknown{ color: var(--text-dim); }
/* ── Parameters Panel ───────────────────────────────────────────────────── */
#np-params-panel {
  margin-top: 0.65rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font-size: 0.72rem;
}

.np-params-section {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.np-params-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.np-params-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.3rem 0.5rem;
}

.np-param {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 6px;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border);
}

.np-param-lbl {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 0.1rem;
}

.np-param-val {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* track params — different accent */
#track-params-grid .np-param-val {
  color: #22d3a5;
}

/* dist value — shows match quality */
#tp-dist {
  font-size: 0.75rem;
}

.np-params-divider {
  height: 1px;
  background: var(--border);
  margin: 0.55rem 0;
}

/* mood param bar — tiny visual bar inside each cell */
.np-param-bar {
  height: 2px;
  border-radius: 2px;
  background: var(--border);
  margin-top: 0.2rem;
  overflow: hidden;
}
.np-param-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  transition: width 0.6s ease;
}
#track-params-grid .np-param-bar-fill {
  background: #22d3a5;
}

/* ── Mobile First ─────────────────────────────────────────────────────────── */
@media (max-width: 680px) {

  /* Stack layout: topbar → left panel (collapsed) → center → player bar */
  #view-app {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto;
  }

  #topbar {
    grid-column: 1;
    padding: 0 1rem;
    height: 48px;
  }

  .app-logo {
    font-size: 1rem;
  }

  /* Left panel becomes a compact horizontal strip */
  #left-panel {
    grid-row: 2;
    grid-column: 1;
    flex-direction: column;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow: visible;
  }

  /* Panel header hidden on mobile — save space */
  .panel-hdr { display: none; }

  /* Connection buttons row */
  #left-panel > div:first-of-type {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.6rem 0.75rem;
    align-items: center;
  }

  #polar-connect-btn {
    flex: 1;
    min-width: 140px;
    padding: 0.5rem 0.6rem;
    font-size: 0.75rem;
  }

  #polar-sim-btn {
    flex: 1;
    min-width: 140px;
    padding: 0.5rem 0.6rem !important;
    font-size: 0.68rem !important;
  }

  /* Hide long simulation description on mobile */
  #left-panel p[style*="text-align:center"] {
    display: none;
  }

  /* Metrics: 2×2 grid → single compact row */
  .polar-metrics {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap;
    gap: 0;
    padding: 0 0.75rem 0.5rem !important;
    overflow-x: auto;
  }

  .polar-metric {
    flex: 1;
    min-width: 0;
    padding: 0.35rem 0.4rem;
    border-right: 1px solid var(--border);
    text-align: center;
  }

  .polar-metric:last-child { border-right: none; }

  .polar-metric-lbl {
    font-size: 0.55rem;
    white-space: nowrap;
  }

  .polar-metric-val {
    font-size: 0.85rem;
  }

  /* Mood score + Start Listening — keep visible on mobile, compact */
  #left-panel > div:has(#polar-start-btn) {
    padding: 0.5rem 0.75rem 0.5rem !important;
    border-top: 1px solid var(--border);
    margin-top: 0 !important;
  }

  #polar-start-btn {
    width: calc(100% - 0rem) !important;
    margin: 0.4rem 0 0 !important;
    padding: 0.5rem 1rem;
    font-size: 0.78rem;
  }

  /* Status text */
  #polar-status-wrap {
    display: none;
  }

  /* Center panel full width */
  #center-panel {
    grid-row: 3;
    grid-column: 1;
    padding: 0.75rem 0.75rem;
  }

  /* Player bar */
  #player-bar {
    grid-column: 1;
    grid-row: 4;
  }

  /* Now playing card */
  #now-playing {
    max-width: 100%;
    border-radius: 12px;
    padding: 0.85rem 1rem 1rem;
  }

  #np-thumb {
    width: 64px !important;
    height: 64px !important;
  }

  #np-title { font-size: 1rem !important; }

  /* Params panel grid → 2 col on mobile */
  .np-params-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Survey welcome — stack on mobile */
  .welcome-split {
    flex-direction: column !important;
    gap: 1.5rem;
  }

  .welcome-left, .welcome-right {
    width: 100% !important;
  }

  .welcome-title { font-size: 2rem !important; }
}

@media (max-width: 680px) {
  .app-logo span {
    display: none;
  }

  .app-logo {
    font-size: 0.95rem;
  }

  #topbar-status {
    font-size: 0.7rem;
  }

  #topbar {
    gap: 0.5rem;
  }
}

@media (max-width: 680px) {
  .polar-metric-lbl {
    color: var(--text) !important;
    opacity: 0.6;
  }

  .polar-metric-val {
    color: var(--text) !important;
    font-weight: 600;
  }
}