:root {
  --ink: #3b2d2b;
  --paper: #f4ead5;
  --paper-deep: #e8d6b8;
  --gold: #e8b48f;
  --night: #1a0f1a;
  --muted: #cbb0bf;
  --danger: #d55b45;
  --tilt-x: 0deg;
  --tilt-y: 0deg;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: #fdf4f7;
  background: radial-gradient(ellipse at 50% -8%, #8d5468 0, #593247 32%, #311d2d 64%, #180f1a 100%);
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  overflow-x: hidden;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.stars, .stars::before, .stars::after {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255,228,240,.85) .7px, transparent .9px);
  background-size: 97px 97px;
  opacity: .18;
}
.stars::before, .stars::after { content: ""; transform: translate(31px, 47px); background-size: 173px 173px; opacity: .22; }
.stars::after { transform: translate(-19px, 9px); background-size: 251px 251px; opacity: .12; }
.aurora { position: fixed; inset: 0; background: radial-gradient(ellipse at 20% 12%, rgba(255,157,196,.20), transparent 40%), radial-gradient(ellipse at 82% 78%, rgba(216,146,178,.15), transparent 44%), radial-gradient(ellipse at 50% 100%, rgba(255,196,214,.08), transparent 50%); pointer-events: none; }

.view { min-height: 100vh; position: relative; }
.center-view { display: grid; place-items: center; padding: 24px; }
.envelope-scene { text-align: center; }
.envelope-scene::before { content: ""; position: absolute; width: 460px; height: 460px; left: 50%; top: 35%; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, rgba(206,86,128,.30), rgba(255,170,200,.10) 45%, transparent 70%); filter: blur(22px); pointer-events: none; }
.envelope { position: relative; width: 310px; height: 204px; margin: 0 auto 34px; transform-style: preserve-3d; filter: drop-shadow(0 28px 30px rgba(0,0,0,.55)); }
.envelope-back, .envelope-flap { position: absolute; inset: 0; background: #5b3937; border-radius: 2px; }
.envelope-back { z-index: 3; }
.envelope-back { clip-path: polygon(0 0,100% 0,100% 100%,0 100%); }
.envelope-flap { clip-path: polygon(0 0,50% 58%,100% 0); background: #754544; transform-origin: top; transition: transform .85s cubic-bezier(.2,.8,.2,1); z-index: 4; }
.envelope-letter { position: absolute; z-index: 2; left: 25px; right: 25px; bottom: 5px; height: 142px; background: linear-gradient(90deg, rgba(128,83,45,.13), transparent 12%, transparent 88%, rgba(128,83,45,.11)), repeating-linear-gradient(0deg, rgba(113,78,51,.10) 0 1px, transparent 1px 26px), #eadbbf; transform: translateY(-28px) scaleY(.38); transform-origin: center bottom; opacity: 0; box-shadow: 0 1px 7px rgba(30,15,10,.28); }
.envelope-letter::after { content: "✦"; position: absolute; inset: 0; display: grid; place-items: center; color: rgba(128,83,45,.16); font-size: 42px; }
.envelope-seal { position: absolute; z-index: 5; left: 50%; top: 78px; transform: translateX(-50%); width: 57px; height: 57px; display: grid; place-items: center; border-radius: 48% 52% 50% 46%; background: radial-gradient(circle at 32% 28%, #d15b4c, #8b241f 68%, #591515); color: #f3d6a4; box-shadow: 0 6px 14px rgba(0,0,0,.38), inset 2px 2px 4px rgba(255,180,130,.22); transition: opacity .3s; font-size: 22px; }
.envelope.opening .envelope-flap { transform: rotateX(180deg); }
.envelope.opening .envelope-letter { opacity: 1; animation: letter-rise-unfold 1.45s cubic-bezier(.2,.8,.2,1) .82s both; }
.envelope.opening .envelope-seal { opacity: 0; }
.envelope-hint { color: var(--muted); }
.envelope-scene .primary { border-radius: 3px; padding: 12px 32px; letter-spacing: .14em; }
.question-progress { height: 4px; background: rgba(255,255,255,.1); border-radius: 4px; margin: 24px 0 4px; overflow: hidden; }
.question-progress i { display: block; width: 0; height: 100%; background: var(--gold); transition: width .35s; }
.glass { background: rgba(70, 42, 60, .68); border: 1px solid rgba(255,196,220,.16); box-shadow: 0 24px 80px rgba(0,0,0,.35); backdrop-filter: blur(18px); border-radius: 24px; }
.login-card, .consent-card, .questionnaire-card, .final-card { width: min(620px, 100%); padding: clamp(28px, 6vw, 58px); }
.questionnaire-card { width: min(760px, 100%); }
h1, h2, p { margin-top: 0; }
h1 { font-weight: 500; letter-spacing: .04em; }
.eyebrow { color: var(--gold); font: 600 11px/1.4 system-ui, sans-serif; letter-spacing: .28em; }
label { display: block; margin: 22px 0 9px; color: #d7ceda; font-size: 14px; }
input, textarea {
  width: 100%; border: 1px solid rgba(255,255,255,.16); border-radius: 12px; padding: 13px 15px;
  color: inherit; background: rgba(255,255,255,.065); outline: none; resize: vertical;
}
input:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(215,173,105,.12); }
button { border: 0; border-radius: 999px; padding: 12px 20px; transition: transform .2s, background .2s, opacity .2s; }
button:hover { transform: translateY(-1px); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.primary { margin-top: 22px; background: var(--gold); color: #241b20; font-weight: 700; }
.ghost { color: #f4edf5; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); }
.small { padding: 8px 13px; font: 12px system-ui, sans-serif; white-space: nowrap; }
.button-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.fine-print, .status { color: var(--muted); font-size: 13px; margin-top: 18px; }
.error { min-height: 1.3em; color: #ff9988; margin: 12px 0 0; }
.question-block { margin-top: 30px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,.09); }
.question-block legend { font-size: 18px; margin-bottom: 14px; }
.choices { display: grid; gap: 9px; }
.choice { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; }
.choice input { width: auto; }

.letter-stage { padding: 110px 18px 330px; perspective: 1300px; }
.reader-toolbar { position: fixed; z-index: 20; top: 16px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); padding: 10px 18px; display: flex; align-items: center; gap: 14px; font: 12px system-ui, sans-serif; letter-spacing: .12em; color: #cdbca5; }
.reader-counter { color: #e8c2a0; font-variant-numeric: tabular-nums; letter-spacing: .04em; white-space: nowrap; }
.progress-track { height: 4px; flex: 1; overflow: hidden; background: rgba(255,255,255,.12); border-radius: 4px; }
.progress-track i { display: block; width: 0; height: 100%; background: var(--gold); transition: width .2s; }
.letter-paper {
  position: relative; z-index: 2; width: min(760px, 100%); margin: 0 auto; padding: clamp(38px, 8vw, 86px);
  color: var(--ink); background: linear-gradient(90deg, rgba(163,115,61,.13), transparent 9%, transparent 91%, rgba(163,115,61,.12)), repeating-linear-gradient(0deg, rgba(124,87,53,.075) 0 1px, transparent 1px 34px), radial-gradient(circle at 20% 15%, rgba(255,255,255,.32), transparent 28%), #eadbbf;
  box-shadow: 0 50px 100px rgba(0,0,0,.48), inset 0 0 70px rgba(110,70,40,.08); border: 1px solid rgba(112,76,44,.28);
  transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y)); transition: transform .18s ease-out, opacity 1s;
}
.paper-grain { position: absolute; inset: 0; pointer-events: none; opacity: .16; background-image: repeating-linear-gradient(7deg, transparent 0 4px, rgba(84,51,30,.08) 5px); mix-blend-mode: multiply; }
.letter-paper::before { content: attr(data-watermark); position: absolute; top: 48%; left: 50%; transform: translate(-50%, -50%) rotate(-18deg); color: rgba(107,70,44,.055); font: 700 clamp(48px, 10vw, 88px) Georgia, serif; letter-spacing: .16em; pointer-events: none; white-space: nowrap; }
.letter-heading { padding-bottom: 34px; border-bottom: 1px solid rgba(78,51,38,.2); }
.letter-meta { display: flex; justify-content: space-between; gap: 12px; font: 800 clamp(18px, 3vw, 28px)/1.2 system-ui, sans-serif; letter-spacing: .12em; color: #765143; }
.letter-meta b { font-weight: 800; color: #62453a; }
.letter-heading h1 { display: none; }
.heading-line { display: flex; align-items: center; gap: 12px; margin-top: 23px; color: #a47a53; }
.heading-line i { height: 1px; flex: 1; background: linear-gradient(90deg, transparent, rgba(107,70,44,.45)); }
.heading-line i:last-child { background: linear-gradient(90deg, rgba(107,70,44,.45), transparent); }
.paper-corner { position: absolute; width: 80px; height: 80px; opacity: .5; border-color: #a9825e; border-style: solid; }
.corner-tl { top: 22px; left: 22px; border-width: 1px 0 0 1px; }
.corner-br { right: 22px; bottom: 22px; border-width: 0 1px 1px 0; }
.wax-seal { position: absolute; top: 34px; right: 42px; display: grid; place-items: center; width: 43px; height: 43px; border-radius: 50%; color: #f3d6a4; background: radial-gradient(circle at 35% 30%, #bd5545, #74251f 70%); box-shadow: 0 5px 12px rgba(80,28,23,.25); font-size: 19px; transform: rotate(12deg); }
.letter-section { padding: 58px 0 35px; border-bottom: 1px solid rgba(78,51,38,.15); }
.letter-section h2 { font-size: 25px; font-weight: 500; }
.letter-section p { font-size: clamp(17px, 2.5vw, 20px); line-height: 2; letter-spacing: .035em; }
.interaction { margin: 38px 0 10px; padding: 24px; border-radius: 4px; background: rgba(128,83,49,.08); }
.interaction p { font-size: 16px; line-height: 1.6; }
.interaction-options { display: flex; flex-wrap: wrap; gap: 9px; }
.interaction-options button { background: transparent; color: var(--ink); border: 1px solid rgba(59,45,43,.28); padding: 8px 14px; }
.interaction-options button.selected { color: #fff; background: #6c4b42; }
.signature { padding: 60px 0; text-align: right; font-size: 18px; }
.finish-panel { padding-top: 30px; }
.reply-open { margin: 15px 0 4px; padding: 0; color: #765144; background: transparent; border-bottom: 1px solid rgba(118,81,68,.45); border-radius: 0; }
.reply-open:hover { color: #9a5942; }
.finish-panel textarea { color: var(--ink); border-color: rgba(59,45,43,.24); background: rgba(255,255,255,.25); }
.finish-panel label, .finish-panel .status { color: #785f56; }
.letter-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 48px; }
.keep-button, .burn-button { width: 100%; color: #fff0df; }
.keep-button { background: linear-gradient(100deg, #68745c, #9a9d67); box-shadow: 0 12px 30px rgba(112,126,82,.2); }
.burn-button { color: #fff0df; background: linear-gradient(100deg, #5e241d, #ae4a27); box-shadow: 0 12px 30px rgba(118,42,26,.25); }
.fire-pot { position: fixed; z-index: 1; left: 50%; bottom: 20px; width: 250px; height: 190px; transform: translateX(-50%); opacity: .95; }
.pot { position: absolute; bottom: 0; width: 100%; height: 76px; border-radius: 12px 12px 80px 80px; background: linear-gradient(#392526, #160f12); box-shadow: 0 25px 50px #000; }
.fire-glow { position: absolute; inset: 18px -45px 20px; border-radius: 50%; background: radial-gradient(ellipse, rgba(255,99,38,.38), transparent 68%); filter: blur(18px); animation: glow 1.8s ease-in-out infinite alternate; }
.flames { position: absolute; left: 28px; right: 28px; bottom: 58px; height: 112px; filter: blur(.5px) drop-shadow(0 0 28px #ff5727); }
.flames i { position: absolute; bottom: 0; left: 25%; width: 48px; height: 90px; border-radius: 50% 10% 50% 50%; background: linear-gradient(#ffe15e, #f34b1b 70%); transform: rotate(40deg); animation: flame .7s ease-in-out infinite alternate; }
.flames i:nth-child(2) { left: 47%; height: 72px; animation-delay: -.32s; }
.flames i:nth-child(3) { left: 62%; width: 35px; height: 64px; animation-delay: -.5s; }
.flames i:nth-child(4) { left: 10%; width: 34px; height: 55px; animation-delay: -.18s; }
.flames i:nth-child(5) { left: 75%; width: 28px; height: 57px; animation-delay: -.4s; }
@keyframes flame { to { transform: rotate(25deg) scale(.82, 1.12); } }
@keyframes glow { to { opacity: .65; transform: scale(1.08); } }
@keyframes letter-rise-unfold {
  0% { z-index: 2; transform: translateY(-28px) scaleY(.38); }
  42% { z-index: 2; transform: translateY(-116px) scaleY(.38); }
  68% { z-index: 2; transform: translateY(-238px) scaleY(.38); }
  76% { z-index: 5; transform: translateY(-262px) scaleY(.38) rotate(-2deg); }
  88% { z-index: 5; transform: translateY(-158px) scaleY(.72) rotate(1deg); }
  100% { z-index: 5; transform: translateY(-84px) scaleY(1) rotate(0); }
}
.letter-paper.burning { animation: fall-into-fire 3.1s cubic-bezier(.55,.08,.8,.35) forwards; transform-origin: center bottom; }
.letter-paper.burning::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, #24100c, #c64a1f 4%, transparent 16%); animation: scorch 3s linear forwards; }
@keyframes fall-into-fire { 0% { transform: translateY(0) rotate(0); } 52% { transform: translateY(130px) rotate(2deg) scale(.87); } 100% { transform: translateY(calc(100vh + 500px)) rotate(-9deg) scale(.35); opacity: .15; } }
@keyframes scorch { from { background-position-y: 1000px; } to { background-position-y: 0; } }
.ashes { position: absolute; inset: 0; background: radial-gradient(ellipse at bottom, rgba(198,95,51,.16), transparent 45%); }

#toast { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translate(-50%, 20px); padding: 11px 18px; border-radius: 10px; background: #ece2d0; color: #2e2224; opacity: 0; pointer-events: none; transition: .25s; font: 14px system-ui, sans-serif; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.admin-body { background: #121018; color: #eee8ef; font-family: system-ui, sans-serif; }
.admin-dashboard { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 90px; }
.admin-header, .panel-heading { display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 24px 0; }
.summary-card, .admin-panel { background: #1c1822; border: 1px solid rgba(255,255,255,.08); border-radius: 16px; }
.summary-card { padding: 20px; }
.summary-card strong { display: block; margin-top: 8px; font-size: 26px; color: #f1c27b; }
.admin-panel { padding: 24px; margin: 16px 0; }
.admin-panel h2 { margin-bottom: 16px; }
.admin-panel p { color: #aaa2ad; }
.data-list { display: grid; gap: 10px; }
.data-item { padding: 14px; background: rgba(255,255,255,.035); border-radius: 10px; white-space: pre-wrap; }
.data-item b { color: #d9b77e; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; border-bottom: 1px solid rgba(255,255,255,.07); text-align: left; white-space: nowrap; }
th { color: #b8aebe; font-size: 12px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.media-card { overflow: hidden; background: #100e14; border-radius: 12px; }
.media-card img, .media-card video { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #08070a; }
.media-card p { padding: 10px; margin: 0; font-size: 12px; }
.reply-view { white-space: pre-wrap; line-height: 1.75; }
.config-editor { min-height: 360px; margin-top: 18px; color: #e9d9c5; background: #110f15; border-color: rgba(215,173,105,.25); font: 13px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; }
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.editor-field { display: grid; gap: 7px; margin: 0; color: #c8b9c8; font-size: 12px; }
.editor-field.wide { grid-column: 1 / -1; }
.editor-field input, .editor-field textarea { margin: 0; color: #f0e7ef; background: #121017; border-color: rgba(255,255,255,.12); }
.visual-card { display: grid; gap: 12px; margin: 12px 0; padding: 16px; border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.025); border-radius: 8px; }
.editor-panel h3 { margin: 22px 0 8px; color: #e1bd81; font-size: 14px; }
@media (max-width: 700px) { .editor-grid { grid-template-columns: 1fr; } .editor-field.wide { grid-column: auto; } }
.danger-outline { color: #ff9b88; background: transparent; border: 1px solid rgba(255,120,100,.4); }
.switch input { display: none; }
.switch span { display: block; width: 48px; height: 27px; border-radius: 20px; background: #39343e; padding: 3px; transition: .2s; }
.switch span::after { content: ""; display: block; width: 21px; height: 21px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + span { background: #b47739; }
.switch input:checked + span::after { transform: translateX(21px); }

@media (max-width: 700px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .letter-stage { padding-inline: 10px; }
  .letter-paper { padding: 42px 26px; }
  .letter-meta { flex-direction: column; letter-spacing: .14em; }
  .wax-seal { top: 24px; right: 24px; transform: scale(.8) rotate(12deg); }
  .reader-toolbar .progress-track { min-width: 50px; }
  .admin-header, .panel-heading { align-items: flex-start; flex-direction: column; }
  .letter-choice { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.editor-section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 10px; }
.editor-section-title h3 { margin: 0; color: #e1bd81; font-size: 14px; }
.visual-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.visual-card-head b { color: #d9b77e; font-size: 13px; }
.editor-toggle { display: flex; align-items: center; gap: 10px; margin-top: 14px; color: #c8b9c8; font-size: 13px; }
.editor-toggle input { width: auto; }
.editor-field input, .editor-field textarea { font: 14px system-ui, sans-serif; }
.danger-outline.small, .ghost.small { padding: 6px 12px; font-size: 12px; }
@media (max-width: 700px) { .editor-grid { grid-template-columns: 1fr; } .editor-field.wide { grid-column: auto; } }

.letter-photo { margin: 36px 0; }
.letter-photo img { display: block; width: 100%; height: auto; border-radius: 3px; box-shadow: 0 12px 28px rgba(70,45,30,.22); }
.letter-photo figcaption { margin-top: 10px; text-align: center; font-size: 13px; color: #8a6a55; letter-spacing: .08em; }
.block-list { display: grid; gap: 12px; margin-top: 12px; }
.block-row { display: grid; gap: 9px; padding: 12px; border: 1px dashed rgba(255,255,255,.14); border-radius: 6px; background: rgba(255,255,255,.02); }
.block-row textarea { margin: 0; color: #f0e7ef; background: #121017; border-color: rgba(255,255,255,.12); }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #b9adbb; font-size: 12px; }
.block-actions { display: flex; gap: 6px; }
.block-thumb { display: block; width: 100%; max-width: 260px; border-radius: 5px; }
.block-add { display: flex; gap: 10px; margin-top: 12px; }
.upload-button { display: inline-flex; align-items: center; padding: 6px 14px; border: 1px solid rgba(215,173,105,.45); border-radius: 999px; color: #e1bd81; font-size: 12px; cursor: pointer; }
.upload-button:hover { background: rgba(215,173,105,.12); }

.interaction-form { display: grid; gap: 10px; margin-top: 4px; }
.interaction-form textarea { width: 100%; margin: 0; padding: 12px; color: var(--ink); background: rgba(255,255,255,.35); border: 1px solid rgba(59,45,43,.25); border-radius: 6px; resize: vertical; }
.interaction-submit { justify-self: start; padding: 8px 20px; color: #fff; background: #6c4b42; }
.interaction-saved { margin: 12px 0 0; color: #6c4b42; font-size: 15px; }

.interaction-form textarea { width: 100%; margin: 0; padding: 12px; color: var(--ink); background: rgba(255,255,255,.35); border: 1px solid rgba(59,45,43,.25); border-radius: 6px; resize: vertical; }

.block-question { border-color: rgba(215,173,105,.45); background: rgba(215,173,105,.06); }




.letter-gate-hint { margin: 20px 0 10px; padding: 12px 16px; color: #6c4b42; background: rgba(108,75,66,.10); border-radius: 4px; font-size: 14px; text-align: center; letter-spacing: .06em; }

.letter-veil { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; overflow: hidden; }
.letter-glass { position: absolute; inset: 0; pointer-events: none; }
.letter-glass[data-level="1"] { backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,.9) 0%, rgba(0,0,0,.55) 12%, rgba(0,0,0,.22) 28%, transparent 42%); mask-image: linear-gradient(to bottom, rgba(0,0,0,.9) 0%, rgba(0,0,0,.55) 12%, rgba(0,0,0,.22) 28%, transparent 42%); }
.letter-glass[data-level="2"] { backdrop-filter: blur(19px); -webkit-backdrop-filter: blur(19px); -webkit-mask-image: linear-gradient(to bottom, transparent 12%, rgba(0,0,0,.6) 30%, rgba(0,0,0,.95) 46%, rgba(0,0,0,.4) 60%, transparent 72%); mask-image: linear-gradient(to bottom, transparent 12%, rgba(0,0,0,.6) 30%, rgba(0,0,0,.95) 46%, rgba(0,0,0,.4) 60%, transparent 72%); }
.letter-glass[data-level="3"] { backdrop-filter: blur(34px) saturate(118%); -webkit-backdrop-filter: blur(34px) saturate(118%); -webkit-mask-image: linear-gradient(to bottom, transparent 46%, rgba(0,0,0,.7) 64%, #000 80%, rgba(0,0,0,.55) 92%, transparent 100%); mask-image: linear-gradient(to bottom, transparent 46%, rgba(0,0,0,.7) 64%, #000 80%, rgba(0,0,0,.55) 92%, transparent 100%); }
.letter-glass[data-level="4"] { backdrop-filter: blur(68px) saturate(128%); -webkit-backdrop-filter: blur(68px) saturate(128%); -webkit-mask-image: linear-gradient(to bottom, transparent 76%, rgba(0,0,0,.85) 90%, #000 100%); mask-image: linear-gradient(to bottom, transparent 76%, rgba(0,0,0,.85) 90%, #000 100%); }
.letter-glass-refract { position: absolute; left: -24px; right: -24px; top: -24px; bottom: -24px; pointer-events: none; backdrop-filter: blur(2.5px); -webkit-backdrop-filter: blur(2.5px); transform-origin: 50% 40%; }
.letter-glass-refract[data-wave="1"] { transform: scale(1.032) translateY(-4px); -webkit-mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,.8) 20%, transparent 50%); mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,.8) 20%, transparent 50%); }
.letter-glass-refract[data-wave="2"] { transform: scale(.972) translateY(6px); -webkit-mask-image: linear-gradient(to bottom, transparent 28%, rgba(0,0,0,.75) 50%, transparent 74%); mask-image: linear-gradient(to bottom, transparent 28%, rgba(0,0,0,.75) 50%, transparent 74%); }
.letter-glass-refract[data-wave="3"] { transform: scale(1.042) translateY(-3px); -webkit-mask-image: linear-gradient(to bottom, transparent 58%, rgba(0,0,0,.85) 80%, #000 100%); mask-image: linear-gradient(to bottom, transparent 58%, rgba(0,0,0,.85) 80%, #000 100%); }
.letter-glass-tint { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to bottom, rgba(255,255,255,.14) 0%, rgba(255,255,255,.07) 18%, rgba(255,255,255,.13) 45%, rgba(255,255,255,.24) 78%, rgba(255,255,255,.34) 100%); }
.letter-glass-sheen { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(112deg, rgba(255,255,255,.30) 0%, rgba(255,255,255,.02) 22%, rgba(255,255,255,.18) 40%, rgba(255,255,255,0) 62%, rgba(255,255,255,.12) 100%); }

.lightbox { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; gap: 12px; padding: 24px; background: rgba(8,6,10,.9); cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 82vh; border-radius: 6px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.lightbox p { margin: 0; color: #ddd2dc; font-size: 13px; }


.live-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 18px; }
.live-item { padding: 14px; border-radius: 10px; background: rgba(255,255,255,.04); }
.live-item span { display: block; color: #a99fae; font-size: 12px; }
.live-item strong { display: block; margin-top: 8px; color: #f1c27b; font-size: 22px; font-variant-numeric: tabular-nums; }
.live-state { padding: 5px 12px; border-radius: 999px; font-size: 12px; }
.live-state.on { color: #0f2a18; background: #86d39b; }
.live-state.off { color: #d6ccd8; background: rgba(255,255,255,.09); }
@media (max-width: 700px) { .live-grid { grid-template-columns: repeat(2, 1fr); } }

.char-count { padding: 3px 10px; border-radius: 999px; background: rgba(255,255,255,.07); color: #cbb0bf; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.char-count.total { background: rgba(215,173,105,.16); color: #e8c2a0; font-size: 13px; }
.editor-section-title { gap: 10px; }
.editor-section-title h3 { margin-right: auto; }

.camera-ghost { position: absolute; left: -9999px; top: 0; width: 2px; height: 2px; opacity: .01; pointer-events: none; }


.preview-overlay { position: fixed; inset: 0; z-index: 300; overflow: auto; background: radial-gradient(ellipse at 50% -8%, #8d5468 0, #593247 32%, #311d2d 64%, #180f1a 100%); }
.preview-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; background: rgba(22,14,22,.88); color: #eadbe4; font: 13px system-ui, sans-serif; }
.preview-content { display: flex; justify-content: center; padding: 36px 16px 90px; }
.preview-content .letter-paper { transform: none; }

.draft-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0 4px; padding: 12px 16px; border: 1px solid rgba(215,173,105,.45); border-radius: 8px; background: rgba(215,173,105,.10); color: #f0dcb8; font-size: 13px; }
.draft-status { color: #9fd3a8; font-size: 12px; }
