:root {
  color-scheme: light;
  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: #272a2e; }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(255,255,255,0.32), transparent 28%), radial-gradient(circle at right center, rgba(255,240,202,0.14), transparent 20%);
  pointer-events: none;
}
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 24px;
  padding: 24px;
  align-items: stretch;
}
.panel {
  border: 1px solid rgba(44,50,56,0.12);
  border-radius: 28px;
  background: rgba(255,251,245,0.72);
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 80px rgba(33,45,61,0.18);
}
.panel-left {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 30px;
  gap: 22px;
}
.panel-stage {
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.eyebrow {
  margin: 0 0 12px;
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: #6f7884;
}
h1 { margin: 0; font-size: clamp(3rem, 6vw, 4.9rem); line-height: 0.94; }
.lede { margin: 18px 0 0; max-width: 32ch; color: #4f5560; font-size: 1.03rem; line-height: 1.62; }
.controls { display: flex; flex-wrap: wrap; gap: 12px; }
.action-button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease, color 160ms ease;
}
.action-button:hover:enabled { transform: translateY(-1px); }
.action-button:disabled { cursor: not-allowed; opacity: 0.52; }
.primary { background: #2d343c; color: #fffaf1; box-shadow: 0 12px 30px rgba(20,20,20,0.18); }
.secondary { background: rgba(255,252,247,0.74); color: #2f353e; border: 1px solid rgba(47,53,62,0.12); }
.meta-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.count-card {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-radius: 22px;
  background: rgba(255,255,255,0.58);
  border: 1px solid rgba(44,50,56,0.08);
}
.count-label { font-size: 0.92rem; color: #59606b; }
.count-value { font-size: 2.1rem; line-height: 1; }
.selection-label { color: #4f5560; min-height: 1.5em; font-weight: 600; }
.status-stack {
  padding: 18px 20px;
  border-radius: 22px;
  background: rgba(37,42,48,0.08);
  border: 1px solid rgba(44,50,56,0.08);
}
.connection-pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.status-connecting, .status-reconnecting { background: rgba(255,210,119,0.2); color: #845d14; }
.status-connected { background: rgba(88,190,124,0.22); color: #1e6b3a; }
.status-disconnected { background: rgba(226,99,99,0.18); color: #8c2a2a; }
.status-text, .error-text { margin: 12px 0 0; line-height: 1.5; }
.status-text { color: #505762; }
.error-text { min-height: 1.4em; color: #a93737; }
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: #59606b;
  font-size: 0.93rem;
}
.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: -1px;
}
.dot-player { background: #ffb34d; }
.dot-palm { background: #67bf84; }
.dot-place { background: #ffffff; border: 1px solid rgba(47,53,62,0.18); }
#island-canvas {
  width: 100%;
  max-width: 1200px;
  aspect-ratio: 3 / 2;
  display: block;
  border-radius: 22px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
}
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .panel-stage { order: -1; }
}
@media (max-width: 640px) {
  .app-shell { padding: 14px; gap: 14px; }
  .panel-left { padding: 22px; }
  .count-card { align-items: start; flex-direction: column; }
}
