:root {
  --bg: #0e0e12;
  --card: #1a1a22;
  --card2: #222230;
  --fg: #e8e8f0;
  --dim: #9a9ab0;
  --keep: #35c281;
  --reject: #e2565b;
  --accent: #7c9cff;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  overscroll-behavior: none; user-select: none; -webkit-user-select: none;
}
body { display: flex; flex-direction: column; height: 100dvh; }

#bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-top) + 10px) 16px 10px;
  font-size: 13px; color: var(--dim);
}
#kept { color: var(--keep); font-weight: 600; }
#rejected { color: var(--reject); font-weight: 600; }
.ghost { background: none; border: none; color: var(--dim); font-size: 22px; }

#stage { flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 12px; min-height: 0; }

.card {
  width: 100%; max-width: 460px; flex: 1; max-height: 62vh;
  background: linear-gradient(160deg, var(--card2), var(--card));
  border-radius: 26px; padding: 28px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 18px; position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  transition: transform .05s linear, opacity .2s;
  touch-action: pan-y;
}
.card.flyKeep { transform: translateX(120%) rotate(12deg) !important; opacity: 0; transition: transform .28s, opacity .28s; }
.card.flyReject { transform: translateX(-120%) rotate(-12deg) !important; opacity: 0; transition: transform .28s, opacity .28s; }
.group {
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); background: rgba(124,156,255,.12);
  padding: 5px 12px; border-radius: 999px;
}
.name { font-size: 19px; font-weight: 600; word-break: break-word; line-height: 1.35; }
.playstate { font-size: 46px; color: var(--fg); opacity: .9; margin: 6px; }
.pos { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }
.hint { color: var(--dim); font-size: 12px; margin-top: 14px; height: 16px; }

#controls {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 12px 16px calc(var(--safe-bot) + 16px);
}
.big {
  flex: 1; max-width: 200px; padding: 20px 10px; font-size: 18px; font-weight: 700;
  border: none; border-radius: 18px; color: #0a0a0a;
}
.big.keep { background: var(--keep); }
.big.reject { background: var(--reject); }
.big:active { transform: scale(.96); }
.mid { width: 58px; height: 58px; border-radius: 50%; border: 1px solid #333;
  background: var(--card2); color: var(--fg); font-size: 22px; }
.mid:disabled { opacity: .35; }

.menu { position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: flex-end; z-index: 10; }
.menu.hidden { display: none; }
.menu-inner { width: 100%; background: var(--card); border-radius: 22px 22px 0 0;
  padding: 22px 20px calc(var(--safe-bot) + 22px); display: flex; flex-direction: column; gap: 12px; }
.menu-inner h2 { margin: 0 0 4px; font-size: 18px; }
.stat { color: var(--dim); font-size: 13px; margin: 0 0 8px; }
.menu-btn { padding: 15px; border-radius: 14px; border: none; font-size: 16px;
  background: var(--card2); color: var(--fg); text-align: left; }
.menu-btn.ghost { background: none; color: var(--dim); text-align: center; }
.fineprint { color: var(--dim); font-size: 12px; line-height: 1.5; margin: 6px 2px 0; }
.fineprint code { background: var(--card2); padding: 1px 5px; border-radius: 5px; }
.dlprogress { height: 34px; border-radius: 10px; background: var(--card2); position: relative; overflow: hidden; }
.dlprogress.hidden { display: none; }
#dlBar { position: absolute; inset: 0; width: 0%; background: var(--accent); transition: width .2s; }
#dlText { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--fg); mix-blend-mode: difference; }
.flash { animation: flash .3s; }
@keyframes flash { from { background: rgba(255,255,255,.08); } to { background: transparent; } }
