/* ==========================================================================
   《煩惱的尺度》 Scale of a Worry — v2.0 Director's Cut
   Museum Editorial · 0.05mm Technical Pen · Architectural Drafting Instrument
   ========================================================================== */

:root {
  --bg-color: #f6f2e9;
  --ink-color: #1c2229;
  --ink-muted: rgba(28, 34, 41, 0.58);
  --ink-faint: rgba(28, 34, 41, 0.14);
  --accent-color: #c8553d;
  --panel-bg: rgba(246, 242, 233, 0.82);
  --panel-border: rgba(28, 34, 41, 0.18);
  --serif: "Songti TC", "Noto Serif TC", "Hiragino Mincho ProN", "PMingLiU", Georgia, serif;
  --sans: "PingFang TC", "Noto Sans TC", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, monospace;
}

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

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  color: var(--ink-color);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  touch-action: none;
}

#scene-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  cursor: crosshair;
}

#paper-grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

#vignette-overlay {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(circle at 50% 47%, transparent 45%, rgba(0, 0, 0, 0.16) 100%);
  opacity: 0.55;
}

/* Museum Viewport Drafting Frame */
.viewport-frame {
  position: fixed;
  inset: 10px;
  z-index: 4;
  border: 1px solid var(--ink-faint);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease, border-color 0.4s ease;
}

body.state-exploring .viewport-frame {
  opacity: 1;
}

.vf-cross {
  position: absolute;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  color: var(--ink-muted);
  opacity: 0.65;
}
.vf-cross.tl { top: -6px; left: -4px; }
.vf-cross.tr { top: -6px; right: -4px; }
.vf-cross.bl { bottom: -6px; left: -4px; }
.vf-cross.br { bottom: -6px; right: -4px; }

/* Minimal Center Measurement Reticle (Keeps Artwork Completely Unobstructed) */
.center-reticle {
  position: fixed;
  top: 47%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  z-index: 10;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.8s ease;
}
body.state-exploring .center-reticle {
  opacity: 1;
}

.reticle-ring {
  position: absolute;
  inset: 0;
  border: 1px solid var(--accent-color);
  border-radius: 50%;
  opacity: 0.62;
  animation: pulseRing 3.6s ease-in-out infinite;
}
.reticle-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-color);
  box-shadow: 0 0 10px var(--accent-color);
}
.reticle-hair {
  position: absolute;
  background: var(--accent-color);
  opacity: 0.35;
}
.reticle-hair.h { width: 46px; height: 1px; }
.reticle-hair.v { width: 1px; height: 46px; }

@keyframes pulseRing {
  0%, 100% { transform: scale(0.84); opacity: 0.42; }
  50% { transform: scale(1.22); opacity: 0.84; }
}

/* ==========================================================================
   INTRO SCREEN
   ========================================================================== */
.intro-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(246, 242, 233, 0.86);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.85s cubic-bezier(0.22, 1, 0.36, 1), transform 0.85s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.85s;
}

body.state-exploring .intro-screen {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
  visibility: hidden;
}

.intro-frame {
  position: relative;
  width: 100%;
  max-width: 640px;
  padding: 44px 44px 32px;
  background: rgba(251, 249, 243, 0.95);
  border: 1px solid rgba(28, 34, 41, 0.22);
  box-shadow: 0 28px 80px rgba(24, 30, 38, 0.11);
}

.drafting-corner {
  position: absolute;
  width: 15px;
  height: 15px;
  border-color: #1c2229;
  border-style: solid;
  pointer-events: none;
}
.drafting-corner.tl { top: -1px; left: -1px; border-width: 1.5px 0 0 1.5px; }
.drafting-corner.tr { top: -1px; right: -1px; border-width: 1.5px 1.5px 0 0; }
.drafting-corner.bl { bottom: -1px; left: -1px; border-width: 0 0 1.5px 1.5px; }
.drafting-corner.br { bottom: -1px; right: -1px; border-width: 0 1.5px 1.5px 0; }

.intro-header {
  text-align: center;
  margin-bottom: 28px;
}

.intro-spec-line {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: rgba(28, 34, 41, 0.54);
  margin-bottom: 14px;
}
.spec-dot { margin: 0 8px; }

.intro-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 46px);
  font-weight: 500;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  color: #181e24;
}

.intro-subtitle {
  margin: 7px 0 18px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  color: #c8553d;
}

.intro-desc {
  margin: 0 auto;
  max-width: 470px;
  font-family: var(--serif);
  font-size: 14.5px;
  line-height: 1.9;
  color: rgba(28, 34, 41, 0.78);
}

.worry-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.input-caliper {
  position: relative;
  display: flex;
  align-items: center;
}

.caliper-bracket {
  width: 11px;
  height: 46px;
  border: 1px solid rgba(28, 34, 41, 0.45);
  flex-shrink: 0;
  transition: border-color 0.25s ease;
}
.caliper-bracket.left { border-right: none; }
.caliper-bracket.right { border-left: none; }
.input-caliper:focus-within .caliper-bracket { border-color: #c8553d; }

#worry-input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: none;
  border-bottom: 1px solid rgba(28, 34, 41, 0.28);
  background: transparent;
  font-family: var(--serif);
  font-size: 18px;
  color: #181e24;
  text-align: center;
  outline: none;
  user-select: text;
  transition: border-color 0.25s ease;
}
#worry-input:focus { border-bottom-color: #c8553d; }
#worry-input::placeholder { color: rgba(28, 34, 41, 0.35); font-size: 15px; }

.input-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: rgba(28, 34, 41, 0.48);
  padding: 0 10px;
}
.char-count { font-family: var(--mono); }

.preset-section {
  margin-top: 4px;
  text-align: center;
}
.preset-label {
  display: block;
  font-size: 12px;
  color: rgba(28, 34, 41, 0.56);
  margin-bottom: 10px;
}
.preset-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.preset-pill {
  appearance: none;
  border: 1px solid rgba(28, 34, 41, 0.2);
  background: rgba(255, 255, 255, 0.58);
  color: #242c34;
  font-family: var(--sans);
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.preset-pill:hover {
  border-color: #c8553d;
  color: #c8553d;
  background: rgba(200, 85, 61, 0.06);
  transform: translateY(-1px);
}

.intro-actions {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.primary-btn, .secondary-btn, .ghost-btn, .release-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 24px;
  font-family: var(--serif);
  font-size: 14.5px;
  letter-spacing: 0.1em;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.25s ease;
}

.primary-btn {
  background: #1c2229;
  color: #f6f2e9;
  border: 1px solid #1c2229;
}
.primary-btn:hover {
  background: #c8553d;
  border-color: #c8553d;
  transform: translateY(-1px);
}

.secondary-btn {
  background: transparent;
  color: var(--ink-color);
  border: 1px solid var(--panel-border);
}
.secondary-btn:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.ghost-btn {
  background: transparent;
  color: var(--ink-muted);
  border: 1px solid transparent;
}
.ghost-btn:hover { color: var(--ink-color); }

.release-btn {
  background: rgba(230, 194, 128, 0.14);
  color: #f4d89f;
  border: 1px solid rgba(230, 194, 128, 0.55);
}
.release-btn:hover {
  background: rgba(230, 194, 128, 0.28);
  transform: translateY(-1px);
}

.intro-footer {
  margin-top: 22px;
  text-align: center;
  font-family: var(--mono);
  font-size: 10.5px;
  color: rgba(28, 34, 41, 0.46);
  letter-spacing: 0.06em;
}

/* ==========================================================================
   TOP HUD
   ========================================================================== */
.top-hud {
  position: fixed;
  top: 14px;
  left: 16px;
  right: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

body.state-exploring .top-hud {
  opacity: 1;
  transform: translateY(0);
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.hud-brand {
  appearance: none;
  background: none;
  border: none;
  padding: 2px 8px 2px 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  color: var(--ink-color);
  transition: opacity 0.2s;
}
.hud-brand:hover { opacity: 0.72; }
.brand-cn {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.16em;
}
.brand-en {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.22em;
  color: var(--ink-muted);
}

.phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ink-color);
  border-radius: 2px;
}

.phase-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-color);
  box-shadow: 0 0 8px var(--accent-color);
}

.hud-icon-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 31px;
  padding: 0 10px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink-color);
  font-family: var(--sans);
  font-size: 12px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.hud-icon-btn:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}
.hud-icon-btn.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #fff;
}

.pinned-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--accent-color);
  color: #fff;
  font-family: var(--mono);
  font-size: 10px;
}

/* ==========================================================================
   UPPER-CENTER FLOATING WORRY CALIPER (Unobstructed Center!)
   ========================================================================== */
.worry-anchor {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease;
}

body.state-exploring .worry-anchor {
  opacity: 1;
}

.worry-card {
  position: relative;
  padding: 8px 22px 9px;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  text-align: center;
  max-width: min(490px, 82vw);
  transition: transform 0.5s ease, background-color 0.4s ease, border-color 0.4s ease, opacity 0.6s ease;
}

.worry-card.released {
  opacity: 0.28;
  filter: blur(0.6px);
}

.worry-card::before,
.worry-card::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 16px;
  height: 1px;
  background: var(--accent-color);
  opacity: 0.6;
}
.worry-card::before { left: -20px; }
.worry-card::after { right: -20px; }

.worry-meta-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.worry-tag {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  color: var(--accent-color);
}

.worry-cat-pill {
  font-family: var(--mono);
  font-size: 9.5px;
  padding: 1px 6px;
  border: 1px solid var(--panel-border);
  color: var(--ink-muted);
}

.worry-text {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(15px, 2vw, 19px);
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--ink-color);
  line-height: 1.38;
}

.worry-ratio {
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-muted);
  word-break: break-all;
}

/* ==========================================================================
   INTERACTIVE BLUEPRINT CALLOUT PINS
   ========================================================================== */
.pins-layer {
  position: fixed;
  inset: 0;
  z-index: 14;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}
body.state-exploring .pins-layer { opacity: 1; }

.bp-pin {
  position: absolute;
  pointer-events: auto;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.bp-pin-dot {
  width: 23px;
  height: 23px;
  border-radius: 50%;
  border: 1px solid var(--ink-color);
  background: var(--panel-bg);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-color);
  transition: all 0.22s ease;
}

.bp-pin.collected .bp-pin-dot {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.bp-pin:hover .bp-pin-dot,
.bp-pin.open .bp-pin-dot {
  border-color: var(--accent-color);
  background: var(--accent-color);
  color: #fff;
  transform: scale(1.12);
}

.bp-pin-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  white-space: nowrap;
  padding: 2px 6px;
  background: var(--panel-bg);
  border: 1px solid var(--ink-faint);
}

.bp-pin-popover {
  position: absolute;
  top: 30px;
  left: 0;
  width: 256px;
  padding: 11px 13px;
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink-color);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 6;
}
.bp-pin.align-right .bp-pin-popover { left: auto; right: 0; }
.bp-pin.open .bp-pin-popover,
.bp-pin:hover .bp-pin-popover {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.bp-pin-spec-tag {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--accent-color);
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

/* ==========================================================================
   BOTTOM EDITORIAL SCALE NARRATION STAGE
   ========================================================================== */
.scale-panel {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  width: min(740px, calc(100vw - 128px));
  z-index: 16;
  padding: 16px 24px 14px;
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.7s ease, background-color 0.4s ease, border-color 0.4s ease;
}

.scale-panel::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid var(--ink-faint);
  pointer-events: none;
}

body.state-exploring .scale-panel {
  opacity: 1;
  pointer-events: auto;
}

.scale-header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ink-faint);
  margin-bottom: 8px;
}

.scale-id-block {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--mono);
}
.scale-fig { font-size: 11px; color: var(--accent-color); letter-spacing: 0.1em; }
.scale-exp { font-size: 17px; font-weight: 500; color: var(--ink-color); }
.scale-human-size { font-size: 11px; color: var(--ink-muted); }

.scale-title-block {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.scale-name {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--ink-color);
}
.scale-en {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  color: var(--ink-muted);
}

.scale-metrics-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-muted);
}
.metric-sep { opacity: 0.45; }
.time-chip { color: var(--accent-color); }

.scale-narration {
  margin: 0;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.78;
  color: var(--ink-color);
  min-height: 2.6em;
}

.scale-aside {
  margin: 7px 0 0;
  padding-left: 10px;
  border-left: 1.5px solid var(--accent-color);
  font-size: 12.5px;
  line-height: 1.58;
  color: var(--ink-muted);
}

.scale-footer-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-muted);
}

.scale-interact-hint {
  color: var(--ink-muted);
  letter-spacing: 0.03em;
}

.scroll-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-color);
  white-space: nowrap;
}
.scroll-chevron {
  display: inline-block;
  animation: bobDown 1.9s ease-in-out infinite;
}
@keyframes bobDown {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}

/* ==========================================================================
   RIGHT CHAPTERIZED LOGARITHMIC RULER
   ========================================================================== */
.scale-ruler {
  position: fixed;
  top: 78px;
  right: 20px;
  bottom: 28px;
  z-index: 18;
  display: flex;
  align-items: stretch;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.7s ease;
}
body.state-exploring .scale-ruler {
  opacity: 1;
  pointer-events: auto;
}

.ruler-chapters {
  position: relative;
  width: 58px;
  height: 100%;
  pointer-events: none;
}

.ruler-chapter-btn {
  position: absolute;
  right: 2px;
  transform: translateY(-50%);
  appearance: none;
  background: none;
  border: none;
  padding: 2px 4px;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-muted);
  opacity: 0.62;
  cursor: pointer;
  pointer-events: auto;
  white-space: nowrap;
  transition: opacity 0.2s, color 0.2s;
}
.ruler-chapter-btn:hover,
.ruler-chapter-btn.active {
  opacity: 1;
  color: var(--accent-color);
}

.ruler-track {
  position: relative;
  width: 22px;
  height: 100%;
  cursor: pointer;
}
.ruler-track::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 6px;
  width: 1px;
  background: var(--ink-faint);
}
.ruler-progress {
  position: absolute;
  top: 0;
  right: 6px;
  width: 1.5px;
  height: 0%;
  background: var(--accent-color);
}
.ruler-ticks { position: absolute; inset: 0; }
.ruler-tick {
  position: absolute;
  right: 6px;
  height: 1px;
  width: 6px;
  background: var(--ink-muted);
  opacity: 0.42;
  transform: translateY(-50%);
}
.ruler-tick.major { width: 11px; opacity: 0.8; }
.ruler-tick.inversion { width: 14px; height: 1.5px; background: var(--accent-color); opacity: 1; }
.ruler-tick.pinned::after {
  content: "";
  position: absolute;
  left: -6px;
  top: -2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-color);
}
.ruler-thumb {
  position: absolute;
  right: 3px;
  top: 0%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-color);
  transform: translateY(-50%);
  box-shadow: 0 0 10px var(--accent-color);
  pointer-events: none;
}
.thumb-readout {
  display: none;
}

/* ==========================================================================
   FIELD SPECIMEN JOURNAL DRAWER
   ========================================================================== */
.journal-drawer {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  justify-content: flex-end;
}
.journal-drawer[hidden] { display: none; }

.journal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 22, 0.52);
  backdrop-filter: blur(6px);
}

.journal-panel {
  position: relative;
  z-index: 2;
  width: min(440px, 92vw);
  height: 100%;
  background: #f6f2e9;
  color: #1c2229;
  border-left: 1px solid rgba(28, 34, 41, 0.2);
  display: flex;
  flex-direction: column;
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.25);
}

.journal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 22px 16px;
  border-bottom: 1px solid rgba(28, 34, 41, 0.14);
}
.journal-header h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.1em;
}
.journal-header p {
  margin: 5px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(28, 34, 41, 0.62);
}

.journal-list {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.specimen-card {
  padding: 13px 15px;
  border: 1px solid rgba(28, 34, 41, 0.18);
  background: rgba(255, 255, 255, 0.72);
}
.specimen-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  color: #c8553d;
  margin-bottom: 4px;
}
.specimen-title {
  margin: 0 0 5px;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
}
.specimen-text {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.65;
  color: rgba(28, 34, 41, 0.78);
}
.journal-empty {
  text-align: center;
  padding: 46px 20px;
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.85;
  color: rgba(28, 34, 41, 0.56);
}

/* ==========================================================================
   FINALE OVERLAY
   ========================================================================== */
.finale-overlay {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 11, 22, 0.54);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.65s ease;
}
.finale-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.finale-card {
  width: 100%;
  max-width: 590px;
  padding: 36px 34px;
  background: rgba(13, 16, 28, 0.92);
  border: 1px solid rgba(230, 194, 128, 0.36);
  color: #f2ede2;
  text-align: center;
}
.finale-spec {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  color: #e6c280;
  margin-bottom: 12px;
}
.finale-title {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.06em;
}
.finale-body {
  margin: 0 0 20px;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.85;
  color: rgba(242, 237, 226, 0.86);
}
.finale-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 14px 0;
  margin-bottom: 22px;
  border-top: 1px solid rgba(242, 237, 226, 0.14);
  border-bottom: 1px solid rgba(242, 237, 226, 0.14);
}
.finale-stat-val {
  display: block;
  font-family: var(--mono);
  font-size: 16px;
  color: #e6c280;
}
.finale-stat-lbl {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: rgba(242, 237, 226, 0.62);
}
.finale-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.finale-card .primary-btn {
  background: #e6c280;
  border-color: #e6c280;
  color: #121520;
}
.finale-card .primary-btn:hover { background: #f3d79e; border-color: #f3d79e; }
.finale-card .secondary-btn { color: #f2ede2; border-color: rgba(242, 237, 226, 0.28); }
.finale-card .ghost-btn { color: rgba(242, 237, 226, 0.68); }

/* ==========================================================================
   POSTCARD STUDIO MODAL
   ========================================================================== */
.postcard-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.postcard-modal[hidden] { display: none; }

.postcard-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 22, 0.74);
  backdrop-filter: blur(10px);
}

.postcard-dialog {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1060px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: #f6f2e9;
  color: #1c2229;
  border: 1px solid rgba(28, 34, 41, 0.25);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.postcard-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(28, 34, 41, 0.14);
}
.postcard-dialog-header h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: 0.1em;
}
.postcard-subtitle {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: rgba(28, 34, 41, 0.62);
}

.close-btn {
  appearance: none;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(28, 34, 41, 0.22);
  background: transparent;
  color: #1c2229;
  font-size: 15px;
  cursor: pointer;
  border-radius: 2px;
}
.close-btn:hover { border-color: #c8553d; color: #c8553d; }

.postcard-workspace {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}
.postcard-preview-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #e9e4d9;
  gap: 16px;
  overflow: auto;
}
.postcard-canvas-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 62vh;
}
#postcard-canvas {
  max-width: 100%;
  max-height: 60vh;
  width: auto;
  height: auto;
  box-shadow: 0 20px 52px rgba(18, 24, 34, 0.26);
  background: #f6f2e9;
}
.postcard-quick-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.postcard-controls-pane {
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-left: 1px solid rgba(28, 34, 41, 0.12);
}
.control-group { display: flex; flex-direction: column; gap: 8px; }
.control-label { font-size: 12.5px; font-weight: 500; color: #1c2229; }
.control-hint { font-weight: 400; font-size: 11px; color: #c8553d; margin-left: 4px; }

.scale-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  max-height: 230px;
  overflow-y: auto;
  padding-right: 4px;
}
.scale-pick-btn {
  appearance: none;
  text-align: left;
  padding: 7px 9px;
  border: 1px solid rgba(28, 34, 41, 0.18);
  background: rgba(255, 255, 255, 0.68);
  color: #1c2229;
  font-family: var(--sans);
  font-size: 12px;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  transition: all 0.18s ease;
}
.scale-pick-btn:hover { border-color: #c8553d; }
.scale-pick-btn.active { background: #1c2229; border-color: #1c2229; color: #f6f2e9; }
.scale-pick-exp { font-family: var(--mono); font-size: 10px; opacity: 0.7; }
.scale-pick-star { color: #c8553d; margin-right: 3px; }

.theme-picker, .layout-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.theme-chip, .layout-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid rgba(28, 34, 41, 0.2);
  background: #fff;
  color: #1c2229;
  font-size: 12px;
  border-radius: 2px;
  cursor: pointer;
}
.theme-chip.active, .layout-chip.active {
  border-color: #c8553d;
  background: rgba(200, 85, 61, 0.08);
  color: #c8553d;
  font-weight: 500;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.22);
}
.swatch-ivory { background: #f6f2e9; }
.swatch-midnight { background: #0b1628; }
.swatch-cyanotype { background: #163559; }
.swatch-quantum { background: #0b0918; }
.swatch-parchment { background: #efe4ce; }

.signature-input {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid rgba(28, 34, 41, 0.22);
  background: #fff;
  font-family: var(--serif);
  font-size: 13.5px;
  color: #1c2229;
  outline: none;
  user-select: text;
}
.signature-input:focus { border-color: #c8553d; }

/* TOAST */
.toast {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translate(-50%, -12px);
  z-index: 80;
  padding: 8px 16px;
  background: #1c2229;
  color: #f6f2e9;
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* RESPONSIVE */
@media (max-width: 860px) {
  .viewport-frame { inset: 6px; }
  .intro-frame { padding: 28px 20px 24px; }
  .top-hud { top: 8px; left: 10px; right: 10px; }
  .hud-btn-label, .phase-badge, .ruler-chapters { display: none; }
  .worry-anchor { top: 58px; }
  .scale-panel {
    bottom: 14px;
    width: calc(100vw - 52px);
    left: calc(50% - 10px);
    padding: 13px 16px 12px;
  }
  .scale-name { font-size: 17px; }
  .scale-narration { font-size: 13.5px; }
  .scale-ruler { right: 8px; }
  .postcard-workspace { grid-template-columns: 1fr; overflow-y: auto; }
  .postcard-controls-pane { border-left: none; border-top: 1px solid rgba(28, 34, 41, 0.12); overflow-y: visible; }
  .bp-pin-label { display: none; }
}
