/* ==========================================================================
   FOR VIKEN — 20TH BIRTHDAY (FROM JENA)
   Design Language: Minimal, intimate, clean, neutral-toned, mobile-first
   ========================================================================== */

:root {
  --bg-color: #F5F4F0;
  --text-primary: #20211F;
  --text-secondary: #777872;
  --accent-muted: #65727A;
  --accent-dark: #3F4A50;
  --border-color: #D8D6D0;
  --card-bg: #FFFFFF;
  --card-bg-subtle: #FAFAF8;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --transition-fast: 0.2s ease;
  --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-subtle: 0 4px 20px -2px rgba(32, 33, 31, 0.04);
  --shadow-card: 0 6px 24px -4px rgba(32, 33, 31, 0.06);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100%;
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 0;
}

/* App Container (Mobile centered view) */
.app-container {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--bg-color);
  padding: 24px 20px 20px 20px;
}

@media (min-width: 480px) {
  .app-container {
    min-height: 92vh;
    margin: 24px auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 28px 24px 24px 24px;
  }
}

/* Minimalist Small Music Toggle */
.music-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  height: 23px;
  background: rgba(245, 244, 240, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  opacity: 0.8;
}

.music-toggle:hover {
  opacity: 1;
  color: var(--text-primary);
  border-color: var(--accent-muted);
  background: rgba(255, 255, 255, 0.9);
}

.music-toggle.playing {
  opacity: 1;
  color: var(--text-primary);
  border-color: var(--accent-muted);
}

.music-bars {
  display: flex;
  align-items: flex-end;
  gap: 1.5px;
  height: 9px;
  width: 8px;
}

.m-bar {
  width: 1.5px;
  background-color: var(--accent-muted);
  border-radius: 1px;
  height: 2px;
  transition: height 0.2s ease, background-color 0.2s ease;
}

.music-toggle.playing .m-bar {
  background-color: var(--text-primary);
}

.music-toggle.playing .mb-1 {
  animation: microBar 0.8s ease-in-out infinite alternate;
}
.music-toggle.playing .mb-2 {
  animation: microBar 0.6s ease-in-out infinite alternate 0.15s;
}
.music-toggle.playing .mb-3 {
  animation: microBar 0.95s ease-in-out infinite alternate 0.3s;
}

@keyframes microBar {
  0% { height: 2px; }
  100% { height: 9px; }
}

/* Header & Progress Indicator */
.app-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity var(--transition-smooth), transform var(--transition-smooth);
}

.app-header.visible {
  opacity: 1;
  transform: translateY(0);
}

.step-indicator {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  text-transform: lowercase;
}

.progress-track {
  width: 100%;
  height: 2px;
  background-color: var(--border-color);
  border-radius: 1px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background-color: var(--accent-dark);
  border-radius: 1px;
  transition: width var(--transition-smooth);
}

/* Content Wrapper & Sections */
.content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 480px;
}

.section {
  display: none;
  flex-direction: column;
  flex: 1;
  width: 100%;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.section.active {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

.section-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
}

/* Typography styles */
.section-title {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  line-height: 1.35;
}

.section-desc {
  font-size: 0.92rem;
  color: var(--text-secondary);
  font-weight: 400;
  line-height: 1.55;
}

.section-hint {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: 0.02em;
  margin-top: 2px;
}

.section-header-compact {
  margin-bottom: 16px;
}

/* SCREEN 00: OPENING */
.opening-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 10px 60px 10px;
}

.opening-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--accent-muted);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 24px;
}

.opening-greeting {
  font-size: 2rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.opening-sub {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.opening-sender {
  font-size: 0.9rem;
  color: var(--accent-muted);
  font-weight: 400;
  margin-bottom: 44px;
}

.opening-action {
  margin-top: 8px;
}

/* Primary Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  border-radius: var(--radius-full);
}

.btn-primary {
  background-color: var(--text-primary);
  color: #FFFFFF;
  padding: 12px 28px;
}

.btn-primary:hover {
  background-color: var(--accent-dark);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Photo Frames */
.photo-frame {
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: #EAE8E2;
  border: 1px solid var(--border-color);
  position: relative;
}

.hero-frame {
  aspect-ratio: 4 / 4.8;
  margin-bottom: 20px;
}

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

.text-block {
  margin-bottom: 24px;
}

/* Navigation Controls [ back ] [ next ] */
.nav-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
  transition: var(--transition-fast);
}

.nav-btn:hover {
  color: var(--text-primary);
  background-color: rgba(0, 0, 0, 0.03);
}

.nav-btn.btn-next {
  color: var(--text-primary);
}

.nav-btn.btn-restart {
  color: var(--accent-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 8px 18px;
  background-color: #FFFFFF;
}

.nav-btn.btn-restart:hover {
  border-color: var(--accent-muted);
}

/* SCREEN 02: MEMORIES */
.memories-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}

.memory-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-subtle);
  transition: var(--transition-fast);
}

.memory-photo-wrap {
  aspect-ratio: 4 / 3.4;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  background-color: #EAE8E2;
}

.memory-img {
  transition: transform 0.4s ease, opacity 0.25s ease;
}

.memory-photo-wrap:hover .memory-img {
  transform: scale(1.02);
}

.photo-tap-hint {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(32, 33, 31, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #FFFFFF;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-weight: 400;
  pointer-events: none;
  letter-spacing: 0.02em;
}

.memory-caption-box {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  background-color: #FFFFFF;
}

.memory-caption {
  font-size: 0.88rem;
  color: var(--text-primary);
  font-weight: 400;
  letter-spacing: -0.01em;
  flex: 1;
  padding-right: 12px;
}

.memory-counter {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.memory-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}

.memory-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background-color: var(--border-color);
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  padding: 0;
}

.memory-dot.active {
  background-color: var(--accent-dark);
  width: 18px;
}

/* SCREEN 03: LITTLE THINGS */
.little-things-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.little-item {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: all var(--transition-smooth);
}

.little-item:hover {
  border-color: var(--accent-muted);
}

.little-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.little-item-title {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-primary);
}

.little-item-icon {
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  transition: transform var(--transition-fast);
}

.little-item.open .little-item-icon {
  transform: rotate(45deg);
  color: var(--accent-dark);
}

.little-item-content {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.3s ease, margin-top 0.3s ease;
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.little-item.open .little-item-content {
  max-height: 120px;
  opacity: 1;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-color);
  color: var(--accent-dark);
}

/* SCREEN 04: THE LETTER */
.letter-container {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px 20px;
  box-shadow: var(--shadow-subtle);
  margin-bottom: 20px;
  position: relative;
}

.letter-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.letter-greeting {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.letter-stamp {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 10px;
  color: var(--accent-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.letter-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.65;
  font-weight: 400;
}

.letter-body p {
  margin: 0;
}

.letter-footer {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-color);
}

.letter-sign-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.letter-sender-name {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* SCREEN 05: ENDING */
.ending-inner {
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 10px 0 20px 0;
}

.ending-frame {
  aspect-ratio: 4 / 4.2;
  width: 100%;
  max-width: 320px;
  margin: 0 auto 20px auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-subtle);
}

.ending-card {
  width: 100%;
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  box-shadow: var(--shadow-subtle);
  margin-bottom: 24px;
}

.ending-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-muted);
  border: 1px solid var(--border-color);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
}

.ending-title {
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.ending-divider {
  width: 36px;
  height: 1px;
  background-color: var(--border-color);
  margin: 0 auto 14px auto;
}

.ending-message {
  font-size: 0.94rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 16px;
}

.ending-signature {
  font-size: 0.92rem;
  color: var(--accent-dark);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.ending-actions {
  margin-top: 4px;
}
