:root {
  color-scheme: dark;
  --bg: #070b14;
  --card: rgba(17, 25, 41, 0.72);
  --card2: rgba(23, 36, 60, 0.6);
  --text: #eef3fb;
  --muted: #98a8c3;
  --dim: #7184a4;
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.18);
  --brand: #7c3aed;
  --brand2: #06b6d4;
  --good: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 6px 22px rgba(0, 0, 0, 0.28);
  --radius: 22px;
  --radius-sm: 14px;
  --radius-lg: 28px;
  --ease: cubic-bezier(.4, .14, .3, 1);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body { display: flex; flex-direction: column; min-height: 100vh; }
button, input { font: inherit; }
a { color: inherit; }
::selection { background: rgba(124, 58, 237, .45); }

.bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(900px 600px at 12% 8%, rgba(124, 58, 237, .35), transparent 60%),
    radial-gradient(800px 500px at 88% 18%, rgba(6, 182, 212, .26), transparent 60%),
    radial-gradient(700px 700px at 50% 110%, rgba(124, 58, 237, .18), transparent 60%),
    linear-gradient(135deg, #060a14, #0a1324 50%, #060a14);
}
.bg::after {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  opacity: .55;
}

/* ===== Site header ===== */
.siteHeader {
  width: min(1180px, calc(100% - 28px));
  margin: 22px auto 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
}
.brandMark {
  display: inline-grid; place-items: center;
  filter: drop-shadow(0 6px 18px rgba(124, 58, 237, .35));
}
.brandName {
  font-weight: 900; letter-spacing: -0.01em; font-size: 1.1rem;
}
.siteNav { display: flex; gap: 18px; }
.siteNav a {
  color: var(--muted); text-decoration: none; font-weight: 700; font-size: .95rem;
  padding: 8px 12px; border-radius: 999px; transition: color .15s var(--ease), background .15s var(--ease);
}
.siteNav a:hover { color: var(--text); background: rgba(255, 255, 255, .05); }

/* ===== Layout shell ===== */
.shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto; padding: 22px 0 56px;
  flex: 1;
}

/* ===== Cards ===== */
.card {
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* ===== Hero ===== */
.hero { padding: clamp(28px, 5vw, 56px); margin-top: 3vh; position: relative; overflow: hidden; }
.hero::before {
  content: ''; position: absolute; inset: -1px;
  border-radius: inherit; pointer-events: none;
  background: linear-gradient(135deg, rgba(124, 58, 237, .35), transparent 30%, transparent 70%, rgba(6, 182, 212, .35));
  -webkit-mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
  -webkit-mask-composite: xor; mask-composite: exclude;
  padding: 1px; opacity: .6;
}
.eyebrow {
  margin: 0 0 8px; text-transform: uppercase; letter-spacing: .18em;
  color: #8bdcf0; font-size: .72rem; font-weight: 800;
}
h1 {
  margin: 0; font-size: clamp(2.1rem, 6.5vw, 4.4rem);
  line-height: 1.02; letter-spacing: -0.025em; font-weight: 900;
  max-width: 920px;
}
.grad {
  background: linear-gradient(120deg, #c084fc 0%, #06b6d4 60%, #7dd3fc 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
h2 { margin: 0; font-size: clamp(1.15rem, 2.4vw, 1.55rem); letter-spacing: -0.015em; font-weight: 800; }
h3 { margin: 0 0 6px; font-size: 1.05rem; font-weight: 800; letter-spacing: -0.01em; }
.lead {
  max-width: 720px; color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.18rem); line-height: 1.65;
  margin-top: 16px;
}

/* ===== Forms ===== */
.form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  max-width: 820px; margin-top: 28px;
}
label {
  color: var(--muted); display: grid; gap: 8px;
  font-weight: 700; font-size: .9rem;
}
input {
  width: 100%; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 13px 16px;
  color: var(--text); background: rgba(255, 255, 255, .04);
  outline: none; transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
input::placeholder { color: var(--dim); }
input:hover { background: rgba(255, 255, 255, .06); }
input:focus {
  border-color: rgba(6, 182, 212, .8);
  box-shadow: 0 0 0 4px rgba(6, 182, 212, .14);
  background: rgba(255, 255, 255, .06);
}
.check {
  grid-template-columns: auto 1fr; align-items: center;
  align-self: end; padding: 12px 0;
  cursor: pointer;
}
.check input { width: 20px; height: 20px; accent-color: var(--brand2); }
.check span { color: var(--text); font-weight: 700; }

/* ===== Buttons ===== */
.actions, .controls, .top-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; align-items: center; }
button {
  border: 0; border-radius: 999px; padding: 12px 20px;
  color: var(--text); cursor: pointer; font-weight: 800;
  letter-spacing: -0.005em;
  transition: transform .12s var(--ease), opacity .15s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease);
}
button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  box-shadow: 0 10px 30px rgba(124, 58, 237, .35), inset 0 1px rgba(255, 255, 255, .25);
}
.primary:hover { box-shadow: 0 14px 36px rgba(124, 58, 237, .45), inset 0 1px rgba(255, 255, 255, .25); }
.secondary {
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--line-strong);
}
.secondary:hover { background: rgba(255, 255, 255, .12); }
.ghost {
  background: transparent; border: 1px solid var(--line);
  color: var(--muted);
}
.ghost:hover { color: var(--text); border-color: var(--line-strong); }
.hint { color: var(--muted); margin-top: 18px; font-size: .92rem; }
.hidden { display: none !important; }

/* ===== Features ===== */
.featureRow {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin-top: 22px;
}
.feature {
  padding: 22px 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .035);
  border-radius: var(--radius);
  transition: border-color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
}
.feature:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, .055); transform: translateY(-2px); }
.feature p { color: var(--muted); margin: 0; font-size: .94rem; line-height: 1.55; }
.featIcon {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; font-size: 1.3rem;
  background: linear-gradient(135deg, rgba(124, 58, 237, .3), rgba(6, 182, 212, .22));
  border: 1px solid var(--line-strong);
  margin-bottom: 14px;
}

/* ===== How it works ===== */
.howBlock { padding: clamp(22px, 4vw, 36px); margin-top: 22px; }
.steps {
  margin: 18px 0 0; padding: 0; list-style: none;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; counter-reset: step;
}
.steps li {
  counter-increment: step;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 18px 56px;
  position: relative;
  color: var(--muted);
  font-size: .95rem; line-height: 1.5;
}
.steps li::before {
  content: counter(step);
  position: absolute; top: 16px; left: 18px;
  width: 28px; height: 28px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  color: white; font-weight: 900; font-size: .9rem;
}
.steps li b { color: var(--text); }

/* ===== App view ===== */
.topbar {
  display: flex; justify-content: space-between; gap: 16px; align-items: center;
  padding: 20px 22px; margin-bottom: 16px;
}
.topbar-title { min-width: 0; flex: 1; }
.titleInput {
  border: 0; background: transparent; padding: 0;
  font-size: clamp(1.4rem, 4vw, 2.3rem);
  font-weight: 900; letter-spacing: -0.02em; line-height: 1.1;
}
.titleInput:focus { outline: none; box-shadow: 0 2px 0 rgba(6, 182, 212, .8); border-radius: 0; }
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, .7fr);
  gap: 16px;
}
.panel { padding: 22px; }
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 18px;
}

/* ===== Status pill ===== */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 999px; padding: 7px 12px;
  font-size: .82rem; font-weight: 800;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .04);
  white-space: nowrap;
}
.pill::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--warn); box-shadow: 0 0 8px currentColor;
}
.pill.online::before { background: var(--good); animation: pulse 2s infinite; }
.pill.offline::before { background: var(--bad); }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .55; transform: scale(.85); }
}

/* ===== Deck (cards) ===== */
.deck {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 12px;
}
.cardBtn {
  position: relative;
  min-height: 116px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, .03));
  border: 1px solid var(--line-strong);
  font-size: 2rem; font-weight: 800;
  box-shadow: inset 0 1px rgba(255, 255, 255, .14), 0 6px 18px rgba(0, 0, 0, .25);
  transition: transform .15s var(--ease), background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease);
  color: var(--text);
}
.cardBtn:hover {
  transform: translateY(-4px);
  border-color: rgba(6, 182, 212, .5);
  box-shadow: inset 0 1px rgba(255, 255, 255, .18), 0 16px 30px rgba(0, 0, 0, .35);
}
.cardBtn.selected {
  background: linear-gradient(135deg, rgba(124, 58, 237, .95), rgba(6, 182, 212, .8));
  border-color: rgba(6, 182, 212, .9);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, .45), 0 16px 30px rgba(6, 182, 212, .25);
  transform: translateY(-4px);
}
.cardBtn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.shortcuts {
  margin-left: auto; color: var(--dim); font-size: .82rem;
}
.shortcuts kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 6px;
  font-size: .78rem;
  color: var(--text);
}

/* ===== People list ===== */
.people { display: grid; gap: 8px; }
.person {
  display: grid; grid-template-columns: 1fr auto;
  align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .035);
  border-radius: 16px;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.person:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, .055); }
.person.self { border-color: rgba(6, 182, 212, .4); background: rgba(6, 182, 212, .06); }
.person b { font-weight: 800; }
.person small { color: var(--muted); display: block; margin-top: 3px; font-weight: 500; }

/* Vote chip with flip */
.vote {
  min-width: 50px; min-height: 50px;
  perspective: 600px;
  position: relative;
}
.voteInner {
  width: 100%; height: 50px; min-width: 50px;
  display: grid; place-items: center;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, .06);
  font-size: 1.15rem; font-weight: 900;
  transition: transform .55s var(--ease), background .25s var(--ease);
  transform-style: preserve-3d;
}
.vote.done .voteInner {
  color: #05121a;
  background: linear-gradient(135deg, #a7f3d0, #67e8f9);
  border-color: rgba(6, 182, 212, .5);
  box-shadow: 0 6px 16px rgba(6, 182, 212, .25);
}
.vote.flip .voteInner { animation: flip .6s var(--ease); }
@keyframes flip {
  0% { transform: rotateY(0deg); }
  50% { transform: rotateY(90deg); }
  100% { transform: rotateY(0deg); }
}
.vote.hiddenVote .voteInner { color: var(--muted); font-size: .95rem; }
.vote.waiting .voteInner { background: rgba(255, 255, 255, .04); border-style: dashed; }

/* ===== Progress bar ===== */
.progress {
  width: 90px; height: 6px;
  background: rgba(255, 255, 255, .06);
  border-radius: 999px;
  overflow: hidden;
  align-self: center;
}
#progressBar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--brand), var(--brand2));
  transition: width .35s var(--ease);
  border-radius: 999px;
}

/* ===== Stats ===== */
.stats {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px; margin-top: 18px;
  animation: fadeUp .4s var(--ease);
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.stat {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid var(--line);
}
.stat b {
  display: block; font-size: 1.5rem; font-weight: 900;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #e0e7ff, #a7f3d0);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat span { color: var(--muted); font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }

/* ===== Settings / details ===== */
.settings {
  margin-top: 22px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.settings summary {
  cursor: pointer; font-weight: 800;
  color: var(--text);
  padding: 4px 0;
  list-style: none;
  display: flex; align-items: center; gap: 8px;
}
.settings summary::-webkit-details-marker { display: none; }
.settings summary::before {
  content: '›'; display: inline-block;
  transition: transform .2s var(--ease);
  font-size: 1.2rem; color: var(--muted);
}
.settings[open] summary::before { transform: rotate(90deg); }
.settings label { margin-top: 14px; }
.settings-row { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: end; }

/* ===== History ===== */
.historyBlock { margin-top: 16px; }
.history { display: grid; gap: 10px; color: var(--muted); }
.roundItem {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--line);
  line-height: 1.5;
}
.roundItem b { color: var(--text); }
.roundItem small { color: var(--dim); display: block; margin-top: 4px; }
.empty { color: var(--dim); font-style: italic; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(20, 30, 50, .92);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 700;
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
  z-index: 100;
}
.toast.show {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

/* ===== Footer ===== */
.siteFooter {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 32px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .9rem;
}
.siteFooter a { color: var(--text); font-weight: 700; text-decoration: none; }
.siteFooter a:hover { color: var(--brand2); }
.siteFooter .dim { color: var(--dim); font-weight: 500; }

/* ===== Responsive ===== */
@media (max-width: 960px) {
  .featureRow { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .siteHeader { margin-top: 14px; }
  .siteNav { display: none; }
  .form-grid, .grid, .settings-row { grid-template-columns: 1fr; }
  .topbar { align-items: stretch; flex-direction: column; }
  .deck { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .cardBtn { min-height: 92px; font-size: 1.7rem; }
  .featureRow { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .shortcuts { display: none; }
  .siteFooter { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
