:root {
  --bg: #eceae4;
  --panel-bg: #f5f4f0;
  --ink: #4a4640;
  --grid-line: #b9b5ac;
  --active-border: #6b6459;
}

* { box-sizing: border-box; }

body {
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  margin: 0;
  min-height: 100vh;
}

h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  color: var(--ink);
}

.layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 3rem;
  padding: 3rem;
  flex-wrap: wrap;
}

.main-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

/* Board */
.board {
  display: grid;
  grid-template-columns: repeat(8, 3.5rem);
  grid-template-rows: repeat(8, 3.5rem);
  background: var(--grid-line);
  gap: 1px;
  border: 1px solid var(--grid-line);
  border-radius: 4px;
  overflow: hidden;
}

.cell {
  background: #9a9690;
  cursor: pointer;
  position: relative;
  padding: 0;
}

.cell[data-filled="true"] {
  background: transparent;
}

/* Shape list */
.shape-section {
  background: var(--panel-bg);
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
}

.shape-list {
  display: flex;
  gap: 1rem;
}

.shape-option {
  width: 3.5rem;
  height: 3.5rem;
  padding: 0;
  border: 3px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  background: #d8d5cd;
  overflow: hidden;
}

.shape-option[data-active="true"] {
  border-color: var(--active-border);
  box-shadow: 0 0 0 2px rgba(107, 100, 89, 0.25);
}

/* Sidebar */
.sidebar {
  background: var(--panel-bg);
  padding: 1.5rem;
  border-radius: 8px;
  min-width: 14rem;
}

.combo-list {
  list-style: none;
  margin: 0 0 1.5rem 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.combo-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 2px solid transparent;
  border-radius: 6px;
  background: #e4e1d9;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--ink);
  text-align: left;
}

.combo-option[data-active="true"] {
  border-color: var(--active-border);
  background: #ded9cc;
}

.combo-swatch {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 3px;
  flex: none;
  overflow: hidden;
  display: flex;
}
.combo-swatch span { flex: 1; height: 100%; }

.rotation-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.rotation-controls button {
  flex: 1;
  padding: 0.5rem 0.4rem;
  border: 1px solid var(--grid-line);
  border-radius: 6px;
  background: #e4e1d9;
  cursor: pointer;
  color: var(--ink);
  font-size: 0.85rem;
}

.rotation-controls button:hover {
  background: #ded9cc;
}

.rotation-display {
  font-size: 0.85rem;
  color: var(--ink);
}

/* Tile drawing, used both on board and in the shape list */
.tile-visual {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.tile-shape {
  position: absolute;
  inset: 0;
}

.tile-shape-horizontal {
  clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
}

.tile-shape-vertical {
  clip-path: polygon(0 0, 100% 0, 100% 50%, 0 50%);
}

.tile-shape-diagonal {
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

.tile-shape-circle {
  clip-path: circle(100% at 0 100%);
}
