/* The Hub: a private owlery. Original CSS and SVG art only; fonts are self-hosted. */

@font-face { font-family: "Cinzel"; font-weight: 400; font-style: normal; font-display: swap; src: url("./fonts/cinzel-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Cinzel"; font-weight: 700; font-style: normal; font-display: swap; src: url("./fonts/cinzel-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IM Fell English"; font-weight: 400; font-style: normal; font-display: swap; src: url("./fonts/im-fell-english-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IM Fell English"; font-weight: 400; font-style: italic; font-display: swap; src: url("./fonts/im-fell-english-latin-400-italic.woff2") format("woff2"); }

:root {
  --display: "Cinzel", "Trajan Pro", Georgia, serif;
  --body: "IM Fell English", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* Lumos: parchment by day */
  --bg: #e9d8ae;
  --bg-glow: #f6ead0;
  --paper: #f9f0d9;
  --paper-2: #f0e1ba;
  --ink: #2a1a0c;
  --ink-soft: #5a4128;
  --line: #a98a52;
  --line-strong: #7d5f2d;
  --gold: #8a6212;
  --gold-bright: #d9a93a;
  --focus: #1d3f7a;
  --btn-bg: #7a1520;
  --btn-fg: #fbf1d6;
  --btn-ghost-fg: #7a1520;
  --link: #1d3f7a;
  --danger: #8a1220;
  --good: #1f5a3a;
  --shadow: 0 2px 0 rgba(90, 60, 20, 0.25), 0 10px 24px -12px rgba(60, 35, 10, 0.5);
  --dt-bg: #f6dcd3;
  --dt-line: #8a1f2d;
  --albus-bg: #dce3f2;
  --albus-line: #1d3f7a;
  --note-bg: #ece6d4;
  --map-paper: #e3cc96;
  --map-paper-2: #d2b673;
  --map-ink: #3b2310;
  --candle-glow: rgba(255, 190, 80, 0.55);
  --torch: rgba(255, 150, 40, 0.26);

  --st-open: #1d4f9a;
  --st-progress: #9a6a00;
  --st-blocked: #5b5b66;
  --st-done: #6b2fa0;
  --st-verified: #1f6a3c;
  --st-closed: #74603c;
  --st-deferred: #0e6b78;
  --st-rejected: #9a1c2c;
}

:root[data-theme="dark"] {
  /* Nox: midnight in the Great Hall */
  --bg: #0a0f22;
  --bg-glow: #18204a;
  --paper: #151c3a;
  --paper-2: #1d2650;
  --ink: #f0e7cb;
  --ink-soft: #bdbddb;
  --line: #3b4678;
  --line-strong: #7782c4;
  --gold: #eec26a;
  --gold-bright: #f3c969;
  --focus: #ffd96b;
  --btn-bg: #a3243a;
  --btn-fg: #fff4dc;
  --btn-ghost-fg: #f3c969;
  --link: #9cc0ff;
  --danger: #ff9aa6;
  --good: #7fe0a8;
  --shadow: 0 2px 0 rgba(0, 0, 0, 0.4), 0 12px 28px -12px rgba(0, 0, 0, 0.8);
  --dt-bg: #3a1a2a;
  --dt-line: #ff8f9d;
  --albus-bg: #17254f;
  --albus-line: #8fb4ff;
  --note-bg: #1c2240;
  --map-paper: #3a3222;
  --map-paper-2: #2d2719;
  --map-ink: #f2dfae;
  --candle-glow: rgba(255, 200, 100, 0.35);
  --torch: rgba(255, 140, 40, 0.16);

  --st-open: #8fb4ff;
  --st-progress: #f3c969;
  --st-blocked: #b3b3c2;
  --st-done: #c9a2ff;
  --st-verified: #7fe0a8;
  --st-closed: #c9b68a;
  --st-deferred: #6fdbe8;
  --st-rejected: #ff8f9d;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body);
  font-size: 1.125rem;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--bg-glow), transparent 70%),
    repeating-linear-gradient(0deg, rgba(120, 80, 30, 0.035) 0 2px, transparent 2px 5px),
    var(--bg);
  background-attachment: fixed;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; line-height: 1.2; margin: 0 0 0.5em; letter-spacing: 0.02em; }
p { margin: 0 0 0.8em; }
small { font-size: 0.82em; color: var(--ink-soft); }
.muted { color: var(--ink-soft); }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

/* ---------- Atmosphere ---------- */
.atmosphere { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.torch { position: absolute; top: 18%; width: 46vw; max-width: 640px; height: 70vh; background: radial-gradient(closest-side, var(--torch), transparent); animation: torch-flicker 3.4s ease-in-out infinite; }
.torch-l { left: -18vw; }
.torch-r { right: -18vw; animation-delay: -1.7s; }
.candles { position: absolute; top: 84px; left: 0; right: 0; height: 120px; }
.candle { position: absolute; width: 9px; height: 40px; background: linear-gradient(90deg, #d8c79a, #fff4d2 45%, #cdb98a); border-radius: 2px 2px 1px 1px; animation: candle-float 7s ease-in-out infinite; opacity: 0.85; }
.flame { position: absolute; left: 50%; top: -17px; width: 11px; height: 18px; margin-left: -5.5px; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; background: radial-gradient(ellipse at 50% 70%, #fff6c8 0 25%, #ffc24a 55%, #ff8a1f 100%); box-shadow: 0 0 22px 8px var(--candle-glow); animation: flame 1.3s ease-in-out infinite alternate; transform-origin: 50% 100%; }
.candle:nth-child(1) { left: 6%; top: 10px; animation-delay: -1s; }
.candle:nth-child(2) { left: 17%; top: 52px; height: 30px; animation-delay: -3s; }
.candle:nth-child(3) { left: 29%; top: 4px; animation-delay: -5s; }
.candle:nth-child(4) { left: 41%; top: 44px; height: 34px; animation-delay: -2s; }
.candle:nth-child(5) { left: 55%; top: 8px; animation-delay: -4s; }
.candle:nth-child(6) { left: 67%; top: 56px; height: 28px; animation-delay: -6s; }
.candle:nth-child(7) { left: 80%; top: 2px; animation-delay: -1.5s; }
.candle:nth-child(8) { left: 92%; top: 40px; height: 36px; animation-delay: -3.5s; }
.candle:nth-child(odd) .flame { animation-duration: 1.1s; }
@keyframes candle-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes flame { 0% { transform: scale(1, 1) rotate(-3deg); } 100% { transform: scale(0.92, 1.1) rotate(3deg); } }
@keyframes torch-flicker { 0%, 100% { opacity: 0.85; } 22% { opacity: 1; } 48% { opacity: 0.7; } 71% { opacity: 0.95; } }

#shell, #view-signin { position: relative; z-index: 1; }

/* ---------- Masthead ---------- */
.masthead {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, #2c190d, #1f1209);
  color: #f6e4b0;
  border-bottom: 3px double #d9a93a;
  --focus: #ffd96b;
  --btn-bg: #7a1520;
}
.masthead-in { max-width: 1240px; margin: 0 auto; padding: 0.55rem 1rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 0.6rem; color: inherit; text-decoration: none; }
.brand-crest { width: 44px; height: 44px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 1.35rem; letter-spacing: 0.08em; }
.brand-sub { font-style: italic; font-size: 0.9rem; color: #e1c98a; }
.tabs { display: flex; gap: 0.25rem; margin-left: 0.5rem; flex: 1; }
.tabs a { font-family: var(--display); font-size: 0.9rem; letter-spacing: 0.04em; color: #f6e4b0; text-decoration: none; padding: 0.55rem 0.9rem; border-radius: 6px 6px 0 0; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a:hover { background: rgba(255, 220, 140, 0.12); }
.tabs a[aria-current="page"] { border-bottom-color: #ffd96b; background: rgba(255, 220, 140, 0.16); color: #fff7dc; }
.masthead-tools { display: flex; align-items: center; gap: 0.6rem; }
.who { font-style: italic; font-size: 0.95rem; color: #e8d29a; max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Crest ---------- */
.crest-disc { fill: #7a1520; stroke: #d9a93a; stroke-width: 4; }
.crest-ring { fill: none; stroke: #d9a93a; stroke-width: 1.5; stroke-dasharray: 3 4; }
.crest-wand { stroke: #f6e4b0; stroke-width: 6; stroke-linecap: round; fill: none; }
.crest-star { fill: #ffd96b; }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--display); font-weight: 700; font-size: 0.95rem; letter-spacing: 0.04em;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 44px; padding: 0.55rem 1.2rem;
  color: var(--btn-fg); background: var(--btn-bg);
  border: 2px solid #d9a93a; border-radius: 999px;
  cursor: pointer; text-decoration: none;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease, filter 0.12s ease;
}
.btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: progress; transform: none; }
.btn-small { min-height: 36px; padding: 0.3rem 0.85rem; font-size: 0.8rem; }
.btn-ghost { background: transparent; color: var(--btn-ghost-fg); border-color: currentColor; box-shadow: none; }
.btn-wax .wax { width: 1.15em; height: 1.15em; border-radius: 52% 48% 55% 45% / 48% 55% 45% 52%; background: radial-gradient(circle at 35% 30%, #ff9aa0, #b0202c 55%, #5e0d16); box-shadow: inset 0 0 0 2px rgba(255, 220, 160, 0.5); flex: none; }
.link { font: inherit; color: var(--link); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 1rem; }
.label { display: block; font-family: var(--display); font-weight: 700; font-size: 0.82rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); margin-bottom: 0.3rem; }
input[type="text"], input[type="password"], input[type="search"], textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper);
  border: 2px solid var(--line-strong); border-radius: 8px; padding: 0.6rem 0.8rem;
}
textarea { resize: vertical; min-height: 7rem; }
::placeholder { color: var(--ink-soft); opacity: 0.85; font-style: italic; }
.check, .radio { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; min-height: 44px; }
input[type="checkbox"], input[type="radio"] { width: 1.25rem; height: 1.25rem; accent-color: var(--btn-bg); }
fieldset.device { border: 0; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: 0.2rem 1.4rem; }
fieldset.device legend { padding: 0; margin-bottom: 0.2rem; }
.error-line { color: var(--danger); font-weight: 700; }
.row-end { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1rem; }

/* ---------- Sign-in ---------- */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.signin-card { width: min(440px, 100%); background: var(--paper); border: 3px double var(--gold-bright); border-radius: 14px; padding: 1.6rem 1.6rem 1.4rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 0.2rem; text-align: center; }
.signin-card .field, .signin-card .check { text-align: left; }
.signin-card h1 { font-size: 1.5rem; margin-bottom: 0.3rem; }
.crest { width: 92px; height: 92px; margin: 0 auto 0.6rem; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35)); }
.signin-card .btn { margin-top: 0.4rem; }

/* ---------- Rooms ---------- */
.room { max-width: 1240px; margin: 0 auto; padding: 1.2rem 1rem 3rem; outline: none; }
.room-title { font-size: clamp(1.6rem, 4.5vw, 2.4rem); text-align: center; margin-bottom: 0.2rem; color: var(--ink); text-shadow: 0 1px 0 var(--paper); }
.room-sub { text-align: center; font-style: italic; color: var(--ink-soft); margin-bottom: 1.2rem; }
.panel { background: var(--paper); border: 2px solid var(--line-strong); border-radius: 12px; padding: 1.1rem 1.2rem 1.2rem; box-shadow: var(--shadow); margin-bottom: 1.6rem; position: relative; }
.panel::before { content: ""; position: absolute; inset: 5px; border: 1px solid var(--line); border-radius: 8px; pointer-events: none; }
.panel > h2 { font-size: 1.25rem; }
.foot { text-align: center; padding: 1rem; font-style: italic; color: var(--ink-soft); font-size: 0.95rem; }

.drop { border: 2px dashed var(--line-strong); border-radius: 10px; padding: 0.8rem 1rem; background: var(--paper-2); transition: background 0.15s; }
.drop.is-over { background: var(--albus-bg); border-color: var(--albus-line); border-style: solid; }
.drop p { margin: 0 0 0.3rem; }
.thumbs { list-style: none; padding: 0; margin: 0.4rem 0 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.thumb { position: relative; width: 92px; height: 92px; border: 2px solid var(--gold-bright); border-radius: 8px; overflow: hidden; background: var(--paper); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button { position: absolute; top: 2px; right: 2px; width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff4dc; background: #7a1520; color: #fff4dc; font-weight: 700; cursor: pointer; line-height: 1; }
.thumb .thumb-state { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(20, 10, 4, 0.82); color: #f6e4b0; font-size: 0.7rem; padding: 1px 4px; text-align: center; }
.owl-progress-wrap { margin-top: 0.8rem; }
progress { width: 100%; height: 14px; border: 0; border-radius: 99px; overflow: hidden; background: var(--paper-2); box-shadow: inset 0 0 0 2px var(--line-strong); accent-color: var(--btn-bg); }
progress::-webkit-progress-bar { background: var(--paper-2); }
progress::-webkit-progress-value { background: linear-gradient(90deg, #b0202c, #d9a93a); border-radius: 99px; transition: width 0.25s ease; }
progress::-moz-progress-bar { background: linear-gradient(90deg, #b0202c, #d9a93a); border-radius: 99px; }

/* ---------- Feed ---------- */
.feed-head { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.feed-head h2 { margin: 0; font-size: 1.3rem; }
.count-pill { font-family: var(--display); font-size: 0.8rem; background: var(--btn-bg); color: var(--btn-fg); border-radius: 99px; padding: 0.1rem 0.6rem; vertical-align: middle; }
.accio { max-width: 520px; margin-top: 0.6rem; }
.accio input { font-size: 1.05rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.chip { font-family: var(--display); font-size: 0.78rem; letter-spacing: 0.03em; font-weight: 700; min-height: 40px; padding: 0.3rem 0.8rem; border-radius: 99px; border: 2px solid var(--chip-c, var(--line-strong)); background: var(--paper); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 0.4rem; }
.chip:hover { background: var(--paper-2); }
.chip[aria-pressed="true"] { background: var(--chip-c, var(--btn-bg)); color: var(--chip-fg, #fff); }
.chip .n { font-family: var(--body); font-weight: 400; opacity: 0.85; }
.chip-all { --chip-c: var(--line-strong); --chip-fg: var(--paper); }
.chip.s-open { --chip-c: var(--st-open); }
.chip.s-progress { --chip-c: var(--st-progress); }
.chip.s-blocked { --chip-c: var(--st-blocked); }
.chip.s-done { --chip-c: var(--st-done); }
.chip.s-verified { --chip-c: var(--st-verified); }
.chip.s-closed { --chip-c: var(--st-closed); }
.chip.s-deferred { --chip-c: var(--st-deferred); }
.chip.s-rejected { --chip-c: var(--st-rejected); }
:root[data-theme="dark"] .chip[aria-pressed="true"] { --chip-fg: #0a0f22; }
:root[data-theme="dark"] .chip-all[aria-pressed="true"] { --chip-fg: #0a0f22; }

.state { text-align: center; color: var(--ink-soft); font-style: italic; min-height: 0; }
.state:empty { display: none; }
.state .btn { margin-top: 0.6rem; }
.state-card { background: var(--paper); border: 2px dashed var(--line-strong); border-radius: 12px; padding: 1.2rem; max-width: 520px; margin: 1rem auto; color: var(--ink); font-style: normal; }
.state-card .big { font-size: 2.4rem; display: block; }
.state-error { border-color: var(--danger); }
.hat { display: inline-block; width: 48px; height: 48px; animation: wobble 1.6s ease-in-out infinite; }
.hat path { fill: #6a4a2a; stroke: #2a1a0c; stroke-width: 2; }
.hat .brim { fill: #5a3d20; }
.dots::after { content: ""; animation: dots 1.6s steps(4, end) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75%, 100% { content: "..."; } }
@keyframes wobble { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(7deg) translateY(-3px); } }

.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.card {
  position: relative; display: flex; flex-direction: column; gap: 0.5rem; width: 100%; height: 100%;
  text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--paper); border: 2px solid var(--line-strong); border-left: 8px solid var(--card-c, var(--line-strong));
  border-radius: 10px; padding: 0.8rem 0.9rem 0.7rem; box-shadow: var(--shadow);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.card:hover { transform: translateY(-3px) rotate(-0.15deg); }
.card.s-open { --card-c: var(--st-open); }
.card.s-progress { --card-c: var(--st-progress); }
.card.s-blocked { --card-c: var(--st-blocked); }
.card.s-done { --card-c: var(--st-done); }
.card.s-verified { --card-c: var(--st-verified); }
.card.s-closed { --card-c: var(--st-closed); }
.card.s-deferred { --card-c: var(--st-deferred); }
.card.s-rejected { --card-c: var(--st-rejected); }
.card-top { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.card-id { font-family: var(--display); font-weight: 700; letter-spacing: 0.05em; }
.card-spacer { flex: 1; }
.badge { font-family: var(--display); font-weight: 700; font-size: 0.7rem; letter-spacing: 0.04em; border: 2px solid var(--card-c, var(--line-strong)); border-radius: 99px; padding: 0.1rem 0.6rem; background: var(--paper-2); color: var(--ink); display: inline-flex; gap: 0.3rem; align-items: center; white-space: nowrap; }
.badge.s-open { --card-c: var(--st-open); } .badge.s-progress { --card-c: var(--st-progress); } .badge.s-blocked { --card-c: var(--st-blocked); } .badge.s-done { --card-c: var(--st-done); } .badge.s-verified { --card-c: var(--st-verified); } .badge.s-closed { --card-c: var(--st-closed); } .badge.s-deferred { --card-c: var(--st-deferred); } .badge.s-rejected { --card-c: var(--st-rejected); }
.card-snippet { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 0; overflow-wrap: anywhere; }
.card-meta, .chip .n, .count-pill, .bar-row .bar-n, time { font-family: var(--display); font-size: 0.82rem; }
.card-meta { display: flex; flex-wrap: wrap; gap: 0.3rem 0.9rem; font-size: 0.92rem; color: var(--ink-soft); margin-top: auto; align-items: center; }
.lantern { display: inline-flex; align-items: center; gap: 0.35rem; font-family: var(--display); font-weight: 700; font-size: 0.68rem; letter-spacing: 0.04em; color: var(--ink); background: var(--paper-2); border: 2px solid var(--gold-bright); border-radius: 99px; padding: 0.1rem 0.55rem 0.1rem 0.3rem; }
.lantern i { width: 12px; height: 16px; border-radius: 4px 4px 6px 6px; background: radial-gradient(circle at 50% 60%, #fff6c8, #ffb83a 60%, #c46a10); box-shadow: 0 0 10px 3px var(--candle-glow); animation: flame 1.4s ease-in-out infinite alternate; }

/* wax seals for priority */
.seal { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 52% 48% 56% 44% / 46% 56% 44% 54%; font-family: var(--display); font-weight: 700; font-size: 0.72rem; color: #fff4dc; background: radial-gradient(circle at 35% 30%, var(--seal-hi, #e04a58), var(--seal, #8c1224) 60%, var(--seal-lo, #4a0a12)); box-shadow: inset 0 0 0 2px rgba(255, 230, 180, 0.4), 0 2px 3px rgba(0, 0, 0, 0.4); flex: none; }
.seal.p0 { --seal: #2b0b0f; --seal-hi: #6a1a22; --seal-lo: #120406; color: #ffd96b; animation: seal-pulse 2.2s ease-in-out infinite; }
.seal.p1 { --seal: #9c1424; --seal-hi: #e8505e; }
.seal.p2 { --seal: #1f5a3a; --seal-hi: #3f9a68; --seal-lo: #0d2e1d; }
.seal.p3 { --seal: #1d3f7a; --seal-hi: #4a78c8; --seal-lo: #0e2148; }
.seal.p-none { background: transparent; color: var(--ink-soft); border: 2px dashed var(--line-strong); box-shadow: none; }
@keyframes seal-pulse { 0%, 100% { box-shadow: inset 0 0 0 2px rgba(255, 217, 107, 0.5), 0 0 0 0 rgba(255, 217, 107, 0.5); } 50% { box-shadow: inset 0 0 0 2px rgba(255, 217, 107, 0.8), 0 0 14px 4px rgba(255, 217, 107, 0.55); } }

/* ---------- Sheets (dialogs) ---------- */
dialog.sheet { border: 0; padding: 0; margin: 0; max-width: none; max-height: none; width: 100vw; height: 100vh; height: 100dvh; background: transparent; color: var(--ink); overflow: hidden; }
dialog.sheet::backdrop { background: rgba(10, 6, 20, 0.62); backdrop-filter: blur(2px); }
.sheet-right[open] { display: flex; justify-content: flex-end; }
.sheet-centre[open] { display: grid; place-items: center; padding: 1rem; }
.sheet-panel { background: var(--paper); border-left: 4px double var(--gold-bright); width: min(720px, 100%); height: 100%; overflow-y: auto; box-shadow: -12px 0 40px rgba(0, 0, 0, 0.5); animation: slide-in 0.28s ease-out; display: flex; flex-direction: column; }
.profile-panel { height: auto; max-height: 100%; width: min(680px, 100%); border: 4px double var(--gold-bright); border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); animation: pop-in 0.22s ease-out; }
@keyframes slide-in { from { transform: translateX(44px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop-in { from { transform: scale(0.94); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; padding: 0.7rem 1rem; background: var(--paper-2); border-bottom: 2px solid var(--line-strong); }
.sheet-title { margin: 0; font-size: 1.15rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.sheet-body { padding: 1rem 1.1rem 2rem; }
.sheet-body h3 { font-size: 0.95rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); border-bottom: 1px solid var(--line); padding-bottom: 0.2rem; margin-top: 1.4rem; }
.desc { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--paper-2); border: 1px solid var(--line); border-left: 5px solid var(--gold-bright); border-radius: 6px; padding: 0.8rem 1rem; margin: 0.4rem 0 0; font-size: 1.12rem; }
.gallery { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.6rem; }
.gallery button { display: block; width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 2px solid var(--gold-bright); border-radius: 8px; overflow: hidden; background: var(--paper-2); cursor: zoom-in; position: relative; color: var(--ink-soft); font: inherit; }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fields { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; margin: 0.5rem 0 0; }
.fields dt { font-family: var(--display); font-weight: 700; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); padding-top: 0.2rem; }
.fields dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.fields dd.empty { color: var(--ink-soft); font-style: italic; }
.thread { list-style: none; padding: 0; margin: 0.6rem 0 0; display: flex; flex-direction: column; gap: 0.8rem; }
.msg { max-width: 92%; border: 2px solid var(--dt-line); background: var(--dt-bg); border-radius: 12px 12px 4px 12px; padding: 0.5rem 0.8rem 0.6rem; align-self: flex-end; box-shadow: var(--shadow); }
.msg-albus { border-color: var(--albus-line); background: var(--albus-bg); border-radius: 12px 12px 12px 4px; align-self: flex-start; font-style: italic; }
.msg-note { border-style: dashed; border-color: var(--line-strong); background: var(--note-bg); align-self: center; font-size: 0.95rem; }
.msg-head { display: flex; align-items: center; gap: 0.5rem; font-family: var(--display); font-size: 0.72rem; letter-spacing: 0.06em; font-weight: 700; margin-bottom: 0.2rem; }
.mono { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 4px; border-radius: 50%; background: var(--dt-line); color: var(--paper); font-family: var(--display); font-size: 0.7rem; font-style: normal; }
.msg-albus .mono { background: var(--albus-line); }
.msg-note .mono { background: var(--line-strong); }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg time { margin-left: auto; font-family: var(--body); font-weight: 400; color: var(--ink-soft); font-style: normal; letter-spacing: 0; font-size: 0.82rem; }
.reply { margin-top: 1.2rem; }
.inline-status { min-height: 1.4em; font-style: italic; }
.inline-status.is-error { color: var(--danger); font-style: normal; font-weight: 700; }
.inline-status.is-good { color: var(--good); }

.lightbox-panel { position: relative; max-width: min(1100px, 100%); max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; animation: pop-in 0.22s ease-out; }
.lightbox-panel img { max-width: 100%; max-height: calc(100dvh - 7rem); border: 4px double var(--gold-bright); border-radius: 8px; background: var(--paper); object-fit: contain; }
.lightbox-cap { color: #fff4dc; font-style: italic; margin: 0; text-align: center; text-shadow: 0 1px 4px #000; }
.lightbox-close { position: absolute; top: -6px; right: -6px; }
@media (max-width: 520px) { .lightbox-close { top: 4px; right: 4px; } }

/* ---------- The Order ---------- */
.group { margin: 0 0 2rem; }
.ribbon { position: relative; margin: 0 auto 1rem; width: fit-content; max-width: 92%; padding: 0.4rem 2.6rem; text-align: center; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ribbon-fg, #fff4dc); background: var(--ribbon, #7a1520); clip-path: polygon(0 0, 100% 0, calc(100% - 18px) 50%, 100% 100%, 0 100%, 18px 50%); filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.3)); }
.group:nth-of-type(4n+1) .ribbon { --ribbon: #7a1520; }
.group:nth-of-type(4n+2) .ribbon { --ribbon: #1d5a3a; }
.group:nth-of-type(4n+3) .ribbon { --ribbon: #1d3f7a; }
.group:nth-of-type(4n+4) .ribbon { --ribbon: #f0c24a; --ribbon-fg: #2a1a0c; }
.chars { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }
.char { position: relative; background: var(--paper); border: 2px solid var(--line-strong); border-radius: 12px; padding: 0.9rem; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.35rem; box-shadow: var(--shadow); transition: transform 0.14s ease; }
.char:hover { transform: translateY(-3px); }
.char.is-over { outline: 3px dashed var(--focus); outline-offset: 3px; }
.portrait { width: 104px; height: 104px; border-radius: 50%; border: 4px solid var(--gold-bright); box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--gold), 0 6px 12px rgba(0, 0, 0, 0.35); overflow: hidden; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #a3243a, #4a0a12); color: #ffe9a8; font-family: var(--display); font-weight: 700; font-size: 2rem; margin: 0.3rem 0; flex: none; }
.portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.portrait.big { width: 160px; height: 160px; font-size: 3rem; }
.char-name { font-size: 1.1rem; margin: 0; }
.char-open { font: inherit; font-family: var(--display); font-weight: 700; color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer; letter-spacing: 0.03em; }
.char-open::after { content: ""; position: absolute; inset: 0; border-radius: 12px; }
.char-open:focus-visible { outline: none; }
.char-open:focus-visible::after { outline: 3px solid var(--focus); outline-offset: 2px; }
.char-group { font-style: italic; color: var(--ink-soft); font-size: 0.95rem; margin: 0; }
.char-line { margin: 0; font-size: 0.98rem; overflow-wrap: anywhere; }
.char-line b { font-family: var(--display); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); display: block; }
.char .add-portrait { position: relative; z-index: 1; margin-top: auto; }
.sess { font-family: var(--mono); font-size: 0.82rem; color: var(--ink-soft); }
.wand-chip { display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--display); font-weight: 700; font-size: 0.74rem; letter-spacing: 0.03em; padding: 0.2rem 0.7rem 0.2rem 0.3rem; border-radius: 99px; background: var(--paper-2); border: 2px solid var(--wand, var(--line-strong)); color: var(--ink); }
.wand-chip .stick { position: relative; width: 26px; height: 4px; border-radius: 3px; background: linear-gradient(90deg, #5a3a1c, #a47a44); }
.wand-chip .tip { position: absolute; right: -4px; top: 50%; width: 9px; height: 9px; margin-top: -4.5px; border-radius: 50%; background: var(--wand); box-shadow: 0 0 10px 4px var(--wand); animation: wand-glow 1.8s ease-in-out infinite; }
.wand-chip .note { font-family: var(--body); font-weight: 400; font-style: italic; letter-spacing: 0; }
.wand-chip.av-available { --wand: #22a25a; }
.wand-chip.av-busy { --wand: #d98a14; }
.wand-chip.av-blocked { --wand: #d6283c; }
.wand-chip.av-idle { --wand: #3f78e0; }
.wand-chip.av-unknown { --wand: #8a8a96; }
@keyframes wand-glow { 0%, 100% { opacity: 0.75; transform: scale(0.9); } 50% { opacity: 1; transform: scale(1.2); } }
.profile-top { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; text-align: center; }

/* ---------- The Marauder's Map ---------- */
.map { position: relative; max-width: 1060px; margin: 1rem auto 0; min-height: 360px; }
.map-fold, .map-ink { background: radial-gradient(ellipse at 20% 15%, rgba(255, 245, 210, 0.45), transparent 55%), radial-gradient(ellipse at 85% 90%, rgba(90, 50, 10, 0.35), transparent 60%), repeating-linear-gradient(90deg, rgba(90, 50, 10, 0.05) 0 3px, transparent 3px 9px), linear-gradient(135deg, var(--map-paper), var(--map-paper-2)); color: var(--map-ink); border: 3px solid #6b4a22; box-shadow: var(--shadow), inset 0 0 60px rgba(90, 50, 10, 0.45); clip-path: polygon(0 1%, 4% 0, 12% 1.2%, 24% 0, 38% 1%, 52% 0, 66% 1.2%, 80% 0, 92% 1%, 100% 0, 99% 12%, 100% 28%, 99% 46%, 100% 64%, 99% 82%, 100% 100%, 90% 99%, 76% 100%, 60% 98.8%, 44% 100%, 28% 99%, 14% 100%, 0 99%, 1% 84%, 0 66%, 1% 48%, 0 30%, 1% 14%); }
.map-fold { min-height: 360px; display: grid; place-content: center; gap: 1.2rem; text-align: center; padding: 2rem 1rem; }
.map-fold-title { font-family: var(--display); font-size: 1.2rem; margin: 0; letter-spacing: 0.08em; }
.map.is-sealed .map-ink { display: none; }
.map:not(.is-sealed) .map-fold { display: none; }
.map-ink { position: relative; padding: 1.6rem 1.4rem 1.4rem; animation: ink-in 0.9s ease-out; }
@keyframes ink-in { from { opacity: 0; filter: blur(6px); } to { opacity: 1; filter: none; } }
.map-ink .steps { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.steps use { fill: var(--map-ink); opacity: 0; }
.map-content { position: relative; z-index: 1; }
.map-title { text-align: center; font-size: clamp(1.1rem, 3vw, 1.6rem); margin-bottom: 0.2rem; }
.map-sub { text-align: center; font-style: italic; margin-bottom: 0.6rem; }
.map-totals { text-align: center; font-family: var(--display); font-weight: 700; font-size: 1rem; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 1.4rem; }
.map-grid h3 { font-size: 0.9rem; letter-spacing: 0.12em; text-transform: uppercase; border-bottom: 1px solid currentColor; padding-bottom: 0.2rem; margin-top: 0.6rem; }
.bars { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 0.6rem; align-items: baseline; }
.bar-row .bar-name { overflow-wrap: anywhere; }
.bar-row .bar-n { font-family: var(--display); font-weight: 700; }
.bar-row progress { grid-column: 1 / -1; height: 10px; background: rgba(60, 35, 10, 0.2); box-shadow: inset 0 0 0 1px var(--map-ink); }
.bar-row progress::-webkit-progress-bar { background: rgba(60, 35, 10, 0.15); }
.bar-row progress::-webkit-progress-value { background: var(--map-ink); }
.bar-row progress::-moz-progress-bar { background: var(--map-ink); }
.bar-row .bar-hint { grid-column: 1 / -1; font-size: 0.85rem; font-style: italic; margin-top: -0.2rem; }

/* footprints trace across the map, one after another, then fade */
.trail use { animation: step 12s ease-in-out infinite; }
.trail use:nth-child(1) { animation-delay: 0s; } .trail use:nth-child(2) { animation-delay: 0.7s; } .trail use:nth-child(3) { animation-delay: 1.4s; } .trail use:nth-child(4) { animation-delay: 2.1s; } .trail use:nth-child(5) { animation-delay: 2.8s; } .trail use:nth-child(6) { animation-delay: 3.5s; } .trail use:nth-child(7) { animation-delay: 4.2s; } .trail use:nth-child(8) { animation-delay: 4.9s; } .trail use:nth-child(9) { animation-delay: 5.6s; } .trail use:nth-child(10) { animation-delay: 6.3s; } .trail use:nth-child(11) { animation-delay: 7s; } .trail use:nth-child(12) { animation-delay: 7.7s; }
.trail-b use { animation-duration: 10s; }
@keyframes step { 0% { opacity: 0; } 4% { opacity: 0.4; } 40% { opacity: 0.3; } 62%, 100% { opacity: 0; } }

/* ---------- Toasts and the owl ---------- */
.toasts { position: fixed; inset: auto 0 1rem 0; margin: 0 auto; width: min(460px, calc(100% - 1.6rem)); padding: 0; border: 0; background: transparent; color: inherit; overflow: visible; display: none; flex-direction: column; gap: 0.5rem; }
.toasts:popover-open { display: flex; }
.toast { background: #24150c; color: #fbe9b6; border: 2px solid #d9a93a; border-radius: 10px; padding: 0.6rem 0.9rem; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5); font-family: var(--body); animation: pop-in 0.2s ease-out; }
.toast.is-error { border-color: #ff8f9d; }
.toast b { font-family: var(--display); }

.owl-fly { position: fixed; left: 8vw; top: 55vh; width: 120px; z-index: 100; pointer-events: none; opacity: 0; }
.owl-fly svg { width: 100%; display: block; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.35)); }
.owl-body { fill: #8a6a42; stroke: #3c2814; stroke-width: 2; }
.owl-belly { fill: #e8d3a0; }
.owl-eye-ring { fill: #fff2c4; stroke: #3c2814; stroke-width: 1.5; }
.owl-pupil { fill: #1a1008; }
.owl-beak { fill: #e8a020; stroke: #3c2814; stroke-width: 1; }
.owl-wing path { fill: #6d4f2c; stroke: #3c2814; stroke-width: 2; }
.owl-letter { fill: #f9f0d9; stroke: #7a1520; stroke-width: 2; }
.owl-fly.is-flying { animation: owl-away 2.1s ease-in forwards; }
.owl-fly.is-flying .owl-wing-l { animation: flap-l 0.22s ease-in-out infinite alternate; transform-origin: 44px 46px; }
.owl-fly.is-flying .owl-wing-r { animation: flap-r 0.22s ease-in-out infinite alternate; transform-origin: 76px 46px; }
@keyframes owl-away { 0% { opacity: 0; transform: translate(0, 0) scale(0.7); } 10% { opacity: 1; } 55% { transform: translate(45vw, -26vh) scale(1); } 100% { opacity: 0; transform: translate(95vw, -62vh) scale(0.45); } }
@keyframes flap-l { from { transform: rotate(18deg); } to { transform: rotate(-24deg); } }
@keyframes flap-r { from { transform: rotate(-18deg); } to { transform: rotate(24deg); } }

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
  body { font-size: 1.06rem; }
  .masthead-in { gap: 0.4rem; padding: 0.4rem 0.7rem; }
  .brand-sub { display: none; }
  .tabs { order: 3; flex: 1 1 100%; width: 100%; margin: 0; }
  .masthead-tools .btn { min-height: 36px; padding: 0.3rem 0.7rem; font-size: 0.75rem; }
  .brand { flex: 1; }
  .tabs a { flex: 1; text-align: center; padding: 0.55rem 0.4rem; font-size: 0.78rem; }
  .masthead-tools { margin-left: auto; }
  .who { display: none; }
  .candles { top: 126px; }
  .candle:nth-child(n+6) { display: none; }
  .room { padding: 0.8rem 0.75rem 2.5rem; }
  .panel { padding: 0.9rem 0.85rem 1rem; }
  .fields { grid-template-columns: 1fr; gap: 0; }
  .fields dd { margin-bottom: 0.5rem; }
  .msg { max-width: 100%; }
  .sheet-panel { border-left: 0; }
  .ribbon { padding: 0.4rem 2rem; font-size: 0.85rem; }
  .btn { min-height: 44px; }
}

/* ---------- Respect people who want stillness ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .steps use { opacity: 0.4; }
  .owl-fly { display: none; }
}
