/* ── design tokens ── */
:root {
  --cream:        #FAF7F5;
  --white:        #FFFFFF;
  --rose:         #F2D7D9;
  --rose-light:   #F8ECED;
  --lilac:        #DDD0EC;
  --lilac-light:  #EDE7F6;
  --plum:         #9B6B7E;
  --deep:         #5C3D4E;
  --muted:        #A08898;
  --border:       #E0CED4;
  --border-strong:#C4A8B0;

  --cop-fill:     #A5C4D4;
  --cop-border:   #5F98B0;
  --cop-text:     #2A6070;
  --robber-fill:  #E8C87A;
  --robber-border:#C4A040;
  --robber-text:  #7A5A10;
  --barricade:    #9B6B7E;
  --valid-fill:   #F2D7D9;
  --sel-fill:     #DDD0EC;
  --sel-border:   #9B6B7E;
  --edge-col:     #DDD0D4;
  --node-col:     #FAF7F5;

  --green:        #7DAE76;
  --red:          #B86060;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  background: var(--cream);
  color: var(--deep);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── typography ── */
h1, h2, h3 { font-family: 'Cormorant Garant', serif; }
h1 { font-size: 1.4rem; font-weight: 600; color: var(--plum); line-height: 1; }
h2 { font-size: 0.95rem; font-weight: 600; color: var(--deep); }
h3 {
  font-size: 0.65rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 7px;
}

/* ── header ── */
header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-shrink: 0;
}
header p {
  font-size: 0.75rem;
  color: var(--muted);
  font-style: italic;
}

/* ── layout ── */
.app {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── sidebar ── */
.sidebar {
  width: 230px;
  min-width: 230px;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 14px;
  gap: 18px;
  flex-shrink: 0;
}

.sidebar-section { display: flex; flex-direction: column; }

/* ── form controls ── */
select, input[type="number"] {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.83rem;
  color: var(--deep);
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 9px;
  width: 100%;
  appearance: none;
  cursor: pointer;
  margin-bottom: 6px;
}
select:focus, input:focus {
  outline: 2px solid var(--lilac);
  border-color: transparent;
}
input[type="number"] { width: 56px; text-align: center; margin-bottom: 0; }

.field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.field-row label { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }

/* ── buttons ── */
.btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.83rem;
  color: var(--deep);
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: background 0.12s, border-color 0.12s;
  margin-bottom: 5px;
  display: block;
}
.btn:hover { background: var(--rose-light); border-color: var(--border-strong); }

.btn.primary {
  background: var(--plum);
  color: var(--white);
  border-color: var(--plum);
  font-weight: 500;
}
.btn.primary:hover { background: var(--deep); border-color: var(--deep); }

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
  font-size: 0.78rem;
}
.btn.ghost:hover { background: var(--rose-light); color: var(--plum); }

/* ── info boxes ── */
.mode-desc {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.55;
  background: var(--lilac-light);
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 2px;
}
.graph-desc {
  font-size: 0.72rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 3px;
  line-height: 1.4;
}

.status-box {
  background: var(--rose-light);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 11px;
  font-size: 0.8rem;
  line-height: 1.5;
}
.status-box strong { color: var(--plum); font-weight: 500; }
.status-box.win-cops  { background: #e6f2e4; border-color: #b0d4a8; }
.status-box.win-cops strong { color: #3d7a36; }
.status-box.win-robber { background: #f5e8d0; border-color: #d4b070; }
.status-box.win-robber strong { color: #8a5c10; }

/* ── legend ── */
.legend { display: flex; flex-direction: column; gap: 5px; }
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}
.legend-dot {
  width: 13px; height: 13px; border-radius: 50%;
  flex-shrink: 0; border: 1.5px solid rgba(0,0,0,0.12);
}
.legend-dash {
  width: 16px; height: 4px; border-radius: 2px;
  flex-shrink: 0; background: var(--barricade);
}

/* ── divider ── */
hr { border: none; border-top: 1px solid var(--border); }

/* ── main area ── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── canvas ── */
.canvas-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* ── instruction bar ── */
.instruction-bar {
  background: var(--white);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 7px 18px;
  font-size: 0.8rem;
  color: var(--muted);
  flex-shrink: 0;
  min-height: 34px;
}
.instruction-bar strong { color: var(--plum); font-weight: 500; }

/* ── log ── */
.log {
  height: 104px;
  overflow-y: auto;
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 7px 15px;
  flex-shrink: 0;
}
.log-entry {
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.7;
}
.log-entry.event { color: var(--deep); }
.log-entry.good  { color: var(--green); }
.log-entry.bad   { color: var(--red); }
.log-entry.info  { color: var(--muted); font-style: italic; }

/* ── skip button overlay ── */
#btn-skip-barricade {
  position: absolute;
  bottom: 12px;
  right: 16px;
  width: auto;
  padding: 7px 18px;
  display: none;
}
