/* ---- vendored fonts (no external calls) ---- */
@font-face {
  font-family: "IM Fell English";
  font-style: normal;
  font-weight: 400;
  src: url("fonts/imfellenglish-regular.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "IM Fell English";
  font-style: italic;
  font-weight: 400;
  src: url("fonts/imfellenglish-italic.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Tangerine";
  font-style: normal;
  font-weight: 400;
  src: url("fonts/tangerine-regular.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Tangerine";
  font-style: normal;
  font-weight: 700;
  src: url("fonts/tangerine-bold.woff2") format("woff2");
  font-display: swap;
}

:root {
  --ink: #2b1c0e;
  --ink-soft: #4a341d;
  --parchment-1: #f3e2ba;
  --parchment-2: #e6cf9c;
  --parchment-edge: #b8945a;
  --wax: #7c1a1a;
  --wax-dark: #591010;
}

* { box-sizing: border-box; }

/* hidden must always win, even over .loader/.owl-fly/.tut-overlay display:flex */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "IM Fell English", Georgia, serif;
  color: var(--ink);
  /* candlelit night-sky backdrop behind the 3D dust */
  background:
    radial-gradient(1200px 700px at 50% -10%, #2a2340 0%, #171226 45%, #0c0916 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
}

#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

#app {
  position: relative;
  z-index: 1;
  width: min(680px, 92vw);
  margin: 40px auto;
}

/* ---- parchment card ---- */
.parchment {
  position: relative;
  padding: clamp(28px, 5vw, 52px);
  border-radius: 6px;
  background:
    radial-gradient(120% 120% at 30% 10%, var(--parchment-1) 0%, var(--parchment-2) 70%, #d8bd85 100%);
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.55),
    inset 0 0 60px rgba(150, 110, 60, 0.35),
    inset 0 0 3px rgba(90, 60, 20, 0.6);
  border: 1px solid var(--parchment-edge);
  /* torn, uneven edge feel */
  filter: drop-shadow(0 2px 0 rgba(0,0,0,0.05));
}
.parchment::after {
  /* subtle aged blotches */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 6px;
  pointer-events: none;
  background:
    radial-gradient(60px 40px at 15% 85%, rgba(120,80,30,0.12), transparent 70%),
    radial-gradient(80px 50px at 85% 20%, rgba(120,80,30,0.10), transparent 70%);
}
.parchment::before {
  /* a slight second sheet resting behind the parchment, for depth */
  content: "";
  position: absolute;
  inset: 9px -11px -13px 7px;
  z-index: -1;
  border-radius: 8px;
  background: linear-gradient(160deg, #e7cf9a 0%, #d8bd85 62%, #cbac72 100%);
  border: 1px solid var(--parchment-edge);
  transform: rotate(-1.4deg);
  box-shadow: 0 22px 42px rgba(0, 0, 0, 0.42);
  pointer-events: none;
}

.title {
  font-family: "Tangerine", cursive;
  font-weight: 700;
  font-size: clamp(64px, 14vw, 120px);
  line-height: 0.9;
  margin: 0 0 6px;
  text-align: center;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255,255,255,0.25);
}

.flavor {
  text-align: center;
  font-style: italic;
  color: var(--ink-soft);
  margin: 0 0 28px;
  font-size: 1.15rem;
}

/* ---- form fields ---- */
.field { display: block; margin: 0 0 20px; }
.field > span {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 6px;
  color: var(--ink-soft);
}
.field em { font-style: italic; opacity: 0.8; font-size: 0.95rem; }

input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  font-family: "IM Fell English", Georgia, serif;
  font-size: 1.15rem;
  color: var(--ink);
  background: rgba(255, 250, 235, 0.55);
  border: none;
  border-bottom: 2px solid rgba(90, 60, 20, 0.5);
  padding: 10px 6px;
  outline: none;
}
input:focus, textarea:focus {
  background: rgba(255, 250, 235, 0.85);
  border-bottom-color: var(--wax);
}

/* ---- wax seal button ---- */
.wax-btn {
  display: inline-block;
  font-family: "IM Fell English", Georgia, serif;
  font-size: 1.15rem;
  letter-spacing: 0.3px;
  color: #f6e3c6;
  cursor: pointer;
  padding: 12px 28px;
  border: none;
  border-radius: 40px;
  background: radial-gradient(circle at 35% 30%, #a83232 0%, var(--wax) 55%, var(--wax-dark) 100%);
  box-shadow: 0 6px 16px rgba(80, 15, 15, 0.5), inset 0 2px 4px rgba(255,255,255,0.25);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.wax-btn:hover { transform: translateY(-1px); }
.wax-btn:active { transform: translateY(1px); box-shadow: 0 3px 8px rgba(80,15,15,0.5); }
.wax-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ---- chat view ---- */
.chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  font-style: italic;
  color: var(--ink-soft);
}
.turn-badge {
  font-style: normal;
  font-size: 0.95rem;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(124, 26, 26, 0.12);
  border: 1px solid rgba(124, 26, 26, 0.3);
}
.turn-badge.mine { background: rgba(30, 100, 40, 0.15); border-color: rgba(30,100,40,0.4); }
.head-right { display: flex; align-items: center; gap: 10px; }

/* small round icon button (history drawer, close) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(90, 60, 20, 0.4);
  background: rgba(255, 250, 235, 0.4);
  color: var(--ink);
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.icon-btn:hover { background: rgba(255, 250, 235, 0.85); border-color: var(--wax); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

/* --------------------------------------------------------------------------- */
/* History drawer                                                               */
/* --------------------------------------------------------------------------- */
.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(8, 6, 16, 0.55);
  backdrop-filter: blur(2px);
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 71;
  width: min(380px, 88vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(140% 100% at 100% 0%, var(--parchment-1) 0%, var(--parchment-2) 70%, #d8bd85 100%);
  box-shadow: -18px 0 50px rgba(0, 0, 0, 0.5);
  border-left: 1px solid var(--parchment-edge);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 14px;
  border-bottom: 1px dashed rgba(90, 60, 20, 0.4);
}
.drawer-title {
  font-family: "Tangerine", cursive;
  font-weight: 700;
  font-size: 3rem;
  line-height: 1;
  margin: 0;
  color: var(--ink);
}
.drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.drawer-empty {
  text-align: center;
  font-style: italic;
  color: var(--ink-soft);
  margin-top: 24px;
}

.hist-item {
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 252, 240, 0.55);
  border: 1px solid rgba(90, 60, 20, 0.25);
  max-width: 88%;
  align-self: flex-start;
}
.hist-item.mine {
  align-self: flex-end;
  background: rgba(124, 26, 26, 0.1);
  border-color: rgba(124, 26, 26, 0.3);
}
.hist-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.hist-who { font-style: italic; font-weight: 700; }
.hist-body {
  font-family: "Tangerine", cursive;
  font-size: 1.7rem;
  line-height: 1.1;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}
.hist-locked { font-family: "IM Fell English", serif; font-size: 0.95rem; font-style: italic; color: var(--wax); }

.letter {
  min-height: 120px;
  padding: 22px 20px;
  margin-bottom: 26px;
  background: rgba(255, 252, 240, 0.4);
  border: 1px dashed rgba(90, 60, 20, 0.4);
  border-radius: 4px;
}
.letter-meta {
  margin: 0 0 8px;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink-soft);
}
.letter-body {
  font-family: "Tangerine", cursive;
  font-size: clamp(30px, 5vw, 40px);
  line-height: 1.15;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}
.letter-body.faded { opacity: 0; }
.letter-body.appear { animation: inkIn 0.9s ease forwards; }
@keyframes inkIn {
  from { opacity: 0; filter: blur(3px); transform: translateY(6px); }
  to   { opacity: 1; filter: blur(0); transform: none; }
}

.reply { position: relative; }
.reply textarea { min-height: 90px; resize: vertical; }
.reply-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}
.reply-right { display: flex; align-items: center; gap: 14px; }

/* outlined "ghost" button (Express emotions) */
.ghost-btn {
  font-family: "IM Fell English", Georgia, serif;
  font-size: 1.02rem;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 9px 16px;
  border: 1px solid rgba(90, 60, 20, 0.45);
  border-radius: 40px;
  background: rgba(255, 250, 235, 0.4);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.ghost-btn:hover { background: rgba(255, 250, 235, 0.75); border-color: var(--wax); }
.ghost-btn.active {
  background: rgba(124, 26, 26, 0.12);
  border-color: var(--wax);
  color: var(--ink);
}

/* on-screen emoji keyboard */
.emoji-panel {
  margin-top: 12px;
  padding: 12px 14px;
  max-height: 210px;
  overflow-y: auto;
  border: 1px solid rgba(90, 60, 20, 0.4);
  border-radius: 8px;
  background: rgba(255, 252, 240, 0.6);
  box-shadow: inset 0 0 20px rgba(150, 110, 60, 0.18);
  animation: riseIn 0.25s ease both;
}
.emoji-section { margin-bottom: 10px; }
.emoji-section:last-child { margin-bottom: 0; }
.emoji-label {
  font-style: italic;
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 2px;
}
.emoji-key {
  font-size: 1.5rem;
  line-height: 1;
  padding: 5px 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.08s ease;
}
.emoji-key:hover { background: rgba(124, 26, 26, 0.12); transform: scale(1.15); }
.emoji-key:active { transform: scale(0.95); }

.waiting {
  text-align: center;
  color: var(--ink-soft);
  font-style: italic;
  font-size: 1.15rem;
}
.owl-icon {
  display: block;
  font-size: 3rem;
  animation: bob 2.6s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

.error {
  color: var(--wax);
  font-style: italic;
  font-size: 0.98rem;
  margin: 6px 0 0;
}

/* --------------------------------------------------------------------------- */
/* Welcome / Lumos gate                                                         */
/* --------------------------------------------------------------------------- */
.welcome {
  position: relative;
  text-align: center;
  padding: 20px 16px 40px;
  color: #efe6d0;
  animation: riseIn 0.9s ease both;
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}
/* fade the welcome away once Lumos is cast */
.welcome.dismiss {
  animation: dimOut 0.7s ease forwards;
  pointer-events: none;
}
@keyframes dimOut {
  to { opacity: 0; transform: scale(1.04); }
}

/* lightning scar */
.scar {
  width: 44px;
  height: 66px;
  color: #d9b48a;
  filter: drop-shadow(0 0 8px rgba(220, 190, 140, 0.55));
  margin-bottom: 4px;
  animation: scarSpark 5.5s ease-in-out infinite;
}
@keyframes scarSpark {
  0%, 88%, 100% { color: #d9b48a; filter: drop-shadow(0 0 8px rgba(220,190,140,0.5)); }
  92%           { color: #fff6dc; filter: drop-shadow(0 0 18px rgba(255,240,200,0.95)); }
}

.welcome-title {
  color: #f4ead2;
  text-shadow: 0 2px 18px rgba(180, 150, 90, 0.45);
  margin-bottom: 0;
}
.welcome-sub {
  font-style: italic;
  font-size: 1.2rem;
  color: #cdbf9d;
  margin: 0 0 6px;
}

/* Hedwig, the snowy owl */
.hedwig {
  width: clamp(150px, 34vw, 200px);
  height: auto;
  margin: 6px auto 10px;
  display: block;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.5));
  animation: owlFloat 4.2s ease-in-out infinite;
}
@keyframes owlFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}
.owl-white  { fill: #f7f5ef; }
.owl-wing   { fill: #e7e3d6; }
.owl-disc   { fill: #ffffff; }
.owl-speck ellipse { fill: #cfc7b4; }
.owl-shadow { fill: rgba(0, 0, 0, 0.35); }
.owl-eye-ring { fill: #e6a533; }
.owl-eye    { fill: #241a0e; }
.owl-glint  { fill: #fff; }
.owl-beak   { fill: #d98a2b; color: #d98a2b; }

/* Lumos wand button */
.lumos-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding: 14px 34px 14px 26px;
  font-family: "IM Fell English", Georgia, serif;
  font-size: 1.5rem;
  letter-spacing: 1px;
  color: #f6ecd2;
  cursor: pointer;
  background: linear-gradient(180deg, #2a2036 0%, #191325 100%);
  border: 1px solid rgba(220, 200, 150, 0.35);
  border-radius: 40px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.06);
  transition: transform 0.14s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.lumos-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 240, 200, 0.7);
  box-shadow: 0 10px 28px rgba(0,0,0,0.55), 0 0 26px rgba(255, 235, 180, 0.35);
}
.lumos-btn:active { transform: translateY(0); }
.lumos-btn.casting { pointer-events: none; }

/* the wand: a slim wooden shaft with a glowing tip */
.wand {
  position: relative;
  width: 46px;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #5a3b22 0%, #7a5230 60%, #916338 100%);
  transform: rotate(-12deg);
  flex: none;
}
.wand::after {
  /* glowing tip */
  content: "";
  position: absolute;
  right: -5px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: radial-gradient(circle, #fffef2 0%, #ffe9a8 45%, rgba(255,220,120,0) 75%);
  box-shadow: 0 0 10px 3px rgba(255, 226, 150, 0.7);
  animation: tipIdle 2.6s ease-in-out infinite;
}
@keyframes tipIdle {
  0%, 100% { opacity: 0.75; box-shadow: 0 0 8px 2px rgba(255,226,150,0.55); }
  50%      { opacity: 1;    box-shadow: 0 0 14px 5px rgba(255,235,170,0.85); }
}
.lumos-btn.casting .wand::after {
  animation: tipBlaze 0.6s ease forwards;
}
@keyframes tipBlaze {
  to { box-shadow: 0 0 40px 22px rgba(255, 245, 210, 1); opacity: 1; }
}

.welcome-hint {
  font-style: italic;
  color: #9c916f;
  font-size: 1rem;
  margin: 16px 0 0;
}
.welcome-err { text-align: center; color: #ffb4a0; }

/* small text link (e.g. "How it works") */
.link-btn {
  display: inline-block;
  margin: 18px auto 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: "IM Fell English", Georgia, serif;
  font-size: 1rem;
  color: #cdbf9d;
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: color 0.2s ease;
}
.link-btn:hover { color: #f4ead2; }

/* on the parchment (dark ink on light), the forget link needs ink colours */
.forget-link {
  display: block;
  margin: 20px auto 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
  opacity: 0.8;
}
.forget-link:hover { color: var(--wax); opacity: 1; }

/* --------------------------------------------------------------------------- */
/* First-time tutorial overlay                                                  */
/* --------------------------------------------------------------------------- */
.tut-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 6, 16, 0.72);
  backdrop-filter: blur(3px);
  animation: riseIn 0.4s ease both;
}
.tut-card {
  width: min(560px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  text-align: left;
}
.tut-title {
  font-family: "Tangerine", cursive;
  font-weight: 700;
  font-size: clamp(44px, 9vw, 64px);
  line-height: 1;
  text-align: center;
  margin: 0 0 8px;
  color: var(--ink);
}
.tut-intro {
  text-align: center;
  font-style: italic;
  color: var(--ink-soft);
  margin: 0 0 22px;
  font-size: 1.1rem;
}
.tut-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 26px;
}
.tut-steps li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
  font-size: 1.08rem;
  line-height: 1.4;
  color: var(--ink);
}
.tut-steps strong { color: var(--ink); }
.tut-steps em { font-style: italic; }
.tut-emoji {
  flex: none;
  font-size: 1.7rem;
  line-height: 1;
  margin-top: 2px;
}
.tut-card .wax-btn { display: block; margin: 0 auto; }

/* --------------------------------------------------------------------------- */
/* Lumos flash — screen brightens like a light switched on, then settles        */
/* --------------------------------------------------------------------------- */
.flash {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background: radial-gradient(circle at 50% 62%, #fffdf6 0%, #fff3d4 40%, #f6e6c0 100%);
  opacity: 0;
}
.flash.cast { animation: lumosFlash 1.6s ease-out forwards; }
@keyframes lumosFlash {
  0%   { opacity: 0; }
  22%  { opacity: 1; }       /* light snaps on */
  45%  { opacity: 0.96; }    /* holds bright */
  100% { opacity: 0; }       /* eases back to normal */
}

/* --------------------------------------------------------------------------- */
/* Parchment unroll — the passage/letter unfurls into view                      */
/* --------------------------------------------------------------------------- */
.unroll {
  transform-origin: top center;
  animation: unrollScroll 1.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes unrollScroll {
  0%   { transform: scaleY(0.02); opacity: 0.2; filter: blur(1px); }
  55%  { transform: scaleY(1.03); opacity: 1;   filter: blur(0); }
  100% { transform: scaleY(1);    opacity: 1; }
}

/* --------------------------------------------------------------------------- */
/* Setup steps + gate interstitial                                              */
/* --------------------------------------------------------------------------- */
.setup-step { animation: riseIn 0.5s ease both; }

/* identity choice: the two friends, side by side */
.who-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.who-row .wax-btn { min-width: 130px; }

.gate-loading {
  text-align: center;
  padding: 20px 10px 8px;
}
.gate-loading .loader-owl {
  width: 120px;
  height: auto;
  display: block;
  margin: 0 auto 14px;
  filter: drop-shadow(0 10px 16px rgba(90, 60, 20, 0.4));
  animation: owlFloat 2.4s ease-in-out infinite;
}
.gate-loading .loader-text {
  color: var(--ink-soft);
  text-shadow: none;
}

.gate-status {
  text-align: center;
  padding: 8px 6px;
  animation: riseIn 0.5s ease both;
}
.gate-emoji {
  display: block;
  font-size: 3.4rem;
  margin-bottom: 6px;
  animation: bob 2.6s ease-in-out infinite;
}
.gate-title {
  font-family: "Tangerine", cursive;
  font-weight: 700;
  font-size: clamp(48px, 10vw, 72px);
  line-height: 1;
  margin: 0 0 8px;
  color: var(--ink);
}
.gate-msg {
  font-style: italic;
  font-size: 1.2rem;
  color: var(--ink-soft);
  margin: 0 0 24px;
}

/* --------------------------------------------------------------------------- */
/* Shared owl: flapping wings (used by loader + send flight)                    */
/* --------------------------------------------------------------------------- */
.fowl .wing.left  { transform-origin: 50px 46px; animation: flapL 0.30s ease-in-out infinite; }
.fowl .wing.right { transform-origin: 70px 46px; animation: flapR 0.30s ease-in-out infinite; }
.fowl .wing path  { fill: #e7e3d6; }
@keyframes flapL { 0%, 100% { transform: rotate(6deg); } 50% { transform: rotate(-30deg); } }
@keyframes flapR { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(30deg); } }

/* --------------------------------------------------------------------------- */
/* Loading screen                                                               */
/* --------------------------------------------------------------------------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  background: radial-gradient(1000px 700px at 50% 40%, #241d38 0%, #140f22 55%, #090612 100%);
  transition: opacity 0.7s ease;
}
.loader.done { opacity: 0; pointer-events: none; }
.loader-stage {
  position: relative;
  width: 220px;
  height: 220px;
  display: grid;
  place-items: center;
}
.rune-ring {
  position: absolute;
  inset: 0;
  width: 220px;
  height: 220px;
  color: #d9b48a;
  filter: drop-shadow(0 0 10px rgba(220, 190, 140, 0.4));
  animation: ringSpin 14s linear infinite;
}
.rune-ring .ring-outer,
.rune-ring .ring-mid {
  fill: none;
  stroke: rgba(220, 190, 140, 0.55);
  stroke-width: 1.5;
  stroke-dasharray: 6 10;
}
.rune-ring .ring-mid { stroke-dasharray: 3 8; opacity: 0.7; }
.rune-ring .ring-glyphs text {
  fill: #e9d3ab;
  font-size: 16px;
  text-anchor: middle;
  dominant-baseline: middle;
}
.loader-owl {
  position: relative;
  width: 118px;
  height: auto;
  z-index: 1;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,0.5));
  animation: owlFloat 2.4s ease-in-out infinite;
}
@keyframes ringSpin { to { transform: rotate(360deg); } }
.loader-text {
  font-family: "IM Fell English", Georgia, serif;
  font-size: 1.4rem;
  letter-spacing: 0.5px;
  color: #e9d9b8;
  text-shadow: 0 2px 14px rgba(180, 150, 90, 0.4);
}
.loader-text .dots {
  display: inline-block;
  width: 1.2em;
  text-align: left;
  animation: dots 1.4s steps(4, end) infinite;
  overflow: hidden;
  vertical-align: bottom;
}
@keyframes dots {
  0%   { clip-path: inset(0 100% 0 0); }
  100% { clip-path: inset(0 0 0 0); }
}

/* --------------------------------------------------------------------------- */
/* Send flight: parchment folds, owl carries it off-screen                      */
/* --------------------------------------------------------------------------- */
.owl-fly {
  position: fixed;
  inset: 0;
  z-index: 55;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fly-stage {
  position: relative;
  width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.fly-owl { width: 120px; height: auto; filter: drop-shadow(0 8px 12px rgba(0,0,0,0.5)); }
.fly-scroll {
  width: 64px;
  height: 78px;
  margin-top: -6px;
  border-radius: 4px;
  background:
    linear-gradient(90deg, rgba(120,80,30,0.25) 0 2px, transparent 2px) 20% 0/20px 100%,
    radial-gradient(120% 120% at 30% 10%, var(--parchment-1) 0%, var(--parchment-2) 80%);
  box-shadow: 0 4px 10px rgba(0,0,0,0.4), inset 0 0 8px rgba(150,110,60,0.4);
  transform-origin: center top;
}
.owl-fly.go .fly-stage   { animation: flyAway 2.1s cubic-bezier(0.5, 0, 0.75, 1) forwards; }
.owl-fly.go .fly-scroll  { animation: foldUp 0.6s ease forwards; }
@keyframes foldUp {
  0%   { height: 78px; border-radius: 4px; }
  60%  { height: 26px; border-radius: 4px 4px 10px 10px / 4px 4px 14px 14px; }
  100% { height: 22px; width: 58px; border-radius: 6px 6px 12px 12px; }
}
@keyframes flyAway {
  0%   { transform: translate(0, 26px) scale(1);            opacity: 1; }
  16%  { transform: translate(0, 0) scale(1);               opacity: 1; }
  100% { transform: translate(46vw, -66vh) scale(0.28) rotate(10deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .rune-ring, .fowl .wing.left, .fowl .wing.right,
  .loader-owl, .hedwig, .scar { animation: none; }
}

@media (max-width: 480px) {
  #app { margin: 16px auto; }
}
