:root {
  --bg: #14110f; --bg2: #201a16; --ink: #f4ede4; --muted: #b3a89b;
  --warm: #e0a84e; --warm-ink: #1b1206; --line: #3a312a; --err: #ff8f7a;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh; display: flex; flex-direction: column;
  background: radial-gradient(120% 70% at 50% 0%, #2b221b 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; }
.brand { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; letter-spacing: .02em; color: var(--muted); }
main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
.view { width: 100%; max-width: 360px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.view[hidden] { display: none; }
h1 { font: 600 clamp(1.6rem, 7vw, 2rem)/1.2 Georgia, "Times New Roman", serif; margin: 6px 0 0; }
h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 12px 0 0; align-self: flex-start; }
.lede { color: var(--muted); margin: 0; }
.fine { color: var(--muted); font-size: .85rem; margin: 0; }
button { font: inherit; cursor: pointer; border-radius: 999px; min-height: 48px; padding: 0 22px; border: 0; }
.primary { width: 100%; background: var(--warm); color: var(--warm-ink); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.primary svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); min-height: 36px; padding: 0 14px; font-size: .9rem; }
.link { background: none; color: var(--muted); min-height: 44px; padding: 0 10px; text-decoration: underline; text-underline-offset: 3px; }
button:disabled { opacity: .6; cursor: progress; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--warm); outline-offset: 3px; }
details { width: 100%; margin-top: 8px; }
summary { color: var(--muted); cursor: pointer; padding: 10px 0; list-style-position: inside; }
form { display: flex; flex-direction: column; gap: 10px; text-align: left; width: 100%; }
label { color: var(--muted); font-size: .9rem; }
input[type=email] { font: inherit; width: 100%; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); color: var(--ink); }
.row { display: flex; gap: 8px; } .row input { flex: 1; min-width: 0; }
#status { min-height: 1.5em; margin: 0 0 8px; text-align: center; color: var(--muted); max-width: 360px; }
#status.error { color: var(--err); }
#lab-offline-status { text-align: center; color: var(--muted); font-size: .85rem; margin: 0 16px 8px; }
#lab-offline-status:empty { display: none; }
footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; padding: 8px 16px 16px; }
footer[hidden] { display: none; }
ul { list-style: none; padding: 0; margin: 0; width: 100%; text-align: left; }
li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
li .link { min-height: 36px; flex: none; }
.switch { display: flex; gap: 10px; align-items: center; color: var(--ink); align-self: flex-start; min-height: 44px; }
.switch input { width: 22px; height: 22px; accent-color: var(--warm); }

/* the door */
.door { width: 76px; height: 112px; border-radius: 38px 38px 6px 6px; position: relative;
  background: linear-gradient(#5a3b26, #3d271a); border: 3px solid #6f4a31; box-shadow: 0 0 0 6px #2a2019; }
.door.open { background: linear-gradient(#ffd38a, #e0a84e); box-shadow: 0 0 0 6px #2a2019, 0 0 60px 10px rgba(224,168,78,.35); }
.door .knob { position: absolute; right: 12px; top: 58px; width: 9px; height: 9px; border-radius: 50%; background: var(--warm); }
.door.open .knob { background: #7a4f20; }

/* the welcome sign */
#view-home { gap: 0; }
.sign { position: relative; padding-top: 70px; transform-origin: 50% 0; animation: sway 4s ease-in-out 1 both; }
.chain { position: absolute; top: 0; width: 2px; height: 82px; background: repeating-linear-gradient(#8d7a64 0 6px, transparent 6px 9px); }
.chain.left { left: 24%; transform: rotate(14deg); transform-origin: top; }
.chain.right { right: 24%; transform: rotate(-14deg); transform-origin: top; }
.plaque { display: flex; flex-direction: column; align-items: center; padding: 26px 34px 30px; border-radius: 18px;
  background: linear-gradient(#f6ecd9, #ead9b9); color: #2d3b2a; border: 6px double #2d3b2a;
  box-shadow: 0 0 0 4px #ead9b9, 0 18px 50px rgba(0,0,0,.5), 0 0 120px rgba(224,168,78,.25);
  font: italic 600 clamp(2.4rem, 13vw, 3.4rem)/1.05 Georgia, "Times New Roman", serif; text-align: center; }
.plaque span + span { font-size: .78em; }
@keyframes sway { 0% { transform: rotate(-5deg); } 30% { transform: rotate(3.5deg); } 55% { transform: rotate(-2deg); } 80% { transform: rotate(.8deg); } 100% { transform: rotate(0); } }
@media (prefers-reduced-motion: reduce) { .sign { animation: none; } }

dialog { max-width: min(26rem, calc(100vw - 32px)); border-radius: 16px; border: 1px solid var(--line); background: var(--bg2); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog button { margin: 6px 4px 0 0; }
dialog .primary { width: auto; }
.or { width: 100%; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .9rem; margin-top: 10px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
