:root {
  color-scheme: light;
  --bg: #bcb4a7;
  --bg-soft: #c8c1b6;
  --paper: #ece3d4;
  --paper-2: #e4d9c8;
  --line: #c3b59f;
  --line-strong: #a3937d;
  --ink: #2f2b24;
  --ink-soft: #5e5649;
  --muted: #7b7264;
  --olive: #6f7a68;
  --blue-ink: #4b5e67;
  --brown: #7a6253;
  --danger: #8b5a57;
  --shadow: 0 16px 36px rgba(72, 58, 40, 0.09);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(255, 248, 232, 0.28), transparent 28%),
    linear-gradient(180deg, #c5bdae 0%, var(--bg) 100%);
}

button,
input {
  font: inherit;
}

code {
  font-family: "Courier New", monospace;
  font-size: 0.95em;
}

.shell {
  width: min(1100px, calc(100% - 28px));
  margin: 22px auto 42px;
}

.panel {
  background: linear-gradient(180deg, rgba(236, 227, 212, 0.98), rgba(228, 217, 200, 0.98));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

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

h1,
h2,
h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  letter-spacing: 0.01em;
}

h1 {
  font-size: clamp(2.8rem, 7vw, 4.8rem);
  line-height: 0.95;
}

h2 {
  font-size: clamp(1.7rem, 3.2vw, 2.25rem);
}

h3 {
  font-size: 1.4rem;
}

.hero {
  margin-bottom: 18px;
  background:
    linear-gradient(180deg, rgba(240, 233, 222, 0.98), rgba(228, 217, 200, 0.98)),
    repeating-linear-gradient(
      180deg,
      transparent,
      transparent 30px,
      rgba(163, 147, 125, 0.05) 30px,
      rgba(163, 147, 125, 0.05) 31px
    );
}

.hero-copy,
.section-copy,
.section-note,
.player-meta,
.banner,
.error,
#winner-copy,
.room-detail,
.menu-summary {
  color: var(--ink-soft);
  line-height: 1.55;
}

.home-grid,
.content-grid,
.game-grid,
.inline-fields,
.menu-grid {
  display: grid;
  gap: 16px;
}

.home-grid {
  grid-template-columns: 1.15fr 0.85fr;
}

.content-grid {
  grid-template-columns: 1.1fr 0.9fr;
}

.game-grid {
  grid-template-columns: 0.82fr 1.18fr;
}

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

.form-panel,
.sidebar-panel,
.menu-card,
.placeholder-panel {
  background: linear-gradient(180deg, rgba(238, 229, 215, 0.98), rgba(229, 218, 201, 0.98));
}

.top-actions {
  display: flex;
  margin-bottom: 14px;
}

label {
  display: block;
  margin-top: 14px;
  color: var(--ink);
  font-size: 0.95rem;
}

input {
  width: 100%;
  margin-top: 7px;
  padding: 12px 13px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(249, 245, 236, 0.96);
  color: var(--ink);
  outline: none;
}

input:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(163, 147, 125, 0.14);
}

.inline-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

button {
  margin-top: 16px;
  border: 1px solid #78816f;
  border-radius: 14px;
  padding: 11px 16px;
  background: #75816d;
  color: #f7f2ea;
  cursor: pointer;
  transition: transform 0.14s ease, background 0.14s ease, opacity 0.14s ease;
}

button:hover {
  background: #66725f;
  transform: translateY(-1px);
}

button.secondary {
  background: #6b5d53;
  border-color: #65564c;
}

button.secondary:hover {
  background: #5f5248;
}

button.ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line-strong);
}

button.small {
  margin-top: 0;
  padding: 8px 12px;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.menu-card {
  border: 1px solid rgba(163, 147, 125, 0.55);
  border-radius: 18px;
  padding: 18px;
}

.menu-card.available {
  background: linear-gradient(180deg, rgba(241, 234, 224, 0.98), rgba(231, 223, 210, 0.98));
}

.menu-card-head {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: start;
}

.menu-badge {
  flex-shrink: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(122, 98, 83, 0.12);
  color: var(--brown);
  font-size: 0.82rem;
}

.menu-badge.implemented {
  background: rgba(111, 122, 104, 0.16);
  color: var(--olive);
}

.menu-meta,
.placeholder-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.menu-meta span,
.meta-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(249, 245, 236, 0.82);
  border: 1px solid rgba(163, 147, 125, 0.45);
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.menu-points,
.placeholder-list {
  margin: 14px 0 0;
  padding-left: 18px;
  color: var(--ink-soft);
  line-height: 1.55;
}

.placeholder-list li + li,
.menu-points li + li {
  margin-top: 6px;
}

.hud {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.hud-code-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

.room-code {
  display: inline-block;
  padding: 9px 13px;
  border-radius: 12px;
  background: rgba(251, 246, 236, 0.9);
  border: 1px solid var(--line);
  color: var(--brown);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 4vw, 2rem);
  letter-spacing: 0.12em;
}

.room-summary {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.room-detail {
  margin: 0;
  text-align: right;
}

.detail-label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.hud-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: end;
}

.banner,
.error {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(249, 245, 236, 0.9);
  border: 1px solid var(--line);
}

.error {
  color: var(--danger);
  border-color: rgba(139, 90, 87, 0.3);
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 10px;
}

.section-note {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.player-list,
.assignment-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.player-item {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(163, 147, 125, 0.48);
  background: rgba(247, 241, 231, 0.9);
}

.player-item.empty-slot {
  background: rgba(237, 230, 218, 0.72);
  border-style: dashed;
}

.player-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.player-name {
  font-weight: 700;
  color: var(--ink);
}

.player-state {
  font-size: 0.92rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.player-state.connected,
.player-state.active {
  color: var(--blue-ink);
}

.player-state.pending {
  color: var(--brown);
}

.player-state.sent,
.player-state.done,
.player-state.winner {
  color: var(--olive);
}

.player-state.disconnected {
  color: var(--danger);
}

.player-meta {
  margin: 7px 0 0;
  font-size: 0.9rem;
}

.compact-list {
  margin-top: 14px;
}

.collect-form {
  margin-top: 18px;
}

.phrase-inputs {
  display: grid;
  gap: 10px;
}

.waiting-card {
  margin-top: 20px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(246, 241, 232, 0.94);
  border: 1px solid rgba(111, 122, 104, 0.35);
}

.notebook-panel {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(241, 235, 224, 0.98), rgba(232, 223, 208, 0.98)),
    repeating-linear-gradient(
      180deg,
      transparent,
      transparent 42px,
      rgba(75, 94, 103, 0.09) 42px,
      rgba(75, 94, 103, 0.09) 43px
    );
}

.notebook-panel::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 46px;
  width: 1px;
  background: rgba(139, 90, 87, 0.18);
}

.assignment-list {
  margin-top: 18px;
}

.assignment-empty {
  padding: 16px;
  border-radius: 16px;
  border: 1px dashed rgba(163, 147, 125, 0.5);
  color: var(--muted);
  background: rgba(246, 241, 232, 0.64);
}

.assignment-button {
  width: 100%;
  margin: 0;
  padding: 14px 0 14px 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(75, 94, 103, 0.16);
  border-radius: 0;
  color: var(--ink);
  display: grid;
  grid-template-columns: 36px 1fr 46px;
  gap: 14px;
  align-items: center;
  box-shadow: none;
}

.assignment-button:hover {
  background: rgba(123, 114, 100, 0.04);
  box-shadow: none;
}

.assignment-index {
  color: var(--muted);
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
}

.assignment-text {
  line-height: 1.4;
  text-align: left;
}

.assignment-mark {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(163, 147, 125, 0.6);
  display: grid;
  place-items: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.6rem;
  color: transparent;
  justify-self: end;
}

.assignment-button.completed .assignment-mark {
  color: var(--brown);
  background: rgba(228, 216, 208, 0.5);
  transform: rotate(-10deg);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(79, 67, 54, 0.24);
}

.modal-card {
  width: min(420px, 100%);
  text-align: center;
}

@media (max-width: 960px) {
  .menu-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .home-grid,
  .content-grid,
  .game-grid,
  .inline-fields,
  .hud {
    grid-template-columns: 1fr;
  }

  .room-summary {
    justify-items: start;
  }

  .room-detail {
    text-align: left;
  }

  .hud-actions {
    justify-content: start;
  }

  .player-row {
    align-items: start;
    flex-direction: column;
    gap: 4px;
  }
}
