:root {
  --bg: #f2eadf;
  --panel: rgba(255, 250, 242, 0.92);
  --ink: #182319;
  --accent: #8a4b08;
  --line: rgba(24, 35, 25, 0.15);
  --shadow: 0 20px 60px rgba(74, 46, 12, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(216, 167, 94, 0.25), transparent 28%),
    radial-gradient(circle at right 20%, rgba(35, 82, 58, 0.14), transparent 24%),
    linear-gradient(180deg, #f8f2e8 0%, #efe4d3 100%);
}

.app-shell {
  width: min(1200px, calc(100vw - 32px));
  margin: 24px auto 48px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.hero {
  margin-bottom: 16px;
}

.eyebrow {
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.75rem;
  margin: 0 0 8px;
}

.hero h1,
.panel h2 {
  margin: 0 0 10px;
}

.controls {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.controls label {
  display: grid;
  gap: 6px;
}

.controls input {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
}

.setup-form {
  display: grid;
  gap: 14px;
}

.setup-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.setup-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.setup-card h3 {
  margin: 0;
  font-size: 1rem;
}

.toggle-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
}

.toggle-row input {
  margin: 0;
}

.setup-preview {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.72);
}

.setup-preview summary {
  cursor: pointer;
  font-weight: 600;
}

.setup-preview pre {
  margin: 12px 0 0;
  padding: 12px;
  border-radius: 14px;
  background: #f8f1e5;
  overflow: auto;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #bc6e18);
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.55;
}

.status {
  margin-bottom: 16px;
}

#log {
  min-height: 84px;
  margin: 16px 0 0;
  padding: 12px;
  border-radius: 14px;
  background: #f8f1e5;
  overflow: auto;
}

.layout {
  display: grid;
  gap: 16px;
  grid-template-columns: 320px 1fr;
}

.players {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.players li {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  line-height: 1.35;
}

.board {
  position: relative;
  min-height: 600px;
  border-radius: 18px;
  overflow: auto;
  background: linear-gradient(180deg, #faf6ef, #efe7da);
  cursor: grab;
}

.board-canvas {
  position: relative;
  width: 1400px;
  height: 1100px;
}

.board-content {
  position: relative;
  width: 1400px;
  height: 1100px;
  transform-origin: top left;
  background:
    linear-gradient(rgba(24, 35, 25, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 35, 25, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, #faf6ef, #efe7da);
  background-size: 96px 96px, 96px 96px, auto;
}

.board.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.tile {
  position: absolute;
  width: 96px;
  height: 96px;
  border-radius: 14px;
  border: 1px solid rgba(24, 35, 25, 0.12);
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.95), rgba(237, 227, 209, 0.92));
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(48, 39, 18, 0.12);
}

.tile-preview {
  opacity: 0.88;
  z-index: 9;
  border: 2px solid rgba(35, 82, 58, 0.45);
  box-shadow: 0 12px 24px rgba(48, 39, 18, 0.18);
}

.tile-art-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.board-meeple {
  position: absolute;
  width: 28px;
  height: 28px;
  z-index: 7;
  color: #c0392b;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.28));
}

.board-meeple.rotated {
  transform: rotate(90deg);
}

.board-meeple-svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.board-meeple-svg use {
  fill: currentColor;
}

.player-color-0 {
  color: #c0392b;
}

.player-color-1 {
  color: #2c7a7b;
}

.player-color-2 {
  color: #8e44ad;
}

.player-color-3 {
  color: #d4a017;
}

.player-color-4 {
  color: #2f855a;
}

.player-color-5 {
  color: #4a5568;
}

.board-target {
  position: absolute;
  width: 96px;
  height: 96px;
  border: 2px dashed rgba(138, 75, 8, 0.55);
  border-radius: 14px;
  background: rgba(188, 110, 24, 0.12);
  color: var(--accent);
  font-weight: 700;
  z-index: 8;
}

.rotation-picker {
  position: absolute;
  display: flex;
  gap: 6px;
  transform: translateY(102px);
  z-index: 9;
}

.rotation-picker button {
  padding: 8px 12px;
  font-size: 0.85rem;
}

.rotate-cycle-button {
  min-width: 44px;
  padding: 8px 0;
  font-size: 1.1rem;
  line-height: 1;
}

.place-tile-button {
  min-width: 64px;
}

.meeple-spot {
  position: absolute;
  width: 26px;
  height: 26px;
  min-width: 26px;
  padding: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.82);
  background: linear-gradient(135deg, #23523a, #4f8c61);
  z-index: 12;
  box-shadow: 0 5px 12px rgba(24, 35, 25, 0.34);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}

.meeple-spot-field {
  background: linear-gradient(135deg, #23523a, #4f8c61);
}

.meeple-spot-road {
  background: linear-gradient(135deg, #7d4d20, #b87938);
}

.meeple-spot-city {
  background: linear-gradient(135deg, #6b2e1e, #b84f2c);
}

.meeple-spot-river {
  background: linear-gradient(135deg, #2a6f97, #4ea8de);
}

.actions-panel {
  margin-top: 16px;
}

.action-summary {
  margin-bottom: 12px;
  color: var(--accent);
  font-weight: 600;
}

.actions {
  display: grid;
  gap: 12px;
}

.action-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.68);
}

.action-card h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.action-card p {
  margin: 0 0 10px;
}

.option-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-list button {
  padding: 10px 14px;
}

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

  .layout {
    grid-template-columns: 1fr;
  }

  .board {
    min-height: 420px;
  }
}
