/* Flick — Phase 0 shell. Portrait, one-thumb, dark. */
:root{
  --bg:#0b0b12; --card:#161624; --line:#262638; --fg:#fff; --dim:#9aa0b5;
  --accent:#ff3b6b; --ok:#3ddc84; --gold:#ffd93d; --blue:#4dd4ff;
  --safe-t:env(safe-area-inset-top,0px); --safe-b:env(safe-area-inset-bottom,0px);
  /* Height of the reserved control strip. The game frame stops above it. */
  /* Reserved bands. The game renders between them and under neither. */
  --topbar:60px;
  --bar:128px;
}
*{margin:0;padding:0;box-sizing:border-box;-webkit-tap-highlight-color:transparent}

/* The overlays below are toggled with the `hidden` attribute but each carries a
   class that sets display:flex — an author rule beats the UA rule that makes
   [hidden] display:none, so they would never actually hide. This has to come
   first and it has to be !important. */
[hidden]{display:none !important}
html,body{height:100%;overflow:hidden;background:var(--bg);color:var(--fg);
  font-family:system-ui,-apple-system,"SF Pro Text",sans-serif;
  -webkit-user-select:none;user-select:none;overscroll-behavior:none}
button{font:inherit;color:inherit;border:0;background:none;cursor:pointer}
input{font:inherit}

/* ---- the pager -------------------------------------------------------- */
/* CSS scroll-snap rather than a JS pager: on iOS Safari it is the only thing
   that gets native rubber-band feel and 120Hz momentum for free. */
.feed{height:100dvh;overflow-y:scroll;scroll-snap-type:y mandatory;
  overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch;scrollbar-width:none}
.feed::-webkit-scrollbar{display:none}

.slide{position:relative;height:100dvh;scroll-snap-align:start;scroll-snap-stop:always;
  overflow:hidden;background:#0e0e18}

/* Inset by the control strip: the game gets its own space and never sits under
   the one region the player needs in order to leave. */
.slide iframe{position:absolute;left:0;right:0;top:calc(var(--topbar) + var(--safe-t));
  width:100%;
  height:calc(100dvh - var(--topbar) - var(--safe-t) - var(--bar) - var(--safe-b));
  border:0;background:#10101a;opacity:0;transition:opacity .22s}
.slide.live iframe{opacity:1}

/* Placeholder shown until the game calls sdk.ready() */
.ph{position:absolute;left:0;right:0;top:calc(var(--topbar) + var(--safe-t));bottom:calc(var(--bar) + var(--safe-b));display:flex;flex-direction:column;
  align-items:center;justify-content:center;gap:14px;color:var(--dim)}
.ph-title{font:700 22px/1 system-ui;color:#fff}
.ph-dot{width:34px;height:34px;border-radius:50%;border:3px solid #2a2a3d;
  border-top-color:var(--accent);animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.slide.live .ph{display:none}

/* ---- meta + action rail ---------------------------------------------- */
.meta{display:none}   /* replaced by the control strip's own meta */
.meta h2{font:700 19px/1.2 system-ui;margin-bottom:3px}
.meta p{font:500 14px/1.35 system-ui;color:#d6d9e4}
.meta .tag{display:inline-block;margin-top:7px;padding:3px 9px;border-radius:99px;
  background:rgba(255,255,255,.13);font:600 11px/1 system-ui;letter-spacing:.5px;
  text-transform:uppercase;color:#fff}

.rail{display:none}
/* On a game with no score, love is the only verdict available — so it reads
   as the primary action rather than one icon among six. */
@keyframes lovepop{40%{transform:scale(1.45)}100%{transform:scale(1.12)}}

/* ---- result card ----------------------------------------------------- */
/* The backdrop must not trap the player. It covers the whole screen, so with
   pointer-events:auto a swipe over the top half hits the overlay instead of the
   feed and the feed becomes unswipeable the moment any game ends — which is
   most of the time. Backdrop passes touches through; only the card itself is
   interactive, and the card forwards vertical flicks to the feed (app.js). */
.result{position:fixed;inset:0;z-index:20;display:flex;align-items:flex-end;
  pointer-events:none;
  background:linear-gradient(to top,rgba(6,6,12,.94) 45%,rgba(6,6,12,.2));
  animation:fade .18s}
.result-card{pointer-events:auto}
@keyframes fade{from{opacity:0}}
.result-card{width:100%;padding:26px 20px calc(24px + var(--safe-b));text-align:center}
.r-label{font:600 13px/1 system-ui;letter-spacing:1.4px;text-transform:uppercase;color:var(--dim)}
.r-score{font:800 clamp(44px,15vw,72px)/1 system-ui;margin:8px 0 4px}
.r-sub{font:500 15px/1.4 system-ui;color:var(--dim);min-height:20px}
.r-board{margin:16px auto 4px;max-width:340px;text-align:left}
.r-row{display:flex;align-items:center;gap:10px;padding:7px 12px;border-radius:10px;
  font:600 14px/1 system-ui;color:#cfd4e2}
.r-row.me{background:rgba(255,59,107,.16);color:#fff}
.r-row .rk{width:20px;color:var(--dim);font-weight:700}
.r-row .nm{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.r-row .sc{font-variant-numeric:tabular-nums;font-weight:800}
.r-actions{display:flex;flex-direction:column;gap:9px;max-width:340px;margin:18px auto 0}
.btn-primary{padding:15px;border-radius:14px;background:var(--accent);
  font:700 17px/1 system-ui;color:#fff}
.btn-ghost{padding:13px;border-radius:14px;background:rgba(255,255,255,.09);
  font:600 15px/1 system-ui}
.btn-primary:active,.btn-ghost:active{opacity:.7}
.r-next{margin-top:16px;font:600 13px/1 system-ui;color:var(--dim)}

/* ---- sheets ---------------------------------------------------------- */
.sheet{position:fixed;inset:0;z-index:30;background:rgba(0,0,0,.6);
  display:flex;align-items:flex-end}
.sheet-card{width:100%;max-height:76dvh;background:var(--card);
  border-radius:18px 18px 0 0;display:flex;flex-direction:column;
  padding-bottom:var(--safe-b);animation:up .22s cubic-bezier(.2,.9,.3,1)}
@keyframes up{from{transform:translateY(100%)}}
.sheet-head{display:flex;align-items:center;justify-content:space-between;
  padding:16px 18px 8px;font:700 17px/1 system-ui}
.sheet-x{font-size:19px;color:var(--dim);padding:4px 8px}
.sheet-tabs{display:flex;gap:8px;padding:0 18px 10px}
.tab{padding:7px 14px;border-radius:99px;background:rgba(255,255,255,.07);
  font:600 13px/1 system-ui;color:var(--dim)}
.tab.on{background:rgba(255,255,255,.16);color:#fff}
.sheet-body{flex:1;overflow-y:auto;padding:4px 18px 14px;-webkit-overflow-scrolling:touch}
.sheet-row{display:flex;gap:10px;align-items:baseline;padding:9px 0;
  border-bottom:1px solid var(--line);font:500 14px/1.4 system-ui}
.sheet-row .who{font-weight:700;color:#fff}
.sheet-row .val{margin-left:auto;font-weight:800;font-variant-numeric:tabular-nums}
.sheet-empty{padding:26px 0;text-align:center;color:var(--dim);font:500 14px/1.5 system-ui}
.sheet-form{display:flex;gap:8px;padding:10px 18px 14px;border-top:1px solid var(--line)}
.sheet-form input{flex:1;padding:12px 14px;border-radius:12px;border:0;
  background:#20203044;color:#fff;outline:none}
.sheet-form button{padding:12px 16px;border-radius:12px;background:var(--accent);font-weight:700}

/* ---- onboarding ------------------------------------------------------ */
.sheet-full{position:fixed;inset:0;z-index:60;background:var(--bg);
  display:flex;align-items:center;justify-content:center;padding:28px}
.ob-inner{width:100%;max-width:340px;text-align:center}
.ob-mark{font:800 44px/1 system-ui;letter-spacing:-1.5px;
  background:linear-gradient(92deg,var(--accent),var(--gold));
  -webkit-background-clip:text;background-clip:text;color:transparent}
.ob-line{margin:14px 0 26px;font:500 16px/1.5 system-ui;color:var(--dim)}
.ob-input{width:100%;padding:15px 16px;border-radius:14px;border:1px solid var(--line);
  background:#14141f;color:#fff;text-align:center;outline:none}
.ob-input:focus{border-color:var(--accent)}
.ob-btn{width:100%;margin-top:12px;padding:15px;border-radius:14px;
  background:var(--accent);font:700 17px/1 system-ui}
.ob-fine{margin-top:18px;font:500 12px/1.5 system-ui;color:#6b7188}

/* ---- challenge banner ------------------------------------------------- */
.challenge{position:fixed;left:12px;right:12px;top:calc(10px + var(--safe-t));z-index:15;
  padding:12px 15px;border-radius:14px;background:rgba(255,59,107,.94);
  font:600 14px/1.35 system-ui;box-shadow:0 8px 26px rgba(0,0,0,.45)}

/* ---- reserved top band ------------------------------------------------ */
.topband{position:fixed;left:0;right:0;top:0;z-index:14;
  height:calc(var(--topbar) + var(--safe-t));padding:var(--safe-t) 12px 0;
  display:flex;align-items:center;gap:9px;
  background:#0b0b12;border-bottom:1px solid #1d1d2b}
.tb-meta{flex:1;min-width:0}
.tb-meta h2{font:700 16px/1.2 system-ui;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tb-meta p{font:500 11px/1.3 system-ui;color:var(--dim);margin-top:1px;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.topband .tag{flex:0 0 auto;padding:3px 8px;border-radius:99px;background:rgba(255,255,255,.09);
  font:600 9px/1.4 system-ui;letter-spacing:.4px;text-transform:uppercase;color:#c8cddb}
.tb-continue{background:rgba(61,220,132,.18)!important;color:#7cffb0!important}
.tb-round{position:relative;flex:0 0 auto;width:36px;height:36px;border-radius:50%;
  font:600 14px/1 system-ui;background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.12);color:#e8eaf2}
.tb-round:active{transform:scale(.9)}
.tb-ship{flex:0 0 auto;padding:8px 12px;border-radius:99px;background:var(--accent);
  font:700 11px/1 system-ui;color:#fff;white-space:nowrap}
.tb-ship.out{background:rgba(255,255,255,.1);color:#c8cddb}

/* ---- reserved control strip ------------------------------------------- */
.controls{position:fixed;left:0;right:0;bottom:0;z-index:14;
  height:calc(var(--bar) + var(--safe-b));padding:10px 12px var(--safe-b);
  display:flex;flex-direction:column;gap:8px;
  background:#0b0b12;border-top:1px solid #1d1d2b;
  touch-action:none;-webkit-user-select:none;user-select:none}
.ctl-grip{position:absolute;left:50%;top:5px;transform:translateX(-50%);
  width:38px;height:4px;border-radius:99px;background:#33334a}
.ctl-row{display:flex;align-items:center;gap:8px}


.ctl-round{position:relative;flex:0 0 auto;width:38px;height:38px;border-radius:50%;
  font:600 15px/1 system-ui;background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.12);color:#e8eaf2}
.ctl-round:active{transform:scale(.9)}
.ctl-next{background:var(--accent);border-color:transparent;color:#fff}
.mine-count{position:absolute;top:-4px;right:-4px;min-width:17px;height:17px;padding:0 4px;
  border-radius:99px;background:var(--accent);font:700 10px/17px system-ui;color:#fff}

/* The create button is the product's primary action, so it is the largest,
   most colourful thing on the screen that is not the game. */
/* Prev and next flank it, so an equal-width pair leaves the plus dead centre. */
.ctl-bottom{justify-content:space-between}
.ctl-make{flex:0 0 auto;width:58px;height:58px;border-radius:50%;
  background:var(--accent);color:#fff;font:300 30px/1 system-ui;
  display:flex;align-items:center;justify-content:center;
  box-shadow:0 6px 20px rgba(255,59,107,.35)}
.ctl-make:active{transform:scale(.92);opacity:.9}
.ctl-round{width:46px;height:46px;border-radius:14px}
.ctl-next{background:rgba(255,255,255,.1);border-color:rgba(255,255,255,.14);color:#e8eaf2}

/* Game actions: one fixed row, evenly spread, never over the game. */
.ctl-acts{justify-content:space-between;gap:2px}
.act{flex:1 1 0;min-width:0;display:flex;flex-direction:column;align-items:center;gap:2px;
  padding:4px 0;border-radius:10px}
.act:active{background:rgba(255,255,255,.08)}
.act .ico{font-size:20px;line-height:1}
.act .lbl{font:600 9px/1 system-ui;color:#9aa0b5;letter-spacing:.2px}
.act.on .ico{transform:scale(1.1)}
.act.on[data-act=like] .ico{animation:lovepop .32s ease}
.act.on[data-act=like] .lbl{color:#ffb3c6}
@keyframes lovepop{40%{transform:scale(1.45)}100%{transform:scale(1.1)}}

/* ---- guaranteed nav --------------------------------------------------- */
.nav-btn{width:44px;height:44px;border-radius:50%;font:600 17px/1 system-ui;
  background:rgba(20,20,32,.62);border:1px solid rgba(255,255,255,.14);color:#e8eaf2;
  backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}
.nav-btn:active{transform:scale(.9);background:rgba(255,59,107,.8)}
.nav-next{background:rgba(255,59,107,.72);border-color:rgba(255,255,255,.2)}

/* ---- my games --------------------------------------------------------- */
.mine-count{position:absolute;top:-3px;right:-3px;min-width:19px;height:19px;
  padding:0 5px;border-radius:99px;background:var(--accent);
  font:700 11px/19px system-ui;color:#fff}
.mine-card{max-height:82dvh}
.mine-totals{display:flex;gap:16px;padding:2px 18px 12px;border-bottom:1px solid var(--line)}
.mine-tot{display:flex;flex-direction:column}
.mine-tot b{font:800 19px/1.1 system-ui}
.mine-tot span{font:600 10px/1 system-ui;color:var(--dim);letter-spacing:.4px;
  text-transform:uppercase;margin-top:3px}
.mine-row{display:flex;gap:12px;align-items:flex-start;padding:13px 0;
  border-bottom:1px solid var(--line)}
.mine-main{flex:1;min-width:0}
.mine-title{font:700 15px/1.25 system-ui;display:flex;align-items:center;gap:6px}
.mine-title .remix{font:600 10px/1 system-ui;color:var(--dim);
  border:1px solid var(--line);padding:2px 5px;border-radius:4px}
.mine-blurb{font:500 12px/1.35 system-ui;color:var(--dim);margin-top:2px;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mine-stats{display:flex;gap:12px;margin-top:7px;flex-wrap:wrap}
.mine-stat{font:600 11px/1 system-ui;color:#c8cddb}
.mine-stat b{font-weight:800;color:#fff}
.mine-stat.lead b{color:var(--gold)}
.mine-side{display:flex;flex-direction:column;align-items:flex-end;gap:6px;flex:0 0 auto}
.mine-pill{padding:4px 9px;border-radius:99px;font:700 10px/1 system-ui;
  letter-spacing:.3px;text-transform:uppercase}
.pill-private{background:rgba(255,255,255,.1);color:#c8cddb}
.pill-exploring{background:rgba(77,212,255,.18);color:#8fe4ff}
.pill-promoted{background:rgba(61,220,132,.18);color:#7cffb0}
.pill-buried{background:rgba(255,77,109,.16);color:#ff9fb2}
.mine-acts{display:flex;gap:6px}
.mine-act{padding:6px 10px;border-radius:8px;background:rgba(255,255,255,.09);
  font:600 11px/1 system-ui}
.mine-act.primary{background:var(--accent);color:#fff}
.mine-act:active{opacity:.7}
.mine-why{font:500 10px/1.3 system-ui;color:#6b7188;margin-top:5px}

/* ---- ship bar --------------------------------------------------------- */
/* right edge stops short of the ✨ make button, which is fixed at right:14px */

/* A full, opaque panel: creating is its own moment, and a game flickering away
   underneath it is both distracting and a waste of the phone's battery — the
   game itself is paused while this is open. */
.sheet-solid{background:var(--bg);align-items:stretch;z-index:40}
.sheet-solid .sheet-card{max-height:none;height:100%;border-radius:0;
  padding-top:var(--safe-t);animation:none;justify-content:flex-start}
.sheet-solid .make-working{margin:auto 0;padding-bottom:12vh}
.make-real{margin-top:8px;font:600 12px/1.4 system-ui;color:#6b7188;
  letter-spacing:.3px;text-transform:uppercase}

/* ---- make a game ------------------------------------------------------ */
.make-card{padding-bottom:calc(20px + var(--safe-b))}
.make-input{width:calc(100% - 36px);margin:4px 18px 0;padding:14px;border-radius:14px;
  border:1px solid var(--line);background:#10101a;color:#fff;resize:none;outline:none;
  font:500 16px/1.4 system-ui}
.make-input:focus{border-color:var(--accent)}
.make-examples{display:flex;gap:8px;overflow-x:auto;padding:12px 18px 4px;
  scrollbar-width:none}
.make-examples::-webkit-scrollbar{display:none}
.make-chip{flex:0 0 auto;padding:8px 13px;border-radius:99px;background:rgba(255,255,255,.08);
  font:500 13px/1 system-ui;color:#c8cddb;white-space:nowrap}
.make-chip:active{background:rgba(255,255,255,.18)}
#make-compose .btn-primary{margin:14px 18px 0;width:calc(100% - 36px)}
.make-fine{margin:10px 18px 0;font:500 12px/1.5 system-ui;color:#6b7188;text-align:center}
.make-opts{margin:14px 18px 0;border-top:1px solid var(--line);padding-top:10px}
.make-opts-toggle{display:flex;align-items:center;gap:8px;width:100%;padding:6px 0;
  font:600 14px/1 system-ui;color:#c8cddb}
.make-opts-sum{margin-left:auto;font-weight:500;color:#6b7188;font-size:13px}
.make-opts-chev{color:#6b7188;transition:transform .2s}
.make-opts.open .make-opts-chev{transform:rotate(180deg)}
.make-opts-body{padding:6px 0 2px}
.make-opt{padding:9px 0}
.make-opt-label{font:600 12px/1 system-ui;color:#8b93a8;letter-spacing:.4px;
  text-transform:uppercase;margin-bottom:7px}
.make-opt-row{display:flex;gap:7px;overflow-x:auto;scrollbar-width:none;padding-bottom:2px}
.make-opt-row::-webkit-scrollbar{display:none}
.make-opt-btn{flex:0 0 auto;padding:8px 13px;border-radius:99px;white-space:nowrap;
  background:rgba(255,255,255,.07);font:500 13px/1 system-ui;color:#c8cddb}
.make-opt-btn.on{background:var(--accent);color:#fff;font-weight:600}
.make-opt-hint{margin-top:6px;font:500 12px/1.4 system-ui;color:#6b7188}

.make-target{margin:0 18px 10px;padding:9px 12px;border-radius:10px;
  background:rgba(255,59,107,.14);font:600 13px/1.3 system-ui;color:#ffb3c6}
.make-working{padding:28px 18px 8px;text-align:center}
.make-working .btn-primary,.make-working .btn-ghost{width:100%;margin-top:10px}
.make-spinner{width:38px;height:38px;margin:0 auto 16px;border-radius:50%;
  border:3px solid #262638;border-top-color:var(--accent);animation:spin .8s linear infinite}
.make-stage{font:700 19px/1.35 system-ui;transition:opacity .28s;min-height:52px;
  display:flex;align-items:center;justify-content:center;padding:0 6px}
.make-done-mark{font-size:40px;margin-bottom:10px}

/* ---- toast ------------------------------------------------------------ */
.toast{position:fixed;left:50%;bottom:calc(96px + var(--safe-b));transform:translateX(-50%);
  z-index:50;padding:11px 18px;border-radius:99px;background:rgba(20,20,32,.96);
  border:1px solid var(--line);font:600 14px/1 system-ui;white-space:nowrap;
  animation:fade .16s}
