:root {
  color-scheme: light;
  --bg: #f6f7f2;
  --ink: #20231f;
  --muted: #62685f;
  --line: #d9ddcf;
  --brand: #2d6a4f;
  --brand-dark: #1f513c;
  --panel: #ffffff;
  --warn: #a64020;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  cursor: pointer;
  font-weight: 700;
  padding: 0.75rem 1rem;
}

button:hover {
  background: var(--brand-dark);
}

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

.secondary {
  background: #e8ece0;
  color: var(--ink);
}

.secondary:hover {
  background: #dbe2d0;
}

.shell {
  margin: 0 auto;
  max-width: 1180px;
  padding: 28px;
}

.hero {
  align-items: end;
  display: grid;
  gap: 28px;
  grid-template-columns: 1.3fr 1fr;
  min-height: 260px;
  padding: 32px 0;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 4.6rem);
  letter-spacing: 0;
  line-height: 1;
  margin: 0 0 16px;
}

.hero p {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.5;
  margin: 0;
  max-width: 680px;
}

.eyebrow {
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-actions {
  display: grid;
  gap: 12px;
}

.join-form,
.toolbar,
.order-form {
  display: flex;
  gap: 10px;
}

input,
select,
textarea {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 42px;
  padding: 0.68rem 0.75rem;
  width: 100%;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 22px;
  padding: 24px;
}

.hidden {
  display: none !important;
}

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

label {
  color: var(--muted);
  display: grid;
  font-size: 0.9rem;
  gap: 6px;
}

.wide {
  grid-column: 1 / -1;
}

.game-head {
  align-items: start;
  display: flex;
  gap: 20px;
  justify-content: space-between;
}

.game-head h2 {
  font-size: 2rem;
  margin: 4px 0 0;
}

.code-box {
  background: #f0f4e9;
  border-radius: 8px;
  min-width: 150px;
  padding: 14px 18px;
  text-align: center;
}

.code-box span,
.metrics span {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.code-box strong {
  font-size: 2rem;
  letter-spacing: 0.08em;
}

.toolbar {
  margin: 18px 0;
}

.role-box {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.metrics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.metrics div,
.role-card {
  background: #f8faf5;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.metrics strong {
  font-size: 1.6rem;
}

.hint,
.message {
  color: var(--muted);
  min-height: 1.4em;
}

.message {
  color: var(--warn);
  font-weight: 700;
}

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

.role-card h3 {
  margin: 0 0 12px;
}

.role-card dl {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
  margin: 0;
}

.role-card dd {
  font-weight: 800;
  margin: 0;
}

.submitted {
  color: var(--brand);
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: right;
}

th:first-child,
td:first-child {
  text-align: left;
}

@media (max-width: 820px) {
  .shell {
    padding: 18px;
  }

  .hero,
  .grid-form,
  .metrics,
  .cards {
    grid-template-columns: 1fr;
  }

  .join-form,
  .order-form,
  .game-head {
    align-items: stretch;
    flex-direction: column;
  }
}
