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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: #050e1c;
  color: var(--text-light);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}

.sky-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 78% 12%, rgba(255, 243, 200, 0.14), transparent 36%),
    radial-gradient(circle at 22% 18%, rgba(84, 134, 194, 0.16), transparent 44%),
    linear-gradient(180deg, #050e1c 0%, #0d1d35 55%, #15263a 100%);
  pointer-events: none;
}

.snow-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 12;
  pointer-events: none;
}

:root {
  --mobile-shell-width: 420px;
  --app-vh: 100dvh;
}

.app-shell {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--mobile-shell-width);
  min-height: var(--app-vh);
  margin: 0 auto;
  padding: 0;
  background: linear-gradient(180deg, #050e1c 0%, #050e1c 22%, #11243d 65%, #15263a 84%, #15263a 100%);
  display: flex;
  flex-direction: column;
}

@media (min-width: 460px) {
  .app-shell {
    border-inline: 1px solid rgba(244, 198, 104, 0.12);
    box-shadow: 0 0 80px rgba(2, 6, 15, 0.88);
  }
}

/* Floating Transparent Header Overlay */
.top-hud {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, var(--mobile-shell-width));
  z-index: 26;
  padding: calc(10px + env(safe-area-inset-top)) 12px 20px;
  background: linear-gradient(
    180deg,
    rgba(5, 14, 28, 0.86) 0%,
    rgba(5, 14, 28, 0.44) 64%,
    rgba(5, 14, 28, 0) 100%
  );
  pointer-events: none;
}

.hud-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.brand-block {
  min-width: 0;
  flex: 1;
  pointer-events: auto;
}

.brand-kicker {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  line-height: 1.2;
  text-shadow: 0 1px 8px rgba(3, 8, 18, 0.85);
}

.brand-title {
  margin: 2px 0 0;
  font-family: var(--font-sans);
  font-size: clamp(0.88rem, 3.7vw, 0.96rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: var(--snow-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 2px 12px rgba(3, 8, 18, 0.9);
}

.hud-quick-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  pointer-events: auto;
}

.btn-hud-pill,
.btn-hud-icon {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(44, 62, 88, 0.56);
  color: var(--text-light);
  font-family: var(--font-sans);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 14px rgba(2, 6, 15, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, opacity 0.18s ease, transform 0.14s ease;
}

.btn-hud-pill {
  border-radius: 999px;
  padding: 0 9px;
  height: 30px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.btn-hud-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

#toggle-snow-btn[aria-pressed="true"] {
  color: #e2effd;
  border-color: rgba(210, 232, 255, 0.44);
}

#toggle-snow-btn[aria-pressed="false"] {
  color: var(--text-light-muted);
  opacity: 0.72;
}

.btn-hud-pill:hover,
.btn-hud-icon:hover {
  background: rgba(22, 43, 72, 0.88);
  border-color: rgba(255, 229, 158, 0.6);
}

.btn-hud-pill:active,
.btn-hud-icon:active {
  transform: scale(0.96);
}

.btn-hud-pill:focus-visible,
.btn-hud-icon:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

/* Header Utility Menu Popover */
.hud-utility-menu {
  position: absolute;
  top: calc(100% - 8px);
  right: 12px;
  left: 12px;
  z-index: 35;
  padding: 12px;
  border-radius: 16px;
  background: rgba(10, 21, 39, 0.96);
  border: 1px solid rgba(244, 198, 104, 0.34);
  box-shadow: 0 22px 48px rgba(2, 6, 15, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
}

.hud-utility-menu[hidden] {
  display: none;
}

.utility-menu-legend {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  font-size: 0.78rem;
  color: var(--text-light-muted);
}

.utility-menu-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-utility {
  appearance: none;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 11px;
  border: 1px solid rgba(244, 198, 104, 0.28);
  background: rgba(21, 41, 68, 0.9);
  color: var(--text-light);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.btn-utility-finale {
  grid-column: 1 / -1;
  background: rgba(244, 198, 104, 0.14);
  border-color: rgba(244, 198, 104, 0.45);
  color: var(--gold-bright);
}

.btn-utility-reset {
  border-color: rgba(230, 140, 140, 0.28);
  background: rgba(74, 24, 32, 0.45);
  color: #f6c7c7;
}

/* Full-Bleed Background House Stage */
.stage-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0 0 env(safe-area-inset-bottom);
}

.facade-stage {
  width: 100%;
  display: block;
}

.building-mount {
  position: relative;
  width: 100%;
  aspect-ratio: 660 / 2040;
  overflow: hidden;
  background: transparent;
}

.building-mount::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.42s ease;
  background: radial-gradient(
    circle at 50% 42%,
    rgba(6, 15, 30, 0) 24%,
    rgba(5, 11, 24, 0.36) 68%,
    rgba(3, 8, 18, 0.62) 100%
  );
}

.building-mount--zoomed::after {
  opacity: 1;
}

.building-camera {
  position: relative;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  transform: translate(0%, 0%) scale(1);
  transition: transform 0.72s cubic-bezier(0.22, 1, 0.36, 1);
}

.building-mount--zoomed .building-camera {
  will-change: transform;
}

.building-camera--instant {
  transition: none !important;
}

.facade-svg {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
}

.windows-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Interactive Window Button — big unified arched windows */
.advent-window {
  position: absolute;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  border-radius: 50% 50% 0 0 / var(--arch-v, 40%) var(--arch-v, 40%) 0 0;
}

.advent-window:focus-visible {
  outline: 3px solid var(--gold-bright);
  outline-offset: 4px;
}

.window-frame {
  display: block;
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
  background: #0e1b2c;
}

/* Recess shadow: the glass sits deep inside the stone */
.window-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    inset 0 9px 14px rgba(10, 5, 2, 0.5),
    inset 6px 0 10px rgba(10, 5, 2, 0.22),
    inset -6px 0 10px rgba(10, 5, 2, 0.22);
}

/* Soft GPU-composited hover warmth & next-window pulse inside window glass */
.window-hover-veil {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    ellipse at 50% 48%,
    rgba(255, 232, 178, 0.26) 0%,
    rgba(244, 198, 104, 0.12) 65%,
    rgba(244, 198, 104, 0.04) 100%
  );
  transition: opacity 0.22s ease;
}

.window-next-halo {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 50% 45%,
    rgba(255, 226, 154, 0.44) 0%,
    rgba(244, 198, 104, 0.16) 62%,
    rgba(244, 198, 104, 0.04) 100%
  );
  box-shadow: inset 0 0 16px rgba(255, 214, 132, 0.5);
}

.advent-window--next .window-next-halo {
  display: block;
  animation: next-window-pulse 2.8s ease-in-out infinite;
}

@keyframes next-window-pulse {
  0%,
  100% {
    opacity: 0.26;
  }
  50% {
    opacity: 0.92;
  }
}

@media (hover: hover) and (pointer: fine) {
  .advent-window:hover .window-hover-veil {
    opacity: 1;
  }

  .advent-window--dim:hover .window-scene-layer {
    filter: brightness(1.12);
    transform: scale(1.025);
  }

  .advent-window:hover .window-number {
    transform: translateX(-50%) scale(1.08);
    box-shadow: inset 0 0 0 1.3px rgba(255, 224, 158, 0.96), 0 3px 8px rgba(16, 6, 6, 0.58);
  }
}

.advent-window--lit .window-frame {
  box-shadow: 0 0 18px rgba(255, 196, 100, 0.55), 0 0 42px rgba(245, 158, 54, 0.28);
}

.advent-window--focused .window-frame {
  box-shadow: 0 0 26px rgba(244, 198, 104, 0.56);
}

.advent-window--just-lit .window-frame,
.advent-window--igniting .window-frame {
  animation: window-ignite 1.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes window-ignite {
  0% {
    filter: brightness(0.82) saturate(0.45);
  }
  28% {
    filter: brightness(1.6) saturate(1.15);
    box-shadow: 0 0 42px rgba(255, 236, 162, 0.98), 0 0 86px rgba(245, 164, 54, 0.88);
  }
  65% {
    filter: brightness(1.22);
  }
  100% {
    filter: brightness(1) saturate(1);
  }
}

.window-scene-layer {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 0;
  transition: opacity 0.5s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.advent-window--dim.advent-window--focused .window-scene-layer {
  filter: brightness(1.12);
}

.advent-window--just-lit .window-scene-layer,
.advent-window--igniting .window-scene-layer {
  animation: scene-bloom 1.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes scene-bloom {
  0% {
    opacity: 0.72;
    filter: saturate(0.3) brightness(0.68);
    transform: scale(0.97);
  }
  40% {
    opacity: 1;
    filter: saturate(1.18) brightness(1.28);
    transform: scale(1.02);
  }
  100% {
    opacity: 1;
    filter: saturate(1) brightness(1);
    transform: scale(1);
  }
}

.window-scene-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.window-scene-svg--shadow .fig-rim {
  stroke: none;
}

.advent-window--dim .window-scene-svg * {
  animation: none !important;
}

/* Unified arched mullions & exterior ornament overlays (facade 1 < glass 2 < mullions 3 < exteriors 4 < medallions 5 < vignette 6) */
.mullions-overlay-svg,
.exteriors-overlay-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.mullions-overlay-svg {
  z-index: 3;
}

.exteriors-overlay-svg {
  z-index: 4;
}

/* Day number medallion */
.window-number {
  position: absolute;
  left: 50%;
  bottom: -10.5px;
  transform: translateX(-50%);
  z-index: 5;
  width: 21px;
  height: 21px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1;
  color: #fff3dc;
  background: radial-gradient(circle at 38% 32%, #682332 0%, #41121d 100%);
  border: 1px solid #350d16;
  box-shadow: inset 0 0 0 1.1px rgba(226, 190, 132, 0.85), 0 2px 5px rgba(16, 6, 6, 0.5);
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.3s ease, color 0.3s ease;
}

.advent-window--lit .window-number {
  background: radial-gradient(circle at 38% 32%, #8b2b39 0%, #561620 100%);
  color: #fff6df;
}

.advent-window--locked .window-number {
  opacity: 0.72;
  background: radial-gradient(circle at 38% 32%, #243752 0%, #152236 100%);
  border-color: #111b2c;
  color: #cdd9ea;
}


/* Window interior animations */
.anim-steam {
  animation: steam-rise 3.2s ease-in-out infinite;
  transform-origin: center bottom;
}

.anim-steam-delay {
  animation: steam-rise 3.2s ease-in-out 1.2s infinite;
  transform-origin: center bottom;
}

@keyframes steam-rise {
  0% {
    opacity: 0.25;
    transform: translateY(2px) scaleY(0.85);
  }
  50% {
    opacity: 0.85;
    transform: translateY(-4px) scaleY(1.08);
  }
  100% {
    opacity: 0.2;
    transform: translateY(-8px) scaleY(0.9);
  }
}

.anim-ball-roll {
  animation: ball-roll 2.6s ease-in-out infinite;
}

@keyframes ball-roll {
  0%,
  100% {
    transform: translateX(0px);
  }
  50% {
    transform: translateX(9px);
  }
}

.anim-sway {
  animation: gentle-sway 2.8s ease-in-out infinite;
  transform-origin: 50% 80%;
}

@keyframes gentle-sway {
  0%,
  100% {
    transform: rotate(-3deg);
  }
  50% {
    transform: rotate(4deg);
  }
}

.anim-flicker {
  animation: candle-flicker 1.9s ease-in-out infinite;
  transform-origin: center bottom;
}

@keyframes candle-flicker {
  0%,
  100% {
    opacity: 0.95;
    transform: scale(1);
  }
  45% {
    opacity: 0.72;
    transform: scale(0.92, 1.06);
  }
  75% {
    opacity: 1;
    transform: scale(1.06, 0.96);
  }
}

.anim-twinkle {
  animation: star-twinkle 2.2s ease-in-out infinite;
}

.anim-sleigh-soar {
  animation: sleigh-soar 5.6s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.anim-reindeer-leap {
  animation: reindeer-leap 1.25s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.anim-reindeer-leap-alt {
  animation: reindeer-leap 1.25s ease-in-out 0.42s infinite;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes sleigh-soar {
  0%, 100% {
    transform: translateY(0px) rotate(-1.4deg);
  }
  50% {
    transform: translateY(-7px) rotate(1.2deg);
  }
}

@keyframes reindeer-leap {
  0%, 100% {
    transform: translateY(0px) rotate(-2deg);
  }
  50% {
    transform: translateY(-4.5px) rotate(2.6deg);
  }
}

.anim-twinkle-alt {
  animation: star-twinkle 2.2s ease-in-out 1.1s infinite;
}

@keyframes star-twinkle {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.42;
  }
}

/* Compact legend strip below building */
.legend-strip {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 11px 13px;
  border-radius: 14px;
  background: rgba(11, 24, 43, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.09);
  font-size: 0.77rem;
  line-height: 1.35;
  color: var(--text-light-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.legend-swatch {
  width: 14px;
  height: 18px;
  border-radius: 4px 4px 2px 2px;
  display: inline-block;
  flex-shrink: 0;
}

.legend-swatch-dim {
  background: linear-gradient(180deg, var(--glass-dim-top), var(--glass-dim-bottom));
  border: 1.5px solid #537896;
}

.legend-swatch-lit {
  background: radial-gradient(circle, var(--glass-lit-center), var(--glass-lit-mid));
  border: 1.5px solid var(--gold);
  box-shadow: 0 0 10px rgba(245, 182, 74, 0.75);
}

/* Modal / Reflection Postcard — Mobile Bottom Sheet */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 48;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(5, 11, 22, 0.74);
  backdrop-filter: blur(8px);
}

.modal-overlay[hidden] {
  display: none;
}

.postcard-modal {
  position: relative;
  width: min(100%, var(--mobile-shell-width));
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--paper-bg);
  color: var(--ink-dark);
  border-radius: 22px 22px 0 0;
  border: 2px solid var(--paper-border);
  border-bottom: none;
  box-shadow: var(--shadow-card);
  padding: 20px 16px calc(22px + env(safe-area-inset-bottom));
  animation: modal-pop 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.postcard-modal::before {
  content: "";
  display: block;
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: rgba(93, 85, 68, 0.26);
  margin: -6px auto 12px;
}

.journal-modal {
  width: min(100%, var(--mobile-shell-width));
}

@keyframes modal-pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.day-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.badge-date {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--spruce);
  color: #f6f2e4;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-archetype {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(124, 31, 40, 0.92);
  border: 1px solid rgba(244, 198, 104, 0.38);
  color: #fcf3e3;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
}

.badge-status--dim {
  background: #e7dec8;
  color: #5d5544;
}

.badge-status--lit {
  background: #fde5a7;
  color: #7c450d;
}

.modal-close-btn {
  appearance: none;
  border: 1px solid var(--paper-border);
  background: var(--paper-surface);
  color: var(--ink-dark);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.modal-close-btn:hover {
  background: #eadcc0;
}

.modal-theme {
  margin: 0 0 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--crimson);
  letter-spacing: 0.03em;
}

.modal-question {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-size: clamp(1.18rem, 2.1vw, 1.48rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.32;
  color: var(--ink-dark);
}

.field-label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-dark);
}

.reflection-textarea {
  width: 100%;
  min-height: 120px;
  padding: 13px 15px;
  border-radius: var(--radius-md);
  border: 1.5px solid #ccb992;
  background: #fffdf7;
  color: var(--ink-dark);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.55;
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.reflection-textarea:focus {
  outline: none;
  border-color: var(--spruce);
  box-shadow: 0 0 0 3px rgba(27, 77, 62, 0.16);
}

.field-error {
  margin: 6px 0 0;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--crimson);
}

.practice-box {
  margin-top: 18px;
  padding: 15px 17px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #f3e8ce 0%, #f8f0dc 100%);
  border: 1px solid #dcc89d;
  border-left: 4px solid var(--spruce);
}

.practice-kicker {
  display: block;
  margin-bottom: 4px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--spruce);
}

.practice-text {
  margin: 0 0 11px;
  font-size: 0.93rem;
  color: var(--ink-dark);
}

.practice-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
}

.practice-check input {
  width: 17px;
  height: 17px;
  accent-color: var(--spruce);
}

.story-preview-note {
  margin-top: 14px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  background: rgba(244, 198, 104, 0.22);
  border: 1px dashed #cfa350;
  font-size: 0.84rem;
  color: #6a4212;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-footer {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-footer-right {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-left: auto;
}

.btn-paper-secondary {
  appearance: none;
  border: 1px solid #cab893;
  background: transparent;
  color: var(--ink-muted);
  border-radius: 999px;
  padding: 10px 18px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-paper-secondary:hover {
  background: #efe3c8;
  color: var(--ink-dark);
}

.btn-paper-submit {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 11px 24px;
  background: linear-gradient(135deg, var(--crimson) 0%, var(--crimson-deep) 100%);
  color: #fff9ef;
  font-family: var(--font-sans);
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(127, 29, 36, 0.28);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.btn-paper-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 11px 24px rgba(127, 29, 36, 0.36);
}

/* Journal Modal */
.journal-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.journal-entry {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: #fffdf7;
  border: 1px solid var(--paper-border);
}

.journal-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.journal-entry-date {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--spruce);
  text-transform: uppercase;
}

.journal-entry-q {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.35;
}

.journal-entry-a {
  margin: 0;
  font-size: 0.92rem;
  white-space: pre-wrap;
  color: var(--ink-dark);
}

.journal-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--ink-muted);
  background: var(--paper-surface);
  border-radius: var(--radius-md);
}

/* Floating Bottom Progress Pill */
.floating-progress-dock {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100vw - 92px), 284px);
  z-index: 28;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.floating-progress-dock.is-hidden {
  opacity: 0;
  transform: translate(-50%, 16px);
}

.progress-pill {
  width: 100%;
  padding: 10px 18px 12px;
  border-radius: 999px;
  background: rgba(78, 88, 108, 0.50);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 14px 36px rgba(2, 6, 15, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
}

.progress-pill-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 7px;
  font-size: 0.78rem;
}

.progress-label {
  color: rgba(244, 247, 252, 0.92);
}

.progress-value {
  font-weight: 700;
}

.progress-num {
  color: var(--gold-bright);
  font-weight: 700;
}

.progress-sep {
  color: rgba(228, 236, 248, 0.72);
  font-weight: 500;
}

.progress-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(12, 20, 34, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #9e242c 0%, #e06d2e 68%, #ffdf85 100%);
  box-shadow: 0 0 12px rgba(255, 200, 104, 0.75);
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Toast notification */
.toast {
  position: fixed;
  left: 50%;
  top: calc(70px + env(safe-area-inset-top));
  transform: translateX(-50%);
  z-index: 55;
  max-width: calc(min(100vw, var(--mobile-shell-width)) - 24px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(14, 30, 52, 0.95);
  color: var(--gold-bright);
  border: 1px solid rgba(244, 198, 104, 0.45);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.52);
  font-size: 0.84rem;
  font-weight: 600;
  text-align: center;
}

/* Two-step peek dock when zooming into a window */
.window-peek-dock {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 44;
  width: min(calc(100vw - 18px), calc(var(--mobile-shell-width) - 16px));
}

.window-peek-dock[hidden] {
  display: none;
}

.peek-dock-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 13px;
  border-radius: 18px;
  background: rgba(10, 21, 40, 0.95);
  border: 1px solid rgba(244, 198, 104, 0.36);
  box-shadow: 0 20px 50px rgba(2, 6, 15, 0.78), inset 0 1px 0 rgba(255, 240, 196, 0.14);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: peek-rise 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes peek-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.peek-dock-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.peek-dock-day {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(244, 198, 104, 0.16);
  color: var(--gold-bright);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.peek-dock-archetype {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(139, 38, 49, 0.35);
  border: 1px solid rgba(244, 198, 104, 0.22);
  color: #fce8d8;
  font-size: 0.74rem;
  font-weight: 600;
}

.peek-dock-title {
  margin: 0;
  color: #f9f2e4;
  font-family: var(--font-display, Georgia, serif);
  font-size: 1rem;
  line-height: 1.25;
}

.peek-dock-caption {
  margin: 0;
  color: rgba(218, 230, 244, 0.84);
  font-size: 0.82rem;
  line-height: 1.38;
}

.peek-dock-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.peek-open-btn {
  flex: 1;
  min-height: 44px;
  padding: 10px 11px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #f3c463 0%, #e09b3d 100%);
  color: #1f1406;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 8px 20px rgba(224, 155, 61, 0.34);
}

.peek-open-btn:disabled {
  opacity: 0.78;
  cursor: default;
}

.peek-open-btn:active:not(:disabled) {
  transform: scale(0.985);
}

.peek-close-btn {
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(190, 214, 242, 0.26);
  background: rgba(255, 255, 255, 0.06);
  color: #e6eef8;
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}

/* Auth / Checkout / Device limit UI inside postcard modal */
.auth-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.auth-tab {
  flex: 1;
  min-height: 38px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid #d4c39d;
  background: #f2e8d2;
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.auth-tab.is-active {
  background: var(--spruce);
  border-color: var(--spruce);
  color: #fbf7ed;
}

.auth-subtext {
  margin: 0 0 14px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink-muted);
}

.auth-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border-radius: var(--radius-md);
  border: 1.5px solid #ccb992;
  background: #fffdf7;
  color: var(--ink-dark);
  font-family: var(--font-sans);
  font-size: 1rem;
}

.auth-input:focus {
  outline: none;
  border-color: var(--spruce);
  box-shadow: 0 0 0 3px rgba(27, 77, 62, 0.16);
}

.auth-input-code {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.24em;
}

.auth-test-hint {
  margin-bottom: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  background: #fde9b2;
  border: 1px solid #d7a645;
  color: #5e3807;
  font-size: 0.84rem;
}

.auth-buy-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.device-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.device-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f5ebd5;
  border: 1px solid #d8c7a0;
}

.device-row-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.84rem;
  color: var(--ink-dark);
}

.device-row-meta small {
  color: var(--ink-muted);
  font-size: 0.74rem;
}

.gift-link-box {
  padding: 11px 12px;
  border-radius: 10px;
  background: #fffdf7;
  border: 1.5px dashed #b99756;
  color: var(--ink-dark);
  font-size: 0.82rem;
  word-break: break-all;
}

.modal-question {
  font-size: 1.12rem;
  margin-bottom: 14px;
}

.modal-footer {
  flex-direction: column-reverse;
  align-items: stretch;
}

.modal-footer-right {
  margin-left: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-paper-secondary,
.btn-paper-submit {
  min-height: 44px;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}