/* ── Reset & Base ───────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #0f1117;
  color: #d4d4d8;
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 1100px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* ── Header ────────────────────────────────────────── */
header {
  text-align: center;
}

header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #e4e4e7;
  letter-spacing: -0.02em;
}

.subtitle {
  margin-top: 4px;
  font-size: 0.88rem;
  color: #71717a;
}

/* ── Controls ──────────────────────────────────────── */
#controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
  justify-content: center;
}

#controls label {
  display: flex;
  flex-direction: column;
  font-size: 0.78rem;
  font-weight: 600;
  color: #a1a1aa;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  gap: 4px;
}

#controls input,
#controls select {
  background: #1e1e2e;
  color: #e4e4e7;
  border: 1px solid #2e2e3e;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.9rem;
  width: 100px;
  outline: none;
  transition: border-color 0.2s;
}

#controls input:focus,
#controls select:focus {
  border-color: #6366f1;
}

#controls select {
  width: 120px;
}

#btn-reset {
  background: #6366f1;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

#btn-reset:hover {
  background: #4f46e5;
}

/* ── Legend ─────────────────────────────────────────── */
#legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  font-size: 0.8rem;
  color: #a1a1aa;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.swatch {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.swatch-sea          { background: #2563eb; }
.swatch-ground0      { background: #65a30d; }
.swatch-ground2      { background: #3f6b0a; }
.swatch-ground4      { background: #2d4a03; }
.swatch-mountain     { background: #78716c; }
.swatch-house        { background: #f59e0b; }
.swatch-superposition { background: #27272a; }

/* ── Canvas Grid ───────────────────────────────────── */
#grid-wrapper {
  border: 1px solid #2e2e3e;
  border-radius: 8px;
  overflow: hidden;
  background: #18181b;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

#grid-canvas {
  display: block;
  cursor: pointer;
}

/* ── Status Bar ────────────────────────────────────── */
#status-bar {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 800px;
  font-size: 0.82rem;
  color: #71717a;
}

#status-count {
  font-variant-numeric: tabular-nums;
}
