/* ==========================================================
   Hear My Thoughts — a quiet place, not a product.
   A temporary space: nothing typed here persists. Single
   screen, no scrolling on the main experience. The atmosphere
   carries the design; the writing space is the whole product.
   ========================================================== */

@font-face {
  font-family: 'Geist';
  src: url('https://cdn.jsdelivr.net/npm/geist@1/dist/fonts/geist-sans/Geist-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-sans: 'Geist', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --color-ink: #f6f1ea;
  --color-ink-soft: rgba(246, 241, 234, 0.72);
  --color-ink-faint: rgba(246, 241, 234, 0.45);

  --glass-fill: rgba(255, 255, 255, 0.07);
  --glass-fill-strong: rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.16);
  --glass-border-strong: rgba(255, 255, 255, 0.3);
  --glass-shadow: rgba(8, 6, 9, 0.35);

  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);

  /* The composer's "tall box" height and line-height, kept as
     variables so the placeholder's vertical centering (a calc()
     below) stays correct across breakpoints without JS math. */
  --composer-min-h: 260px;
  --composer-line-h: 34px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #14100f;
}

body {
  font-family: var(--font-sans);
  color: var(--color-ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ----------------------------------------------------------
   Atmosphere — fullscreen scene
   ---------------------------------------------------------- */

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #14100f;
  transition: filter 1s var(--ease-soft), transform 1s var(--ease-soft);
}

.bg-media {
  position: absolute;
  inset: -4%;
  animation: bgZoom 40s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes bgZoom {
  from { transform: scale(1); }
  to   { transform: scale(1.08); }
}

.bg-video,
.bg-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 60%; /* default; JS sets a per-scene, per-breakpoint value */
}

.bg-fallback {
  display: none;
}

.bg-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(12, 9, 12, 0.5) 0%,
    rgba(12, 9, 12, 0.22) 30%,
    rgba(10, 8, 11, 0.16) 54%,
    rgba(10, 8, 11, 0.52) 86%,
    rgba(8, 6, 9, 0.68) 100%
  );
}

.bg-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 42%, rgba(0, 0, 0, 0) 38%, rgba(6, 5, 7, 0.32) 100%);
}

/* Subtle floating sparkles — extremely quiet, never decorative clutter */
.sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sparkle {
  position: absolute;
  font-size: var(--size, 8px);
  color: rgba(255, 255, 255, 0.5);
  opacity: 0.18;
  animation: sparkleDrift var(--dur, 18s) ease-in-out infinite;
  will-change: transform, opacity;
}

@keyframes sparkleDrift {
  0%, 100% { transform: translate(0, 0); opacity: 0.12; }
  50%      { transform: translate(var(--dx, 6px), var(--dy, -10px)); opacity: 0.32; }
}

/* ----------------------------------------------------------
   Stage — header row on top, centered column filling the rest
   ---------------------------------------------------------- */

.stage {
  position: relative;
  z-index: 1;
  height: 100dvh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: clamp(16px, 3vh, 28px) clamp(20px, 6vw, 64px) clamp(20px, 4vh, 40px);
}

.stage-center {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
}

/* ----------------------------------------------------------
   Header — wordmark left, controls top-right
   ---------------------------------------------------------- */

.app-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  opacity: 0;
  animation: riseIn 1.7s var(--ease-soft) 0.2s both;
  transition: filter 0.8s var(--ease-soft), opacity 0.8s var(--ease-soft);
}

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

.wordmark-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-ink);
  animation: pulseDot 3.6s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(246, 241, 234, 0.35); opacity: 0.55; }
  50%      { box-shadow: 0 0 0 6px rgba(246, 241, 234, 0); opacity: 1; }
}

.wordmark-text {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--color-ink-soft);
}

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

/* ----------------------------------------------------------
   Hero — headline + supporting line
   ---------------------------------------------------------- */

.hero {
  position: relative;
  max-width: 760px;
  margin-top: clamp(18px, 5vh, 56px);
  transition: filter 0.8s var(--ease-soft), opacity 0.6s var(--ease-soft);
}

/* A soft, blurred scrim held just behind the hero text — keeps it
   legible over busy parts of the scene without darkening the frame. */
.hero::before {
  content: '';
  position: absolute;
  inset: -32px -56px;
  background: radial-gradient(ellipse at 50% 45%, rgba(6, 5, 7, 0.4) 0%, rgba(6, 5, 7, 0) 70%);
  filter: blur(8px);
  z-index: -1;
}

.headline {
  margin: 0;
  font-weight: 400;
  font-size: clamp(1.7rem, 3.4vw, 2.7rem);
  line-height: 1.32;
  letter-spacing: -0.01em;
  color: var(--color-ink);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45), 0 8px 32px rgba(0, 0, 0, 0.4);
  opacity: 0;
  animation: riseIn 1.9s var(--ease-soft) 0.75s both;
}

.supporting {
  margin: clamp(16px, 2.6vh, 24px) 0 0;
  font-weight: 300;
  font-size: clamp(0.9rem, 1.4vw, 1.05rem);
  line-height: 1.7;
  letter-spacing: 0.01em;
  color: rgba(246, 241, 234, 0.85);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 6px 22px rgba(0, 0, 0, 0.4);
  opacity: 0;
  animation: riseIn 1.9s var(--ease-soft) 1.35s both;
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ----------------------------------------------------------
   Spacer
   ---------------------------------------------------------- */

.spacer {
  flex: 1 1 auto;
  min-height: 16px;
}

/* ----------------------------------------------------------
   Composer — the writing space. The dominant element on the
   page, not a conventional form field.
   ---------------------------------------------------------- */

.composer {
  position: relative;
  width: min(820px, 88vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  animation: riseIn 2s var(--ease-soft) 1.95s both;
}

.composer-glass {
  position: relative;
  width: 100%;
  border-radius: 28px;
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  box-shadow: 0 24px 70px var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  overflow: hidden;
  animation: breathe 7s ease-in-out infinite;
  transition: border-color 0.6s var(--ease-soft), background 0.6s var(--ease-soft), box-shadow 0.6s var(--ease-soft);
}

.composer-glass:focus-within {
  border-color: var(--glass-border-strong);
  background: var(--glass-fill-strong);
  box-shadow: 0 28px 80px rgba(8, 6, 9, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  animation-play-state: paused;
}

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

.composer-input {
  display: block;
  width: 100%;
  min-height: var(--composer-min-h);
  max-height: 46vh;
  resize: none;
  background: transparent;
  border: none;
  padding: 30px 34px;
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 1.18rem;
  line-height: 1.7;
  color: var(--color-ink);
  text-align: left;
  transition: opacity 0.55s var(--ease-soft), height 0.25s var(--ease-soft), padding-top 0.4s var(--ease-soft);
}

.composer-input:focus {
  outline: none;
}

.composer-input::placeholder {
  color: var(--color-ink-faint);
  font-weight: 300;
}

/* Empty box: placeholder sits centered, both axes — an inviting
   prompt rather than a top-anchored form field. */
.composer-input:placeholder-shown {
  text-align: center;
  padding-top: calc((var(--composer-min-h) - var(--composer-line-h)) / 2);
}

/* A short line of typed text stays centered too; once it grows
   into a real paragraph, it settles into natural left alignment. */
.composer-input.is-short:not(:placeholder-shown) {
  text-align: center;
}

.composer-input.releasing {
  opacity: 0;
  transition: opacity 0.1s ease;
}

.release-message {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 36px;
  text-align: center;
  opacity: 0;
  transform: scale(0.97);
  pointer-events: none;
  transition: opacity 1.1s var(--ease-soft), transform 1.1s var(--ease-soft);
}

.release-message.visible {
  opacity: 1;
  transform: scale(1);
}

.release-message-primary {
  font-weight: 300;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: var(--color-ink);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.3);
}

.release-message-secondary {
  font-weight: 300;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  color: var(--color-ink-soft);
}

/* A quiet "letting go…" indicator while the words are in flight */
.release-progress {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 300;
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  color: var(--color-ink-faint);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s var(--ease-soft);
}

.release-progress.visible {
  opacity: 1;
}

.release-dots {
  display: inline-flex;
  gap: 2px;
  margin-left: 3px;
}

.release-dots span {
  opacity: 0.25;
  animation: dotPulse 1.4s ease-in-out infinite;
}

.release-dots span:nth-child(2) { animation-delay: 0.2s; }
.release-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 100% { opacity: 0.25; }
  50%      { opacity: 0.95; }
}

/* A soft bloom at the moment of release — the reward for letting go */
.release-glow {
  position: absolute;
  inset: -45%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 246, 232, 0.4) 0%, rgba(255, 246, 232, 0) 68%);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

.release-glow.burst {
  animation: releaseBurst 1.6s var(--ease-soft) forwards;
}

@keyframes releaseBurst {
  0%   { opacity: 0; transform: scale(0.55); }
  28%  { opacity: 0.9; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.5); }
}

/* ----------------------------------------------------------
   Letting go — words drift up out of the box and dissolve,
   one visual line at a time (matched to how they actually wrap)
   ---------------------------------------------------------- */

.release-lines {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  padding: 30px 34px;
  pointer-events: none;
  z-index: 3;
}

.flying-line {
  display: block;
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 1.18rem;
  line-height: 1.7;
  color: var(--color-ink);
  white-space: pre-wrap;
  opacity: 0;
}

.flying-line.flying {
  animation-name: flyAway;
  animation-timing-function: var(--ease-soft);
  animation-fill-mode: forwards;
  animation-duration: 1.3s; /* fallback; JS sets the real duration inline */
}

@keyframes flyAway {
  0%   { opacity: 0.95; transform: translateY(0); filter: blur(0px); }
  10%  { opacity: 0.95; transform: translateY(-6px); filter: blur(0px); }
  60%  { opacity: 0.6; transform: translateY(-90px); filter: blur(4px); }
  100% { opacity: 0; transform: translateY(-190px); filter: blur(13px); }
}

/* Offscreen twin of the textarea, used only to measure where the
   browser actually wraps each visual line of text. */
.line-mirror {
  position: absolute;
  visibility: hidden;
  pointer-events: none;
  top: 0;
  left: -9999px;
  padding: 30px 34px;
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 1.18rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* ----------------------------------------------------------
   Nothing you write here is saved — a quiet, permanent trust
   signal. Stays visible even while writing (unlike the hero).
   ---------------------------------------------------------- */

.privacy-note {
  margin: 14px 0 0;
  font-size: 0.72rem;
  font-weight: 300;
  letter-spacing: 0.03em;
  color: var(--color-ink-faint);
}

/* ----------------------------------------------------------
   Hold to let go — prominent, deliberate, a little ceremonial
   ---------------------------------------------------------- */

.release-hold {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 14px 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.26);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  box-shadow: 0 14px 36px rgba(8, 6, 9, 0.32);
  overflow: hidden;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: opacity 0.6s var(--ease-soft), border-color 0.3s var(--ease-soft), box-shadow 0.4s var(--ease-soft), margin-top 0.3s var(--ease-soft);
}

.release-hold.visible {
  opacity: 1;
  pointer-events: auto;
  animation: holdInvite 3.4s ease-in-out 0.5s infinite;
}

.release-hold.visible.holding {
  animation: none;
}

.release-hold:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 3px;
}

@keyframes holdInvite {
  0%, 100% { box-shadow: 0 14px 36px rgba(8, 6, 9, 0.32), 0 0 0 0 rgba(255, 255, 255, 0.14); }
  50%      { box-shadow: 0 14px 36px rgba(8, 6, 9, 0.32), 0 0 0 9px rgba(255, 255, 255, 0); }
}

.release-hold:active {
  transform: scale(0.97);
}

.release-hold.holding {
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 18px 48px rgba(8, 6, 9, 0.42);
}

.release-hold-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.34));
  transform-origin: left;
}

.release-hold-icon {
  position: relative;
  z-index: 1;
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--color-ink-soft);
  transition: color 0.3s var(--ease-soft), transform 0.3s var(--ease-soft);
}

.release-hold-label {
  position: relative;
  z-index: 1;
  font-size: 0.88rem;
  font-weight: 450;
  letter-spacing: 0.015em;
  color: var(--color-ink-soft);
  transition: color 0.3s var(--ease-soft);
}

.release-hold.holding .release-hold-label,
.release-hold.holding .release-hold-icon {
  color: var(--color-ink);
}

.release-hold.holding .release-hold-icon {
  transform: translateY(-2px);
}

/* ----------------------------------------------------------
   Focus mode — while writing, everything else goes quiet.
   Releasing goes further: the hero disappears entirely for a
   clean canvas (the atmosphere stays blurred; that's the mood).
   ---------------------------------------------------------- */

body.is-writing .atmosphere {
  filter: blur(18px) brightness(0.82) saturate(92%);
  transform: scale(1.06);
}

/* !important below is deliberate: .app-header and .hero carry a
   fill-forwards entrance animation, and CSS animation effects on a
   property outrank plain declarations in the cascade regardless of
   selector specificity — without it these opacity overrides are
   silently ignored once the entrance animation has finished. */

body.is-writing .app-header {
  filter: blur(6px);
  opacity: 0.32 !important;
  pointer-events: none;
}

body.is-writing .hero {
  filter: blur(6px);
  opacity: 0.28 !important;
  pointer-events: none;
}

body.is-releasing .hero {
  filter: none;
  opacity: 0 !important;
}

/* Mobile keyboard open: quiet the environment further so the
   writing itself is the only thing that matters. */
body.keyboard-open .app-header {
  opacity: 0.16 !important;
}

/* ----------------------------------------------------------
   Header controls — mute + settings, 44px touch targets
   ---------------------------------------------------------- */

.quiet-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  color: var(--color-ink-soft);
  cursor: pointer;
  padding: 0;
  transition: background 0.5s var(--ease-soft), border-color 0.5s var(--ease-soft),
    color 0.5s var(--ease-soft), transform 0.25s var(--ease-soft);
}

.quiet-btn:hover {
  background: var(--glass-fill-strong);
  color: var(--color-ink);
}

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

.quiet-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 2px;
}

.quiet-icon {
  width: 18px;
  height: 18px;
}

.icon-off {
  display: none;
}

.quiet-btn[aria-pressed='false'] {
  color: var(--color-ink-faint);
}

.quiet-btn[aria-pressed='false'] .icon-on {
  display: none;
}

.quiet-btn[aria-pressed='false'] .icon-off {
  display: block;
}

.scene-label {
  margin: 14px 0 0;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--color-ink-faint);
  opacity: 0;
  transition: opacity 0.7s var(--ease-soft);
  text-align: center;
}

.scene-label.visible {
  opacity: 1;
}

/* ----------------------------------------------------------
   Atmosphere — a right-side panel, not a centered modal
   ---------------------------------------------------------- */

.atmosphere-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.4s var(--ease-soft), visibility 0s linear 0.4s;
}

.atmosphere-overlay.open {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.4s var(--ease-soft), visibility 0s linear 0s;
}

.atmosphere-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 6, 8, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.atmosphere-panel {
  position: relative;
  width: min(400px, 92vw);
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: rgba(20, 16, 17, 0.82);
  border-left: 1px solid var(--glass-border);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
  box-shadow: -20px 0 60px rgba(6, 5, 6, 0.5);
  transform: translateX(100%);
  transition: transform 0.45s var(--ease-soft);
}

.atmosphere-overlay.open .atmosphere-panel {
  transform: translateX(0);
}

.atmosphere-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 24px 16px;
}

.atmosphere-title {
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-ink-soft);
}

.atmosphere-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  color: var(--color-ink-soft);
  cursor: pointer;
  flex: 0 0 auto;
}

.atmosphere-close svg {
  width: 14px;
  height: 14px;
}

.atmosphere-close:hover {
  color: var(--color-ink);
  background: var(--glass-fill-strong);
}

.atmosphere-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 24px calc(28px + env(safe-area-inset-bottom, 0px));
}

.atmosphere-section {
  padding: 18px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.atmosphere-section:first-child {
  border-top: none;
  padding-top: 4px;
}

.atmosphere-divider {
  margin-top: 6px;
  padding: 14px 0 4px;
}

.atmosphere-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-ink-faint);
  margin-bottom: 12px;
}

.atmosphere-sublabel {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-ink-faint);
  margin-bottom: 10px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.settings-row .atmosphere-sublabel {
  margin-bottom: 0;
}

.settings-slider {
  width: 100%;
  accent-color: var(--color-ink);
  transition: opacity 0.3s var(--ease-soft);
}

.settings-slider:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

/* Theme presets — complete emotional environments, not just images */

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.theme-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 4 / 3.4;
  border: 1.5px solid transparent;
  cursor: pointer;
  background: #000;
  padding: 0;
  text-align: left;
}

.theme-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.85;
  transition: opacity 0.3s var(--ease-soft), transform 6s var(--ease-soft);
}

.theme-card:hover img {
  opacity: 1;
  transform: scale(1.05);
}

.theme-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 38%, rgba(0, 0, 0, 0.72) 100%);
}

.theme-card-text {
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: 9px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.theme-card-name {
  font-size: 0.78rem;
  font-weight: 500;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.theme-card-mood {
  font-size: 0.6rem;
  font-weight: 300;
  letter-spacing: 0.02em;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.68);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.theme-card.active {
  border-color: rgba(255, 255, 255, 0.75);
}

.theme-card.active::before {
  content: '';
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-ink);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
}

/* Scene picker (Custom section) */

.scene-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.scene-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border: 1.5px solid transparent;
  cursor: pointer;
  background: #000;
  padding: 0;
}

.scene-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.82;
  transition: opacity 0.3s var(--ease-soft), transform 6s var(--ease-soft);
}

.scene-card:hover img {
  opacity: 1;
  transform: scale(1.05);
}

.scene-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.65) 100%);
}

.scene-card-name {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 6px;
  z-index: 1;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #fff;
  text-align: left;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.scene-card.active {
  border-color: rgba(255, 255, 255, 0.75);
}

.scene-card.active::before {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-ink);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
}

/* Ambience / Music toggle */

.mini-toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.mini-toggle-track {
  display: block;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--glass-fill-strong);
  border: 1px solid var(--glass-border);
  position: relative;
  transition: background 0.3s var(--ease-soft), border-color 0.3s var(--ease-soft);
}

.mini-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-ink-faint);
  transition: transform 0.3s var(--ease-soft), background 0.3s var(--ease-soft);
}

.mini-toggle[aria-pressed='true'] .mini-toggle-track {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.4);
}

.mini-toggle[aria-pressed='true'] .mini-toggle-knob {
  background: var(--color-ink);
  transform: translateX(16px);
}

/* Ambience / Music track lists */

.track-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.track-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 10px;
  background: none;
  border: none;
  color: var(--color-ink-soft);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 300;
  text-align: left;
  cursor: pointer;
  transition: background 0.25s var(--ease-soft), color 0.25s var(--ease-soft);
}

.track-row:hover {
  background: var(--glass-fill);
  color: var(--color-ink);
}

.track-row-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: transparent;
}

.track-row.active {
  color: var(--color-ink);
  font-weight: 400;
}

.track-row.active .track-row-dot {
  background: var(--color-ink);
}

/* ----------------------------------------------------------
   Reduced motion — respect it fully
   ---------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .bg-media { animation: none; }
  .sparkle { animation: none; opacity: 0.2; }
  .wordmark-dot { animation: none; }
  .composer-glass { animation: none; }
  .release-hold.visible { animation: none; }
  .app-header, .headline, .supporting, .composer {
    animation: none;
    opacity: 1;
  }
  .flying-line.flying { animation: flyAwayReduced 1s ease forwards; }
}

@keyframes flyAwayReduced {
  0%   { opacity: 0.95; }
  100% { opacity: 0; }
}

/* ----------------------------------------------------------
   Responsive — tablet
   ---------------------------------------------------------- */

@media (max-width: 1024px) {
  .hero { max-width: 560px; }
}

/* ----------------------------------------------------------
   Responsive — mobile
   ---------------------------------------------------------- */

@media (max-width: 640px) {
  :root {
    --composer-min-h: 220px;
    --composer-line-h: 28px;
  }

  .stage {
    padding: calc(14px + env(safe-area-inset-top, 0px)) 16px calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .wordmark-text { font-size: 0.64rem; letter-spacing: 0.18em; }

  .hero { margin-top: clamp(14px, 4vh, 28px); }
  .headline { font-size: clamp(1.5rem, 6.4vw, 2rem); }
  .supporting { font-size: 0.86rem; }

  .composer { width: 100%; }

  .composer-input {
    padding: 24px 22px;
    font-size: 1.05rem;
  }

  .composer-glass { border-radius: 22px; }

  .release-lines { padding: 24px 22px; }
  .flying-line { font-size: 1.05rem; }

  .release-hold { padding: 12px 22px; margin-top: 12px; }
  .release-hold-label { font-size: 0.82rem; }

  .privacy-note { font-size: 0.66rem; margin-top: 10px; }

  .atmosphere-panel { width: 92vw; }
  .theme-grid { grid-template-columns: repeat(2, 1fr); }
  .scene-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) and (max-height: 700px) {
  .hero { margin-top: clamp(8px, 3vh, 16px); }
  .supporting { margin-top: 10px; }
  :root {
    --composer-min-h: 170px;
  }
  .privacy-note { margin-top: 6px; }
  .release-hold { margin-top: 8px; }
}
