/* The Vailt. Palette from Jace's brief: Night Ink, Bruised Violet, Black Cherry, Bayou Green, Lilac Fog, Old Paper. */
:root {
  --ink: #171117; --ink-soft: #2a1e28; --violet: #75596F; --cherry: #A83456; --bayou: #557260; --lilac: #C7AFD2;
  --paper: #F2EDE3; --paper-deep: #e6ddcf; --cream: #fff9ed; --gold: #d3a85e; --blue: #7590a5;
  --panel: rgba(23, 17, 23, 0.84);
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Manrope', 'Avenir Next', 'Helvetica Neue', Arial, sans-serif;
  --hand: 'Caveat', 'Segoe Script', cursive;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--paper); font: 15px/1.55 var(--sans); }
a { color: var(--lilac); }
h1, h2, h3, .serif { font-family: var(--serif); font-weight: 500; letter-spacing: 0.01em; margin: 0 0 0.4em; line-height: 1.15; }
h1 { font-size: 2.1rem; } h2 { font-size: 1.4rem; color: var(--lilac); }
.fine { font-size: 0.8rem; color: var(--lilac); opacity: 0.85; }
.btn, button { background: var(--cherry); color: var(--paper); border: 0; padding: 0.6em 1.3em; font: 600 0.9rem var(--sans); letter-spacing: 0.04em; border-radius: 999px; cursor: pointer; text-decoration: none; display: inline-block; }
button.danger { background: #5a1c2b; } button.ok { background: var(--bayou); }
main { padding: 1rem; max-width: 900px; margin: 0 auto; }
main.wide { max-width: none; padding: 0; }
.hero { text-align: center; padding: 14vh 1rem; }
.hero h1 { font-size: 3rem; font-style: italic; }

/* Emblem menu: the seal sits top centre; tapping it slides it left and the options fan out beside it. */
.menu { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 0.6rem; height: 52px; }
.emblem { width: 52px; height: 52px; padding: 0; border-radius: 50%; background: var(--panel); border: 1px solid var(--violet); box-shadow: 0 0 18px rgba(168, 52, 86, 0.55); transition: transform 0.25s, box-shadow 0.25s; flex: none; }
.emblem img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.emblem:hover, .menu.open .emblem { transform: scale(1.08); box-shadow: 0 0 28px rgba(168, 52, 86, 0.9); }
.drawer { display: flex; align-items: center; gap: 0.3rem; max-width: 0; overflow: hidden; opacity: 0; transition: max-width 0.35s ease, opacity 0.25s ease; white-space: nowrap; }
.menu.open .drawer { max-width: 700px; opacity: 1; }
.drawer a { text-decoration: none; color: var(--paper); background: var(--panel); border: 1px solid var(--violet); border-radius: 999px; padding: 0.35em 0.9em; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; }
.drawer a:hover { color: var(--lilac); border-color: var(--lilac); }
.drawer .who { display: flex; align-items: center; gap: 0.4rem; color: var(--lilac); font-size: 0.8rem; margin-left: 0.4rem; }
.drawer img, .av { width: 24px; height: 24px; border-radius: 50%; vertical-align: middle; }
.drawer .leave { color: var(--violet); }
.back { position: fixed; top: 18px; left: 16px; z-index: 50; text-decoration: none; color: var(--paper); background: var(--panel); border: 1px solid var(--violet); border-radius: 999px; padding: 0.4em 1em; font-size: 0.78rem; letter-spacing: 0.04em; }
.back:hover { color: var(--lilac); border-color: var(--lilac); }
main:not(.wide) { padding-top: 76px; }

/* Full-screen scenes, art as background, hotspots in percent. */
.scene { position: relative; width: 100%; height: 100vh; height: 100dvh; margin: 0 auto; background: center / cover no-repeat var(--ink); overflow: hidden; }
.scene > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.panel { position: absolute; left: 4%; bottom: 6%; max-width: 44%; background: var(--panel); padding: 1.1rem 1.3rem; border: 1px solid var(--violet); border-radius: 10px; backdrop-filter: blur(5px); }
main:not(.wide) .panel { position: static; max-width: none; }

/* Map pins (temporary, until the layered art lands). */
.pin { position: absolute; transform: translate(-50%, -50%); text-decoration: none; color: var(--paper); display: flex; flex-direction: column; align-items: center; }
.pin .dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--paper); background: var(--cherry); box-shadow: 0 0 14px var(--cherry); }
.pin.locked .dot { background: var(--violet); box-shadow: none; opacity: 0.5; }
.pin.locked { cursor: not-allowed; opacity: 0.7; }
.pin .label { margin-top: 4px; background: var(--panel); padding: 2px 9px; border-radius: 999px; white-space: nowrap; text-align: center; font-family: var(--serif); font-size: 0.95rem; }
.pin .label small { display: none; }
.pin:hover .label small { display: block; font-family: var(--sans); font-size: 0.7rem; color: var(--lilac); }
.pin.open:hover .dot { transform: scale(1.3); }

/* Fixed-ratio scenes: the art keeps its 16:9 frame, letterboxed in Night Ink, so percent positions are exact. */
.scene.fixed { width: min(100vw, calc(100dvh * 16 / 9)); height: min(100dvh, calc(100vw * 9 / 16)); position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.scene.fixed .layer { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Invitation */
.invitation .envelope { transition: transform 0.6s ease, filter 0.6s ease; transform-origin: 50% 68%; }
.invitation .seal { position: absolute; left: 50%; top: 68%; width: 11%; aspect-ratio: 1; transform: translate(-50%, -50%); background: none; padding: 0; border: 0; border-radius: 50%; cursor: pointer; filter: drop-shadow(0 6px 10px rgba(0,0,0,0.6)); transition: transform 0.2s; }
.invitation .seal img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.invitation .seal .broken { opacity: 0; }
.invitation .seal:not(:disabled):hover { transform: translate(-50%, -50%) scale(1.06); }
.invitation.is-shaking .seal { animation: crack 0.7s ease-in-out; }
@keyframes crack { 0%,100% { transform: translate(-50%, -50%) rotate(0); } 20% { transform: translate(-52%, -49%) rotate(-5deg); } 40% { transform: translate(-48%, -51%) rotate(5deg); } 60% { transform: translate(-51%, -50%) rotate(-3deg); } 80% { transform: translate(-49%, -50%) rotate(3deg); } }
.invitation.is-broken .seal .intact { opacity: 0; transition: opacity 0.2s; }
.invitation.is-broken .seal .broken { opacity: 1; transition: opacity 0.2s; }
.invitation.is-broken .envelope, .invitation.is-broken .seal { filter: brightness(0.55) blur(1px); transition: filter 1.2s ease 0.8s; }
.invitation .paper { position: absolute; left: 50%; top: 50%; width: 46%; max-height: 86%; overflow: auto; transform: translate(-50%, -40%); opacity: 0; pointer-events: none; background: var(--paper); color: var(--ink); padding: 2.2rem 2.4rem; border-radius: 3px; box-shadow: 0 20px 70px rgba(0,0,0,0.7); font-family: var(--serif); font-size: 1.15rem; line-height: 1.5; transition: opacity 1s ease 1.4s, transform 1s ease 1.4s; }
.invitation.is-broken .paper { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); }
.paper .big { font-size: 1.5rem; font-style: italic; }
.paper p { margin: 0 0 0.8em; }
.strike { text-decoration: line-through; text-decoration-color: var(--cherry); text-decoration-thickness: 2px; }
.ink { font-family: var(--hand); font-size: 1.6rem; color: #2a1a22; transform: rotate(-2deg); display: inline-block; }
.move { border-top: 1px solid var(--violet); padding-top: 0.8rem; margin-top: 0.6rem !important; font-family: var(--sans); font-size: 0.85rem; }
.paper .fine { color: var(--violet); opacity: 1; }

/* Hotel cabinet */
.cabinet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; margin: 0.8rem 0; }
.key button, .key { background: rgba(0,0,0,0.3); border: 1px solid var(--violet); border-radius: 8px; padding: 0.4rem; text-align: center; width: 100%; color: var(--paper); font: 500 0.75rem var(--sans); letter-spacing: 0; }
.key img { width: 100%; max-height: 70px; object-fit: contain; display: block; margin-bottom: 0.2rem; }
.key.mine, .key.mine button { border-color: var(--cherry); box-shadow: 0 0 12px var(--cherry); }
.key.dim { opacity: 0.35; }

/* Tables (admin, leaderboard) */
.grid { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-bottom: 1.5rem; }
.grid th, .grid td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--ink-soft); vertical-align: top; }
.grid th { color: var(--lilac); font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.7rem; }
.actions form { display: inline-block; margin: 0 0.3rem 0.3rem 0; }
.actions button, .inline button { padding: 0.3em 0.8em; font-size: 0.75rem; }
main.wide section { padding: 1rem 1.5rem; }
main.wide > h1 { padding: 76px 1.5rem 0; }
select, input { font: inherit; padding: 0.3em 0.5em; background: var(--ink-soft); color: var(--paper); border: 1px solid var(--violet); border-radius: 6px; }

/* Landscape-only on phones. */
#rotate { display: none; position: fixed; inset: 0; z-index: 99; background: var(--ink); color: var(--paper); align-items: center; justify-content: center; text-align: center; font-family: var(--serif); font-size: 1.3rem; }
#rotate .phone { font-size: 4rem; animation: tilt 1.6s ease-in-out infinite alternate; }
@keyframes tilt { from { transform: rotate(0deg); } to { transform: rotate(-90deg); } }
@media (max-width: 900px) and (orientation: portrait) { #rotate { display: flex; } }
@media (max-height: 500px) {
  .menu { top: 6px; height: 40px; } .emblem { width: 40px; height: 40px; }
  .drawer a { font-size: 0.68rem; padding: 0.3em 0.7em; } .back { top: 12px; font-size: 0.68rem; }
  .panel { padding: 0.6rem 0.8rem; max-width: 55%; font-size: 0.8rem; } .panel h1 { font-size: 1.3rem; }
  .invitation .paper { padding: 1rem 1.2rem; font-size: 0.85rem; width: 56%; } .paper .big { font-size: 1.1rem; } .ink { font-size: 1.2rem; }
  .key img { max-height: 40px; }
}
