:root {
  color-scheme: dark;
  --ink: #f7f2e8;
  --muted: #aaa5b4;
  --surface: #201d2b;
  --surface-2: #2a2636;
  --line: #3a3547;
  --purple: #a981ff;
  --purple-dark: #7750d8;
  --green: #8fe2b1;
  --red: #ff6678;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(169, 129, 255, .15), transparent 30rem),
    #151320;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: not-allowed; opacity: .42; }

.page-shell {
  width: min(100%, 560px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 18px;
  display: grid;
  place-items: center;
}

.panel {
  width: 100%;
  padding: clamp(24px, 6vw, 42px);
  background: rgba(32, 29, 43, .93);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .32);
}

.home-panel, .join-panel { text-align: center; }
.eyebrow { margin: 0 0 12px; color: var(--purple); font-size: .72rem; font-weight: 700; letter-spacing: .18em; }
h1, h2, h3 { font-family: ui-rounded, "Arial Rounded MT Bold", Inter, system-ui, sans-serif; }
.home-panel h1, .join-panel h1 { margin: 0; font-size: clamp(3.2rem, 14vw, 5.3rem); line-height: .85; letter-spacing: -.07em; }
.home-panel h1 span, .join-panel h1 span { color: var(--purple); }
.intro { margin: 28px 0 30px; color: var(--muted); line-height: 1.55; }

form { text-align: left; }
label { display: block; margin: 0 0 8px; font-size: .8rem; font-weight: 700; }
input {
  width: 100%;
  padding: 15px 17px;
  color: var(--ink);
  background: #17151f;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
}
input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(169, 129, 255, .15); }

.primary {
  position: relative;
  z-index: 1;
  width: 100%;
  margin-top: 14px;
  padding: 15px 20px;
  color: #17131f;
  background: var(--purple);
  border: 0;
  border-radius: 13px;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(119, 80, 216, .28);
}
.primary:not(:disabled):hover { background: #b694ff; transform: translateY(-1px); }
.primary.is-ready { color: #102118; background: var(--green); }
.text-link { display: inline-block; margin-top: 24px; color: var(--muted); font-size: .85rem; }
.error { margin: 16px 0 0; color: #ff9aa6; font-size: .9rem; }

.lobby-panel { padding: 28px; }
.room-header { display: flex; align-items: center; justify-content: space-between; }
.room-header .eyebrow { margin-bottom: 2px; }
.room-header h2 { margin: 0; font-size: 2.2rem; letter-spacing: .12em; }
.icon-button {
  padding: 10px 13px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-weight: 700;
}
.rule { height: 1px; margin: 24px 0; background: var(--line); }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-heading h3 { margin: 0; font-size: 1rem; }
.section-heading small { color: var(--muted); font-size: .65rem; font-weight: 700; letter-spacing: .1em; }
.categories { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.category {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-weight: 700;
}
.category span { color: var(--purple); font-size: 1.1rem; }
.category.selected { color: var(--ink); border-color: var(--purple); background: rgba(169, 129, 255, .13); }
.mode-heading { margin-top: 22px; }
.players-section { margin-top: 27px; }
.players { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.players li { display: flex; align-items: center; gap: 10px; min-height: 43px; padding: 7px 10px; background: #191720; border-radius: 10px; }
.player-mark { display: grid; place-items: center; width: 29px; height: 29px; color: #17131f; background: var(--purple); border-radius: 50%; font-size: .78rem; font-weight: 800; }
.players li small { padding: 3px 6px; color: var(--purple); background: rgba(169, 129, 255, .12); border-radius: 5px; font-size: .55rem; font-weight: 800; }
.players li strong { margin-left: auto; color: var(--muted); font-size: .72rem; }
.players li.ready strong { color: var(--green); }
.players li.offline { opacity: .45; }
.players li.offline strong { color: var(--muted); }
.waiting-note { margin: 20px 0 4px; color: var(--muted); text-align: center; font-size: .8rem; }

.round-shell { min-height: 100vh; }
.reveal {
  min-height: 100vh;
  padding: 28px;
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  place-items: center;
  text-align: center;
  overflow: hidden;
}
.reveal::before { content: ""; align-self: end; }
.reveal p { margin: 0 0 22px; font-size: .75rem; font-weight: 800; letter-spacing: .22em; opacity: .7; }
.reveal h1 { margin: 0; font-size: clamp(3.4rem, 14vw, 8rem); line-height: .92; letter-spacing: -.07em; }
.reveal.word { background: radial-gradient(circle, rgba(169, 129, 255, .22), transparent 58%), #151320; }
.reveal.word h1 { color: var(--purple); }
.reveal.impostor { background: radial-gradient(circle, rgba(255, 102, 120, .22), transparent 58%), #1c1016; }
.reveal.impostor h1 { color: var(--red); }
.reveal.inverted {
  background: radial-gradient(circle, rgba(143, 226, 177, .16), transparent 58%), #101a17;
}
.inverted-card { width: min(100%, 620px); }
.inverted-card > p { color: var(--green); }
.inverted-list { display: grid; gap: 12px; width: 100%; margin: 0; padding: 0; list-style: none; }
.inverted-list li {
  display: grid;
  gap: 5px;
  padding: 18px 20px;
  background: rgba(255, 255, 255, .055);
  border: 1px solid rgba(143, 226, 177, .2);
  border-radius: 15px;
}
.inverted-list span { color: var(--muted); font-size: .82rem; }
.inverted-list strong { color: var(--green); font-family: ui-rounded, system-ui, sans-serif; font-size: clamp(1.5rem, 6vw, 2.4rem); }
.end-button { align-self: end; min-width: 180px; padding: 13px 22px; color: var(--ink); background: transparent; border: 1px solid currentColor; border-radius: 999px; font-weight: 700; }

@media (max-width: 380px) {
  .page-shell { padding: 0; }
  .panel { min-height: 100vh; border: 0; border-radius: 0; display: flex; flex-direction: column; justify-content: center; }
  .lobby-panel { justify-content: flex-start; }
}
