/* Layout: full-screen portrait arena with overlays centered. Black outer space. */
:root{
  --ink:#fff7ec; --stone:#2c2350; --accent:#ffcf3f;
  --display:"Lilita One","Arial Rounded MT Bold",system-ui,sans-serif;
  --body:"Rubik",system-ui,-apple-system,sans-serif;
  color-scheme:dark;
}
[hidden]{display:none!important} /* .overlay sets display:flex, which would otherwise beat the hidden attribute */
html,body{height:100%;margin:0;overflow:hidden;overscroll-behavior:none}
body{background:#000;color:var(--ink);font-family:var(--body);-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
#wrap{position:relative;height:100%;width:100%}
#c{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none}
#debug{position:absolute;left:0;right:0;bottom:0;padding:4px 8px;font:11px/1.3 ui-monospace,Menlo,Consolas,monospace;
  color:#7dffb2;background:rgba(0,0,0,.6);pointer-events:none}
/* Overlays scroll on screens too short for everything, and center their content otherwise (margin:auto). */
.overlay{position:absolute;inset:0;display:flex;flex-direction:column;overflow-y:auto;
  padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px));
  background:rgba(0,0,0,.72);backdrop-filter:blur(3px);text-align:center}
#start{background:#000;backdrop-filter:none} /* the home screen is plain black, not the game showing through */
.menu{display:flex;flex-direction:column;align-items:center;gap:18px;width:100%;max-width:360px;margin:auto;
  padding:max(18px,env(safe-area-inset-top,0px)) 0 max(18px,env(safe-area-inset-bottom,0px))}
h1{font-family:var(--display);font-weight:400;font-size:clamp(46px,14vw,78px);line-height:.95;margin:0;letter-spacing:.01em;
  color:var(--accent);text-shadow:0 4px 0 #b4442a,0 9px 18px rgba(0,0,0,.4);text-wrap:balance}
/* Faces are the top layer of every screen: their own canvas over the whole page, touches
   passing through. A .faces-row holds the room for a row of them; render.js sizes it. */
#faces{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:7}
.faces-row{display:block;flex:none}
button{font-family:var(--display);font-size:26px;letter-spacing:.03em;color:var(--stone);background:var(--accent);border:0;border-radius:999px;
  padding:14px 44px;box-shadow:0 5px 0 #b98a10;cursor:pointer}
button:active{transform:translateY(3px);box-shadow:0 2px 0 #b98a10}
button:focus-visible{outline:3px solid var(--ink);outline-offset:4px}
button.ghost{font-size:18px;padding:10px 26px;background:transparent;color:var(--ink);box-shadow:inset 0 0 0 2px var(--ink)}
button.ghost:active{transform:none;box-shadow:inset 0 0 0 2px var(--accent)}
.icon{width:1.25em;height:1.25em;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.note{font-size:13px;opacity:.7;max-width:290px;line-height:1.4}
/* Basketball and Worms are played sideways: held upright, the game hides behind this. */
#turn{background:#000;backdrop-filter:none;z-index:4}
#turnText{font-family:var(--display);font-size:clamp(32px,9vw,48px);margin:0;color:var(--accent);text-wrap:balance}
.phone{width:96px;height:96px;fill:none;stroke:var(--ink);stroke-width:3;stroke-linecap:round;stroke-linejoin:round;
  animation:turn-phone 2.4s ease-in-out infinite}
@keyframes turn-phone{0%,25%{transform:rotate(0)}55%,85%{transform:rotate(-90deg)}100%{transform:rotate(0)}}
@media (prefers-reduced-motion:reduce){.phone{animation:none;transform:rotate(-90deg)}}
#winner{font-family:var(--display);font-size:clamp(38px,11vw,60px);margin:0;color:var(--ink)}
#listen{position:absolute;left:50%;bottom:max(24px,env(safe-area-inset-bottom,0px));transform:translateX(-50%);z-index:5;
  font-size:20px;padding:12px 28px;white-space:nowrap}
#listen:active{transform:translateX(-50%) translateY(3px)}
#lost{position:absolute;left:50%;top:max(14px,env(safe-area-inset-top,0px));transform:translateX(-50%);z-index:5;
  padding:6px 14px;border-radius:999px;background:rgba(180,40,40,.85);font-weight:700;font-size:14px;white-space:nowrap;pointer-events:none}
/* Camera, microphone and share: icon left of the text. Camera and microphone are on/off toggles:
   dimmed with a slash through the icon when off; when on, a green ring and a green check after
   the text, so it's plainly good (the user's call). */
:root{--good:#4ade80}
.setup{display:flex;flex-direction:column;gap:10px;align-items:stretch;width:min(290px,100%)}
.setup button{display:flex;align-items:center;justify-content:center;gap:10px;padding:10px 20px}
.setup #name span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* Typing your own name: the name button turns into this box and a Save button. */
.name-form{display:flex;gap:8px;align-items:stretch}
.name-form input{flex:1;min-width:0;font:600 17px var(--body);padding:8px 16px;border-radius:999px;border:0;
  background:#1a1430;color:var(--ink);box-shadow:inset 0 0 0 2px rgba(255,247,236,.5)}
.name-form input:focus{outline:none;box-shadow:inset 0 0 0 2px var(--accent)}
.name-form button{padding:8px 18px;font-size:17px}
.visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.toggle:not(.on){opacity:.75}
.toggle .slash{display:none}
.toggle:not(.on) .slash{display:block}
.toggle.on{box-shadow:inset 0 0 0 2px var(--good)}
.toggle .check{display:none;color:var(--good);stroke-width:3}
.toggle.on .check{display:block}
.toggle.on .icon:not(.check){color:var(--good)}
.toggle.note{opacity:1;box-shadow:inset 0 0 0 2px #ff8a7a;font-size:15px} /* the reason it would not start, for a few seconds */
/* Always there in a game, top left: back to the home screen in one tap. */
#back{position:absolute;z-index:6;top:max(10px,env(safe-area-inset-top,0px));left:max(10px,env(safe-area-inset-left,0px));
  width:46px;height:46px;padding:0;display:flex;align-items:center;justify-content:center;border-radius:50%;
  background:rgba(20,16,40,.7);color:var(--ink);box-shadow:inset 0 0 0 2px rgba(255,247,236,.7)}
#back .icon{width:26px;height:26px;stroke-width:2.6}
#back:active{transform:none;background:rgba(20,16,40,.95)}
/* The games: two tiles a row, more rows as games are added. Icon above the name. */
.games{display:grid;grid-template-columns:1fr 1fr;gap:12px;width:min(340px,100%)}
.games button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;
  padding:14px 8px 12px;font-size:20px;line-height:1;border-radius:22px;box-shadow:0 4px 0 #b98a10}
.games button:active{box-shadow:0 1px 0 #b98a10}
.games .icon{width:38px;height:38px;stroke-width:1.8}
.games button::after{font-family:var(--body);font-weight:700;font-size:12px;text-transform:uppercase;letter-spacing:.06em;line-height:1}
.games button.live::after{content:"on now"}
.games button.soon::after{content:"soon"}
.games button.soon{background:transparent;color:var(--ink);opacity:.45;box-shadow:inset 0 0 0 2px rgba(255,247,236,.5);cursor:default}
@media (max-height:700px){.menu{gap:12px}h1{font-size:40px}} /* fit the faces and every button on short screens */

/* The game-over screen on a phone held sideways (after a sideways game): the faces in one row,
   the winner under them, and both buttons side by side, so nothing is below the fold (the user's call). */
@media (orientation:landscape) and (max-height:540px){
  #over .menu{flex-direction:row;flex-wrap:wrap;justify-content:center;align-items:center;gap:8px 16px;max-width:min(760px,100%);
    padding:max(8px,env(safe-area-inset-top,0px)) 0 max(8px,env(safe-area-inset-bottom,0px))}
  #over #winner{flex-basis:100%;font-size:clamp(26px,9vh,38px);line-height:1.1}
  #over button{font-size:20px;padding:9px 30px;box-shadow:0 4px 0 #b98a10}
  #over button.ghost{font-size:16px;padding:9px 22px;box-shadow:inset 0 0 0 2px var(--ink)}
}

/* Opened inside another app's browser, where cameras often fail: how to get out, on the home screen only then. */
.inapp{display:flex;flex-direction:column;align-items:center;gap:10px;width:min(320px,100%);padding:14px 16px;border-radius:16px;
  background:#2a1220;box-shadow:inset 0 0 0 2px #ff8a7a;box-sizing:border-box}
.inapp p{margin:0;font-size:15px;line-height:1.4}
.inapp button{font-size:19px;padding:10px 26px}
.inapp button.ghost{font-size:16px;padding:8px 20px}
