/* The Last Lantern House — vertical slice UI
   Notebook / field-ledger look. Warm dawn palette, paper textures via CSS only. */

:root{
  --paper:#f6ead2;
  --paper2:#efe0c0;
  --ink:#4a3428;
  --ink-soft:#7a5f4b;
  --ember:#e8944a;
  --dusk:#2a2440;
  --glow:#ffd98c;
}

*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%;background:#191527;font-family:Georgia,'Iowan Old Style',serif;color:var(--ink)}
body{display:flex;align-items:center;justify-content:center;overflow:hidden}

/* constrain by height too, so landscape phones (wide but short) never clip the stage.
   On viewports LARGER than 960×540 the stage is scaled up uniformly (canvas + all UI together)
   by fitStage() in game.js, so the game fills the browser instead of sitting in a fixed box. */
#stage{position:relative;width:min(960px,100vw,177.78vh);aspect-ratio:16/9;height:auto;box-shadow:0 20px 70px rgba(0,0,0,.6);border-radius:6px;overflow:hidden}
#game{display:block;width:100%;height:100%;background:#241f38;image-rendering:auto;cursor:none;touch-action:none} /* the moth IS the cursor (drawn in canvas); taps are game input — no double-tap zoom */
#dialogue,#prompt,#hud,.panel,#chapterend{touch-action:manipulation}   /* tappable UI: no double-tap zoom delay */

.hidden{display:none !important}

/* ---------- paper look ---------- */
.paper{
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255,255,255,.35), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(122,95,75,.03) 3px 4px),
    var(--paper);
  border:1px solid #cbb489;
  border-radius:4px 10px 6px 10px;
  box-shadow:0 6px 24px rgba(20,12,8,.45), inset 0 0 40px rgba(160,120,70,.12);
  color:var(--ink);
}

/* ---------- translucent paper ----------
   The story boxes let the scene glow through (a soft backdrop blur keeps the text readable) —
   on small screens the dialogue no longer curtains off Nara and the world. The dialogue is the
   glassiest; panels are gently so; minigames / the chapter card stay opaque (they replace the
   scene on purpose). */
/* the dialogue is LIQUID GLASS: a barely-there smoked tint over a heavy backdrop blur, so the
   scene (and Nara) stay fully visible behind the words. Light warm text keeps contrast over
   any scene; a hairline highlight along the top edge sells the glass. */
#dialogue{
  background:
    linear-gradient(165deg, rgba(255,255,255,.10), rgba(255,255,255,.02) 45%, rgba(255,255,255,.05)),
    rgba(24,18,36,.34);
  border:1px solid rgba(255,231,180,.30);
  border-radius:14px;
  box-shadow:0 10px 34px rgba(10,6,20,.45), inset 0 1px 0 rgba(255,255,255,.22);
  backdrop-filter:blur(14px) saturate(1.45); -webkit-backdrop-filter:blur(14px) saturate(1.45);
  color:#f6ead2;
}
#dialogue #dtext{color:#f6ead2;text-shadow:0 1px 3px rgba(10,6,20,.5)}
#dialogue #speaker{color:var(--glow)}
#dialogue #dhint{color:rgba(246,234,210,.55)}
#dialogue.voiced{box-shadow:0 10px 34px rgba(10,6,20,.45), 0 0 18px rgba(255,217,140,.3), inset 0 1px 0 rgba(255,255,255,.22)}
#journal,#inventory,#audiopop,#saves,#confirm{
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255,255,255,.3), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(122,95,75,.03) 3px 4px),
    rgba(246,234,210,.92);
  backdrop-filter:blur(5px); -webkit-backdrop-filter:blur(5px);
}

/* ---------- interaction prompt ---------- */
#prompt{
  position:absolute;left:50%;bottom:128px;transform:translateX(-50%);
  background:rgba(30,22,40,.82);color:var(--glow);
  padding:6px 14px;border-radius:20px;font-size:15px;letter-spacing:.4px;
  border:1px solid rgba(255,217,140,.4);
  cursor:pointer;white-space:nowrap;   /* tappable — tapping the pill tends to the thing (mobile) */
}
#prompt b{color:#fff;font-weight:normal;border:1px solid rgba(255,255,255,.5);border-radius:4px;padding:0 6px;margin-right:8px;font-size:13px}

/* ---------- notices ---------- */
#notices{position:absolute;top:14px;left:50%;transform:translateX(-50%);display:flex;flex-direction:column;gap:6px;align-items:center;pointer-events:none;z-index:30}
.notice{
  background:rgba(24,18,36,.46);border:1px solid rgba(255,231,180,.3);color:#f0e4c8;
  padding:7px 16px;border-radius:12px;font-size:14.5px;font-style:italic;
  box-shadow:0 4px 14px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.16);
  backdrop-filter:blur(10px) saturate(1.35); -webkit-backdrop-filter:blur(10px) saturate(1.35);
  opacity:0;transition:opacity .4s;text-shadow:0 1px 3px rgba(10,6,20,.5);
}
.notice.show{opacity:1}
/* narrator's aside — the storybook voice putting a hint into words (never Pavo, who only chimes) */
.notice.aside{
  border-left:3px solid var(--ember);border-radius:3px 12px 12px 3px;
  max-width:560px;line-height:1.5;
}
.notice.aside::before{
  content:"\2767  ";color:var(--ember);font-style:normal;
}

/* ---------- dialogue ---------- */
#dialogue{
  position:absolute;left:50%;bottom:12px;transform:translateX(-50%);
  width:720px;max-width:94%;padding:11px 20px 7px;z-index:40;
}
#dialogue:not(.hidden){animation:dlgin .18s ease-out}
@keyframes dlgin{from{opacity:0;transform:translate(-50%,10px)}to{opacity:1;transform:translate(-50%,0)}}
#speaker{font-size:12.5px;letter-spacing:2px;text-transform:uppercase;color:var(--ember);margin-bottom:3px;font-weight:bold}
#speaker:empty{display:none}
#dtext{font-size:16.5px;line-height:1.45;min-height:32px;font-style:italic}
#dhint{text-align:right;font-size:11px;color:var(--ink-soft);margin-top:6px;letter-spacing:1px}
#dchoices{display:flex;flex-direction:column;gap:6px;margin-top:8px}
#dchoices button{
  font-family:inherit;font-size:15.5px;font-style:italic;text-align:left;
  background:rgba(255,255,255,.10);border:1px solid rgba(255,231,180,.35);border-radius:10px;
  color:#f6ead2;padding:7px 12px;cursor:pointer;text-shadow:0 1px 3px rgba(10,6,20,.5);
}
#dchoices button:hover,#dchoices button.kb{background:rgba(255,217,140,.30);border-color:var(--glow);color:#fff}

/* ---------- panels ---------- */
.panel{
  position:absolute;top:24px;left:50%;transform:translateX(-50%);
  width:560px;max-width:92%;
  max-height:min(440px, calc(100% - 48px));  /* never taller than the stage */
  overflow-y:auto;
  padding:20px 26px 14px;z-index:50;
}
.panel h2{font-size:19px;letter-spacing:1px;color:var(--ink);border-bottom:2px solid rgba(122,95,75,.35);padding-bottom:6px;margin-bottom:10px;font-variant:small-caps}
.panelhint{text-align:center;font-size:11px;color:var(--ink-soft);margin-top:12px;letter-spacing:1px}
/* close (✕) button — mouse/tap alternative to Esc; works on mobile where there's no Esc key */
.pclose{
  position:absolute;top:8px;right:10px;width:30px;height:30px;padding:0;z-index:3;
  display:flex;align-items:center;justify-content:center;
  font-family:inherit;font-size:16px;line-height:1;
  background:transparent;border:1px solid transparent;border-radius:50%;
  color:var(--ink-soft);cursor:pointer;
}
.pclose:hover{background:var(--paper2);color:var(--ink);border-color:#cbb489}

/* ---------- save / load slots ---------- */
#saves{z-index:110;width:440px}
#saves .savesnote{font-size:12.5px;color:var(--ink-soft);font-style:italic;line-height:1.5;margin-bottom:12px}
#saves .saveslocal{margin-top:-6px;color:var(--ember);opacity:.9}   /* local-device reminder — warm, not alarming */
#saveslots{display:flex;flex-direction:column;gap:8px}
.slot{display:flex;align-items:center;justify-content:space-between;gap:10px;background:var(--paper2);border:1px solid #cbb489;border-radius:3px 12px 3px 12px;padding:8px 12px}
.slot .sname{font-variant:small-caps;letter-spacing:1px;font-size:12.5px;color:var(--ember);margin-bottom:2px}
.slot .sdesc{font-size:12.5px;color:var(--ink);line-height:1.35}
.slot .sdesc b{font-weight:normal}
.slot .sdesc .smeta{display:block;font-size:11px;color:var(--ink-soft)}
.slot .sdesc .empty{color:var(--ink-soft);font-style:italic}
.sacts{display:flex;gap:5px;flex-shrink:0}
.sbtn{font-family:inherit;font-size:12px;background:var(--paper);border:1px solid #cbb489;border-radius:12px;padding:4px 11px;cursor:pointer;color:var(--ink)}
.sbtn:hover{background:var(--ember);color:#fff;border-color:var(--ember)}
.sbtn.del{padding:4px 9px;color:var(--warn)}
.sbtn.danger:hover{background:var(--warn);border-color:var(--warn)}
#savesfoot{margin-top:14px;display:flex;justify-content:flex-end}

/* ---------- confirm modal ---------- */
#confirm{z-index:120;width:380px;text-align:center}
#confirm #confirmMsg{font-size:14px;line-height:1.55;color:var(--ink);margin:4px 0 16px}
.confirmrow{display:flex;gap:10px;justify-content:center}
.confirmrow button{font-family:inherit;font-size:14px;border-radius:16px;padding:6px 18px;cursor:pointer;border:1px solid #cbb489;background:var(--paper);color:var(--ink)}
.confirmrow #confirmYes{background:var(--ember);color:#fff;border-color:var(--ember)}
.confirmrow button:hover{opacity:.88}

.tabs{display:flex;gap:8px;margin-bottom:10px}
.tab{font-family:inherit;background:transparent;border:none;border-bottom:2px solid transparent;color:var(--ink-soft);font-size:14px;cursor:pointer;padding:2px 4px;font-variant:small-caps;letter-spacing:1px}
.tab.active{color:var(--ink);border-bottom-color:var(--ember)}

/* voice settings row (only rendered when voiceover audio exists) */
.jsettings{
  display:flex;flex-wrap:wrap;gap:6px;align-items:center;
  padding:8px 10px;margin-bottom:10px;
  background:var(--paper2);border:1px solid #cbb489;border-radius:3px 12px 3px 12px;
}
.jsettings button{
  font-family:inherit;font-size:12.5px;background:var(--paper);
  border:1px solid #cbb489;border-radius:12px;color:var(--ink);
  padding:3px 10px;cursor:pointer;
}
.jsettings button:hover{background:var(--glow)}
.jsettings label{font-size:12.5px;color:var(--ink-soft);margin-left:4px}
.jsettings input[type=range]{width:90px;accent-color:var(--ember)}

/* subtle caption cue while a line is being voiced (gentle, no flashing) */
#dialogue.voiced #speaker::after{content:" ♪";color:var(--ember);opacity:.75}
#dialogue.voiced{box-shadow:0 6px 24px rgba(20,12,8,.45), 0 0 16px rgba(255,217,140,.28), inset 0 0 40px rgba(160,120,70,.12)}

.jhintrow{text-align:right;margin-bottom:8px}
#jAskPavo{
  font-family:inherit;font-size:13px;letter-spacing:.5px;
  background:var(--paper2);border:1px solid #cbb489;border-radius:14px;
  color:var(--ink);padding:4px 14px;cursor:pointer;
}
#jAskPavo:hover{background:var(--glow);border-color:var(--ember)}

.task{padding:8px 4px;border-bottom:1px dashed rgba(122,95,75,.3);font-size:15px;line-height:1.45}
.task.current{background:rgba(232,148,74,.12);border-left:3px solid var(--ember);padding-left:10px}
.task.done{color:var(--ink-soft);text-decoration:none}
.task.done::before{content:"✔ ";color:var(--ember)}
.task .tnote{display:block;font-size:13px;font-style:italic;color:var(--ink-soft);margin-top:2px}
.errhead{font-size:12px;letter-spacing:1.5px;text-transform:uppercase;color:var(--ember);margin:12px 0 2px;opacity:.85}

/* ---------- audio settings popup ---------- */
#audiopop{width:360px;max-width:92%}
.arow{display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:11px 4px;border-bottom:1px dashed rgba(122,95,75,.3)}
.arow .alabel{font-size:15.5px}
#apNarrRow .alabel{color:var(--ink-soft);font-size:14px;padding-left:10px}
.arow.disabled{opacity:.4;pointer-events:none}
/* audio status line + Enable button (visible only while the audio context is still locked) */
#apStatus{font-size:13px;color:var(--ink-soft);font-style:italic;text-align:right;flex:1}
#apEnable{width:auto;height:auto;font-size:13px;line-height:1;padding:6px 14px;border-radius:14px;
  background:linear-gradient(180deg,#f2b660,#e5893f);color:#3a2412;border:1px solid var(--ember);cursor:pointer}
#apEnable.hidden{display:none}
/* lantern switch: a warm bead that lights and slides right when On, dims left when Off */
.atoggle{
  position:relative;flex:none;width:56px;height:27px;padding:0;cursor:pointer;
  border-radius:16px;border:1px solid var(--ember);font-size:0;line-height:0;
  background:linear-gradient(180deg,#f2b660,#e5893f);
  box-shadow:inset 0 0 9px rgba(255,228,160,.65), inset 0 1px 0 rgba(255,255,255,.4), 0 1px 3px rgba(40,20,10,.25);
  transition:background .28s ease, box-shadow .28s ease, border-color .28s ease;
}
.atoggle::after{
  content:"";position:absolute;top:2.5px;left:31px;width:20px;height:20px;border-radius:50%;
  background:radial-gradient(circle at 38% 32%, #fff7db 0%, #ffd98c 70%, #f0b95e 100%);
  box-shadow:0 0 9px 2px rgba(255,217,140,.85), 0 1px 2px rgba(40,20,10,.35);
  transition:left .28s cubic-bezier(.5,1.6,.5,1), background .28s ease, box-shadow .28s ease;
}
.atoggle:hover{filter:brightness(1.05)}
.atoggle.off{
  background:linear-gradient(180deg,#e7d8bb,#d8c7a4);border-color:#c1a877;
  box-shadow:inset 0 1px 4px rgba(122,95,75,.35);
}
.atoggle.off::after{
  left:3.5px;background:radial-gradient(circle at 38% 32%, #f3ecda 0%, #d3c3a3 75%, #bfad8b 100%);
  box-shadow:0 1px 2px rgba(40,20,10,.28);
}
.atoggle:focus-visible{outline:2px solid var(--ember);outline-offset:2px}
.arow input[type=range]{width:120px;accent-color:var(--ember)}

.letter{margin-bottom:14px;padding:10px 14px;background:var(--paper2);border:1px solid #cbb489;border-radius:2px 14px 2px 8px}
.letter h3{font-size:13.5px;letter-spacing:1px;color:var(--ember);margin-bottom:4px;font-variant:small-caps}
.letter p{font-size:14.5px;font-style:italic;line-height:1.5;white-space:pre-line}
.letters-empty{font-style:italic;color:var(--ink-soft);font-size:14px}

/* inventory */
#invlist{display:flex;flex-direction:column;gap:2px}
.invrow{display:flex;justify-content:space-between;align-items:baseline;padding:7px 4px;border-bottom:1px dashed rgba(122,95,75,.3)}
.invrow .iname{font-size:15.5px}
.invrow .icount{font-size:14px;color:var(--ember);margin-left:10px;white-space:nowrap}
.invrow .idesc{display:block;font-size:13px;font-style:italic;color:var(--ink-soft)}
.inv-empty{font-style:italic;color:var(--ink-soft);font-size:14px;padding:8px 0}

/* ---------- atlas ---------- */
#atlas{
  background:
    radial-gradient(circle at 30% 20%, rgba(255,217,140,.08), transparent 50%),
    radial-gradient(circle at 70% 70%, rgba(140,120,255,.08), transparent 50%),
    linear-gradient(rgba(33,28,56,.92), rgba(23,18,37,.92));
  backdrop-filter:blur(5px); -webkit-backdrop-filter:blur(5px);
  border:1px solid #4c4270;border-radius:10px;color:#e8ddf5;
  box-shadow:0 8px 30px rgba(0,0,0,.6);
}
#atlas h2{color:var(--glow);border-bottom-color:rgba(255,217,140,.25)}
.atlasnote{font-size:13px;font-style:italic;color:#a99cc9;margin-bottom:12px}
#starlist{display:flex;flex-direction:column;gap:10px}
.star{
  display:flex;align-items:center;gap:14px;text-align:left;
  font-family:inherit;font-size:16px;color:#e8ddf5;cursor:pointer;
  background:rgba(255,255,255,.04);border:1px solid #4c4270;border-radius:8px;padding:10px 14px;
}
.star:hover:not(.locked){background:rgba(255,217,140,.12);border-color:var(--glow)}
.star .dot{width:14px;height:14px;border-radius:50%;background:var(--glow);box-shadow:0 0 12px var(--glow);flex:none}
.star .dot.home{background:#ffb060;box-shadow:0 0 12px #ffb060}
.star .dot.faint{background:#8f86b8;box-shadow:0 0 8px #8f86b8}
.star .sdesc{display:block;font-size:12.5px;font-style:italic;color:#a99cc9}
.star.locked{opacity:.55;cursor:default}
#atlas .panelhint{color:#a99cc9}

/* ---------- HUD ---------- */
#hud{
  position:absolute;top:10px;right:12px;display:flex;gap:6px;z-index:20;
  flex-wrap:wrap;justify-content:flex-end;max-width:62%;
}
#hud button{
  font-family:inherit;font-size:12.5px;letter-spacing:.5px;
  background:rgba(30,22,40,.7);color:#e8d9b8;border:1px solid rgba(232,148,74,.45);
  border-radius:14px;padding:4px 12px;cursor:pointer;white-space:nowrap;
}
#hud button:hover{background:rgba(232,148,74,.3)}
#daybadge{
  position:absolute;top:12px;left:14px;z-index:19;
  font-size:12.5px;letter-spacing:1.5px;color:#e8d9b8;opacity:.85;
  text-transform:uppercase;text-shadow:0 1px 4px rgba(0,0,0,.7);
  max-width:34%;line-height:1.5;
}
/* subtle auto-save indicator, bottom-right */
#savetag{
  position:absolute;right:14px;bottom:12px;z-index:19;
  font-size:11.5px;letter-spacing:1px;color:var(--glow);
  background:rgba(30,22,40,.65);border:1px solid rgba(255,217,140,.35);
  border-radius:12px;padding:3px 11px;
  opacity:0;transform:translateY(4px);transition:opacity .4s, transform .4s;
  pointer-events:none;text-shadow:0 1px 3px rgba(0,0,0,.6);
}
#savetag.show{opacity:.9;transform:translateY(0)}

/* narrow viewports / mobile: keep the badge and HUD out of each other's way */
@media (max-width:760px){
  #hud{gap:4px;max-width:58%}
  #hud button{font-size:10.5px;padding:3px 8px;letter-spacing:.2px}
  #daybadge{font-size:10px;letter-spacing:.8px;top:10px;max-width:36%}
}
@media (max-width:480px){
  #hud{max-width:74%;gap:3px}
  #hud button{font-size:9.5px;padding:2px 7px;min-height:24px}
  /* phones: the top edge belongs to the HUD; the badge moves to the bottom-left */
  #daybadge{top:auto;bottom:8px;left:10px;font-size:9px;letter-spacing:.5px;max-width:60%;z-index:15}
  #dtext{font-size:14.5px}
  .panel{max-height:80%;padding:14px 16px 10px}
}

/* ---------- title ---------- */
#title{
  position:absolute;inset:0;z-index:100;display:flex;overflow-y:auto;
  padding:24px 16px;                        /* scroll (don't clip) when the card is taller than the screen */
  background:
    radial-gradient(ellipse at 50% 110%, rgba(232,148,74,.25), transparent 55%),
    linear-gradient(#171225 0%, #241d3f 60%, #3a2a4a 100%);
  transition:opacity 1.2s;
}
#title.out{opacity:0;pointer-events:none}
/* the animated lantern-house art fills the whole menu, softly blurred so the words stay legible;
   the small #titleart canvas remains as the offscreen paint source it's blitted from */
#titlebg{
  position:absolute;inset:0;width:100%;height:100%;
  filter:blur(7px) saturate(1.08);   /* the blit overscans ~8% in-canvas to hide the blur's soft edges */
  pointer-events:none;               /* (a CSS scale here would overflow #title and spawn scrollbars) */
}
#titleshade{
  position:absolute;inset:0;pointer-events:none;
  background:
    radial-gradient(ellipse at 50% 46%, rgba(16,11,32,0.52), rgba(16,11,32,0.28) 55%, rgba(16,11,32,0.6) 100%);
}
/* margin:auto centers the card yet never clips its top/bottom on a short viewport */
#titlecard{text-align:center;color:#efe3c8;margin:auto;position:relative;z-index:1}
#titlecard h1{text-shadow:0 2px 18px rgba(10,6,20,.85), 0 0 4px rgba(10,6,20,.6)}
#titleart{display:none}   /* painted offscreen; shown full-screen via #titlebg instead */
#titlecard h1{font-size:34px;font-weight:normal;letter-spacing:3px;font-variant:small-caps;color:#f6ead2}
#titlecard .sub{font-style:italic;color:#c9b58f;margin:6px 0 22px;font-size:15px}
#titlebtns{display:flex;gap:12px;justify-content:center;margin-bottom:18px}
#titlebtns button{
  font-family:inherit;font-size:16px;letter-spacing:1px;
  background:transparent;color:var(--glow);border:1px solid rgba(255,217,140,.55);
  border-radius:20px;padding:9px 26px;cursor:pointer;transition:all .25s;
}
#titlebtns button:hover{background:rgba(255,217,140,.15);box-shadow:0 0 20px rgba(255,217,140,.25)}
/* gentle "why is it silent" note on the menu — hidden after the first gesture unlocks audio */
#soundhint{font-size:12.5px;color:var(--glow);letter-spacing:.8px;font-style:italic;margin-bottom:8px;
  opacity:.85;animation:soundpulse 2.6s ease-in-out infinite}
#soundhint.hidden{display:none}
@keyframes soundpulse{0%,100%{opacity:.45}50%{opacity:.9}}
.tinyhelp{font-size:12px;color:#8f86b8;letter-spacing:.5px}
.tinyhelp a{color:#a99cc9;text-decoration:underline dotted}
.tinyhelp a:hover{color:var(--glow)}
/* support link — warm, understated, on the title screen */
.support{margin-top:12px;font-size:13px;letter-spacing:.5px}
.support a{color:var(--glow);text-decoration:none;border-bottom:1px solid rgba(255,217,140,.35);padding-bottom:1px;transition:all .25s}
.support a:hover{color:#fff;border-bottom-color:var(--glow);text-shadow:0 0 12px rgba(255,217,140,.6)}
/* support link inside the Ledger */
.ledgersupport{text-align:center;margin-top:14px;padding-top:10px;border-top:1px solid rgba(122,95,75,.3);font-size:12.5px}
.ledgersupport a{color:var(--ember);text-decoration:none;border-bottom:1px solid rgba(232,148,74,.35);padding-bottom:1px;transition:all .2s}
.ledgersupport a:hover{color:var(--warn);border-bottom-color:var(--ember)}

/* ---------- fade ---------- */
/* ---------- minigame overlay ---------- */
#minigame{position:absolute;inset:0;z-index:130;background:#0c0e14;display:flex;flex-direction:column}
#minigame.hidden{display:none}
#mgbar{display:flex;align-items:center;gap:12px;padding:8px 14px;background:#171225;color:#efe3c8;border-bottom:1px solid #3a2a4a;flex-shrink:0}
#mginfo{display:flex;flex-direction:column;line-height:1.25;flex:1;min-width:0}
#mgtitle{font-variant:small-caps;letter-spacing:1px;font-size:15px;color:#f6ead2}
#mggoal{font-size:12px;color:#c9b58f;font-style:italic;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#mgclose{font-family:inherit;font-size:13px;background:transparent;color:#c9b58f;border:1px solid rgba(255,217,140,.45);border-radius:16px;padding:6px 15px;cursor:pointer;flex-shrink:0}
#mgclose:hover{background:rgba(255,217,140,.14);color:#fff}
#mgiframe{flex:1;width:100%;border:0;background:#0c0e14}

#fade{position:absolute;inset:0;background:#0e0a18;opacity:0;pointer-events:none;transition:opacity .7s;z-index:90}
#fade.on{opacity:1;pointer-events:all}

/* dedication splash — same dusk backdrop as the menu, a single romantic italic line */
#splash{
  position:absolute;inset:0;z-index:120;display:flex;align-items:center;justify-content:center;
  padding:24px;
  background:
    radial-gradient(ellipse at 50% 110%, rgba(232,148,74,.25), transparent 55%),
    linear-gradient(#171225 0%, #241d3f 60%, #3a2a4a 100%);
  opacity:0;pointer-events:none;transition:opacity 1.1s ease;
}
#splash.show{opacity:1;pointer-events:all}
#splashtext{
  font-family:Georgia,'Times New Roman',serif;font-style:italic;font-weight:normal;
  color:#e6d7b8;font-size:clamp(14px,2.4vw,19px);letter-spacing:.6px;
  text-align:center;max-width:80vw;line-height:1.6;
  text-shadow:0 1px 10px rgba(232,148,74,.22);
  opacity:0;transform:translateY(6px);
  transition:opacity 1.4s ease .35s, transform 1.6s ease .35s;
}
#splash.show #splashtext{opacity:1;transform:translateY(0)}

/* ---------- end of Chapter One — thank-you / to-be-continued ---------- */
#chapterend{
  position:absolute;inset:0;z-index:140;display:flex;align-items:center;justify-content:center;
  overflow-y:auto;padding:24px 16px;
  background:
    radial-gradient(ellipse at 50% 110%, rgba(232,148,74,.28), transparent 55%),
    linear-gradient(#171225 0%, #241d3f 60%, #3a2a4a 100%);
  animation:cefade 1.1s ease both;
}
#chapterend.hidden{display:none}
@keyframes cefade{from{opacity:0}to{opacity:1}}
#cecard{
  text-align:center;color:#efe3c8;margin:auto;width:min(520px,92vw);
  font-family:Georgia,'Times New Roman',serif;
}
#cekicker{
  font-variant:small-caps;letter-spacing:3px;font-size:13px;color:var(--glow);
  text-shadow:0 0 14px rgba(255,217,140,.4);margin-bottom:10px;
}
#cecard h2{
  font-size:30px;font-weight:normal;letter-spacing:2px;font-variant:small-caps;
  color:#f6ead2;margin:0 0 18px;
}
#cecard p{font-size:15px;line-height:1.7;color:#d8c8a6;margin:11px auto;max-width:44ch}
#cecard .celead{color:#efe3c8}
#cecard #cetbc{font-style:italic;color:#c9b58f;letter-spacing:1px;margin-top:16px}
#cebtns{display:flex;gap:12px;justify-content:center;flex-wrap:wrap;margin:24px 0 4px}
#cebtns button{
  font-family:inherit;font-size:15px;letter-spacing:1px;
  background:transparent;color:var(--glow);border:1px solid rgba(255,217,140,.55);
  border-radius:20px;padding:9px 24px;cursor:pointer;transition:all .25s;
}
#cebtns button:hover{background:rgba(255,217,140,.15);box-shadow:0 0 20px rgba(255,217,140,.25)}
