:root {
  color-scheme: dark;
  --ink: #f7fbff;
  --muted: #bac8d8;
  --deep: #071321;
  --panel: rgba(6, 18, 30, 0.78);
  --panel-solid: #0b1d2e;
  --line: rgba(255, 255, 255, 0.16);
  --teal: #72dccf;
  --teal-strong: #3eb8aa;
  --coral: #ffb38a;
  --gold: #ffd27a;
  --danger: #ff8a8a;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.36);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--deep);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

.site-header {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(18px, 4vw, 56px);
  background: rgba(5, 13, 24, 0.62);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(18px);
}

.brand,
nav a {
  color: var(--ink);
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 750;
}

.brand-mark {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 2px solid var(--teal);
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(114, 220, 207, 0.8), inset 7px 0 0 rgba(255, 211, 122, 0.86);
}

nav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 3vw, 28px);
  font-size: 0.95rem;
}

nav a {
  color: var(--muted);
}

nav a:hover {
  color: var(--ink);
}

.hero {
  position: relative;
  min-height: 92vh;
  display: grid;
  align-items: center;
  overflow: hidden;
  padding: 112px clamp(18px, 4vw, 56px) 56px;
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(4, 11, 22, 0.9) 0%, rgba(5, 13, 24, 0.62) 42%, rgba(5, 13, 24, 0.2) 78%),
    linear-gradient(0deg, rgba(7, 19, 33, 0.9) 0%, rgba(7, 19, 33, 0.08) 46%),
    url("/assets/dreamscape-hero.png") center / cover no-repeat;
  transform: scale(1.02);
}

.hero-content {
  position: relative;
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 470px);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
}

.intro {
  max-width: 720px;
}

.kicker,
.eyebrow,
.label {
  margin: 0;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 780;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 22px;
  max-width: 780px;
  font-size: clamp(3rem, 7vw, 6.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.lede {
  max-width: 590px;
  margin-bottom: 0;
  color: #dce7f2;
  font-size: clamp(1.05rem, 2vw, 1.34rem);
  line-height: 1.65;
}

.recorder {
  width: 100%;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.recorder-heading,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.recorder h2,
.story-band h2 {
  margin: 6px 0 0;
  font-size: clamp(1.7rem, 3vw, 2.7rem);
  line-height: 1.05;
}

.status-pill {
  min-width: 82px;
  padding: 8px 10px;
  border: 1px solid rgba(114, 220, 207, 0.5);
  border-radius: 999px;
  color: var(--teal);
  background: rgba(114, 220, 207, 0.1);
  font-size: 0.78rem;
  text-align: center;
}

.status-pill.offline {
  border-color: rgba(255, 138, 138, 0.55);
  color: var(--danger);
  background: rgba(255, 138, 138, 0.1);
}

.account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
}

.account-bar span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-button {
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  color: var(--teal);
  background: transparent;
  cursor: pointer;
}

.auth-panel {
  display: grid;
  gap: 14px;
  margin-top: 26px;
}

.mic-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, auto);
  gap: 12px;
  align-items: center;
  margin-top: 24px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.mic-panel strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 1.05rem;
}

.mic-panel.blocked {
  border-color: rgba(255, 138, 138, 0.55);
}

.mic-panel.blocked strong {
  color: var(--danger);
}

.mic-panel.pending {
  border-color: rgba(114, 220, 207, 0.7);
}

.mic-panel.pending strong,
.mic-panel.allowed strong {
  color: var(--teal);
}

.meter {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 28px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.meter > div {
  min-width: 0;
  padding: 16px 14px;
  background: rgba(255, 255, 255, 0.06);
}

.meter strong {
  display: block;
  margin-top: 7px;
  overflow-wrap: anywhere;
  font-size: clamp(1.08rem, 2vw, 1.35rem);
}

.email-field {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
}

.email-field span {
  color: var(--muted);
  font-size: 0.92rem;
}

.email-field input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.email-field input:focus {
  border-color: rgba(114, 220, 207, 0.8);
  box-shadow: 0 0 0 3px rgba(114, 220, 207, 0.12);
}

.recorder-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.icon-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button svg circle,
.icon-button svg rect {
  fill: currentColor;
  stroke: none;
}

.icon-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(114, 220, 207, 0.7);
}

.icon-button:disabled {
  color: rgba(247, 251, 255, 0.42);
  cursor: not-allowed;
}

.icon-button.primary {
  border-color: rgba(114, 220, 207, 0.8);
  color: #06231f;
  background: var(--teal);
  font-weight: 780;
}

.preview {
  width: 100%;
  margin-top: 20px;
}

.notice {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.progress {
  margin-top: 18px;
}

.progress span {
  display: block;
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.progress span::after {
  content: "";
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--gold), var(--coral));
  animation: drift 1.4s infinite ease-in-out;
}

.progress p {
  margin: 10px 0 0;
  color: var(--muted);
}

@keyframes drift {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(240%);
  }
}

.story-band {
  padding: clamp(52px, 8vw, 96px) clamp(18px, 4vw, 56px);
  background:
    linear-gradient(180deg, rgba(7, 19, 33, 0.96), #0a1726 52%, #0f2430);
}

.story-band > * {
  width: min(1180px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.library-tabs {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(96px, 1fr));
  gap: 2px;
  margin-top: 24px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.tab-button {
  min-height: 42px;
  padding: 8px 14px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.tab-button.active {
  color: #06231f;
  background: var(--teal);
  font-weight: 780;
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 26px;
}

.story-card {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(114, 220, 207, 0.11), rgba(255, 179, 138, 0.08)),
    rgba(255, 255, 255, 0.04);
}

.story-card h3 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.18;
}

.story-card time {
  color: var(--muted);
  font-size: 0.88rem;
}

.story-card p {
  color: #d9e5f1;
  line-height: 1.62;
}

.meta-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.meta-list div {
  display: grid;
  grid-template-columns: minmax(90px, 0.75fr) minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.meta-list dt {
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 780;
  text-transform: uppercase;
}

.meta-list dd {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.chip {
  padding: 6px 9px;
  border: 1px solid rgba(114, 220, 207, 0.28);
  border-radius: 999px;
  color: #cefff9;
  background: rgba(114, 220, 207, 0.08);
  font-size: 0.82rem;
}

.story-card button {
  width: 100%;
  margin-top: 4px;
}

.empty-state {
  grid-column: 1 / -1;
  min-height: 190px;
  display: grid;
  place-items: center;
  padding: 30px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.story-dialog {
  width: min(820px, calc(100vw - 28px));
  max-height: min(82vh, 900px);
  overflow: auto;
  padding: clamp(22px, 4vw, 44px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel-solid);
  box-shadow: var(--shadow);
}

.story-dialog::backdrop {
  background: rgba(2, 8, 15, 0.72);
  backdrop-filter: blur(10px);
}

.story-dialog h2 {
  margin: 0 52px 12px 0;
  font-size: clamp(1.9rem, 5vw, 3.1rem);
  line-height: 1;
}

.story-dialog p {
  color: #dce7f2;
  line-height: 1.72;
}

.detail-section {
  margin-top: 28px;
}

.detail-section h3 {
  margin: 0 0 12px;
  color: var(--teal);
  font-size: 0.9rem;
  text-transform: uppercase;
}

.story-dialog audio {
  width: 100%;
  margin: 12px 0 22px;
}

.close-button {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.close-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
}

@media (max-width: 920px) {
  .hero {
    min-height: auto;
    padding-bottom: 42px;
  }

  .hero-content {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .intro {
    max-width: 680px;
  }

  .story-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .site-header {
    align-items: flex-start;
    padding: 14px 16px;
  }

  .brand {
    max-width: 210px;
  }

  nav {
    gap: 12px;
    font-size: 0.88rem;
  }

  .hero {
    padding: 104px 16px 34px;
  }

  h1 {
    font-size: clamp(2.45rem, 14vw, 4rem);
  }

  .lede {
    font-size: 1rem;
  }

  .library-tabs {
    width: 100%;
  }

  .recorder-actions,
  .mic-panel,
  .meter,
  .story-grid {
    grid-template-columns: 1fr;
  }

  .story-card {
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
