:root {
  --bg: #12151c;
  --bg-2: #1a1f2b;
  --ink: #e8edf5;
  --muted: #9aa6b8;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #34d399;
  --danger: #f87171;
  --board: #fffdf8;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
  --toolbar: rgba(18, 21, 28, 0.88);
  font-family: "Segoe UI", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background:
    radial-gradient(1200px 500px at 10% -10%, #1e293b 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #134e4a 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
}

body {
  min-height: 100dvh;
}

.app {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  padding: 12px 16px;
  margin: 12px 12px 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--toolbar);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  z-index: 3;
}

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

.logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, #34d399, #22d3ee);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.12);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-copy strong {
  font-size: 14px;
  letter-spacing: 0.01em;
}

.status {
  font-size: 11px;
  color: var(--muted);
}

.status.ok {
  color: #6ee7b7;
}

.status.bad {
  color: var(--danger);
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: var(--swatch);
  cursor: pointer;
  padding: 0;
}

.swatch.active {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.custom-color {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px dashed rgba(255, 255, 255, 0.35);
  cursor: pointer;
}

.custom-color input {
  border: 0;
  padding: 0;
  width: 150%;
  height: 150%;
  transform: translate(-16%, -16%);
  cursor: pointer;
  background: none;
}

.size-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.size-control input {
  width: 110px;
  accent-color: var(--accent);
}

.size-control em {
  font-style: normal;
  min-width: 18px;
  color: var(--ink);
}

.actions button,
.presence button {
  appearance: none;
  border: 1px solid var(--line);
  background: #232836;
  color: var(--ink);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

.actions button:hover,
.presence button:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

.actions .danger {
  color: #fecaca;
}

.presence {
  margin-left: auto;
  position: relative;
}

.presence button {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
}

.dot.live {
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.16);
}

.user-list {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 210px;
  padding: 8px;
  border-radius: 12px;
  background: #1b2030;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  font-size: 13px;
}

.user-row .chip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.user-row .you {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}

.stage {
  min-height: 0;
  padding: 12px;
}

.board-wrap {
  position: relative;
  height: 100%;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent),
    var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}

#board {
  display: block;
  background:
    radial-gradient(circle at 1px 1px, rgba(17, 24, 39, 0.06) 1px, transparent 0) 0 0 / 22px 22px,
    var(--board);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.28);
  touch-action: none;
  cursor: crosshair;
  user-select: none;
}

.cursors {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.remote-cursor {
  position: absolute;
  transform: translate(-2px, -2px);
  white-space: nowrap;
  font-size: 11px;
  color: #0f172a;
}

.remote-cursor span {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}

.remote-cursor i {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: currentColor;
  border: 2px solid #fff;
}

@media (max-width: 820px) {
  .toolbar {
    gap: 10px;
    padding: 10px;
  }

  .presence {
    margin-left: 0;
  }

  .size-control input {
    width: 80px;
  }
}
