:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #191b21;
  --panel-soft: #20232b;
  --text: #f4f6fb;
  --muted: #a9afbd;
  --line: #303541;
  --green: #35d07f;
  --green-soft: rgba(53, 208, 127, 0.16);
  --red: #ff6b6b;
  --yellow: #f4c95d;
  --button: #f4f6fb;
  --button-text: #111318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  background: var(--button);
  color: var(--button-text);
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button.secondary {
  background: var(--panel-soft);
  color: var(--text);
  border: 1px solid var(--line);
}

button.small {
  width: auto;
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.9rem;
}

.leave-button {
  margin-top: 12px;
}

input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111318;
  color: var(--text);
  outline: none;
}

input:focus {
  border-color: var(--green);
}

label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 700;
}

.app-shell {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 18px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0 18px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 9vw, 4rem);
  line-height: 1;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.hidden {
  display: none !important;
}

.invite-notice {
  margin-bottom: 16px;
  border-radius: 8px;
  border: 1px solid rgba(53, 208, 127, 0.45);
  background: var(--green-soft);
  color: var(--text);
  padding: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.actions,
.join-box {
  margin-top: 16px;
}

.avatar-section {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.avatar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.avatar-header label {
  margin-bottom: 0;
}

.avatar-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.avatar-option {
  display: grid;
  place-items: center;
  width: 46px;
  min-width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 0;
  border: 1px solid var(--line);
  background: #111318;
  color: var(--text);
  font-size: 1.35rem;
}

.avatar-option.selected {
  border-color: rgba(53, 208, 127, 0.75);
  background: var(--green-soft);
  box-shadow: 0 0 0 2px rgba(53, 208, 127, 0.18);
}

.join-box {
  display: grid;
  gap: 10px;
}

.room-layout {
  display: grid;
  gap: 14px;
}

.room-topline,
.players-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.room-code {
  font-size: 2.3rem;
  line-height: 1;
  font-weight: 900;
}

.status-pill,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--panel-soft);
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.badge.ready {
  color: var(--green);
  background: var(--green-soft);
  border-color: rgba(53, 208, 127, 0.45);
}

.badge.active-turn {
  color: var(--green);
  background: var(--green-soft);
  border-color: rgba(53, 208, 127, 0.55);
}

.badge.vote-requested {
  color: #84d8ff;
  background: rgba(132, 216, 255, 0.14);
  border-color: rgba(132, 216, 255, 0.42);
}

.badge.disconnected {
  color: #c4c8d2;
  background: rgba(196, 200, 210, 0.12);
  border-color: rgba(196, 200, 210, 0.34);
}

.badge.waiting {
  color: var(--yellow);
}

.phase-content {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.phase-card {
  display: grid;
  gap: 14px;
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 16px;
}

.phase-card h2,
.players-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.big-message {
  margin: 0;
  font-size: clamp(1.7rem, 8vw, 3.4rem);
  line-height: 1.08;
  font-weight: 900;
}

.hint-box {
  display: grid;
  gap: 10px;
  border-radius: 8px;
  padding: 14px;
  background: #111318;
  border: 1px solid var(--line);
}

.hint-box p {
  margin: 0;
  line-height: 1.45;
}

.helper-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.players-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.player-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 8px;
  background: var(--panel-soft);
  border: 1px solid transparent;
}

.player-row.is-current {
  border-color: rgba(53, 208, 127, 0.75);
  background: rgba(53, 208, 127, 0.14);
}

.player-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

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

.player-avatar {
  flex: 0 0 auto;
  font-size: 1.12em;
  line-height: 1;
}

.vote-target-line {
  margin-top: 6px;
  color: #f4c95d;
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.25;
}

.player-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.error-box {
  margin-top: 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 107, 107, 0.45);
  background: rgba(255, 107, 107, 0.12);
  color: #ffd1d1;
  padding: 12px;
  font-weight: 700;
}

.discussion-card {
  gap: 16px;
}

.overtime-card {
  gap: 16px;
  border-color: rgba(244, 201, 93, 0.42);
  background: rgba(244, 201, 93, 0.08);
}

.timer-box {
  display: grid;
  gap: 4px;
  justify-items: center;
  padding: 16px;
  border-radius: 8px;
  background: #111318;
  border: 1px solid var(--line);
}

.timer-box span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
}

.timer-box strong {
  font-size: clamp(3rem, 18vw, 5.2rem);
  line-height: 1;
}

.current-player-card {
  border-radius: 8px;
  padding: 14px;
  background: var(--green-soft);
  border: 1px solid rgba(53, 208, 127, 0.45);
}

.current-player-name {
  margin: 0;
  color: var(--green);
  font-size: clamp(1.5rem, 8vw, 2.8rem);
  line-height: 1.05;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.vote-list,
.result-list {
  display: grid;
  gap: 10px;
}

.vote-option,
.result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 8px;
  background: #111318;
  border: 1px solid var(--line);
}

.vote-option strong,
.result-row span {
  overflow-wrap: anywhere;
}

.vote-option .helper-text {
  display: block;
  margin-top: 3px;
  font-size: 0.85rem;
}

.vote-button {
  min-width: 92px;
}

.results-card {
  gap: 16px;
}

.big-result,
.word-result,
.outcome-text {
  margin: 0;
  overflow-wrap: anywhere;
}

.big-result {
  font-size: clamp(1.35rem, 6vw, 2rem);
  line-height: 1.15;
  font-weight: 900;
}

.word-result {
  color: var(--muted);
  font-weight: 800;
}

.outcome-text {
  border-radius: 8px;
  padding: 12px;
  color: var(--green);
  background: var(--green-soft);
  border: 1px solid rgba(53, 208, 127, 0.45);
  font-weight: 900;
}

.result-row strong {
  min-width: 38px;
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--panel-soft);
  text-align: center;
}

@media (min-width: 760px) {
  .room-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
  }
}
