* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh;
  background: #0b0e1a radial-gradient(ellipse at 50% -10%, #1c2447 0%, #0b0e1a 60%);
  color: #f2f2f2; font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none;
  background-image: radial-gradient(1px 1px at 12% 22%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 68% 8%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 84% 30%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 32% 12%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 48% 42%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 92% 55%, #fff 50%, transparent 51%);
  opacity: .5;
}
header { text-align: center; padding: 28px 16px 8px; position: relative; }
header h1 { margin: 6px 0 4px; font-size: 2.4rem; letter-spacing: .06em; }
header h1 span { color: #c51111; }
.tagline { color: #b8bdd6; margin: 0 0 8px; }
.bean {
  width: 74px; height: 88px; margin: 0 auto; position: relative;
  background: #c51111; border: 3px solid #1a1a1a;
  border-radius: 48% 48% 42% 42% / 58% 58% 38% 38%;
  box-shadow: 0 6px 0 rgba(0,0,0,.35);
}
.bean::before, .bean::after {
  content: ""; position: absolute; bottom: -3px; width: 16px; height: 26px;
  background: #c51111; border: 3px solid #1a1a1a; border-top: none;
  border-radius: 0 0 8px 8px;
}
.bean::before { left: 10px; }
.bean::after { right: 10px; }
.visor {
  position: absolute; top: 22px; left: 10px; right: 8px; height: 26px;
  background: #bfe9ff; border: 3px solid #1a1a1a; border-radius: 14px;
}
main { max-width: 640px; margin: 0 auto; padding: 12px 16px 40px; position: relative; }
.card {
  background: rgba(20, 24, 48, .92); border: 1px solid #2c355e;
  border-radius: 16px; padding: 20px; margin-top: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.hidden { display: none; }
h2 { margin: 0 0 12px; font-size: 1.3rem; }
h3 { margin: 18px 0 4px; font-size: 1.05rem; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
textarea {
  width: 100%; background: #0f1326; color: #fff; border: 1px solid #3a4470;
  border-radius: 10px; padding: 10px 12px; font-size: 1rem; line-height: 1.5; resize: vertical;
}
textarea:focus { outline: 2px solid #c51111; border-color: #c51111; }
.hint { color: #9aa1c0; font-size: .9rem; margin: 4px 0 10px; }
.count { color: #c9cede; font-size: .95rem; margin: 8px 0; }
.count .ok { color: #4ade80; font-weight: 700; }
.count .bad { color: #f87171; font-weight: 700; }
#pool, #basePool, #crewPool, #impPool { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
h3.crew { color: #38f0d4; }
h3.imp { color: #f87171; }
.pool-row {
  display: flex; align-items: center; justify-content: space-between;
  background: #0f1326; border: 1px solid #2c355e; border-radius: 10px; padding: 8px 10px;
}
.pool-row .rname { font-weight: 600; }
.pool-row .dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 7px; vertical-align: -1px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid #3a4470;
  background: #1a2040; color: #fff; font-size: 1.1rem; cursor: pointer;
}
.stepper button:active { background: #c51111; }
.stepper span { min-width: 22px; text-align: center; font-weight: 700; font-size: 1.05rem; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
button {
  font: inherit; cursor: pointer; border-radius: 10px; border: none;
  padding: 10px 16px; font-weight: 700;
}
button.big { background: #c51111; color: #fff; font-size: 1.05rem; flex: 1; }
button.big:active { background: #a30e0e; }
button.ghost { background: #1a2040; color: #dfe3f5; border: 1px solid #3a4470; }
button.ghost:active { background: #2a3260; }
.error { color: #f87171; font-weight: 600; min-height: 1.2em; margin: 10px 0 0; }
.results-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 10px; }
#cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
@media (max-width: 480px) { #cards, #pool, #basePool, #crewPool, #impPool { grid-template-columns: 1fr; } }
.pcard {
  background: #0f1326; border: 2px solid #2c355e; border-radius: 14px;
  padding: 16px 12px; text-align: center; cursor: pointer; min-height: 110px;
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
  transition: border-color .15s;
}
.pcard:active { transform: scale(.98); }
.pcard .pname { font-size: 1.15rem; font-weight: 800; }
.pcard .tap { color: #8b93b8; font-size: .85rem; }
.pcard .role { font-size: 1.3rem; font-weight: 800; }
.pcard .rdesc { color: #c9cede; font-size: .85rem; line-height: 1.35; }
.pcard.revealed { border-color: var(--rc, #fff); }
footer { text-align: center; color: #6b7398; font-size: .85rem; padding-bottom: 24px; position: relative; }
