:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #5b6069;
  --line: #d8dde6;
  --paper: #f7f4ee;
  --panel: #ffffff;
  --accent: #0e8f72;
  --accent-strong: #076653;
  --gold: #d69b2d;
  --danger: #c94444;
  --shadow: 0 18px 50px rgba(28, 35, 45, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(14, 143, 114, 0.12), transparent 35%),
    linear-gradient(315deg, rgba(214, 155, 45, 0.16), transparent 38%),
    var(--paper);
  color: var(--ink);
  font-family: Inter, "Segoe UI", "Noto Sans KR", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

h1,
h2 {
  margin: 0;
}

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

h2 {
  font-size: 1.1rem;
}

.round-pill {
  min-width: 150px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  text-align: right;
  font-weight: 800;
}

.round-pill span,
.round-pill strong {
  display: block;
}

.round-pill span {
  color: var(--accent-strong);
  font-size: 0.82rem;
}

.leave-button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 12px;
  background: #f0dddd;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 900;
}

.join-panel,
.game-panel,
.scoreboard {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.join-panel {
  padding: 18px;
  margin-bottom: 16px;
}

.join-panel label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 700;
}

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

.room-form {
  display: grid;
  gap: 10px;
}

.room-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.mini-button {
  min-height: 32px;
  border-radius: 8px;
  padding: 0 10px;
  background: #eceff3;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 900;
}

.room-list {
  display: grid;
  gap: 8px;
}

.room-card-button {
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  display: grid;
  gap: 4px;
}

.room-card-button:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(14, 143, 114, 0.12);
}

.room-card-button strong,
.room-card-button span,
.room-card-button small {
  display: block;
}

.room-card-button small,
.empty-room {
  color: var(--muted);
}

.empty-room {
  margin: 0;
  min-height: 48px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 13px;
  font-weight: 800;
}

.field-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.field-row label {
  margin: 0;
}

input {
  min-width: 0;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--panel);
}

.room-form button,
.controls button {
  min-height: 48px;
  border-radius: 8px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.error-text {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--danger);
  font-weight: 800;
}

.game-panel {
  padding: 18px;
  margin-bottom: 16px;
}

.is-hidden {
  display: none;
}

.arena {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 16px;
  align-items: stretch;
}

.timer-block {
  min-height: 260px;
  border-radius: 8px;
  padding: 22px;
  background: #20252d;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.timer-block span {
  color: #a7e2d4;
  font-size: 1rem;
  font-weight: 800;
}

.timer-block strong {
  display: block;
  margin: 8px 0;
  font-size: clamp(4.4rem, 17vw, 9.5rem);
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}

.timer-block small {
  color: #f1f1f1;
  font-size: 1.02rem;
  line-height: 1.5;
}

.bid-button {
  min-height: 260px;
  border-radius: 8px;
  background: var(--gold);
  color: #1c1510;
  font-size: clamp(1.5rem, 5vw, 2.8rem);
  font-weight: 900;
  touch-action: none;
  user-select: none;
  box-shadow: inset 0 -10px 0 rgba(0, 0, 0, 0.12);
}

.bid-button.is-pressed {
  transform: translateY(3px);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.16);
}

.controls {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

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

.scoreboard {
  padding: 18px;
}

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

.scoreboard-head span {
  color: var(--muted);
  font-weight: 800;
}

.players {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.player-card {
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
  display: grid;
  gap: 10px;
}

.player-card.me {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(14, 143, 114, 0.12);
}

.player-card.winner {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(214, 155, 45, 0.16);
}

.player-card.host {
  background: #fbfdf9;
}

.player-name {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 900;
}

.tag {
  min-width: 42px;
  border-radius: 999px;
  padding: 2px 8px;
  background: #eff5f3;
  color: var(--accent-strong);
  text-align: center;
  font-size: 0.78rem;
  font-weight: 900;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat {
  border-radius: 8px;
  background: #f4f6f8;
  padding: 8px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.stat strong {
  font-variant-numeric: tabular-nums;
}

.bid-line {
  color: var(--muted);
  min-height: 20px;
  font-size: 0.9rem;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 20px, 560px);
    padding: 20px 0;
  }

  .topbar,
  .arena,
  .controls {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .round-pill {
    text-align: left;
  }

  .top-actions {
    align-items: stretch;
  }

  .timer-block,
  .bid-button {
    min-height: 210px;
  }

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

  .field-row {
    grid-template-columns: 1fr;
  }
}
