:root{color-scheme:light;--brand:#522582;--accent:#522582;--ink:#241733;--muted:#645a70;--line:#e5dceb;--paper:#fff;--background:#faf7fc;font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:var(--ink);background:var(--background)}
*{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0}
.shell{width:min(100% - 32px,960px);margin:auto;padding-bottom:3rem}
header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 0}
a{color:#542181;text-underline-offset:3px}
.wordmark{font-size:clamp(1.25rem,5vw,1.7rem);font-weight:950;letter-spacing:-.09em;color:var(--ink);text-decoration:none}
.wordmark span{color:#7138a2}
.wordmark .dot{color:#a26002}
.quiet{font-size:.9rem;font-weight:700;padding:.75rem .2rem}
h1,h2,p{margin:0}
h1{font-size:clamp(2rem,8vw,4.2rem);letter-spacing:-.06em;line-height:1}
h2{font-size:1.25rem;letter-spacing:-.03em;margin-bottom:.9rem}
p{line-height:1.5}
.hero{isolation:isolate;position:relative;overflow:hidden;background:var(--brand);color:#fff;border-radius:24px;padding:clamp(1.5rem,5vw,3rem);text-align:center;margin-bottom:1rem}
.hero::before{content:"";position:absolute;inset:0;z-index:-1;background:radial-gradient(circle at 82% 20%,#fff2,transparent 35%),linear-gradient(145deg,#10051b85,#10051b6b)}
.hero p:last-child{max-width:36ch;margin:.8rem auto 0;color:#fff}
.crest{width:72px;height:72px;object-fit:contain;border-radius:50%;display:inline-block}
.hero .crest{width:94px;height:94px;margin-bottom:.65rem}
.icon{display:inline-grid;place-items:center;background:#ffffff26;color:#d6a637;font-size:2.3rem}
.event-title{font-size:.83rem;font-weight:750;letter-spacing:.025em;margin-bottom:.35rem}
.panel{border:1px solid var(--line);border-radius:20px;background:var(--paper);padding:clamp(1rem,4vw,1.45rem);min-width:0}
.panel p + button{margin-top:.75rem}
.join,.login,.waiting{max-width:480px;margin-inline:auto}
.join,.stack{display:grid;gap:.85rem}
label{font-weight:700;display:grid;gap:.35rem;font-size:.92rem}
input{min-width:0;width:100%;border:1px solid #bbb0c5;border-radius:10px;padding:.65rem .75rem;min-height:46px;background:white;color:var(--ink);font:inherit;font-size:1rem}
input[type=color]{padding:.2rem;width:100%}
.check{display:flex;gap:.65rem;font-weight:500;color:var(--muted);align-items:flex-start}
.check input{width:20px;height:20px;min-height:0;flex:none;accent-color:var(--brand)}
button{appearance:none;border:1px solid transparent;border-radius:12px;min-height:46px;background:color-mix(in srgb,var(--brand) 48%,#180623);color:white;padding:.65rem .95rem;font:inherit;font-weight:750;cursor:pointer;touch-action:manipulation}
button:disabled{opacity:.65;cursor:default}
button.secondary{background:#f4ecfa;color:#47206a;border-color:#e4d5ee}
:focus-visible{outline:3px solid #b77911;outline-offset:3px}
.photo-picker{display:flex;gap:.65rem;align-items:center}
.photo-picker img{width:60px;height:60px;object-fit:cover;border-radius:10px}
.waiting{display:flex;align-items:center;gap:.55rem;flex-wrap:wrap}
.waiting strong{margin-left:auto}
.pulse{width:11px;height:11px;border-radius:50%;background:var(--accent)}
.game-head{display:flex;align-items:center;gap:.65rem;border-bottom:1px solid var(--line);padding:.6rem 0 1rem}
.game-head h1{font-size:clamp(1.5rem,7vw,3rem)}
.game-head .crest{width:clamp(42px,12vw,72px);height:clamp(42px,12vw,72px);flex:none}
.counter{margin-left:auto;align-self:center;text-align:center;background:#eee4f5;border-radius:14px;min-width:60px;padding:.45rem;color:#452065}
.counter strong,.counter small{display:block}
.celebrate{margin:.75rem 0;padding:.8rem;border-radius:10px;background:#f1e6f6;font-weight:800}
.tabs{display:flex;gap:.5rem;margin:1rem 0}
.tabs button{flex:1;background:#fff;color:#47206a;border-color:var(--line)}
.tabs [aria-pressed=true]{background:color-mix(in srgb,var(--brand) 48%,#180623);color:#fff}
.hint{margin:.75rem 0;color:var(--muted)}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,140px),1fr));gap:.65rem}
.tile{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.35rem;overflow:hidden;min-height:115px;aspect-ratio:1.12;border-radius:15px;background:#fff;color:var(--ink);border:1px solid var(--line);padding:.35rem}
.tile-name{text-align:center;overflow-wrap:anywhere;line-height:1.2;font-size:.9rem}
.avatar{width:48px;height:48px;border-radius:50%;object-fit:cover}
.initials{display:grid;place-items:center;background:#f0e5f8;color:#522582;font-size:1.4rem}
.tile.done{padding:0}
.done img{width:100%;height:100%;object-fit:cover}
.done .tile-name{position:absolute;bottom:0;inset-inline:0;background:#1a0827d9;color:white;padding:.38rem}
.tick{position:absolute;top:.35rem;right:.35rem;background:white;color:#236b3e;border-radius:50%;width:26px;height:26px;text-align:center;font-weight:900}
.admin-links{display:flex;gap:1rem;align-items:center;margin-bottom:1rem}
.admin-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr));gap:1rem;margin-top:1rem}
.roster,.scores ol{list-style:none;margin:0 0 .75rem;padding:0}
.roster li,.scores li{display:flex;align-items:center;gap:.65rem;padding:.5rem 0;border-bottom:1px solid var(--line);overflow-wrap:anywhere}
.roster li>:last-child,.scores li>:last-child{margin-left:auto}
.roster small,.scores small{display:block;color:var(--muted)}
.scores li>:last-child{text-align:right;flex:none}
.position{display:grid;place-items:center;border-radius:50%;width:32px;height:32px;flex:none;background:#f3e9fa;color:#522582;font-weight:750}
.colour-row{display:grid;grid-template-columns:1fr 1fr;gap:.6rem}
#qr canvas{display:block;width:min(100%,200px);height:auto}
.join-link{overflow-wrap:anywhere;font-size:.85rem;margin:.5rem 0}
dialog{border:1px solid var(--line);border-radius:20px;color:var(--ink);width:min(100% - 24px,520px);max-height:calc(100dvh - 24px);padding:1rem}
dialog::backdrop{background:#170b21ba}
dialog video,dialog img{display:block;width:100%;max-height:55dvh;object-fit:contain;background:#18131b;border-radius:12px}
dialog video{transform:scaleX(-1)}
.actions{display:flex;gap:.4rem;flex-wrap:wrap;margin-top:.65rem}
#camera-message:not(:empty){margin:.5rem 0}
#notice{position:fixed;z-index:2;bottom:1rem;left:50%;transform:translateX(-50%);background:#241733;color:white;border-radius:12px;padding:.7rem 1rem;width:max-content;max-width:calc(100% - 24px);box-shadow:0 6px 24px #0003}
#poster{display:none}
@media(max-width:370px){.shell{width:calc(100% - 24px)}.grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media print{
    @page{margin:16mm}
    body,.shell{background:white;color:black;margin:0;padding:0;width:100%}
    header,main>*:not(#poster),#notice{display:none!important}
    #poster{display:block;text-align:center;margin:12mm auto}
    #poster .crest{width:28mm;height:28mm}
    #poster h1{font-size:42pt;margin:.3em 0}
    #poster h2{font-size:20pt}
    #poster canvas{width:90mm;height:90mm;image-rendering:pixelated}
}

:root{--ink:#30223e;--muted:#64546e;--line:#e7d8ed;--background:#fff7ed;--paper:#fffdf9;font-family:Arial,sans-serif}
.wordmark{display:inline-flex;align-items:center}
.wordmark img{display:block;width:clamp(135px,45vw,205px);height:auto}
h1,h2{letter-spacing:-.045em}
.hero{border-radius:22px}
.panel,.counter,.celebrate,.demo-banner,.export-callout{border-color:#e7d8ed}
button.secondary,.counter,.celebrate,.demo-banner,.export-callout{background:#eee3f8;color:#472767}
:focus-visible{outline-color:#996148}
.admin-grid select,.gallery-filters select{font:inherit;color:var(--ink);background:white;min-height:46px;border:1px solid #bbb0c5;border-radius:10px;padding:.55rem;width:100%}
.rank-photo{width:40px;height:40px;border-radius:50%;object-fit:cover;flex:none}
.demo-banner,.export-callout{display:flex;align-items:center;justify-content:space-between;gap:.6rem;flex-wrap:wrap;border-radius:14px;margin:.75rem 0;padding:.75rem}
.dialog-head{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-bottom:1rem}
.dialog-head h2{margin:0}
#photo-gallery,#collage{width:min(calc(100% - 24px),900px)}
.gallery-filters{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.7rem}
.gallery-summary{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:.5rem;margin:.85rem 0}
.gallery-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,150px),1fr));gap:.7rem}
.gallery-grid figure{margin:0;overflow:hidden;border:1px solid var(--line);border-radius:12px;background:#fff}
.gallery-grid img{width:100%;aspect-ratio:4/3;object-fit:cover;border-radius:0}
.gallery-grid figcaption{padding:.55rem;overflow-wrap:anywhere}
.gallery-grid figcaption span{display:block;color:var(--muted)}
.collage-sheet{display:grid;justify-items:center;gap:.8rem;margin:1rem 0}
.collage-sheet img{width:min(100%,640px);height:auto;max-height:65dvh;object-fit:contain;background:#eee3f8}
.download-link{display:inline-block;padding:.8rem 1.2rem;border-radius:12px;background:#472767;color:white;font-weight:700}
#camera{padding:0;border:0;border-radius:0;margin:0;inset:0;width:100%;height:100dvh;max-width:none;max-height:none;overflow:auto;background:#130d1b;color:white}
#capture{display:grid;grid-template-rows:auto minmax(0,1fr) auto;height:100%;min-height:210px}
#camera-title{margin:0;padding:max(.8rem,env(safe-area-inset-top)) max(.8rem,env(safe-area-inset-right)) .65rem max(.8rem,env(safe-area-inset-left));text-align:center;overflow-wrap:anywhere}
.camera-stage{min-width:0;min-height:0;display:grid;grid-template: minmax(0,1fr) / minmax(0,1fr);place-items:center;background:#08060b}
#camera .camera-stage :is(video,img){width:100%;height:100%;min-height:0;max-height:none;object-fit:contain;background:transparent;border-radius:0}
.camera-controls{padding:.55rem max(.6rem,env(safe-area-inset-right)) max(.75rem,env(safe-area-inset-bottom)) max(.6rem,env(safe-area-inset-left));background:#251633;text-align:center}
.camera-controls .actions{justify-content:center;margin:0}
.camera-controls button{min-height:52px}
.camera-controls #snap,.camera-controls #save{background:#ffdc75;color:#30223e;min-width:135px}
#camera-message:not(:empty){margin:0 0 .55rem}
#photo-file{margin-bottom:.45rem}
@media(orientation:landscape) and (max-height:560px){
    #capture{grid-template-columns:minmax(0,1fr) minmax(130px,24%);grid-template-rows:auto minmax(0,1fr);padding-left:env(safe-area-inset-left)}
    #camera-title{grid-column:1/-1;padding-top:max(.35rem,env(safe-area-inset-top));padding-bottom:.35rem;font-size:1rem}
    .camera-controls{display:flex;flex-direction:column;justify-content:safe center;overflow:auto;min-height:0}
    .camera-controls .actions{display:grid;gap:.3rem}
    .camera-controls button{min-height:42px;padding:.4rem}
    .camera-controls #snap,.camera-controls #save{min-width:0}
}

footer{padding:1.1rem 0;text-align:center}
button.text-button{padding:.4rem;background:transparent;color:#542181;text-decoration:underline;text-underline-offset:3px}
button.danger{background:#932b36;color:#fff}
textarea{width:100%;min-width:0;padding:.65rem .75rem;border:1px solid #bbb0c5;border-radius:10px;background:#fff;color:var(--ink);font:inherit}
#policy{width:min(calc(100% - 24px),620px)}
#policy h3{margin:1rem 0 .35rem}
#policy li{margin:.3rem 0}
.policy-notes{white-space:pre-wrap;overflow-wrap:anywhere}
