:root { --bg: #0b0713; --bone: #efe6d2; --ink: #f1eaff; --muted: #b3a6c9; --orange: #ff7a1a; --violet: #8b5cf6; --green: #5dff8a; --focus: #ff6b6b; --line: #4a3a5c; }
* { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; min-height: 100vh; background: radial-gradient(120% 90% at 50% -10%, #2a1245 0, var(--bg) 58%); color: var(--ink); font: 18px/1.7 Georgia, "Palatino Linotype", "Book Antiqua", serif; overflow-x: hidden; }
a { color: var(--orange); }
a:focus-visible, button:focus-visible, .ghostwrap:focus-visible, canvas:focus-visible, summary:focus-visible, input:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }

.fog { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.fog i { position: absolute; left: -30%; width: 160%; height: 40vh; background: radial-gradient(closest-side, rgba(139, 92, 246, .16), transparent); filter: blur(30px); animation: drift 60s ease-in-out infinite alternate; }
.fog i:nth-child(1) { top: 5%; }
.fog i:nth-child(2) { top: 40%; animation-duration: 80s; animation-delay: -20s; background: radial-gradient(closest-side, rgba(255, 122, 26, .09), transparent); }
.fog i:nth-child(3) { top: 70%; animation-duration: 70s; animation-delay: -40s; }
@keyframes drift { from { transform: translateX(-8%); } to { transform: translateX(8%); } }

/* slow colour washes for the hidden things */
.tint { position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: 0; transition: opacity 2.6s ease; }
.tint.amber { opacity: .3; background: radial-gradient(ellipse at 50% 100%, #ff9a3c, transparent 70%); }
.tint.moon { opacity: .28; background: radial-gradient(ellipse at 85% 0%, #9ec5ff, transparent 65%); }
.tint.lamp { opacity: .22; background: #ffcf8a; }

/* webs and spider */
.web { position: fixed; z-index: 2; width: min(34vw, 230px); aspect-ratio: 1; pointer-events: none; }
.web svg { display: block; width: 100%; height: 100%; transform-origin: 0 0; opacity: .55; transition: transform 1.6s ease, opacity 1.6s ease, stroke 2s ease; animation: sway 18s ease-in-out infinite alternate; }
.web svg path { fill: none; stroke: var(--bone); stroke-width: .8; }
body.webs-lit .web svg { opacity: 1; }
body.webs-lit .web svg path { stroke: #c9b2ff; stroke-width: 1.2; }
.web.tl { top: 0; left: 0; } .web.tr { top: 0; right: 0; transform: scaleX(-1); }
.web.bl { bottom: 0; left: 0; transform: scaleY(-1); } .web.br { bottom: 0; right: 0; transform: scale(-1, -1); }
@keyframes sway { from { rotate: -.7deg; } to { rotate: .9deg; } }
.thread { position: fixed; top: 0; z-index: 3; width: 1px; background: rgba(239, 230, 210, .45); pointer-events: none; transition: opacity 1s ease; }
.spider { position: fixed; z-index: 4; width: 56px; height: 56px; padding: 0; border: 0; background: transparent; cursor: pointer; transform: translate(-50%, -50%); transition: opacity 1s ease; filter: drop-shadow(0 0 8px rgba(139, 92, 246, .55)); }
.spider svg { display: block; }
.spider .legs { transform-origin: 28px 30px; }
.spider.run .legs { animation: skitter .32s ease-in-out infinite alternate; }
@keyframes skitter { from { transform: rotate(-3deg) scale(1.02); } to { transform: rotate(3deg) scale(.97); } }

.hero, main, .foot { position: relative; z-index: 3; max-width: 760px; margin: 0 auto; padding: 0 20px; }
.hero { text-align: center; padding-top: 24px; }
.topbar { display: flex; justify-content: space-between; align-items: center; }
.chip { min-height: 44px; padding: 6px 16px; border: 2px solid var(--line); background: rgba(20, 12, 29, .85); color: var(--muted); font: 600 .85rem system-ui, sans-serif; letter-spacing: .08em; cursor: pointer; border-radius: 22px; }
.chip[aria-pressed="true"] { border-color: var(--violet); color: #fff; }
.moon { width: 48px; height: 48px; padding: 4px; border: 0; background: transparent; cursor: pointer; filter: drop-shadow(0 0 12px rgba(239, 230, 210, .4)); }
.kicker { margin: 18px 0 0; color: var(--orange); font-style: italic; letter-spacing: .3em; text-transform: uppercase; font-size: .9rem; }
h1 { margin: 6px 0 0; font: italic 700 clamp(3.2rem, 17vw, 7rem)/1 Georgia, serif; color: var(--bone); text-shadow: 0 0 40px rgba(139, 92, 246, .6); }
h1 span { display: inline-block; opacity: .55; }
.by { margin: 4px 0 0; color: var(--muted); letter-spacing: .25em; text-transform: uppercase; font-size: .95rem; display: inline-block; }
.ded { margin: 4px 0 0; color: var(--green); font-style: italic; font-size: .95rem; }
.hint { margin: 10px auto 0; max-width: 40ch; color: var(--muted); font-style: italic; font-size: .95rem; }

.ghostwrap { display: inline-block; margin: 22px auto 0; cursor: pointer; transition: transform 2.4s ease, opacity 2.4s ease; will-change: transform; }
.ghost { display: block; width: 130px; height: auto; filter: drop-shadow(0 0 22px rgba(239, 230, 210, .35)); animation: bob 7s ease-in-out infinite alternate; }
@keyframes bob { from { transform: translateY(-6px); } to { transform: translateY(6px); } }
.seen { margin: 6px 0 0; color: var(--muted); font: .75rem system-ui, sans-serif; letter-spacing: .1em; opacity: 0; transition: opacity 2s ease; }
.ghostwrap.faded .seen { opacity: 1; }

section { margin: 56px 0; }
h2 { margin: 0 0 10px; font: italic 700 clamp(1.5rem, 5vw, 2rem)/1.2 Georgia, serif; color: var(--bone); transition: transform 1.4s ease; }
h2::before { content: ""; display: block; height: 10px; margin-bottom: 18px; background: repeating-linear-gradient(135deg, #000 0 12px, var(--bone) 12px 24px); }
.sub, .twist { color: var(--muted); margin: 0 0 14px; }
.twist { font-style: italic; min-height: 3.4em; }
.embed { min-height: 120px; padding: 18px; border: 2px solid var(--line); background: rgba(20, 12, 29, .8); border-radius: 12px; }
.embed iframe { display: block; width: 100%; height: 352px; border: 0; border-radius: 12px; }
.btn { display: inline-block; min-height: 48px; padding: 10px 24px; border: 2px solid var(--bone); background: var(--orange); color: #120a06; font: 700 1rem Georgia, serif; letter-spacing: .06em; text-decoration: none; cursor: pointer; transition: background-color .5s ease; }
.btn:hover { background: #ff9a4d; }
.btn.ghost { background: transparent; color: var(--bone); }
.btn.ghost:hover { background: rgba(239, 230, 210, .12); }
.tiny { color: var(--muted); font-size: .85rem; margin: 10px 0 0; }
.note p { max-width: 62ch; }
.doors { display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 14px 0 0; list-style: none; }
.doors li { padding: 6px 16px; border: 2px solid var(--line); background: rgba(20, 12, 29, .8); font-style: italic; transition: transform 1.4s ease; }
kbd { padding: 1px 8px; border: 1px solid var(--line); border-radius: 4px; background: #140c1d; font: .85em system-ui, sans-serif; }
.linkbtn { background: none; border: 0; padding: 4px 6px; color: var(--orange); font: inherit; text-decoration: underline; cursor: pointer; min-height: 44px; }

/* tabs, keys, pad */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.tabs button { min-height: 44px; padding: 8px 16px; border: 2px solid var(--line); background: rgba(20, 12, 29, .85); color: var(--muted); font: italic 700 .95rem Georgia, serif; cursor: pointer; transition: background-color .5s ease, color .5s ease, border-color .5s ease; }
.tabs button[aria-pressed="true"] { border-color: var(--violet); color: #fff; background: #25103a; }
.keys { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; margin: 10px 0; }
.key { min-height: 96px; padding: 6px 0; border: 2px solid var(--bone); background: #140c1d; color: var(--bone); cursor: pointer; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; font: 700 .9rem Georgia, serif; touch-action: none; user-select: none; transition: background-color .35s ease; }
.key small { color: var(--muted); font: .7rem system-ui, sans-serif; }
.key.on { background: #3a1d63; border-color: #c9b2ff; }
.pad { position: relative; min-height: 180px; margin: 10px 0; border: 2px solid var(--violet); background: repeating-linear-gradient(90deg, transparent 0 calc(100% / 22 - 1px), rgba(139, 92, 246, .22) calc(100% / 22 - 1px) calc(100% / 22)), radial-gradient(ellipse at 50% 100%, rgba(139, 92, 246, .25), #0a0610 70%); touch-action: none; cursor: crosshair; display: grid; place-items: center; color: #6d5a85; font-style: italic; }
.pad.on { border-color: #c9b2ff; }
.paddot { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; left: 50%; top: 50%; border-radius: 50%; background: var(--bone); box-shadow: 0 0 22px 6px rgba(201, 178, 255, .6); transition: left .12s ease, top .12s ease; pointer-events: none; }
.ctrl { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 12px 0; }
.ctrl label { color: var(--muted); display: flex; gap: 8px; align-items: center; }
.ctrl input[type="range"] { accent-color: var(--orange); min-height: 44px; }

/* arcade */
#gc { display: block; width: 100%; max-width: 480px; height: auto; margin: 10px 0; border: 2px solid var(--bone); background: #0a0610; box-shadow: 0 0 50px rgba(139, 92, 246, .2); touch-action: none; }
.status { color: var(--muted); font-style: italic; }

/* the Séance Book */
.book { margin-top: 18px; border: 2px solid var(--line); padding: 12px 16px; background: rgba(20, 12, 29, .8); }
.book summary { cursor: pointer; font: italic 700 1.2rem Georgia, serif; }
.book summary span { color: var(--green); font-size: .9rem; margin-left: 8px; }
.book ol { margin: 12px 0 0; padding-left: 1.4rem; }
.book li { margin: 6px 0; color: var(--muted); }
.book li.got strong { color: var(--bone); }
.book li span { font-size: .92rem; }

.foot { padding-bottom: 90px; color: var(--muted); font-size: .85rem; }
.boo { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px); z-index: 9; max-width: min(520px, 92vw); padding: 12px 20px; border: 2px solid var(--bone); background: #000; color: var(--bone); font-style: italic; text-align: center; opacity: 0; pointer-events: none; transition: opacity 1.4s ease, transform 1.4s ease; }
.boo.on { opacity: 1; transform: translate(-50%, 0); }
.mermaid { position: fixed; z-index: 6; top: 58%; left: 0; pointer-events: none; filter: drop-shadow(0 0 16px rgba(110, 231, 208, .35)); }

@media (max-width: 620px) {
  .keys { grid-template-columns: repeat(5, 1fr); }
  .key { min-height: 72px; }
  .web { width: 26vw; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
