/* Sir Lucan's gate: the World page's own look (dark warm glass, gold Cinzel, red wax seal). */
:root {
  --ink: #f4ead6;
  --ink-dim: rgba(244, 234, 214, .64);
  --glass: rgba(27, 23, 18, .66);
  --edge: rgba(232, 196, 120, .26);
  --gold: #e8c478;
  --gold-deep: #b98e45;
  --red: #c4492c;
  --bg: #1b1712;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink);
  font-family: Inter, -apple-system, system-ui, sans-serif; }
body { min-height: 100dvh; overflow-x: hidden; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- the town behind the gate ---------- */
.bg { position: fixed; inset: -40px; background: #2a2219 url(gate-bg.jpg) center / cover no-repeat;
  filter: blur(6px) saturate(.9) brightness(.62); transform: scale(1.04); }
.veil { position: fixed; inset: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 42%, rgba(27,23,18,.15), rgba(27,23,18,.78) 70%, rgba(20,16,12,.95)); }

.motes { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.motes i { position: absolute; bottom: -10px; width: 3px; height: 3px; border-radius: 50%;
  background: rgba(255, 220, 150, .75); box-shadow: 0 0 6px 2px rgba(255, 200, 110, .35);
  animation: rise linear infinite; opacity: 0; }
@keyframes rise { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: .9; } 85% { opacity: .5; }
  100% { transform: translate(var(--dx, 20px), -105vh); opacity: 0; } }

/* ---------- layout ---------- */
.gate { position: relative; z-index: 1; min-height: 100dvh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 26px;
  padding: max(28px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom)); }

.crest { text-align: center; }
.wax { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 49% 51% 47% 53% / 52% 46% 54% 48%;
  background: radial-gradient(circle at 35% 30%, #d6654a, #a3311d 55%, #741f11); display: grid; place-items: center;
  box-shadow: 0 4px 10px rgba(0,0,0,.5), inset 0 0 0 4px rgba(120,30,15,.6), inset 0 0 0 6px rgba(240,170,140,.22); }
.wax span { font: 600 28px/1 Cinzel, serif; color: #f7e9d0; text-shadow: 0 1px 0 rgba(90,20,10,.8); }
.crest h1 { margin: 0; font: 600 clamp(26px, 6vw, 34px)/1.05 Cinzel, serif; letter-spacing: .28em; padding-left: .28em;
  color: var(--gold); text-shadow: 0 2px 18px rgba(232,196,120,.25); }
.crest .sub { margin: 10px 0 0; font: 500 13px/1.4 Inter, sans-serif; letter-spacing: .06em; color: var(--ink-dim); }

/* ---------- 1. choose a person ---------- */
.choose { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; width: 100%; max-width: 760px; }
.person { position: relative; width: 164px; padding: 14px 12px 16px; border-radius: 18px; cursor: pointer;
  background: var(--glass); border: 1px solid var(--edge);
  -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 12px 34px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.06);
  transition: transform .35s cubic-bezier(.2,.8,.2,1), border-color .35s, box-shadow .35s;
  animation: arrive .7s cubic-bezier(.2,.8,.2,1) backwards; }
.person:nth-child(2) { animation-delay: .08s; } .person:nth-child(3) { animation-delay: .16s; }
.person:nth-child(4) { animation-delay: .24s; } .person:nth-child(5) { animation-delay: .32s; }
@keyframes arrive { from { opacity: 0; transform: translateY(14px); } }
.person:hover { transform: translateY(-4px); border-color: rgba(232,196,120,.55);
  box-shadow: 0 18px 40px rgba(0,0,0,.45), 0 0 0 1px rgba(232,196,120,.15), 0 0 30px rgba(232,196,120,.12); }
.person:active { transform: translateY(-1px) scale(.985); }
.person:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.person b { display: block; margin-top: 10px; font: 600 14px/1.2 Cinzel, serif; letter-spacing: .08em; color: var(--gold); }
.person small { display: block; margin-top: 4px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-dim); }

/* a figure standing on a pool of warm light */
.stand { position: relative; height: 150px; }
.stand::before { content: ''; position: absolute; left: 50%; bottom: 2px; width: 78%; height: 22px; transform: translateX(-50%);
  border-radius: 50%; background: radial-gradient(ellipse, rgba(232,196,120,.42), rgba(232,196,120,0) 70%); }
.stand img { position: absolute; left: 50%; bottom: 6px; height: calc(100% - 6px); width: auto; transform: translateX(-50%);
  filter: drop-shadow(0 6px 8px rgba(0,0,0,.45)); }
.stand.seal img { display: none; }
.initial { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 84px; height: 84px; border-radius: 49% 51% 47% 53% / 52% 46% 54% 48%;
  display: none; place-items: center; font: 600 36px/1 Cinzel, serif; color: #f7e9d0;
  background: radial-gradient(circle at 35% 30%, #d6654a, #a3311d 55%, #741f11);
  box-shadow: 0 4px 10px rgba(0,0,0,.5), inset 0 0 0 5px rgba(120,30,15,.6), inset 0 0 0 7px rgba(240,170,140,.22); }
.stand.seal .initial { display: grid; }

/* ---------- 2. the PIN ---------- */
.pin { width: 100%; max-width: 340px; display: flex; flex-direction: column; align-items: center;
  animation: arrive .5s cubic-bezier(.2,.8,.2,1); }
.chosen { margin: 0; text-align: center; }
.chosen .stand { height: 132px; }
.chosen figcaption { margin-top: 8px; font: 600 16px/1.2 Cinzel, serif; letter-spacing: .1em; color: var(--gold); }
.msg { margin: 14px 0 0; min-height: 20px; font-size: 13px; color: var(--ink-dim); text-align: center; transition: color .2s; }
.msg.bad { color: #f0a58f; }

.dots { display: flex; gap: 14px; margin: 16px 0 22px; }
.dots i { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid rgba(232,196,120,.6);
  transition: background .15s, transform .15s, box-shadow .15s; }
.dots i.on { background: var(--gold); border-color: var(--gold); transform: scale(1.08); box-shadow: 0 0 10px rgba(232,196,120,.5); }
.dots.shake { animation: shake .42s cubic-bezier(.36,.07,.19,.97); }
.dots.shake i { border-color: #e07a5f; }
.dots.shake i.on { background: #e07a5f; box-shadow: none; }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-8px); } 40%, 60% { transform: translateX(8px); } }

.pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px 22px; }
.pad button { width: 72px; height: 72px; border-radius: 50%; cursor: pointer; display: grid; place-items: center;
  background: rgba(244,234,214,.07); border: 1px solid rgba(232,196,120,.22);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  font: 400 28px/1 Inter, sans-serif; color: var(--ink); transition: background .12s, transform .12s; }
.pad button:hover { background: rgba(232,196,120,.12); }
.pad button:active, .pad button.hit { background: rgba(232,196,120,.3); transform: scale(.94); }
.pad button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.pad .del { background: transparent; border-color: transparent; }
.pad .del svg { width: 26px; height: 26px; fill: none; stroke: var(--ink-dim); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.pad.busy { opacity: .45; pointer-events: none; }

.back { margin-top: 22px; background: none; border: 0; padding: 8px 12px; cursor: pointer; font-size: 13px;
  color: var(--ink-dim); text-decoration: underline; text-underline-offset: 3px; }
.back:hover { color: var(--ink); }

/* ---------- 3. welcome ---------- */
.welcome p { margin: 0; font: 600 clamp(20px, 5vw, 26px)/1.2 Cinzel, serif; letter-spacing: .12em; color: var(--gold);
  text-align: center; animation: arrive .6s cubic-bezier(.2,.8,.2,1); }
.gate.stamped .wax { animation: stamp .55s cubic-bezier(.3,1.6,.5,1); }
@keyframes stamp { 0% { transform: scale(1.6) rotate(-12deg); opacity: .4; } 100% { transform: none; opacity: 1; } }
body.leaving .gate, body.leaving .veil { transition: opacity .7s ease; opacity: 0; }
body.leaving .bg { transition: filter .9s ease; filter: blur(0) brightness(1); }

/* phones */
@media (max-width: 420px) {
  .gate { gap: 20px; }
  .choose { gap: 12px; }
  .person { width: calc(50% - 6px); max-width: 170px; padding: 12px 8px 14px; }
  .stand { height: 128px; }
  .pad { grid-template-columns: repeat(3, 70px); gap: 12px 20px; }
  .pad button { width: 70px; height: 70px; }
}
/* computers: the keyboard types the PIN, so the pad is small and quiet (King, 2026-11-15: "why show PIN like that on big screen?") */
@media (hover: hover) and (pointer: fine) and (min-width: 700px) {
  .pad { grid-template-columns: repeat(3, 46px); gap: 8px 12px; }
  .pad button { width: 46px; height: 46px; font-size: 17px; background: rgba(244,234,214,.04); border-color: rgba(232,196,120,.16); }
  .pad .del svg { width: 20px; height: 20px; }
  .dots { margin: 14px 0 18px; }
  .back { margin-top: 16px; }
}
@media (max-height: 700px) { .chosen .stand { height: 96px; } .crest .wax { width: 50px; height: 50px; margin-bottom: 8px; } .dots { margin: 12px 0 16px; } }
@media (prefers-reduced-motion: reduce) {
  .motes i, .person, .pin, .welcome p, .gate.stamped .wax { animation: none !important; }
  .dots.shake { animation: none; }
}
