/* Movie Night Roulette. Single dark theme on purpose: it gets used in a
   living room with the lights down. */
:root{
  --ground:#15101D;
  --ground-2:#1E1729;
  --panel:#241C32;
  --panel-2:#2E2440;
  --line:#3A2F4D;
  --ink:#F7F1E8;
  --ink-2:#C6B8D4;
  --ink-3:#8E80A2;
  --amber:#EFB34A;
  --amber-deep:#C98A22;
  --rose:#E8899C;
  --teal:#5FC6B5;
  --paper:#F4ECDC;
  --paper-2:#E4D8C1;
  --radius:16px;
}

*{box-sizing:border-box;-webkit-tap-highlight-color:transparent;}
html,body{height:100%;}
body{
  margin:0;background:var(--ground);color:var(--ink);
  font-family:"Baloo 2","Trebuchet MS",system-ui,-apple-system,sans-serif;
  overflow-x:hidden;
  -webkit-user-select:none;user-select:none;
  -webkit-touch-callout:none;
  overscroll-behavior:none;
}
button{font-family:inherit;cursor:pointer;border:none;background:none;color:inherit;}
button:focus-visible,a:focus-visible,input:focus-visible{
  outline:3px solid var(--amber);outline-offset:3px;
}

/* ---------- chrome ---------- */
.app{min-height:100%;display:flex;flex-direction:column;}
.topbar{
  display:flex;align-items:center;gap:14px;
  padding:14px 22px;border-bottom:1px solid var(--line);
  background:var(--ground-2);
}
.brand{font-weight:800;font-size:1.12rem;letter-spacing:-.01em;flex:1;}
.brand em{color:var(--amber);font-style:normal;}
.bulbs{display:flex;gap:7px;}
.bulbs i{width:7px;height:7px;border-radius:50%;background:var(--amber);opacity:.85;}
.bulbs i:nth-child(2){opacity:.45}.bulbs i:nth-child(3){opacity:.65}

.tabs{display:flex;gap:8px;}
.tab{
  padding:11px 18px;border-radius:999px;font-weight:700;font-size:.94rem;
  color:var(--ink-3);min-height:44px;
}
.tab.on{background:var(--panel-2);color:var(--ink);}

main{flex:1;padding:26px 22px 40px;max-width:1100px;width:100%;margin:0 auto;}
.view{display:none;}
.view.on{display:block;}

/* ---------- pot / home ---------- */
.stage{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:18px;text-align:center;padding:10px 0 0;
}
.counts{display:flex;gap:26px;justify-content:center;flex-wrap:wrap;}
.count{display:flex;flex-direction:column;align-items:center;gap:1px;}
.count b{font-size:1.9rem;font-weight:800;color:var(--amber);line-height:1;
  font-variant-numeric:tabular-nums;}
.count span{font-size:.76rem;letter-spacing:.1em;text-transform:uppercase;color:var(--ink-3);}

.pot-wrap{position:relative;width:min(330px,74vw);margin:4px auto 0;}
.pot-wrap svg{width:100%;height:auto;display:block;}
.pot-wrap.shaking{animation:shake .42s ease-in-out infinite;}
@keyframes shake{
  0%,100%{transform:translate(0,0) rotate(0)}
  25%{transform:translate(-9px,3px) rotate(-4deg)}
  75%{transform:translate(9px,-3px) rotate(4deg)}
}
.slip-peek{transform-origin:50% 100%;}
.pot-wrap.shaking .slip-peek{animation:wiggle .3s ease-in-out infinite alternate;}
@keyframes wiggle{from{transform:rotate(-5deg)}to{transform:rotate(5deg)}}

.big{
  min-height:74px;padding:0 42px;border-radius:999px;
  background:linear-gradient(180deg,var(--amber) 0%,var(--amber-deep) 100%);
  color:#2A1B06;font-weight:800;font-size:1.3rem;letter-spacing:-.01em;
  box-shadow:0 8px 0 #8E610F,0 14px 26px rgba(0,0,0,.45);
  transition:transform .09s ease,box-shadow .09s ease;
}
.big:active{transform:translateY(5px);box-shadow:0 3px 0 #8E610F,0 8px 16px rgba(0,0,0,.4);}
.big[disabled]{opacity:.45;box-shadow:none;transform:none;}
.ghost{
  min-height:52px;padding:0 24px;border-radius:999px;border:2px solid var(--line);
  color:var(--ink-2);font-weight:700;font-size:.98rem;
}
.ghost:active{background:var(--panel);}
.hint{color:var(--ink-3);font-size:.92rem;max-width:44ch;margin:0 auto;line-height:1.5;}

/* ---------- reveal ---------- */
.reveal{position:fixed;inset:0;background:rgba(10,7,15,.94);z-index:50;
  display:none;align-items:center;justify-content:center;padding:24px;}
.reveal.on{display:flex;}

.card{
  width:min(300px,68vw);aspect-ratio:2/3;position:relative;
  transform-style:preserve-3d;transition:transform .75s cubic-bezier(.4,.9,.3,1);
  cursor:pointer;
}
.card.flipped{transform:rotateY(180deg);}
.face{
  position:absolute;inset:0;backface-visibility:hidden;border-radius:14px;
  overflow:hidden;box-shadow:0 20px 50px rgba(0,0,0,.6);
}
.face.back{
  background:repeating-linear-gradient(45deg,var(--paper) 0 12px,var(--paper-2) 12px 24px);
  display:flex;align-items:center;justify-content:center;
  border:6px solid var(--paper);
}
.face.back span{
  font-size:3.4rem;
}
.face.front{transform:rotateY(180deg);background:var(--panel);}
.face.front img{width:100%;height:100%;object-fit:cover;display:block;}
.face.front .noposter{
  width:100%;height:100%;display:flex;align-items:center;justify-content:center;
  padding:22px;text-align:center;font-weight:800;font-size:1.3rem;color:var(--ink-2);
}
.tapme{margin-top:18px;color:var(--amber);font-weight:700;letter-spacing:.04em;
  animation:pulse 1.5s ease-in-out infinite;}
@keyframes pulse{0%,100%{opacity:.5}50%{opacity:1}}

.won{display:flex;flex-direction:column;align-items:center;gap:16px;max-width:520px;}
.won h2{margin:0;font-size:clamp(1.5rem,4vw,2.3rem);font-weight:800;text-align:center;
  line-height:1.15;}
.meta{display:flex;gap:9px;flex-wrap:wrap;justify-content:center;}
.pill{
  background:var(--panel-2);border:1px solid var(--line);border-radius:999px;
  padding:5px 13px;font-size:.82rem;color:var(--ink-2);font-weight:600;
}
.pill.plex{color:var(--teal);border-color:rgba(95,198,181,.4);}
.actions{display:flex;gap:12px;flex-wrap:wrap;justify-content:center;margin-top:4px;}
.tokens{display:flex;gap:7px;align-items:center;justify-content:center;color:var(--ink-3);
  font-size:.85rem;font-weight:600;}
.tok{width:20px;height:20px;border-radius:50%;background:var(--rose);display:inline-block;
  box-shadow:inset 0 -3px 0 rgba(0,0,0,.22);}
.tok.spent{background:var(--panel-2);box-shadow:none;}

/* tumbling slips during the shake */
.tumble{position:fixed;inset:0;pointer-events:none;z-index:45;overflow:hidden;display:none;}
.tumble.on{display:block;}
.fly{
  position:absolute;width:52px;height:34px;border-radius:3px;
  background:var(--paper);box-shadow:0 3px 10px rgba(0,0,0,.45);
}

/* ---------- status ---------- */
.status{display:flex;flex-direction:column;align-items:center;gap:14px;text-align:center;
  max-width:460px;}
.bar{width:260px;height:10px;border-radius:999px;background:var(--panel-2);overflow:hidden;}
.bar i{display:block;height:100%;width:30%;border-radius:999px;
  background:linear-gradient(90deg,var(--amber),var(--rose));
  animation:slide 1.5s ease-in-out infinite;}
@keyframes slide{0%{margin-left:-32%}100%{margin-left:102%}}
.bar.done i{width:100%;margin:0;animation:none;background:var(--teal);}

/* ---------- add movies ---------- */
.search{display:flex;gap:10px;margin-bottom:20px;}
.search input{
  flex:1;min-height:54px;border-radius:12px;border:2px solid var(--line);
  background:var(--panel);color:var(--ink);padding:0 18px;font-size:1.05rem;
  font-family:inherit;
}
.search input::placeholder{color:var(--ink-3);}
.grid{display:grid;gap:14px;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));}
.res{
  background:var(--panel);border:1px solid var(--line);border-radius:12px;
  overflow:hidden;display:flex;flex-direction:column;text-align:left;
}
.res img,.res .ph{width:100%;aspect-ratio:2/3;object-fit:cover;display:block;background:var(--panel-2);}
.res .ph{display:flex;align-items:center;justify-content:center;color:var(--ink-3);font-size:2rem;}
.res .t{padding:9px 11px 4px;font-weight:700;font-size:.88rem;line-height:1.25;}
.res .y{padding:0 11px 9px;font-size:.78rem;color:var(--ink-3);}
.res .add{
  margin:0 9px 10px;min-height:42px;border-radius:9px;background:var(--amber);
  color:#2A1B06;font-weight:800;font-size:.88rem;
}
.res .add.have{background:var(--panel-2);color:var(--ink-3);}

/* ---------- pot list ---------- */
.list{display:flex;flex-direction:column;gap:9px;}
.row{
  display:flex;align-items:center;gap:13px;background:var(--panel);
  border:1px solid var(--line);border-radius:12px;padding:10px 14px;
}
.row img{width:40px;height:60px;border-radius:5px;object-fit:cover;background:var(--panel-2);flex:none;}
.row .n{flex:1;min-width:0;}
.row .n b{display:block;font-size:.96rem;font-weight:700;}
.row .n span{font-size:.79rem;color:var(--ink-3);}
.row .x{min-width:44px;min-height:44px;border-radius:9px;color:var(--ink-3);font-size:1.2rem;}
.cool{color:var(--rose);font-size:.76rem;font-weight:700;}

.empty{text-align:center;color:var(--ink-3);padding:50px 20px;line-height:1.6;}
.toast{
  position:fixed;left:50%;bottom:26px;transform:translateX(-50%);
  background:var(--panel-2);border:1px solid var(--line);color:var(--ink);
  padding:13px 22px;border-radius:999px;font-weight:700;z-index:80;
  box-shadow:0 10px 30px rgba(0,0,0,.5);display:none;max-width:88vw;text-align:center;
}
.toast.on{display:block;}

h3.sec{font-size:.8rem;letter-spacing:.12em;text-transform:uppercase;color:var(--ink-3);
  margin:26px 0 11px;font-weight:700;}

@media (prefers-reduced-motion:reduce){
  *{animation-duration:.001ms !important;transition-duration:.05s !important;}
}
