:root {
  color-scheme: light;
  --ink: #15171d;
  --muted: #667085;
  --line: #d7dce5;
  --paper: #f5f1e8;
  --panel: #ffffff;
  --night: #171b24;
  --accent: #0f8b8d;
  --accent-strong: #0a6367;
  --sun: #f0b429;
  --red: #d64545;
  --green: #2f9e62;
  --shadow: 0 18px 55px rgba(27, 32, 43, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% 16%, rgba(240, 180, 41, 0.18), transparent 28%),
    linear-gradient(140deg, rgba(15, 139, 141, 0.16), transparent 38%),
    var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", "Noto Sans KR", Arial, sans-serif;
}

button,
input,
select {
  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: 30px 0;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 900;
}

h1,
h2 {
  margin: 0;
}

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

h2 {
  font-size: 1.12rem;
}

.room-status {
  min-width: 164px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.78);
  text-align: right;
  font-weight: 900;
}

.room-status span,
.room-status strong {
  display: block;
}

.room-status span {
  color: var(--accent-strong);
  font-size: 0.84rem;
}

.rule-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.rule-strip article {
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.72);
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.rule-strip strong {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--night);
  color: #fff;
  display: grid;
  place-items: center;
}

.rule-strip span {
  color: #3b4250;
  line-height: 1.45;
  font-weight: 700;
}

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

.join-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
  margin-bottom: 16px;
}

.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(15, 139, 141, 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;
}

label {
  color: var(--muted);
  font-weight: 800;
}

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

select {
  color: var(--ink);
}

.muted-label {
  opacity: 0.5;
}

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

.error-text {
  grid-column: 1 / -1;
  min-height: 22px;
  margin: 0;
  color: var(--red);
  font-weight: 900;
}

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

.is-hidden {
  display: none;
}

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  gap: 16px;
  align-items: stretch;
}

.clock-face {
  min-height: 310px;
  border-radius: 8px;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent),
    var(--night);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.clock-face span {
  color: #95e0dc;
  font-size: 1rem;
  font-weight: 900;
}

.clock-face strong {
  display: block;
  min-height: 128px;
  margin: 10px 0;
  font-size: clamp(5rem, 18vw, 10rem);
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}

.clock-face small {
  color: #eef2f7;
  font-size: clamp(1.18rem, 3vw, 1.7rem);
  line-height: 1.5;
  font-weight: 900;
}

.clock-face .hint-box {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.clock-face .hint-title {
  width: fit-content;
  border-radius: 8px;
  padding: 4px 9px;
  background: var(--sun);
  color: #19130a;
  font-size: 0.9rem;
  font-weight: 1000;
}

.clock-face .hint-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.clock-face .hint-chip {
  border: 1px solid rgba(149, 224, 220, 0.45);
  border-radius: 8px;
  min-height: 68px;
  padding: 12px;
  background: rgba(149, 224, 220, 0.14);
  color: #ffffff;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: clamp(1.3rem, 4vw, 2rem);
  line-height: 1.18;
  font-weight: 1000;
}

.clock-face .subline {
  display: block;
  color: #c9d4df;
  font-size: 0.9em;
}

.action-zone {
  min-height: 310px;
  display: grid;
  grid-template-rows: minmax(190px, 1fr) auto;
  gap: 12px;
}

.now-button {
  width: 100%;
  min-height: 190px;
  border-radius: 8px;
  background: var(--sun);
  color: #19130a;
  font-size: clamp(2.4rem, 9vw, 5.4rem);
  font-weight: 1000;
  box-shadow: inset 0 -12px 0 rgba(0, 0, 0, 0.14);
  touch-action: manipulation;
}

.now-button:active {
  transform: translateY(3px);
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.18);
}

.action-zone p {
  min-height: 82px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  color: #303846;
  line-height: 1.45;
  font-weight: 800;
}

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

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

.controls .danger {
  background: #f2dddd;
  color: var(--red);
}

.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: 900;
}

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

.player-card {
  min-height: 126px;
  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(15, 139, 141, 0.13);
}

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

.player-card.winner {
  border-color: var(--sun);
  box-shadow: 0 0 0 2px rgba(240, 180, 41, 0.2);
}

.player-card.eliminated {
  opacity: 0.66;
}

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

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

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

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

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

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

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

  .topbar,
  .stage,
  .join-panel,
  .rule-strip {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
  }

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

  .clock-face,
  .action-zone {
    min-height: 230px;
  }

  .clock-face strong {
    min-height: 92px;
  }

  .controls {
    flex-direction: column;
  }

  .clock-face .hint-row {
    grid-template-columns: 1fr;
  }
}
