:root {
  color-scheme: dark;
  --bg: #040508;
  --panel: rgba(8, 11, 16, 0.74);
  --panel-strong: rgba(7, 9, 14, 0.92);
  --line: rgba(255, 244, 223, 0.16);
  --text: #f7eedb;
  --muted: #d0c0a1;
  --soft: #948468;
  --accent: #ffb84d;
  --accent-2: #ff6a3d;
  --danger: #ff6b6b;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --nav-h: 84px;
  --shell-w: 1080px;
  --device-w: 640px;
  --radius: 22px;
  --serif: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", serif;
  --sans: "Bebas Neue", "Avenir Next Condensed", "Arial Narrow", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(255, 136, 0, 0.18), transparent 36%),
    linear-gradient(180deg, #06080d 0%, #020305 100%);
  color: var(--text);
  font-family: var(--serif);
}

body {
  min-height: 100vh;
}

html.reader-route,
body.reader-route {
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + 1.2rem + env(safe-area-inset-bottom, 0px));
}

body.reader-route .app-shell {
  height: 100dvh;
  overflow: hidden;
}

.app-main {
  min-height: 100vh;
}

body.reader-route .app-main {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

.screen {
  width: min(100%, var(--shell-w));
  margin: 0 auto;
  padding: 1.1rem 1rem 1rem;
}

.screen.screen-centered {
  min-height: calc(100dvh - var(--nav-h) - 2rem);
  display: grid;
  align-items: center;
}

.screen-stack {
  width: 100%;
  display: grid;
  gap: 1rem;
}

.reader-screen {
  width: min(100%, var(--device-w));
  padding: 0;
  height: calc(100dvh - var(--nav-h) - 1.3rem);
  overflow: hidden;
}

.hero-card,
.panel,
.chapter-card,
.saved-card {
  background: linear-gradient(180deg, rgba(12, 16, 24, 0.9), rgba(5, 8, 14, 0.96));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-card {
  min-height: calc(100dvh - var(--nav-h) - 2rem);
  display: grid;
  align-items: end;
  background-size: cover;
  background-position: center;
  position: relative;
  max-height: 860px;
}

.hero-card.home-card {
  min-height: 0;
  max-height: none;
}

.hero-card::before,
.reader-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.18) 0%, rgba(3, 5, 8, 0.62) 40%, rgba(2, 3, 5, 0.94) 100%),
    linear-gradient(90deg, rgba(255, 137, 41, 0.14), transparent 44%, rgba(0, 0, 0, 0.3) 100%);
}

.hero-copy,
.reader-copy {
  position: relative;
  z-index: 1;
  padding: 1.3rem;
}

.hero-copy {
  max-width: min(100%, 25rem);
}

.brand-header {
  display: flex;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.brand-link {
  width: min(100%, 560px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.2rem;
  background: #ffffff;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.brand-link img {
  display: block;
  height: 30px;
  width: auto;
}

.eyebrow,
.meta-label,
.dialog-kicker {
  margin: 0 0 0.55rem;
  color: var(--accent);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-family: var(--sans);
  font-size: 0.78rem;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--sans);
  line-height: 0.95;
  text-wrap: balance;
}

.hero-title {
  font-size: clamp(2.7rem, 11vw, 5.6rem);
  max-width: 9ch;
}

.hero-subtitle,
.hero-hook,
.hero-copy p,
.chapter-card p,
.saved-card p,
.note-context,
.empty-state p {
  color: var(--muted);
  line-height: 1.55;
}

.hero-subtitle {
  font-size: 1rem;
  max-width: 20ch;
  margin-top: 0.85rem;
}

.hero-hook {
  font-size: 1.34rem;
  color: var(--text);
  max-width: 15ch;
  margin: 1.15rem 0 0.9rem;
}

.resume-meta {
  margin: 0 0 1rem;
  font-family: var(--sans);
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  color: var(--soft);
}

.button-row,
.saved-actions,
.reader-actions,
.note-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.button,
.note-actions button,
.saved-actions button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.82rem 1.1rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.button:hover,
.note-actions button:hover,
.saved-actions button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.08);
}

.button.primary,
.note-actions .primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #130d06;
  border-color: transparent;
  font-weight: 700;
}

.danger {
  color: #ffd5d5;
  border-color: rgba(255, 107, 107, 0.45);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head h1 {
  font-size: clamp(2rem, 8vw, 3.1rem);
}

.section-head p {
  max-width: 34ch;
  margin: 0;
  color: var(--muted);
}

.chapter-grid,
.saved-grid {
  display: grid;
  gap: 1rem;
}

.chapter-card {
  display: grid;
}

.chapter-cover {
  aspect-ratio: 16 / 10;
  background-size: cover;
  background-position: center;
  position: relative;
}

.chapter-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(3, 5, 8, 0.82));
}

.chapter-body,
.saved-body {
  padding: 1rem;
}

.chapter-body h2,
.saved-body h2 {
  font-size: 1.55rem;
  margin-bottom: 0.55rem;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin: 0.8rem 0 1rem;
  font-family: var(--sans);
  color: var(--soft);
}

.progress-bar {
  flex: 1;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}

.reader-stage {
  height: 100%;
  display: flex;
  align-items: stretch;
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
  max-height: 900px;
}

.reader-copy {
  width: 100%;
  height: 100%;
  padding: 1rem;
  overflow: hidden;
}

.reader-frame {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 1rem;
}

.reader-header,
.reader-footer {
  position: relative;
  z-index: 1;
}

.reader-header {
  display: grid;
  gap: 0.7rem;
  padding: 0.15rem;
}

.reader-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--sans);
  color: var(--muted);
  letter-spacing: 0.08em;
  gap: 1rem;
}

.reader-chapter {
  font-size: clamp(1.35rem, 4vw, 2rem);
  max-width: 14ch;
  color: var(--text);
}

.reader-progress {
  font-size: 0.95rem;
  color: var(--soft);
}

.reader-progress-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.reader-main {
  position: relative;
  z-index: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reader-fit-area {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.1rem 0;
  overflow: hidden;
}

.reader-text-panel {
  width: min(100%, 34rem);
  height: min(100%, clamp(22rem, 62vh, 38rem));
  padding: 1.3rem 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: calc(var(--radius) - 4px);
  background:
    linear-gradient(180deg, rgba(3, 5, 9, 0.62), rgba(6, 10, 16, 0.71)),
    radial-gradient(circle at top, rgba(255, 184, 77, 0.08), transparent 42%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.reader-text-body {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.reader-text {
  font-size: var(--reader-font-size, 2rem);
  line-height: 1.24;
  text-wrap: balance;
  margin: 0;
  width: 100%;
  max-width: 20ch;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

.reader-footer {
  display: grid;
  gap: 0.38rem;
  justify-items: center;
  padding: 0;
}

.reader-actions {
  justify-content: center;
  gap: 0.5rem;
}

.reader-autoplay-progress {
  width: min(100%, 34rem);
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  opacity: 0;
  transition: opacity 120ms ease;
}

.reader-autoplay-progress.active {
  opacity: 1;
}

.reader-autoplay-fill {
  width: 100%;
  height: 100%;
  transform: scaleX(1);
  transform-origin: left center;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}

.icon-button {
  width: 2.1rem;
  height: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10, 14, 22, 0.72);
  color: var(--text);
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease;
  padding: 0;
  backdrop-filter: blur(18px);
}

.icon-button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.08);
}

.icon-button.active {
  background: rgba(255, 184, 77, 0.14);
  border-color: rgba(255, 184, 77, 0.4);
  color: var(--accent);
}

.reader-icon {
  font-family: "Material Symbols Rounded";
  font-weight: normal;
  font-style: normal;
  font-size: 0.98rem;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-variation-settings: "FILL" 0, "wght" 450, "GRAD" 0, "opsz" 24;
}

.icon-button.active .reader-icon {
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24;
}

.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;
}

.saved-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
}

.saved-thumb {
  min-height: 100%;
  background-size: cover;
  background-position: center;
}

.saved-meta {
  margin-bottom: 0.65rem;
  color: var(--soft);
  font-family: var(--sans);
  font-size: 0.9rem;
}

.saved-snippet {
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 0.8rem;
}

.empty-state {
  padding: 1.2rem;
  text-align: center;
}

.empty-state h2 {
  margin-bottom: 0.5rem;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(0.65rem, env(safe-area-inset-bottom, 0px));
  width: min(calc(100% - 1rem), 620px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
  padding: 0.8rem 0.9rem;
  backdrop-filter: blur(24px);
  background: linear-gradient(180deg, rgba(5, 8, 12, 0.5), rgba(5, 8, 12, 0.94));
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 24px;
  z-index: 12;
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.35);
}

.bottom-nav a {
  text-align: center;
  padding: 0.78rem 0.3rem;
  border-radius: 18px;
  border: 1px solid transparent;
  font-family: var(--sans);
  color: var(--soft);
}

.bottom-nav a.active {
  color: var(--text);
  border-color: rgba(255, 184, 77, 0.28);
  background: rgba(255, 184, 77, 0.08);
}

.note-dialog {
  width: min(92vw, 560px);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 0;
  background: rgba(8, 11, 16, 0.96);
  color: var(--text);
  box-shadow: var(--shadow);
}

.note-dialog::backdrop {
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(6px);
}

.note-form {
  padding: 1.15rem;
}

.note-form h2 {
  font-size: 1.65rem;
  margin-bottom: 0.5rem;
}

.note-context {
  margin-bottom: 0.8rem;
  font-size: 0.96rem;
}

#note-input {
  width: 100%;
  min-height: 180px;
  border-radius: 20px;
  padding: 1rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  resize: vertical;
}

@media (min-width: 760px) {
  .screen {
    padding: 1.3rem 1.35rem 1.2rem;
  }

  .screen.screen-centered {
    min-height: calc(100dvh - var(--nav-h) - 2.8rem);
  }

  .reader-screen {
    padding: 0.3rem 0 0.5rem;
    height: min(calc(100dvh - var(--nav-h) - 2.6rem), 860px);
  }

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

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

  .hero-card {
    min-height: min(calc(100dvh - var(--nav-h) - 2.8rem), 820px);
  }

  .hero-card.home-card {
    min-height: 0;
  }

  .hero-copy,
  .reader-copy {
    padding: 1.5rem;
  }

  .reader-copy {
    padding: 1.35rem;
  }

  .reader-frame {
    gap: 1.2rem;
  }

  .reader-text-panel {
    max-width: 38rem;
    padding: 1.65rem 1.5rem;
    height: min(100%, clamp(24rem, 60vh, 42rem));
  }

  .reader-text {
    max-width: 23ch;
  }

  .saved-card {
    grid-template-columns: 132px minmax(0, 1fr);
  }

  .brand-link {
    width: min(100%, 620px);
  }
}

@media (max-width: 420px) {
  .hero-copy,
  .reader-copy {
    padding: 0.95rem;
  }

  .reader-text-panel {
    padding: 1.05rem 0.95rem;
    height: min(100%, clamp(19rem, 58vh, 34rem));
  }
}

body.reader-route.reader-compact .reader-screen {
  height: calc(100dvh - 4.7rem);
}

body.reader-route.reader-compact .bottom-nav {
  width: min(calc(100% - 0.75rem), 540px);
  gap: 0.35rem;
  padding: 0.45rem 0.6rem;
  bottom: max(0.3rem, env(safe-area-inset-bottom, 0px));
}

body.reader-route.reader-compact .bottom-nav a {
  padding: 0.46rem 0.2rem;
  font-size: 0.82rem;
}

body.reader-route.reader-compact .reader-copy {
  padding: 0.65rem;
}

body.reader-route.reader-compact .reader-frame {
  gap: 0.4rem;
}

body.reader-route.reader-compact .reader-header {
  gap: 0.3rem;
}

body.reader-route.reader-compact .reader-chapter {
  font-size: clamp(1rem, 3vw, 1.25rem);
}

body.reader-route.reader-compact .reader-progress {
  font-size: 0.78rem;
}

body.reader-route.reader-compact .reader-text-panel {
  height: 100%;
  padding: 0.8rem 0.9rem;
}

body.reader-route.reader-compact .reader-footer {
  gap: 0.18rem;
}

body.reader-route.reader-compact .icon-button {
  width: 1.81rem;
  height: 1.81rem;
}

body.reader-route.reader-compact .reader-icon {
  font-size: 0.85rem;
}
