:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f5f5f5;
  background: #0d0d0f;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(125, 33, 48, 0.20), transparent 38rem),
    #0d0d0f;
}

button, input { font: inherit; }
button { cursor: pointer; }

.shell {
  width: min(100% - 32px, 680px);
  margin: 0 auto;
  padding: 64px 0;
}

.card {
  background: rgba(24, 24, 27, 0.94);
  border: 1px solid #2d2d32;
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .35);
}

.eyebrow {
  color: #d36b7b;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .18em;
  margin-bottom: 8px;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(32px, 7vw, 48px); }
h2 { font-size: 18px; margin-bottom: 16px; }
.muted { color: #a6a6ad; }
.small-text { font-size: 13px; }

.button {
  border: 1px solid #3b3b42;
  background: #26262b;
  color: #fff;
  border-radius: 11px;
  min-height: 44px;
  padding: 0 16px;
  font-weight: 700;
}

.button:hover { background: #303036; }
.button:disabled { opacity: .55; cursor: wait; }
.button.primary { width: 100%; background: #9e3345; border-color: #b84054; }
.button.primary:hover { background: #af3a4e; }
.button.small { min-height: 36px; font-size: 13px; white-space: nowrap; }

.stack { display: grid; gap: 10px; }
label { color: #c8c8cd; font-size: 14px; font-weight: 700; }
input {
  width: 100%;
  min-height: 46px;
  border: 1px solid #37373e;
  background: #111114;
  color: #fff;
  border-radius: 11px;
  padding: 0 13px;
  outline: none;
}
input:focus { border-color: #a84556; box-shadow: 0 0 0 3px rgba(168, 69, 86, .16); }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #74747c;
  margin: 24px 0;
  font-size: 13px;
}
.divider::before, .divider::after { content: ""; height: 1px; background: #303036; flex: 1; }

.room-topbar, .section-heading, .you-row, .invite-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.room-topbar { margin-bottom: 24px; }
.back-link { color: #aaaab1; text-decoration: none; font-size: 14px; }
.back-link:hover { color: #fff; }

.badge {
  border: 1px solid #3d3d44;
  background: #222227;
  border-radius: 999px;
  padding: 5px 10px;
  color: #cfcfd4;
  font-size: 12px;
  font-weight: 700;
}

.invite-row {
  align-items: stretch;
  margin: 18px 0 24px;
}
.invite-row code {
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 12px;
  background: #111114;
  border: 1px solid #303036;
  border-radius: 10px;
  color: #aaaab1;
  font-size: 12px;
  flex: 1;
}

.panel {
  padding: 18px;
  border: 1px solid #303036;
  background: #151518;
  border-radius: 14px;
  margin-bottom: 24px;
}
.panel h2 { margin-bottom: 14px; }

.players-section { margin-top: 8px; }
.section-heading { margin-bottom: 10px; }
.section-heading h2 { margin: 0; }
.players-list { display: grid; gap: 8px; }
.player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 9px 12px;
  background: #141417;
  border: 1px solid #2b2b30;
  border-radius: 11px;
}
.player-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #323238;
  font-weight: 800;
  flex: 0 0 auto;
}
.player-name { font-weight: 700; overflow-wrap: anywhere; }
.you-tag { margin-left: auto; color: #ca7886; font-size: 12px; font-weight: 800; }
.empty { color: #787880; padding: 18px 4px; text-align: center; }

.online-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #5abf7b;
  box-shadow: 0 0 0 4px rgba(90, 191, 123, .10);
}

.notice {
  padding: 11px 13px;
  border-radius: 10px;
  margin-top: 12px;
  font-size: 14px;
}
.notice.error { border: 1px solid #73313b; background: #2b171b; color: #f1a5b1; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: min(90vw, 520px);
  padding: 11px 15px;
  border-radius: 10px;
  background: #e7e7ea;
  color: #111114;
  box-shadow: 0 16px 50px rgba(0,0,0,.35);
  font-size: 14px;
  font-weight: 700;
}

@media (max-width: 540px) {
  .shell { width: min(100% - 20px, 680px); padding: 24px 0; }
  .card { padding: 20px; border-radius: 16px; }
  .invite-row { flex-direction: column; }
  .invite-row code { min-height: 40px; }
}

/* --------------------------------------------------
   Player presence
   -------------------------------------------------- */

.player-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.presence-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
}

.presence-dot.online {
  background: #5abf7b;
  box-shadow: 0 0 0 4px rgba(90, 191, 123, .10);
}

.presence-dot.offline {
  background: #5d5d65;
  box-shadow: 0 0 0 4px rgba(93, 93, 101, .08);
}

.player-row.is-offline .player-avatar,
.player-row.is-offline .player-name {
  opacity: .58;
}

.player-meta .you-tag {
  margin-left: 0;
}

/* --------------------------------------------------
   Host controls
   -------------------------------------------------- */

.kick-button {
  border: 1px solid #66313a;
  background: #25171a;
  color: #e8a0ac;
  border-radius: 8px;
  padding: 5px 9px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.kick-button:hover {
  border-color: #8b3e4b;
  background: #321b20;
  color: #ffc1cb;
}

.kick-button:disabled {
  opacity: .5;
  cursor: default;
}

/* --------------------------------------------------
   Lobby readiness / host start
   -------------------------------------------------- */

.ready-controls,
.host-panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.ready-controls {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #303036;
}

.ready-text.is-ready {
  color: #76d391;
}

.host-panel h2,
.game-panel h2 {
  margin-bottom: 5px;
}

.host-start-button {
  width: auto !important;
  min-width: 150px;
}

.start-hint {
  margin-top: 12px;
}

.player-name-block {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.host-tag,
.ready-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
  white-space: nowrap;
}

.host-tag {
  padding: 4px 6px;
  color: #e6a4b0;
  background: #301a1f;
  border: 1px solid #66313a;
}

.ready-tag {
  padding: 5px 7px;
  color: #8d8d95;
  background: #1c1c20;
  border: 1px solid #34343a;
}

.ready-tag.is-ready {
  color: #83d99b;
  background: rgba(90, 191, 123, .08);
  border-color: rgba(90, 191, 123, .32);
}

.button:disabled {
  cursor: default;
}

@media (max-width: 540px) {
  .host-panel-row {
    align-items: stretch;
    flex-direction: column;
  }

  .host-start-button {
    width: 100% !important;
  }

  .player-row {
    align-items: flex-start;
  }

  .player-meta {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}


/* --------------------------------------------------
   Private role reveal
   -------------------------------------------------- */

.role-warning {
  margin-bottom: 16px;
}

.role-loading {
  padding: 22px 14px;
  border: 1px dashed #3a3a41;
  border-radius: 12px;
  color: #a6a6ad;
  text-align: center;
}

.role-card {
  padding: 22px;
  border: 1px solid #414148;
  border-radius: 14px;
  background: #101013;
  text-align: center;
}

.role-eyebrow {
  margin-bottom: 8px;
  color: #8d8d95;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
}

.role-name {
  font-size: clamp(28px, 7vw, 42px);
  font-weight: 900;
  letter-spacing: -.03em;
}

.role-description {
  max-width: 480px;
  margin: 12px auto 0;
  color: #b5b5bc;
  line-height: 1.55;
}

.role-card[data-role="mafia"] {
  border-color: #73313b;
  background: linear-gradient(180deg, rgba(116, 37, 49, .18), #101013);
}

.role-card[data-role="mafia"] .role-name {
  color: #e795a3;
}

.role-card[data-role="citizen"] .role-name {
  color: #d8d8dd;
}

/* Game stages */
.game-action-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.stage-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.mafia-team {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.9rem;
}

.night-targets {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.night-target-button {
  width: 100%;
  text-align: left;
}

.night-target-button.selected {
  font-weight: 700;
  outline: 1px solid currentColor;
}

.day-result {
  margin: 8px 0 12px;
  font-weight: 700;
}

.dead-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  opacity: 0.7;
}

.player-row.is-dead {
  opacity: 0.55;
}
