/* Chill Semitone Song Discovery App v4 */
/* Foundation: tokens, song-wall, buttons, overlays, site-chrome, site-fabs, scrollbars (link before this sheet) */

:root {
  /* Workshop overrides on shared tokens */
  --border: #3d3428;
  --accent-soft: rgba(212, 132, 90, 0.14);
  --font: var(--font-sans);
  --transition: 280ms ease;
  --song-wall-z: 300;
  /* Golden master reference (1920×1080 screenshot) */
  --design-ref-w: 1920;
  --design-ref-h: 1080;
  --viewport-w: 100vw;
  --viewport-h: 100dvh;
  --ui-scale: 1;
  --layout-eq-ratio: 0.38;
  --layout-footer-zone: var(--site-footer-zone, 2.25rem);
  --screen-top-pad: 0.35rem;
  --screen-chrome-top: calc(var(--song-wall-height) + var(--screen-top-pad));
  --fab-clearance: 0px;
  --z-overlay: 12000;
  --z-loading: 280;
  --z-chrome: 420;
  --z-home-back: calc(var(--z-chrome) + 8);
  --z-chrome-panel: 450;
  --z-preview-banner: 480;
  --screen-chrome-bottom: calc(
    var(--viewport-h, 100dvh) * var(--layout-eq-ratio)
    + var(--layout-footer-zone)
    + var(--toolbar-h)
    + 0.5rem
    + var(--fab-clearance)
    + env(safe-area-inset-bottom, 0px)
  );
  --start-bottom-reserve: 8.75rem;
  --start-question-gap: 1.375rem;
  --idea-input-font-size: 1.35rem;
  --idea-input-line-height: 1.45;
  --idea-input-pad-block: 1.15rem;
  --idea-input-line: 1.9575rem;
  --idea-input-min-height: calc(var(--idea-input-pad-block) * 2 + var(--idea-input-line));
  --idea-input-icon-inset: calc(var(--idea-input-pad-block) + (var(--idea-input-line) - 2.25rem) / 2);
  --chat-panel-width: 18rem;
  --chat-layout-inset: calc(1rem + var(--chat-panel-width) + 0.65rem);
  --toolbar-h: 2rem;
  --doc-fab-clearance: calc(1rem + 3.25rem + 0.65rem + env(safe-area-inset-bottom, 0px));
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; }

html.is-proportional-desktop {
  font-size: calc(16px * var(--ui-scale));
  --layout-eq-ratio: 0.15;
  --start-bottom-reserve: calc(
    var(--viewport-h) * var(--layout-eq-ratio) + var(--layout-footer-zone) + 0.75rem
  );
}

@media (max-height: 560px) {
  :root {
    --layout-eq-ratio: 0.18;
  }
}

@media (max-height: 500px) {
  :root {
    --layout-eq-ratio: 0.11;
    --fab-clearance: 3.25rem;
  }

  html.is-proportional-desktop {
    --layout-eq-ratio: 0.13;
    --start-bottom-reserve: calc(
      var(--viewport-h) * var(--layout-eq-ratio) + var(--layout-footer-zone) + var(--toolbar-h) +
        var(--fab-clearance) + 0.5rem
    );
  }

  html.is-proportional-desktop .brand-logo.logo-start.logo-start-ready {
    width: 7rem;
    height: 7rem;
  }

  html.is-proportional-desktop {
    --start-question-gap: 0.65rem;
  }

  html.is-proportional-desktop .screen-inner-start .screen-title {
    font-size: 1.2rem;
    margin-bottom: 0.65rem;
  }
}

html.is-proportional-desktop .screen-host.is-start-screen {
  padding-bottom: var(--start-bottom-reserve);
}

html.is-proportional-desktop .screen-inner-start,
.screen-host.is-start-screen .screen-inner-start {
  max-width: min(56rem, calc(var(--viewport-w) - 2.5rem));
}

html.is-proportional-desktop .screen-inner-start .screen-title {
  white-space: nowrap;
  margin-bottom: var(--start-question-gap);
}

@media (min-width: 768px) and (max-width: 900px) {
  html.is-proportional-desktop .screen-inner-start .screen-title {
    white-space: normal;
    text-wrap: balance;
  }
}

@supports not (text-wrap: balance) {
  @media (min-width: 768px) and (max-width: 900px) {
    html.is-proportional-desktop .screen-inner-start .screen-title {
      white-space: normal;
      overflow-wrap: anywhere;
    }
  }
}

html.is-proportional-desktop body.is-start-screen .site-footer {
  bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
  mix-blend-mode: normal;
  color: rgba(235, 228, 216, 0.58);
  z-index: 355;
}

body.is-start-screen {
  --start-toolbar-right: 0.25rem;
  --start-eq-right-inset-ratio: 0.25;
  --toolbar-inner-width: calc(var(--toolbar-h) + 0.5rem + var(--toolbar-h) * 2);
  --chrome-right-clearance: calc(var(--start-toolbar-right) + var(--toolbar-inner-width));
}

html.is-proportional-desktop body.is-start-screen .app-toolbar {
  bottom: calc(1.35rem + env(safe-area-inset-bottom, 0px));
}

body.is-start-screen .app-toolbar {
  right: calc(var(--start-toolbar-right) + env(safe-area-inset-right, 0px));
}

html.is-proportional-desktop body.is-start-screen .contact-fab,
html.is-proportional-desktop body.is-start-screen .team-chat-fab,
html.is-proportional-desktop body.is-start-screen .donate-fab,
html.is-proportional-desktop body.is-start-screen .links-panel-fab {
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  transition: background var(--transition);
}

body.phase-process { background: var(--bg-shift); }

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 45% at 8% 0%, rgba(196, 120, 74, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse 55% 40% at 92% 100%, rgba(157, 74, 122, 0.06) 0%, transparent 50%);
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

/* Owner-only stats — revealed with ?vc=KEY; hidden for everyone else */
.visitor-counter {
  position: fixed;
  left: 0.55rem;
  bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
  z-index: 6;
  font-family: ui-monospace, 'Cascadia Code', 'Segoe UI Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: rgba(235, 228, 216, 0.55);
  mix-blend-mode: difference;
  pointer-events: none;
  user-select: none;
}

.visitor-counter[hidden] {
  display: none !important;
}

.screen-host {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 0;
  padding: calc(var(--song-wall-height) + 2rem) 1.25rem var(--screen-chrome-bottom, 3rem);
  position: relative;
  z-index: 1;
}

.screen-host.has-corner-logo {
  align-items: flex-start;
  padding-top: calc(var(--song-wall-height) + 4.5rem);
}

.screen-host.is-start-screen {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
  overflow-y: hidden;
  padding: 0 1.25rem 3rem;
  min-height: 0;
}

.screen-host.is-start-screen.is-start-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.screen-host.is-fading-out { opacity: 0; transition: opacity var(--transition); }
.screen-host.is-fading-in .screen-inner { opacity: 0; transform: translateY(8px); }
.screen-host .screen-inner.is-visible { opacity: 1; transform: translateY(0); transition: opacity var(--transition), transform var(--transition); }

.screen-inner {
  width: 100%;
  max-width: 36rem;
  margin: 0 auto;
  text-align: center;
}

.screen-inner.wide { max-width: 42rem; }
.screen-inner.left { text-align: left; }

.brand-logo {
  display: block;
  border-radius: 50%;
  box-shadow: 0 0 28px var(--accent-glow);
  cursor: default;
}

/* Safety — never flash in document flow before JS assigns logo-start/logo-corner */
.brand-logo:not(.logo-start):not(.logo-corner) {
  position: fixed;
  width: 0;
  height: 0;
  opacity: 0;
  visibility: hidden;
  overflow: hidden;
  pointer-events: none;
}

.brand-logo:hover {
  box-shadow: 0 0 32px var(--accent-glow);
}

.brand-logo:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.brand-logo.logo-start {
  position: fixed;
  top: calc(var(--song-wall-height) + 3rem);
  left: 50%;
  transform: translateX(-50%);
  width: 12.5rem;
  height: 12.5rem;
  z-index: 25;
  margin: 0;
  box-shadow: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  cursor: default;
  transition: opacity 1.25s ease-out;
  will-change: opacity;
}

.brand-logo.logo-start.logo-start-pending {
  transition: none !important;
}

.brand-logo.logo-start.logo-start-ready {
  opacity: 1;
  visibility: visible;
  pointer-events: none;
  cursor: default;
  transition: opacity 1.25s ease-out;
}

.brand-logo.logo-start.logo-start-exiting {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.85s ease-in, visibility 0s linear 0.85s;
}

.brand-logo.logo-start:hover {
  box-shadow: none;
}

.screen-inner-start {
  padding-top: 0;
  max-width: min(56rem, 100%);
  margin-left: auto;
  margin-right: auto;
}

.screen-inner-start .screen-title {
  margin: 0 0 var(--start-question-gap);
}

.brand-logo.logo-corner {
  position: fixed;
  top: 1rem;
  left: 1rem;
  width: 44px;
  height: 44px;
  z-index: 30;
  margin: 0;
  transform: none;
  box-shadow: 0 0 16px var(--accent-glow);
  transition: transform var(--transition), box-shadow var(--transition);
}

.brand-logo.logo-corner-instant { transition: none; }

@keyframes logoThink {
  0%, 100% { box-shadow: 0 0 16px var(--accent-glow); transform: scale(1); }
  50% { box-shadow: 0 0 28px rgba(212, 132, 90, 0.55); transform: scale(1.04); }
}

@keyframes logoComplete {
  0% { box-shadow: 0 0 16px var(--accent-glow); }
  50% { box-shadow: 0 0 36px rgba(34, 211, 238, 0.4), 0 0 24px var(--accent-glow); }
  100% { box-shadow: 0 0 16px var(--accent-glow); }
}

.brand-logo.logo-thinking { animation: logoThink 600ms ease; }
.brand-logo.logo-complete { animation: logoComplete 900ms ease; }

.brand-name {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
}

.screen-title {
  margin: 0 0 1.5rem;
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.screen-sub {
  margin: -1rem 0 1.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.idea-input {
  width: 100%;
  padding: 1rem 1.25rem;
  font-size: 1.35rem;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.idea-input-wrap {
  position: relative;
  width: 100%;
}

.idea-input-wrap .idea-input {
  padding-right: 3.25rem;
}

.idea-input-wrap:has(> .idea-textarea) > .dictation-btn,
.idea-input-wrap:has(> .explore-textarea) > .dictation-btn {
  top: var(--idea-input-icon-inset);
  transform: none;
}

.dictation-btn {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: color var(--transition), background var(--transition), box-shadow var(--transition);
}

.dictation-btn:hover:not(:disabled) {
  color: var(--accent);
  background: var(--accent-soft);
}

.dictation-btn.is-listening {
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px var(--accent-soft), 0 0 14px var(--accent-glow);
  animation: dictationPulse 1.4s ease-in-out infinite;
}

.dictation-btn.is-unsupported {
  opacity: 0.45;
  cursor: not-allowed;
}

.idea-input-group {
  --idea-send-btn-size: 2.5rem;
  --idea-send-btn-gap: 0.55rem;
  position: relative;
  width: 100%;
}

.screen-inner-start .idea-input-group {
  /* Center the textarea; send button sits outside (left: 100%) and is not part of the optical center */
  width: min(34rem, calc(100% - 2 * (var(--idea-send-btn-size) + var(--idea-send-btn-gap))));
  max-width: min(34rem, calc(100% - 2 * (var(--idea-send-btn-size) + var(--idea-send-btn-gap))));
  margin-left: auto;
  margin-right: auto;
}

.idea-input-group > .idea-input-wrap {
  min-width: 0;
}

.idea-input-group > .idea-send-btn {
  position: absolute;
  top: calc(var(--idea-input-pad-block) + (var(--idea-input-line) - var(--idea-send-btn-size)) / 2);
  left: 100%;
  margin-left: var(--idea-send-btn-gap);
}

.idea-send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--idea-send-btn-size, 2.5rem);
  height: var(--idea-send-btn-size, 2.5rem);
  padding: 0;
  color: #0a1628;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 14px var(--accent-glow);
  transition: transform var(--transition), filter var(--transition), opacity var(--transition);
}

.idea-send-btn:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: scale(1.05);
}

.idea-send-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  box-shadow: none;
}

.idea-send-btn__icon {
  width: 1.15rem;
  height: 1.15rem;
  margin-left: 0.1rem;
}

@keyframes dictationPulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--accent-soft), 0 0 10px var(--accent-glow); }
  50% { box-shadow: 0 0 0 2px var(--accent-soft), 0 0 18px rgba(212, 132, 90, 0.55); }
}

.dictation-nudge {
  margin-top: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--text);
  border: 1px solid var(--border);
}

.idea-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

.idea-input.transformed {
  font-size: 1rem;
  text-align: left;
}

.hint-text {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.app-toolbar {
  position: fixed;
  bottom: calc(1.35rem + env(safe-area-inset-bottom, 0px));
  right: 1rem;
  top: auto;
  z-index: 350;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: calc(100vw - 2rem);
}

.lang-switch {
  display: flex;
  align-items: stretch;
  height: var(--toolbar-h);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--toolbar-h);
  padding: 0;
  font-size: 0.75rem;
  line-height: 1;
  color: var(--muted);
  background: var(--card);
  border-right: 1px solid var(--border);
}

.lang-btn:last-child {
  border-right: none;
}

.lang-btn.is-active {
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

.card-grid {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.card-option {
  padding: 1.1rem 1.25rem;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition), transform var(--transition), opacity var(--transition);
}

.card-option:hover {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-soft);
}

.card-option.card-zoom-in {
  transform: scale(1.03);
  border-color: var(--accent);
  box-shadow: 0 0 24px var(--accent-glow);
}

.card-option.card-fade-out { opacity: 0.25; pointer-events: none; }

.card-label {
  font-size: 1.05rem;
  font-weight: 600;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin: 1rem 0;
}

.chip {
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: 999px;
  color: var(--muted);
  transition: all var(--transition);
}

.chip:hover {
  border-style: solid;
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-soft);
}

.answer-input {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1.1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
  min-height: 3rem;
}

.answer-input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.custom-core-input {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.highlight-list {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: left;
}

.highlight-item {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin-bottom: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.highlight-item input,
.highlight-item textarea {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0;
  resize: none;
  min-height: 1.5rem;
}

.highlight-item input:focus,
.highlight-item textarea:focus { outline: none; }

.startup-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: 0.9rem;
  background: rgba(180, 60, 60, 0.92);
  color: #fff;
}

.screen-loading {
  text-align: center;
}

.loading-text {
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: rgba(235, 228, 216, 0.92);
  margin: 0;
  text-shadow: 0 1px 12px rgba(6, 10, 18, 0.65), 0 0 24px rgba(6, 10, 18, 0.35);
  animation: loading-pulse 2.4s ease-in-out infinite;
}

@keyframes loading-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.screen-error .screen-title {
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 500;
}

.result-title {
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0 0 1rem;
}

.result-meta {
  margin-bottom: 1.5rem;
}

.result-meta-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.result-meta-value {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--accent);
}

.dna-heading {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.dna-box {
  text-align: left;
  max-height: 50vh;
  overflow-y: auto;
  margin-bottom: 1.5rem;
}

.dna-section {
  margin-bottom: 1.25rem;
}

.dna-section:last-child {
  margin-bottom: 0;
}

.dna-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 0.4rem;
}

.dna-body {
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.dna-raw {
  font-size: 0.88rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.result-actions {
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-start;
}

.error-detail {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.dev-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 40vh;
  overflow: auto;
  padding: 0.5rem 1rem;
  font-size: 0.72rem;
  background: rgba(0, 0, 0, 0.85);
  border-top: 1px solid var(--border);
  z-index: 50;
  text-align: left;
}

.dev-summary {
  margin-bottom: 0.5rem;
  color: var(--muted);
}

.dev-block {
  margin: 0.35rem 0;
}

.dev-block summary {
  cursor: pointer;
  color: var(--accent);
}

.dev-pre {
  margin: 0.35rem 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 12rem;
  overflow: auto;
  font-size: 0.68rem;
  color: var(--text);
}

/* v5 — collect, guidance, inspiration, direction, prompt-build */

.guidance-control {
  display: flex;
  border-right: 1px solid var(--border);
}

.guidance-btn {
  padding: 0.35rem 0.5rem;
  font-size: 0.68rem;
  color: var(--muted);
  background: var(--card);
  border-right: 1px solid var(--border);
  white-space: nowrap;
}

.guidance-btn:last-child { border-right: none; }

.guidance-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.block-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
  text-align: left;
}

.block-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  background: var(--card);
  transition: border-color var(--transition);
}

.block-item.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.block-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--muted);
}

.block-textarea {
  width: 100%;
  padding: 0.65rem;
  background: transparent;
  border: none;
  resize: vertical;
  min-height: 4rem;
}

.block-textarea:focus { outline: none; }

.inspiration-drawer {
  margin: 1rem 0;
  text-align: left;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  background: rgba(0, 0, 0, 0.15);
}

.inspiration-summary {
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.inspiration-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.35rem 0 0.75rem;
}

.inspiration-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.inspiration-tab {
  padding: 0.25rem 0.55rem;
  font-size: 0.72rem;
  border: 1px dashed var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: var(--card);
}

.inspiration-tab.is-active {
  border-color: var(--accent);
  color: var(--accent);
}

.inspiration-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.inspiration-recommended {
  margin: 0.75rem 0 1rem;
  text-align: left;
}

.inspiration-recommended-label,
.inspiration-relevant-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

.chip-recommended {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.autocomplete-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
  font-style: italic;
}

.idea-shape-panel {
  margin: 1rem 0;
  text-align: center;
}

.reading-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 1rem 0;
  text-align: left;
}

.reading-card {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  cursor: pointer;
}

.reading-card.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.reading-text {
  flex: 1;
  background: transparent;
  border: none;
  resize: vertical;
  min-height: 2.5rem;
}

.reading-text:focus { outline: none; }

.reading-source {
  font-size: 0.65rem;
  color: var(--accent);
  text-transform: uppercase;
}

.direction-core-label,
.prompt-preview-label,
.intent-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 1rem 0 0.35rem;
  color: var(--muted);
  text-align: left;
}

.direction-core-input,
.prompt-preview {
  width: 100%;
  padding: 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
  resize: vertical;
}

.direction-error {
  font-size: 0.85rem;
  color: var(--accent);
  margin-top: 0.5rem;
}

.local-bundle-panel {
  margin: 1rem 0;
  text-align: left;
}

.local-bundle-section {
  margin-bottom: 0.75rem;
}

.local-bundle-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

.local-bundle-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.intent-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: left;
}

.intent-input {
  width: 100%;
  padding: 0.55rem 0.65rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.dna-edit {
  width: 100%;
  padding: 0.65rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
  text-align: left;
}

@media (max-width: 600px) {
  :root {
    --idea-input-font-size: 1.15rem;
    --idea-input-line: 1.6675rem;
  }

  .screen-title { font-size: 1.25rem; }
  .idea-input { font-size: 1.15rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.primary-textarea {
  width: 100%;
  min-height: 8rem;
  padding: 0.85rem 1rem;
  font-size: 1.05rem;
  line-height: 1.55;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
  margin-bottom: 1rem;
}

.advanced-panel {
  margin: 1.25rem 0;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
}

.advanced-summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
  user-select: none;
  padding: 0.35rem 0;
}

.advanced-summary:hover {
  color: var(--accent);
}

.inspiration-chips-row {
  margin-bottom: 1rem;
}

.inspiration-chips-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.nudge-question {
  font-size: 1.1rem;
  line-height: 1.45;
  margin: 0 0 1rem;
  color: var(--text);
}

.guidance-mode-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.guidance-mode-btn {
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.guidance-mode-btn.is-active {
  border-color: var(--accent);
  color: var(--accent);
}

.guide-panel {
  margin: 1.25rem 0 1.5rem;
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.guide-analysis-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.65rem;
  font-weight: 600;
}

.guide-analysis-text {
  font-size: 1.2rem;
  line-height: 1.5;
  margin: 0 0 1rem;
  color: var(--text);
}

.guide-analysis-loading {
  font-size: 0.95rem;
  color: var(--muted);
  font-style: italic;
}

.guide-correct-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
}

.guide-genre-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 1rem 0 0.5rem;
}

.guide-genre-stars {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip-guide-star.is-selected,
.chip.is-selected {
  border-color: var(--accent);
  color: var(--accent);
}

.guide-genre-more-wrap {
  margin-top: 0.65rem;
}

.guide-genre-all {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.guide-question-block {
  margin: 1.5rem 0;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}

.guide-question-badge {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.guide-question-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

.guide-question-text {
  font-size: 1.1rem;
  line-height: 1.45;
  margin: 0 0 1rem;
}

.guide-error-text {
  font-size: 0.85rem;
  color: #e88;
  margin: 0.5rem 0;
}

.toolbar-btn-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--toolbar-h);
  height: var(--toolbar-h);
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.toolbar-btn-reset:hover {
  color: var(--bg);
  border-color: var(--accent);
  background: var(--accent);
}

.loading-overlay {
  --loading-viz-size: min(300px, 72vw);
  /* Fixed chrome band — same Y on start, explore, document (not tied to is-proportional-desktop). */
  --loading-eq-ratio: 0.38;
  --loading-inset-top: var(--song-wall-height);
  --loading-inset-bottom: calc(var(--viewport-h, 100dvh) * var(--loading-eq-ratio) + var(--layout-footer-zone));
  position: fixed;
  inset: 0;
  z-index: 280;
  display: grid;
  grid-template-rows: var(--loading-inset-top) minmax(0, 1fr) var(--loading-inset-bottom);
  grid-template-columns: 1fr;
  align-items: center;
  justify-items: center;
  gap: 0;
  padding: 0;
  box-sizing: border-box;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 280ms ease, visibility 280ms ease;
  background: rgba(6, 10, 18, 0.42);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

@media (min-width: 768px) {
  .loading-overlay {
    font-size: 16px;
    --loading-eq-ratio: 0.15;
    --loading-inset-top: calc(7.25rem + 0.75rem + 0.55rem + 7.25rem * 0.42);
  }
}

.loading-overlay.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: var(--z-loading);
  background: rgba(8, 14, 26, 0.58);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.loading-overlay__stack {
  grid-row: 2;
  grid-column: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.loading-overlay .loading-text {
  margin: 0;
  text-align: center;
}

.loading-progress {
  width: min(280px, 72vw);
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.loading-progress__bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(120, 200, 255, 0.9), rgba(200, 140, 255, 0.95));
  box-shadow:
    0 0 10px rgba(160, 180, 255, 0.45),
    0 0 22px rgba(140, 120, 255, 0.25);
  animation: loading-progress-glow 2.8s ease-in-out infinite;
  will-change: width;
}

@keyframes loading-progress-glow {
  0%,
  100% {
    filter: brightness(1);
    box-shadow:
      0 0 8px rgba(160, 180, 255, 0.35),
      0 0 18px rgba(140, 120, 255, 0.2);
  }
  50% {
    filter: brightness(1.12);
    box-shadow:
      0 0 14px rgba(160, 200, 255, 0.55),
      0 0 28px rgba(160, 140, 255, 0.35);
  }
}

.loading-progress__step,
.loading-progress__pct {
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
  letter-spacing: 0.03em;
}

.loading-progress__step {
  font-weight: 500;
}

.loading-progress__pct {
  opacity: 0.85;
}

.loading-longer {
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.75;
  text-align: center;
  font-style: italic;
}

@media (prefers-reduced-motion: reduce) {
  .loading-progress__bar {
    animation: none;
    transition: width 0.4s ease;
  }
}

.loading-viz-host {
  grid-row: unset;
  grid-column: unset;
  position: relative;
  width: var(--loading-viz-size);
  height: var(--loading-viz-size);
  flex-shrink: 0;
}

.loading-viz-core {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: 28%;
  height: 28%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: loading-core-pulse 2.4s ease-in-out infinite;
  filter: drop-shadow(0 0 14px rgba(139, 92, 246, 0.45))
    drop-shadow(0 0 24px rgba(212, 132, 90, 0.25));
}

@keyframes loading-core-pulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(0.94);
    opacity: 0.92;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.06);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-viz-core {
    animation: none;
    transform: translate(-50%, -50%) scale(1);
  }
}

html.perf-lite .loading-overlay {
  --loading-viz-size: min(240px, 64vw);
}

html.perf-lite .loading-overlay.is-active {
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.loading-viz-canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  will-change: transform;
}

body.is-loading .screen-host,
body.is-loading .brand-logo.logo-start {
  pointer-events: none;
}

body.is-loading.is-start-screen .screen-host.is-start-screen {
  opacity: 0;
  visibility: hidden;
}

body.is-loading .home-back-btn {
  z-index: var(--z-home-back);
  pointer-events: auto;
}

body.is-loading .song-wall-root,
body.is-loading .app-toolbar,
body.is-loading .contact-fab,
body.is-loading .team-chat-fab,
body.is-loading .donate-fab,
body.is-loading .links-panel-fab {
  pointer-events: auto;
}

body.is-loading .app-toolbar,
body.is-loading .contact-fab,
body.is-loading .team-chat-fab,
body.is-loading .donate-fab,
body.is-loading .links-panel-fab {
  z-index: var(--z-chrome);
}

body.is-loading .song-wall-root {
  z-index: calc(var(--z-chrome) - 10);
}

body.is-loading .contact-form-root,
body.is-loading .donate-fab-root,
body.is-loading .links-panel-fab-root,
body.is-loading .team-chat-root {
  z-index: calc(var(--z-chrome) + 5);
}

body.is-loading .contact-form-overlay {
  z-index: var(--z-chrome-panel);
}

body.is-loading .team-chat-panel {
  z-index: calc(var(--z-chrome-panel) - 5);
}

body.is-loading .song-wall__tooltip-float {
  z-index: calc(var(--z-chrome) + 8);
}

.inline-error {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid rgba(180, 60, 60, 0.5);
  border-radius: var(--radius);
  background: rgba(180, 60, 60, 0.08);
}

.reading-list-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.reading-alt {
  text-align: left;
  max-width: 100%;
  white-space: normal;
  height: auto;
  padding: 0.5rem 0.75rem;
  line-height: 1.35;
}

/* Consent + legal: platform/shared/styles/consent.css */
/* Contact overlay base: platform/shared/styles/overlays.css */

/* Workshop contact-form — chrome blur + field theme */
body.has-contact-open #app-root,
body.has-contact-open .site-footer,
body.has-contact-open .song-wall-root {
  filter: blur(8px) saturate(0.88);
  transition: filter var(--transition);
}

.contact-form-field input,
.contact-form-field textarea {
  background: rgba(10, 22, 40, 0.55);
}

.contact-form-field input:-webkit-autofill,
.contact-form-field input:-webkit-autofill:hover,
.contact-form-field input:-webkit-autofill:focus,
.contact-form-field input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text);
  box-shadow: 0 0 0 1000px rgba(10, 22, 40, 0.55) inset !important;
  transition: background-color 99999s ease-out 0s;
}

.contact-form-submit {
  align-self: flex-start;
  width: auto;
}

.contact-form-root,
.donate-fab-root,
.links-panel-fab-root,
.team-chat-root {
  position: relative;
  z-index: 200;
  pointer-events: none;
}

/* Workshop FAB row — fixed layout (surfaces without site-fab-cluster) */
.contact-fab,
.team-chat-fab,
.donate-fab,
.links-panel-fab {
  position: fixed;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  left: 1rem;
  z-index: 212;
}

body:has(.contact-fab) .team-chat-fab {
  left: calc(1rem + 3.25rem + 0.65rem);
}

body:has(.team-chat-fab) .donate-fab {
  left: calc(1rem + (3.25rem + 0.65rem) * 2);
}

body:has(.donate-fab) .links-panel-fab {
  left: calc(1rem + (3.25rem + 0.65rem) * 3);
}

/* Workshop team-chat — panel width + per-user accent */
.team-chat-panel {
  width: min(var(--chat-panel-width), calc(100vw - 2rem));
}

.team-chat-message {
  position: relative;
  padding: 0.55rem 0.5rem 0.55rem 0.65rem;
  margin-right: 0.15rem;
  border-left-color: var(--chat-user-accent, var(--accent));
  transition: background var(--transition);
}

.team-chat-message:hover {
  background: rgba(0, 0, 0, 0.26);
}

.team-chat-message__user {
  color: var(--chat-user-accent, var(--accent));
}

.team-chat-compose {
  flex-shrink: 0;
}

.team-chat-compose__name:focus,
.team-chat-compose__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.team-chat-compose__send {
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
}

@media (max-width: 480px) {
  .contact-fab {
    left: 0.75rem;
  }

  body:has(.contact-fab) .team-chat-fab {
    left: calc(0.75rem + 3.25rem + 0.65rem);
  }

  body:has(.team-chat-fab) .donate-fab {
    left: calc(0.75rem + (3.25rem + 0.65rem) * 2);
  }

  body:has(.donate-fab) .links-panel-fab {
    left: calc(0.75rem + (3.25rem + 0.65rem) * 3);
  }

  .team-chat-panel {
    left: 0.5rem;
    right: 0.5rem;
    width: auto;
    bottom: calc(5.75rem + env(safe-area-inset-bottom, 0px));
  }

  .team-chat-fab {
    left: 0.75rem;
  }
}

/* Lite tier (mobile / save-data) — lighter GPU compositing, same atmosphere */
html.perf-lite .contact-fab,
html.perf-lite .team-chat-fab,
html.perf-lite .donate-fab,
html.perf-lite .links-panel-fab {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: rgba(18, 28, 46, 0.92);
}

html.perf-lite .consent-overlay,
html.perf-lite .consent-overlay--legal,
html.perf-lite .contact-form-overlay,
html.perf-lite .consent-overlay--prompt,
html.perf-lite .app-screen-prompt {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: rgba(10, 22, 40, 0.88);
}

html.perf-lite body.has-contact-open #app-root,
html.perf-lite body.has-contact-open .site-footer,
html.perf-lite body.has-contact-open .song-wall-root,
html.perf-lite body.has-contact-open .ambient-root {
  filter: none;
}

html.perf-lite .ambient-canvas--rain {
  filter: none;
}

html.perf-lite .song-wall__cover:hover img,
html.perf-lite .song-wall__cover.is-pointed img {
  transform: scale(1.12);
}

