
:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #64707d;
  --line: #d9e0e7;
  --paper: #f7f9fb;
  --panel: #ffffff;
  --accent: #f36f45;
  --accent-2: #177e89;
  --good: #2f9e44;
  --bad: #c92a2a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(140deg, rgba(243, 111, 69, 0.12), transparent 32%),
    linear-gradient(320deg, rgba(23, 126, 137, 0.14), transparent 38%),
    var(--paper);
}

button, input {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 8px;
  min-height: 38px;
  padding: 0 12px;
  cursor: pointer;
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

button.icon {
  width: 38px;
  padding: 0;
}

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

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(190px, 1fr);
  gap: 16px;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
}

.brand {
  font-weight: 900;
  font-size: 18px;
}

.round {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.word {
  color: var(--ink);
  font-weight: 900;
  letter-spacing: 0;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 320px;
  gap: 16px;
  padding: 16px;
  min-height: 0;
}

.panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 0;
}

.side {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.panel h2 {
  margin: 0;
  padding: 14px;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}

.players {
  overflow: auto;
  padding: 8px;
}

.player {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-radius: 7px;
}

.player.active {
  background: rgba(23, 126, 137, 0.1);
}

.player small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.score {
  font-weight: 900;
}

.stage {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
}

.tools {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.swatch {
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 50%;
}

.swatch.active {
  outline: 3px solid rgba(23, 126, 137, 0.24);
}

input[type="range"] {
  width: 110px;
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.notice {
  position: absolute;
  inset: auto 14px 14px 14px;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
  pointer-events: none;
}

.chat {
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
}

.messages {
  overflow: auto;
  padding: 12px;
}

.msg {
  margin-bottom: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.msg.system {
  color: var(--muted);
  font-size: 14px;
}

.msg.correct {
  color: var(--good);
  font-weight: 800;
}

.msg b {
  margin-right: 5px;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
}

.composer input, .join input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  background: #fff;
  color: var(--ink);
}

.join {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(247, 249, 251, 0.88);
  backdrop-filter: blur(10px);
}

.join-box {
  width: min(430px, 100%);
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.join-box h1 {
  margin: 0;
  font-size: 28px;
}

.join-box p {
  margin: 0;
  color: var(--muted);
}

.hidden {
  display: none;
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .round, .actions {
    justify-content: flex-start;
  }

  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(420px, 1fr) 360px;
  }

  .side {
    max-height: 230px;
  }
}
