:root {
  --bg: #f5f2eb;
  --ink: #1e2424;
  --muted: #65706c;
  --panel: #fffdf8;
  --line: #d8d0c1;
  --accent: #d24a38;
  --accent-2: #216e76;
  --accent-3: #e8b044;
  --good: #2d8a55;
  --bad: #9f3a34;
  --shadow: 0 14px 38px rgba(48, 40, 28, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% 12%, rgba(232, 176, 68, 0.22), transparent 28rem),
    linear-gradient(135deg, #f8f4ea 0%, #eaf2ef 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.app {
  width: min(1120px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.hat-mark {
  width: 58px;
  height: 48px;
  flex: 0 0 auto;
}

.brand h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1;
}

.brand p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.pill {
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.68);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.ghost-btn,
.icon-btn,
.primary-btn,
.secondary-btn,
.danger-btn {
  min-height: 42px;
  border-radius: 7px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 750;
}

.primary-btn {
  background: var(--accent);
  color: #fffaf5;
  box-shadow: 0 8px 16px rgba(210, 74, 56, 0.22);
}

.secondary-btn {
  background: var(--accent-2);
  color: white;
}

.danger-btn {
  background: var(--bad);
  color: white;
}

.ghost-btn,
.icon-btn {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
}

.icon-btn {
  width: 44px;
  padding: 0;
  font-size: 21px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 18px;
  align-items: start;
}

.panel,
.card,
.word-card,
.scoreboard {
  background: rgba(255, 253, 248, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 20px;
}

.panel h2,
.card h3,
.scoreboard h3 {
  margin: 0 0 14px;
  line-height: 1.1;
}

.side-heading {
  margin-top: 18px !important;
}

.error-panel {
  margin-bottom: 16px;
  border-color: rgba(159, 58, 52, 0.35);
  color: var(--bad);
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 43px;
  border: 1px solid var(--line);
  background: #fffefa;
  color: var(--ink);
  border-radius: 7px;
  padding: 10px 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(33, 110, 118, 0.13);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.actions select {
  max-width: 150px;
}

.copy-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 14px;
}

.team-list,
.round-list {
  display: grid;
  gap: 10px;
}

.team-card {
  padding: 14px;
  border-radius: 8px;
  background: #fffefa;
  border: 1px solid var(--line);
}

.team-card strong {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}

.team-card small {
  color: var(--muted);
}

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

.word-person {
  padding: 14px;
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.word-person h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.word-person input + input {
  margin-top: 8px;
}

.progress-line {
  height: 10px;
  background: #e7dfd1;
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0 0;
}

.progress-line div {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent-3));
  width: 0%;
}

.play-shell {
  display: grid;
  gap: 16px;
}

.play-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}

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

.turn-box b {
  display: block;
  font-size: 15px;
  margin-bottom: 3px;
}

.turn-box span {
  color: var(--muted);
  font-size: 14px;
}

.timer {
  width: 154px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--accent) var(--timer, 100%), #e8dfd1 0);
  box-shadow: var(--shadow);
}

.timer-inner {
  width: 124px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel);
  font-size: 46px;
  font-weight: 900;
}

.word-card {
  min-height: 235px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 26px;
}

.word-card.compact {
  min-height: 160px;
  margin-top: 18px;
}

.word-card .word {
  font-size: clamp(36px, 7vw, 74px);
  font-weight: 950;
  overflow-wrap: anywhere;
}

.word-card .waiting {
  font-size: clamp(25px, 5vw, 46px);
  font-weight: 850;
}

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

.turn-actions button {
  min-height: 68px;
  font-size: 18px;
}

.scoreboard {
  padding: 18px;
  position: sticky;
  top: 14px;
}

.score-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.score-row:first-of-type {
  border-top: 0;
}

.score {
  min-width: 48px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #eef5f2;
  font-weight: 950;
  font-size: 23px;
}

.active-team .score {
  color: white;
  background: var(--accent-2);
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.meta {
  padding: 12px;
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.meta b {
  display: block;
  font-size: 20px;
}

.meta span {
  color: var(--muted);
  font-size: 13px;
}

.round-chip {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
}

.round-chip .num {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--accent-2);
  font-weight: 900;
}

.round-chip.current {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(210, 74, 56, 0.12);
}

.notice {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.hidden {
  display: none;
}

@media (max-width: 840px) {
  .topbar,
  .layout,
  .play-header {
    grid-template-columns: 1fr;
  }

  .pill-row {
    justify-content: start;
  }

  .setup-grid,
  .word-grid,
  .turn-actions,
  .meta-grid,
  .copy-row {
    grid-template-columns: 1fr;
  }

  .scoreboard {
    position: static;
  }

  .timer {
    width: 132px;
    justify-self: center;
  }

  .timer-inner {
    width: 106px;
    font-size: 38px;
  }

  .brand h1 {
    font-size: 30px;
  }
}
