:root {
  --bg: #FAF6F0;
  --bg-elevated: #FFFDF9;
  --bg-sealed: #F3ECE2;
  --ink: #241C19;
  --ink-muted: #6C5E57;
  --burgundy: #6B1D2F;
  --burgundy-soft: rgba(107, 29, 47, 0.08);
  --gold: #C5A059;
  --gold-soft: rgba(197, 160, 89, 0.16);
  --border: rgba(36, 28, 25, 0.1);
  --shadow: 0 12px 30px rgba(45, 25, 18, 0.07);
  --radius-lg: 22px;
  --radius-md: 14px;
  --font-serif: "Cormorant Garamond", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-image:
    radial-gradient(circle at 12% 0%, rgba(197, 160, 89, 0.14), transparent 42%),
    radial-gradient(circle at 90% 10%, rgba(107, 29, 47, 0.08), transparent 36%);
  min-height: 100dvh;
}

.editorial-shell {
  max-width: 560px;
  margin: 0 auto;
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
}

/* Header */
.hero-header {
  padding: calc(20px + env(safe-area-inset-top)) 20px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 253, 249, 0.92), rgba(250, 246, 240, 0.85));
  backdrop-filter: blur(10px);
}

.hero-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.edition-pill {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--burgundy);
  background: var(--burgundy-soft);
  padding: 5px 10px;
  border-radius: 999px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-muted);
}

.live-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2E8B57;
  box-shadow: 0 0 0 3px rgba(46, 139, 87, 0.18);
}

.live-pill.offline .dot {
  background: #B45309;
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.18);
}

.hero-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(32px, 8vw, 40px);
  line-height: 1.05;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.hero-subtitle {
  margin: 6px 0 16px;
  font-size: 14px;
  color: var(--ink-muted);
}

.progress-wrap {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 13px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
  margin-bottom: 7px;
}

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(36, 28, 25, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--burgundy), var(--gold));
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Main Content */
.main-content {
  padding: 18px 16px 24px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.chapters-feed {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Sealed Card */
.chapter-sealed {
  position: relative;
  background: var(--bg-sealed);
  border: 1px dashed rgba(107, 29, 47, 0.25);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.25s ease;
}

.wax-seal {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #8E2940, var(--burgundy) 68%, #4C1220);
  box-shadow: 0 6px 14px rgba(107, 29, 47, 0.28), inset 0 1px 2px rgba(255, 255, 255, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #F6E6C6;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 20px;
  font-weight: 600;
}

.sealed-body {
  min-width: 0;
}

.sealed-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.teaser-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--burgundy);
}

.sealed-lock-pill {
  font-size: 11px;
  color: var(--ink-muted);
  background: rgba(255, 255, 255, 0.65);
  padding: 2px 8px;
  border-radius: 999px;
}

.sealed-title {
  margin: 0 0 4px;
  font-family: var(--font-serif);
  font-size: 23px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.15;
}

.sealed-hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-muted);
}

/* Revealed Card */
.chapter-open {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.chapter-open.just-revealed {
  animation: unsealPop 0.75s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 0 2px var(--gold), 0 18px 40px rgba(107, 29, 47, 0.16);
}

@keyframes unsealPop {
  0% { opacity: 0.2; transform: translateY(14px) scale(0.97); }
  55% { opacity: 1; transform: translateY(-2px) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.place-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #E8DFD3;
  overflow: hidden;
}

.place-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.place-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20, 14, 12, 0.05) 35%, rgba(20, 14, 12, 0.56) 100%);
}

.place-overlay {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.chapter-kicker {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #FCEFD5;
  background: rgba(107, 29, 47, 0.82);
  padding: 4px 10px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

.done-chip {
  font-size: 11px;
  font-weight: 600;
  color: #1A3A28;
  background: rgba(236, 253, 245, 0.92);
  padding: 4px 10px;
  border-radius: 999px;
}

.chapter-content {
  padding: 18px 18px 20px;
}

.chapter-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 28px;
  line-height: 1.1;
  font-weight: 600;
  color: var(--ink);
}

.chapter-subtitle {
  margin: 5px 0 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--burgundy);
}

.chapter-desc {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.58;
  color: #362C27;
}

.place-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.map-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
}

/* Instax Wide Polaroid Block */
.instax-box {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.instax-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.instax-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--burgundy);
  background: var(--gold-soft);
  padding: 4px 9px;
  border-radius: 999px;
}

.instax-title {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 600;
}

.instax-tips-list {
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.instax-tips-list li {
  font-size: 13px;
  line-height: 1.48;
  color: var(--ink-muted);
  background: var(--bg);
  border-left: 2px solid var(--gold);
  padding: 6px 10px;
  border-radius: 0 8px 8px 0;
}

.instax-tips-list li strong {
  color: var(--ink);
  font-weight: 600;
}

/* Authentic Instax Wide Frame (99x62 mm film ratio) */
.polaroid-wide {
  background: #FFFFFF;
  border: 1px solid rgba(36, 28, 25, 0.12);
  border-radius: 6px;
  padding: 10px 10px 18px;
  box-shadow: 0 10px 24px rgba(36, 28, 25, 0.1);
  margin-bottom: 12px;
}

.polaroid-wide-photo {
  width: 100%;
  aspect-ratio: 99 / 62;
  background: #EFE9E0;
  overflow: hidden;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.polaroid-wide-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.polaroid-empty {
  text-align: center;
  padding: 16px;
  color: var(--ink-muted);
  font-size: 13px;
}

.polaroid-caption {
  margin-top: 10px;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 17px;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.instax-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.upload-label {
  flex: 1 1 180px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--burgundy);
  color: #FFFDF9;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
}

.upload-label input {
  display: none;
}

.print-toggle-btn {
  flex: 1 1 150px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
}

.print-toggle-btn.is-printed {
  background: #ECFDF5;
  border-color: #A7F3D0;
  color: #065F46;
}

/* Album Tab */
.album-intro {
  margin-bottom: 16px;
}

.album-intro h2 {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 30px;
}

.album-intro p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-muted);
}

.album-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.album-locked-card {
  background: var(--bg-sealed);
  border: 1px dashed rgba(107, 29, 47, 0.25);
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 14px;
  color: var(--ink-muted);
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 253, 249, 0.94);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.nav-btn {
  flex: 1;
  max-width: 240px;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 12px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.nav-btn svg {
  width: 22px;
  height: 22px;
}

.nav-btn.active {
  color: var(--burgundy);
  background: var(--burgundy-soft);
  font-weight: 600;
}

.nav-badge {
  font-style: normal;
  font-size: 11px;
  opacity: 0.85;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(82px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(16px);
  opacity: 0;
  pointer-events: none;
  background: var(--ink);
  color: #FFFDF9;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  transition: all 0.25s ease;
  z-index: 60;
  max-width: 90vw;
  text-align: center;
}

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