@font-face{font-family:"Rubik";src:url("/fonts/rubik-var.woff2") format("woff2");font-weight:500 900;font-style:normal;font-display:swap}

:root{--bg:#0B0B0D;--ease-pop:cubic-bezier(.34,1.56,.64,1)}
*{box-sizing:border-box;margin:0;-webkit-tap-highlight-color:transparent}
html{background:var(--bg);color:#fff;font-family:"Rubik",system-ui,sans-serif;-webkit-text-size-adjust:100%;overflow-x:clip}
body{min-height:100dvh;background:var(--bg);overflow-x:clip}
body.open{overflow:hidden}

.home{width:100%;max-width:560px;margin:0 auto;padding:max(28px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(48px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left))}
.head{padding:8px 0 24px}
.head h1{font-size:clamp(44px,13vw,64px);font-weight:900;letter-spacing:-.03em;line-height:1}
.sub{margin-top:12px;max-width:30ch;color:#B9B9C6;font-weight:500;font-size:17px;line-height:1.4}

.games{list-style:none;padding:0;display:grid;grid-template-columns:minmax(0,1fr);gap:8px;perspective:1100px;perspective-origin:50% 30%}
.game{display:block;min-width:0}
.game:first-child{margin-bottom:16px}

/* the card: preserve-3d parent, flat clipped layers inside */
.card{--zp:900;--r:20px;position:relative;display:grid;grid-template-columns:auto minmax(0,1fr);gap:4px 16px;
  width:100%;min-width:0;padding:20px;border-radius:var(--r);text-decoration:none;color:var(--ink);
  transform-style:preserve-3d;transform:perspective(900px);touch-action:pan-y;user-select:none;-webkit-user-select:none;
  outline:none}
.card:focus-visible{outline:4px solid #fff;outline-offset:5px}
.layer{position:absolute;inset:0;border-radius:var(--r);clip-path:inset(0 round var(--r));pointer-events:none;
  transform:translateZ(calc(var(--z,0)*1px)) scale(calc(1 - var(--z,0)/900))}
.layer.base{background:var(--c)}
.layer svg{display:block;width:100%;height:100%}
.l1{--z:8}.l2{--z:20}.l3{--z:34}
.badge,.name,.tag,.num{position:relative;transform:translateZ(calc(var(--z,0)*1px)) scale(calc(1 - var(--z,0)/900))}
.badge{--z:46;grid-row:1/4;align-self:start;width:56px;height:56px;border-radius:14px;background:var(--b);display:grid;place-items:center}
.badge svg{width:44px;height:44px}
.name{--z:60;grid-column:2;align-self:start;font-size:clamp(24px,7vw,28px);font-weight:900;line-height:1.05;letter-spacing:-.025em}
.tag{--z:40;grid-column:2;font-weight:600;font-size:16px;line-height:1.3}
.num{--z:72;grid-column:2;margin-top:8px;display:flex;align-items:baseline;gap:6px}
.num b{font-size:22px;font-weight:900;line-height:1;letter-spacing:-.02em;color:var(--num)}
.num i{font-style:normal;font-weight:600;font-size:16px}

/* compact cards: flat colour blocks; foreground art is left to the lead card so nothing sits under text */
.game:not(:first-child) .l2,.game:not(:first-child) .l3{display:none}
.g-gilded .l1 svg,.g-odd .l1 svg{transform:scaleX(-1)}
/* roles: Quest and Gilded lead with the count, Aces and Odd put the mark on the right */
.g-quest .num b,.g-gilded .num b{font-size:40px;letter-spacing:-.03em}
.g-aces .card,.g-odd .card{grid-template-columns:minmax(0,1fr) auto}
.g-aces .badge,.g-odd .badge{grid-column:2;grid-row:1/4}
.g-aces .name,.g-aces .tag,.g-aces .num,.g-odd .name,.g-odd .tag,.g-odd .num{grid-column:1}

/* lead card: the one focal point, flat, with the mask art kept clear of the text */
.game:first-child .card{--r:28px;min-height:296px;padding:24px 24px 28px;gap:8px 16px;grid-template-rows:auto 1fr auto auto}
.game:first-child .l1,.game:first-child .l3{display:none}
.game:first-child .badge{grid-row:1;width:76px;height:76px;border-radius:24px}
.game:first-child .badge svg{width:62px;height:62px}
.game:first-child .name{font-size:clamp(34px,10vw,44px)}
.game:first-child .tag{grid-column:1/3;grid-row:3;align-self:end;max-width:40%;font-size:18px}
.game:first-child .num{grid-column:1/3;grid-row:4;margin:0;gap:8px}
.game:first-child .num b{font-size:clamp(64px,19vw,88px);line-height:.9;letter-spacing:-.04em}
.game:first-child .num i{font-weight:700;font-size:18px}

.g-mafia .card{--c:#A3101D;--ink:#FFF4E6;--b:#F2C14E;--bedge:#B58A22;--num:#FFD36B}
.g-quest .card{--c:#17317E;--ink:#FFFFFF;--b:#FFD25A;--bedge:#B58E1E;--num:#FFD25A}
.g-gilded .card{--c:#F07A22;--ink:#2A0606;--b:#7A1410;--bedge:#4A0A08;--num:#2A0606}
.g-aces .card{--c:#13235B;--ink:#FFFFFF;--b:#E8ECF7;--bedge:#8C97B8;--num:#E8ECF7}
.g-odd .card{--c:#0E7A4B;--ink:#FFF7E6;--b:#F5C542;--bedge:#B58E1E;--num:#FFF7E6}

/* sheet */
.scrim{position:fixed;inset:0;background:rgba(0,0,0,.62);opacity:0;z-index:10}
.sheet{--sc:#7A0A14;--solid:#7A0A14;--ink:#fff;--goBg:#F2C14E;--goInk:#2A0508;
  position:fixed;left:0;right:0;bottom:0;margin:0 auto;max-width:560px;max-height:92dvh;display:flex;flex-direction:column;z-index:11;color:var(--ink);
  padding:6px 22px calc(20px + env(safe-area-inset-bottom));box-shadow:0 120px 0 var(--solid);border-radius:34px 34px 0 0;
  background:var(--solid);touch-action:none;will-change:transform;outline:none}
.sheet[hidden],.scrim[hidden]{display:none}
.sheet>*{position:relative}
@supports ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){
  html:not(.flat) .sheet{background:var(--sc);-webkit-backdrop-filter:blur(26px) saturate(1.8);backdrop-filter:blur(26px) saturate(1.8)}
}
.sheet[data-game=mafia]{--sc:rgba(150,12,26,.86);--solid:#8A0C18}
.sheet[data-game=quest]{--sc:rgba(22,48,130,.86);--solid:#17317E;--goBg:#FFD25A;--goInk:#0E1F5C}
.sheet[data-game=gilded]{--sc:rgba(186,70,14,.88);--solid:#A8420F;--goBg:#FFE9C7;--goInk:#3A0A0A}
.sheet[data-game=aces]{--sc:rgba(19,35,91,.88);--solid:#13235B;--goBg:#E8ECF7;--goInk:#0C0C10}
.sheet[data-game=odd]{--sc:rgba(14,122,75,.88);--solid:#0B6640;--goBg:#F5C542;--goInk:#111114}
.grab{display:block;width:100%;height:34px;padding:0;border:0;background:none;cursor:grab;color:inherit}
.grab span{display:block;width:54px;height:7px;border-radius:9px;margin:10px auto 0;background:rgba(255,255,255,.7)}
.grab:focus-visible{outline:4px solid #fff;outline-offset:-4px;border-radius:20px}
.sheet-head{display:flex;align-items:center;gap:16px;margin-top:8px}
.sheet .badge{--z:0;flex:none;transform:none;grid-row:auto;width:68px;height:68px;border-radius:22px}
.sheet .badge svg{width:54px;height:54px}
.sheet[data-game=mafia] .badge{--b:#F2C14E;--bedge:#B58A22}
.sheet[data-game=quest] .badge{--b:#FFD25A;--bedge:#B58E1E}
.sheet[data-game=gilded] .badge{--b:#7A1410;--bedge:#4A0A08}
.sheet[data-game=aces] .badge{--b:#E8ECF7;--bedge:#8C97B8}
.sheet[data-game=odd] .badge{--b:#F5C542;--bedge:#B58E1E}
.sheet h2{font-size:clamp(30px,9vw,40px);font-weight:900;line-height:1.02;letter-spacing:-.025em}
.sheet-players{margin-top:12px;font-size:19px;font-weight:700;line-height:1.2}
.sheet-about{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;margin-top:24px;font-size:18px;line-height:1.5;font-weight:500;max-width:60ch}
.go{flex:none;display:flex;align-items:center;justify-content:center;margin-top:24px;min-height:76px;border-radius:99px;
  background:var(--goBg);color:var(--goInk);font-size:34px;font-weight:900;letter-spacing:.01em;text-decoration:none;
  box-shadow:0 8px 0 rgba(0,0,0,.28);transition:transform .35s var(--ease-pop)}
.go:active{transform:translateY(5px) scale(.98);box-shadow:0 3px 0 rgba(0,0,0,.28)}
.go:focus-visible{outline:4px solid #fff;outline-offset:4px}

/* flat: reduced motion, low-end */
html.flat .card,html.flat .layer,html.flat .badge,html.flat .name,html.flat .tag,html.flat .num{transform:none!important}
html.flat .card{transform-style:flat}
html.flat .games{perspective:none}
html.flat .sheet{will-change:auto}
html.flat .go{transition:none}
@media (prefers-reduced-motion:reduce){
  .card,.layer,.badge,.name,.tag,.num{transform:none!important}
  .go{transition:none}
}
@media (min-width:600px){.game:first-child .card{min-height:320px}}
