:root {
  --ink: #2a211b;
  --ink-soft: #54473b;
  --blue-ink: #1f2b47;
  --red: #8c1c24;
  --news: #dfd2b5;
  --letter: #f4ecda;
  --env: #eadcbf;
  --shadow: 40, 25, 10;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100svh;
  color: var(--ink);
  background: var(--news) url(../img/newsprint.jpg) repeat;
  background-size: 640px 640px;
  font-family: 'Old Standard TT', 'Times New Roman', serif;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- atmosfer katmanları ---------- */
.showthrough {
  position: fixed; inset: -4vh -4vw; z-index: 0; pointer-events: none;
  transform: scaleX(-1);
  opacity: .075;
  filter: blur(.45px);
  font: 400 10.5px/1.32 'Old Standard TT', serif;
  text-align: justify; hyphens: auto;
  column-width: 170px; column-gap: 24px; column-rule: 1px solid #000;
  padding: 18vh 3vw 0; overflow: hidden; color: #000;
}
.showthrough h4 { font: 700 15px/1.1 'Old Standard TT', serif; margin: .3em 0 .4em; column-span: none; }
.showthrough p { margin: 0 0 .5em; text-indent: 1em; }
.showthrough .ht {
  height: 120px; margin: 6px 0 8px;
  background: radial-gradient(circle, #000 42%, transparent 44%) 0 0 / 4px 4px;
  -webkit-mask-image: radial-gradient(ellipse at 40% 45%, #000 20%, rgba(0,0,0,.35) 60%, transparent 75%);
          mask-image: radial-gradient(ellipse at 40% 45%, #000 20%, rgba(0,0,0,.35) 60%, transparent 75%);
}
.vignette {
  position: fixed; inset: 0; z-index: 40; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(92, 62, 25, .26) 100%),
    radial-gradient(ellipse at 12% 8%, rgba(150, 105, 40, .10), transparent 40%),
    radial-gradient(ellipse at 88% 92%, rgba(150, 105, 40, .12), transparent 45%);
}
.grain {
  position: fixed; left: -128px; top: -128px; right: -128px; bottom: -128px; z-index: 41; pointer-events: none;
  background: url(../img/grain.png) repeat; background-size: 256px 256px;
  opacity: .11; mix-blend-mode: multiply; will-change: transform;
}
.petals { position: fixed; inset: 0; z-index: 30; pointer-events: none; overflow: hidden; }
.petal {
  position: absolute; left: 0; top: 0; width: 13px; height: 10px;
  border-radius: 70% 0 70% 0;
  background: radial-gradient(circle at 30% 30%, #f1b9bb, #c9545f 70%, #9e3141);
  opacity: .9; will-change: transform;
}
.petal.p2 { background: radial-gradient(circle at 30% 30%, #fbe9d9, #e6b48f 75%); }
.petal.p3 { background: radial-gradient(circle at 30% 30%, #e88d84, #a8282f 80%); width: 11px; height: 9px; }

/* ---------- manşet ---------- */
.masthead {
  position: relative; z-index: 2;
  max-width: 1040px; margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 16px 0;
  text-align: center;
}
.mh-top, .mh-date {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  font: 700 9.5px/1.2 'Old Standard TT', serif; letter-spacing: .12em; text-transform: uppercase;
}
.mh-top { border-bottom: 1px solid var(--ink); padding-bottom: 5px; }
.mh-mid { font-style: italic; font-weight: 400; text-transform: none; letter-spacing: .02em; font-size: 11px; }
.mh-title {
  font-family: 'UnifrakturMaguntia', 'Old English Text MT', serif; font-weight: 400;
  font-size: clamp(44px, 13.5vw, 104px); line-height: .95;
  margin: 6px 0 4px; letter-spacing: .005em;
  text-shadow: .6px .4px 0 rgba(42, 33, 27, .35);
}
.mh-rule { border-top: 3px double var(--ink); border-bottom: 1px solid var(--ink); height: 5px; }
.mh-date { padding: 5px 0 6px; border-bottom: 1px solid var(--ink); font-weight: 400; font-style: italic; text-transform: none; letter-spacing: .03em; font-size: 12px; }
@media (max-width: 520px) { .mh-mid { display: none; } }

/* ---------- sahne 1: zarf ---------- */
.scene { position: relative; z-index: 2; }
.scene-envelope {
  min-height: calc(100svh - 150px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 28px 16px 150px;
}
.envelope {
  position: relative; width: min(90vw, 540px); aspect-ratio: 1.58;
  cursor: pointer; outline: none; touch-action: manipulation; user-select: none; -webkit-user-select: none;
  opacity: 0;
}
.envelope:focus-visible { outline: 2px dashed var(--red); outline-offset: 8px; }
.env-face {
  position: absolute; inset: 0;
  box-shadow: 0 1px 2px rgba(var(--shadow), .25), 0 14px 26px -6px rgba(var(--shadow), .38);
}
.env-front {
  padding: 9px;
  background:
    repeating-linear-gradient(-45deg, #b2302e 0 12px, #efe3c8 12px 18px, #273c68 18px 30px, #efe3c8 30px 36px);
}
.env-paper {
  position: relative; width: 100%; height: 100%;
  background: var(--env) url(../img/envelope.jpg); background-size: 512px;
  box-shadow: inset 0 0 28px rgba(140, 100, 40, .22);
  overflow: hidden;
}
.airmail {
  position: absolute; left: 4.5%; top: 7%;
  border: 1.5px solid #273c68; color: #273c68; padding: 3px 7px 2px;
  font: 700 9px/1.15 'Old Standard TT', serif; letter-spacing: .14em; text-transform: uppercase;
  display: flex; flex-direction: column; align-items: center; transform: rotate(-2deg);
}
.airmail span { font-weight: 400; font-style: italic; letter-spacing: .08em; text-transform: none; font-size: 9.5px; }
.stamp { position: absolute; right: 5%; top: 7%; width: 16%; transform: rotate(3deg); filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); opacity: 0; }
.stamp svg { display: block; width: 100%; height: auto; }
.stamp-t { font: 700 8.5px 'Old Standard TT', serif; letter-spacing: 1.6px; fill: #6e1f1e; }
.stamp-v { font: 700 10px 'Old Standard TT', serif; fill: #6e1f1e; }
.postmark { position: absolute; right: 13%; top: 10%; width: 30%; transform: rotate(-13deg); opacity: 0; mix-blend-mode: multiply; }
.postmark svg { display: block; width: 100%; height: auto; overflow: visible; }
.pm-t { font: 700 6.6px 'Old Standard TT', serif; letter-spacing: .9px; }
.pm-d { font: 700 7.8px 'Old Standard TT', serif; letter-spacing: .5px; }
.pm-s { font: 400 5.6px 'Old Standard TT', serif; letter-spacing: 1px; }
.to-label {
  position: absolute; left: 13%; top: 43%;
  font: italic 400 11px 'Old Standard TT', serif; color: #6b5a47; letter-spacing: .04em;
}
.name-wrap { position: absolute; left: 11%; right: 9%; top: 47%; }
.name-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.name-wrap .gl { fill: var(--blue-ink); fill-opacity: 0; stroke: var(--blue-ink); stroke-width: 26; stroke-linejoin: round; }
.name-wrap .flo { fill: none; stroke: var(--blue-ink); stroke-width: 34; stroke-linecap: round; }
.addr-lines { position: absolute; left: 13%; right: 12%; bottom: 13%; display: grid; gap: 15px; }
.addr-lines i { display: block; height: 0; border-bottom: 1px dotted rgba(80, 60, 40, .35); }
.addr-lines i:first-child { margin-right: 18%; }

/* arka yüz */
.env-back { background: var(--env) url(../img/envelope.jpg); background-size: 512px; overflow: visible; }
.env-inside {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(45deg, rgba(31, 43, 71, .5) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(-45deg, rgba(31, 43, 71, .35) 0 2px, transparent 2px 7px),
    #c9b893;
}
.env-letter {
  position: absolute; left: 6%; right: 6%; top: 6%; height: 86%;
  background: var(--letter) url(../img/letter.jpg); background-size: 512px;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  padding: 9% 10%; display: grid; align-content: start; gap: 9%;
}
.env-letter i { display: block; height: 2px; background: rgba(42, 33, 27, .28); border-radius: 2px; }
.env-letter i:nth-child(2) { margin-right: 22%; }
.env-letter i:nth-child(4) { margin-right: 40%; }
.pocket { position: absolute; inset: 0; background: var(--env) url(../img/envelope.jpg); background-size: 512px; }
.pocket-l { clip-path: polygon(0 0, 52% 56%, 0 100%); filter: brightness(.97); }
.pocket-r { clip-path: polygon(100% 0, 48% 56%, 100% 100%); filter: brightness(.95); }
.pocket-b { clip-path: polygon(0 100%, 50% 44%, 100% 100%); filter: brightness(1.02); box-shadow: inset 0 0 30px rgba(140, 100, 40, .25); }
.flap { position: absolute; left: 0; right: 0; top: 0; height: 60%; transform-origin: 50% 0; z-index: 5; filter: drop-shadow(0 3px 2px rgba(var(--shadow), .3)); }
.flap-shape { position: absolute; inset: 0; clip-path: polygon(0 0, 100% 0, 50% 100%); background: var(--env) url(../img/envelope.jpg); background-size: 512px; filter: brightness(.99); }
.flap.inner .flap-shape { background: #cdbd99; filter: none; }
.env-back .env-inside { z-index: 1; }
.env-back .env-letter { z-index: 2; }
.env-back .pocket { z-index: 3; }
.flap.open { z-index: 1; }
.seal {
  position: absolute; left: 50%; top: 60%; width: 22%; aspect-ratio: 1; z-index: 6;
  transform: translate(-50%, -50%); opacity: 0;
  filter: drop-shadow(0 2px 2px rgba(60, 10, 15, .45));
}
.seal svg { display: block; width: 100%; height: 100%; overflow: visible; }
.seal-glyph { fill: #6a0f19; }
.seal-glyph-hi { fill: #e98b92; opacity: .35; }

.hint {
  margin: 26px 0 0; min-height: 1.3em;
  font: 400 13px/1.3 'Courier Prime', 'Courier New', monospace; letter-spacing: .08em; color: var(--ink-soft);
  opacity: 0;
}
.hint.on { animation: blink 1.6s steps(2, jump-none) infinite; }
@keyframes blink { 0% { opacity: .9; } 100% { opacity: .35; } }

.bed { pointer-events: none; }
.bed svg { display: block; width: 100%; height: auto; overflow: visible; }
.bed-intro { position: absolute; left: 0; right: 0; bottom: 0; max-width: 760px; margin: 0 auto; }
.fl-ink { fill: none; stroke: #3a2e26; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.fl-fill { stroke: none; }

/* ---------- sahne 2: mektup ---------- */
.scene-letter {
  max-width: 1080px; margin: 0 auto; padding: 18px 16px 40px;
  display: grid; grid-template-columns: 1fr; gap: 0;
}
.player-col { position: relative; z-index: 3; }
.player { margin: 0 auto; width: min(86vw, 430px); }
.tt-btn { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; touch-action: manipulation; border-radius: 18px; }
.tt-btn:focus-visible { outline: 2px dashed var(--red); outline-offset: 6px; }
.tt { display: block; width: 100%; height: auto; filter: drop-shadow(0 12px 16px rgba(var(--shadow), .35)); }
.lbl-t, .lbl-b { font: 700 6.3px 'Old Standard TT', serif; letter-spacing: .55px; fill: #f3e2bd; }
.lbl-c { font: 700 7px 'UnifrakturMaguntia', serif; fill: #f3e2bd; letter-spacing: .3px; }
.lbl-s { font: 400 5.6px 'Old Standard TT', serif; fill: #f3e2bd; letter-spacing: .8px; }
.tt-small { font: 400 8px 'Old Standard TT', serif; fill: #e9d3a8; opacity: .7; letter-spacing: 1px; }
.caption {
  margin: 10px 4px 0; padding-top: 6px; border-top: 1px solid rgba(42, 33, 27, .5);
  font: 400 13px/1.4 'Old Standard TT', serif; text-align: center;
}
.cap-k { font-weight: 700; text-transform: uppercase; letter-spacing: .14em; font-size: 10px; margin-right: 4px; }
.cap-a { font-style: italic; }
.cap-state { display: block; font: 400 11px 'Courier Prime', monospace; letter-spacing: .1em; color: var(--ink-soft); margin-top: 2px; }

.note {
  position: relative; z-index: 2;
  margin: -6px auto 0; width: 100%; max-width: 640px;
  background: var(--letter) url(../img/letter.jpg); background-size: 512px;
  box-shadow: inset 0 0 46px rgba(150, 105, 45, .2), 0 1px 2px rgba(var(--shadow), .2), 0 18px 34px -8px rgba(var(--shadow), .42);
  padding: 46px clamp(18px, 6vw, 56px) 0;
  transform-origin: 50% 0;
}
.note::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, transparent calc(33.3% - 1px), rgba(90, 60, 30, .13) 33.3%, rgba(255, 255, 255, .35) calc(33.3% + 1.5px), transparent calc(33.3% + 5px)),
    linear-gradient(180deg, transparent calc(66.6% - 1px), rgba(90, 60, 30, .13) 66.6%, rgba(255, 255, 255, .35) calc(66.6% + 1.5px), transparent calc(66.6% + 5px));
}
.tape { position: absolute; top: -12px; width: 92px; height: 26px; background: rgba(236, 222, 178, .72); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.tape::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 6px, rgba(255,255,255,.18) 6px 7px); }
.tape-l { left: -14px; transform: rotate(-28deg); }
.tape-r { right: -14px; transform: rotate(31deg); }

.poem {
  position: relative;
  font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-weight: 500;
  font-size: clamp(17px, 4.75vw, 25px); line-height: 1.52; color: var(--ink);
}
.stanza { margin: 0 0 1.5em; }
.ln { display: block; padding-left: 1.1em; text-indent: -1.1em; }
.ln.refrain {
  font-family: 'Pinyon Script', cursive; font-style: normal; font-weight: 400;
  font-size: 1.36em; line-height: 1.25; color: var(--red);
  margin: .22em 0 0 .6em; position: relative; width: fit-content;
}
.ln.refrain::after {
  content: ""; position: absolute; left: .9em; right: -.2em; bottom: -.08em; height: .32em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12' preserveAspectRatio='none'%3E%3Cpath d='M2 8 C30 2 52 11 80 6 S130 2 160 7 S190 6 198 4' fill='none' stroke='%238c1c24' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 0 0 / 100% 100%;
  clip-path: inset(0 100% 0 0); opacity: .8;
}
.ln.refrain.under::after { animation: underline .7s steps(8) forwards; }
@keyframes underline { to { clip-path: inset(0 0 0 0); } }
.karagul { display: inline-block; width: 1.25em; height: 1.25em; vertical-align: -.25em; margin-left: .2em; }
.karagul svg { width: 100%; height: 100%; overflow: visible; display: block; }

/* yazılma maskesi */
.js .ln.wait { visibility: hidden; }
.js .ln.writing {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(var(--p, 0) * 1% - 7%), transparent calc(var(--p, 0) * 1%));
          mask-image: linear-gradient(90deg, #000 calc(var(--p, 0) * 1% - 7%), transparent calc(var(--p, 0) * 1%));
}

.bed-note { margin: 4px calc(-1 * clamp(18px, 6vw, 56px)) 0; }
.colophon {
  text-align: center; margin: 26px 0 calc(10px + env(safe-area-inset-bottom));
  font: 400 11px 'Old Standard TT', serif; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft);
}

/* mini plak */
.mini {
  position: fixed; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 45;
  width: 58px; height: 58px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: none; touch-action: manipulation;
  filter: drop-shadow(0 4px 6px rgba(var(--shadow), .45));
}
.mini-disc {
  position: absolute; inset: 0; border-radius: 50%;
  background:
    radial-gradient(circle, #e6dccb 0 2.2px, #a3312c 2.6px 11px, transparent 11.4px),
    repeating-radial-gradient(circle, #141313 0 1.4px, #222 1.6px 2.6px);
}
.mini-disc::after { content: ""; position: absolute; left: 50%; top: 12%; width: 3px; height: 8px; margin-left: -1.5px; background: #f3e2bd; border-radius: 2px; opacity: .8; }
.mini-state { position: absolute; inset: 0; display: grid; place-items: center; }
.mini.paused .mini-state::before { content: ""; width: 0; height: 0; border-left: 13px solid #f3e2bd; border-top: 8px solid transparent; border-bottom: 8px solid transparent; margin-left: 4px; filter: drop-shadow(0 0 2px #000); }

/* masaüstü: plak solda sabit, mektup sağda */
@media (min-width: 960px) {
  .scene-letter { grid-template-columns: minmax(330px, 420px) minmax(0, 620px); gap: 44px; justify-content: center; align-items: start; padding-top: 34px; }
  .player-col { position: sticky; top: 28px; }
  .player { width: 100%; }
  .note { margin-top: 0; }
  .colophon { grid-column: 1 / -1; }
  .scene-envelope { min-height: calc(100svh - 190px); }
}

@media (prefers-reduced-motion: reduce) {
  .hint.on { animation: none; opacity: .8; }
}
