:root {
  color-scheme: light;
  --bg: #f4efe7;
  --bg-strong: #e8dece;
  --card: rgba(255, 251, 244, 0.86);
  --border: rgba(84, 52, 24, 0.16);
  --text: #28180d;
  --muted: #7e6652;
  --accent: #bf5a36;
  --accent-strong: #8f3516;
  --shadow: 0 18px 60px rgba(88, 58, 29, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.65), transparent 32%),
    linear-gradient(135deg, var(--bg), var(--bg-strong));
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 12px 0;
  min-height: 100vh;
}

.hero,
.panel {
  border: 1px solid var(--border);
  background: var(--card);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.hero {
  padding: 40px;
  border-radius: 32px;
  min-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero > .brand-mark {
  position: absolute;
  top: 24px;
  left: 24px;
}

.brand-mark-small {
  padding: 9px 12px;
  font-size: 0.8rem;
}

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

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 16px;
  font-size: clamp(2.5rem, 5vw, 4.8rem);
  line-height: 0.98;
  max-width: 11ch;
}

.lede {
  max-width: 54ch;
  font-size: 1.05rem;
  color: var(--muted);
}

.hero-actions,
.control-row,
.participants-header,
.room-topbar,
.room-layout,
.cards-header,
.controls-head {
  display: flex;
  gap: 12px;
}

.hero-actions {
  margin-top: 28px;
}

.join-form {
  display: flex;
  flex: 1;
  gap: 12px;
}

input,
textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
}

textarea {
  resize: none;
  overflow: auto;
  line-height: 1.35;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 9px 12px;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.primary {
  background: var(--accent);
  color: white;
}

.primary:hover {
  background: var(--accent-strong);
}

.secondary {
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
  border: 1px solid var(--border);
}

.message,
.hint {
  color: var(--muted);
}

.flush {
  margin-bottom: 0;
}

.room {
  height: calc(100vh - 24px);
  display: grid;
  grid-template-rows: auto minmax(72px, min(28vh, 220px)) minmax(370px, 1fr);
  gap: 8px;
  font-size: 0.86rem;
}

.room-topbar {
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: 18px;
}

.room-chip-group,
.room-chip {
  display: flex;
  align-items: center;
  gap: 8px;
}

.room-chip-group {
  min-height: 40px;
}

.room-chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
}

.chip-label,
.room-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.room-meta {
  margin: 0;
  line-height: 1;
}

.tiny-button {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
}

.room-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.95fr);
  gap: 8px;
  min-height: 0;
}

.panel {
  padding: 12px;
  border-radius: 18px;
}

.panel-tight {
  padding: 10px 12px;
}

.label {
  margin-bottom: 6px;
  font-weight: 700;
}

.average {
  margin-top: 0;
  font-size: 0.86rem;
  font-weight: 700;
}

.participants-panel,
.room-sidebar,
.cards-panel {
  min-height: 0;
}

.participants-panel {
  display: flex;
  flex-direction: column;
}

.participants-header {
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.progress-pill {
  margin: 0;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(40, 24, 13, 0.08);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
}

.room-sidebar {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 8px;
}

.controls-panel {
  display: grid;
  gap: 8px;
}

.point-system-panel {
  display: grid;
  gap: 6px;
  min-height: 0;
  max-height: 220px;
}

.point-system-panel textarea {
  height: 100%;
  min-height: 0;
  max-height: none;
}

.controls-head {
  justify-content: space-between;
  align-items: center;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.card-button {
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(191, 90, 54, 0.25);
  background: rgba(255, 255, 255, 0.8);
  color: var(--accent-strong);
  font-size: 1rem;
  font-weight: 700;
}

.card-button.selected {
  background: var(--accent);
  color: white;
}

.card-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.participants {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.participant {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 50px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid var(--border);
}

.participant.waiting {
  background: rgba(255, 255, 255, 0.78);
}

.participant.voted {
  background: rgba(94, 170, 120, 0.14);
  border-color: rgba(65, 124, 84, 0.32);
}

.participant.revealed {
  background: rgba(191, 90, 54, 0.1);
  border-color: rgba(191, 90, 54, 0.28);
}

.participant.disconnected {
  opacity: 0.62;
}

.participant strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.86rem;
}

.participant-meta {
  color: var(--muted);
  font-size: 0.76rem;
}

.pill {
  min-width: 66px;
  padding: 6px 9px;
  border-radius: 12px;
  text-align: center;
  font-weight: 700;
  background: rgba(94, 170, 120, 0.14);
  color: #2e6b43;
}

.pill.muted {
  background: rgba(40, 24, 13, 0.08);
  color: var(--muted);
}

.pill.revealed {
  background: rgba(191, 90, 54, 0.14);
  color: var(--accent-strong);
}

.hidden {
  display: none;
}

@media (max-width: 780px) {
  body {
    overflow: auto;
  }

  .shell {
    width: min(100% - 20px, 1120px);
    padding-top: 20px;
    min-height: auto;
  }

  .hero {
    padding: 24px;
    min-height: auto;
  }

  .hero-actions,
  .join-form,
  .room-topbar,
  .control-row,
  .controls-head {
    flex-direction: column;
  }

  .room {
    height: auto;
  }

  .room-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .participants {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
