:root {
  --paper: #f7f3ea;
  --ink: #172133;
  --muted: #747b87;
  --line: #dcd6c9;
  --red: #ff5f57;
  --blue: #4c8dff;
  --yellow: #ffd45a;
  --panel: #fffdf8;
  --shadow: 0 20px 60px rgba(52, 42, 26, 0.12);
  color: var(--ink);
  background: var(--paper);
  font-family:
    ui-rounded, "SF Pro Rounded", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 15%, rgba(255, 212, 90, 0.2), transparent 20%),
    radial-gradient(
      circle at 92% 75%,
      rgba(76, 141, 255, 0.12),
      transparent 24%
    ),
    var(--paper);
}
button,
input {
  font: inherit;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
header {
  width: min(1180px, calc(100% - 36px));
  height: 78px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}
.brand > span {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 15px 15px 15px 4px;
  background: var(--yellow);
  font-size: 25px;
  font-weight: 900;
  transform: rotate(-4deg);
}
.brand strong,
.brand small {
  display: block;
}
.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.18em;
}
.hall {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}
main {
  width: min(1180px, calc(100% - 36px));
  margin: auto;
  padding: 32px 0 70px;
}
.home {
  min-height: calc(100vh - 160px);
  display: grid;
  grid-template-columns: 1.1fr minmax(340px, 0.7fr);
  gap: clamp(36px, 7vw, 100px);
  align-items: center;
}
.eyebrow {
  margin: 0 0 14px;
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.2em;
}
.home h1 {
  margin: 0;
  font-size: clamp(58px, 9vw, 112px);
  line-height: 0.88;
  letter-spacing: -0.07em;
}
.home h1 span {
  color: var(--blue);
}
.lead {
  max-width: 580px;
  margin: 27px 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
.chips span,
.pill {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  font-size: 12px;
}
.card {
  padding: 28px;
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  padding: 5px;
  background: #eee9dd;
  border-radius: 14px;
}
.tab,
.btn {
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 800;
}
.tab {
  min-height: 42px;
  background: transparent;
  color: var(--muted);
}
.tab.active {
  background: white;
  color: var(--ink);
  box-shadow: 0 4px 15px rgba(45, 39, 28, 0.08);
}
.card h2 {
  margin: 23px 0 5px;
}
.sub {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.field {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}
.field label {
  font-size: 12px;
  font-weight: 800;
}
.field input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: white;
  color: var(--ink);
}
.btn {
  min-height: 46px;
  padding: 0 17px;
  background: #ebe6db;
  color: var(--ink);
}
.btn.primary {
  width: 100%;
  margin-top: 18px;
  background: var(--ink);
  color: white;
}
.btn.red {
  background: var(--red);
  color: white;
}
.btn.blue {
  background: var(--blue);
  color: white;
}
.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}
.game {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
}
.topbar {
  grid-column: 1/-1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.82);
}
.room {
  display: flex;
  align-items: center;
  gap: 10px;
}
.back {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 11px;
  background: #ebe6db;
  cursor: pointer;
}
.room strong,
.room small {
  display: block;
}
.room small {
  margin-top: 2px;
  color: var(--muted);
  font:
    11px ui-monospace,
    monospace;
}
.status {
  text-align: right;
}
.status strong {
  display: block;
  font-size: 20px;
}
.status small {
  color: var(--muted);
}
.board-column {
  display: grid;
  gap: 13px;
  min-width: 0;
}
.prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}
.prompt small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.prompt strong {
  font-size: 22px;
}
.canvas-shell {
  position: relative;
  overflow: hidden;
  aspect-ratio: 8/5;
  border: 1px solid #d4cdbf;
  border-radius: 22px;
  background: white;
  box-shadow: var(--shadow);
  touch-action: none;
}
.canvas-shell canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}
.waiting {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 30px;
  background: rgba(255, 255, 255, 0.8);
  text-align: center;
}
.waiting strong {
  font-size: 24px;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}
.swatch {
  width: 31px;
  height: 31px;
  padding: 0;
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
}
.swatch.active {
  box-shadow: 0 0 0 3px var(--ink);
}
.toolbar input {
  width: 110px;
}
.toolbar .spacer {
  flex: 1;
}
.side {
  display: grid;
  gap: 14px;
  align-content: start;
}
.side .card {
  padding: 18px;
  border-radius: 20px;
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.section-title h2 {
  margin: 0;
  font-size: 16px;
}
.section-title span {
  color: var(--muted);
  font-size: 11px;
}
.players,
.guess-list {
  display: grid;
  gap: 8px;
}
.player {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 9px;
  align-items: center;
  padding: 8px;
  border-radius: 12px;
  background: #f4efe6;
}
.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--avatar);
  font-weight: 900;
}
.player small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}
.score {
  font-weight: 900;
}
.guess-list {
  max-height: 220px;
  overflow: auto;
}
.guess {
  padding: 9px 10px;
  border-radius: 10px;
  background: #f4efe6;
  font-size: 12px;
}
.guess.correct {
  background: #dff8ed;
  color: #176e50;
}
.guess-form {
  display: flex;
  gap: 7px;
  margin-top: 10px;
}
.guess-form input {
  min-width: 0;
  flex: 1;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.guess-form .btn {
  min-height: 42px;
}
.lobby-list {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}
.lobby-player {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-radius: 13px;
  background: #f4efe6;
}
.action-row {
  display: flex;
  gap: 9px;
}
.action-row .btn {
  flex: 1;
}
#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: white;
  opacity: 0;
  transform: translate(-50%, 20px);
  transition: 0.2s;
  pointer-events: none;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
@media (max-width: 820px) {
  .home {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .game {
    grid-template-columns: 1fr;
  }
  .side {
    grid-row: 3;
  }
  .home-copy {
    text-align: center;
  }
  .chips {
    justify-content: center;
  }
}
@media (max-width: 520px) {
  header,
  main {
    width: min(100% - 22px, 1180px);
  }
  header {
    height: 66px;
  }
  main {
    padding-top: 18px;
  }
  .hall {
    font-size: 0;
  }
  .hall::after {
    content: "←";
    font-size: 20px;
  }
  .home h1 {
    font-size: clamp(54px, 20vw, 78px);
  }
  .card {
    padding: 20px;
    border-radius: 22px;
  }
  .topbar {
    padding: 10px;
  }
  .prompt {
    padding: 12px 14px;
  }
  .prompt strong {
    font-size: 18px;
  }
  .canvas-shell {
    border-radius: 16px;
  }
  .toolbar input {
    width: 80px;
  }
  .game {
    gap: 11px;
  }
  .action-row {
    flex-direction: column;
  }
}
