/* Comfortable Golf — course editor chrome. Dark tool skin, light map. */
:root {
  --bar: #1d2634;
  --bar-2: #26313f;
  --panel: #222c3a;
  --panel-2: #2b3747;
  --ink: #e8eef6;
  --dim: #9aabc0;
  --line: rgba(255, 255, 255, 0.09);
  --accent: #5ec27a;
  --accent-deep: #3f9a5b;
  --danger: #e0675c;
  --bar-h: 50px;
  --panel-w: 296px;
  font-family: "Segoe UI", "Avenir Next", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #10161f;
  color: var(--ink);
  font-size: 14px;
}

#editor { position: fixed; inset: 0; }

/* ---- top bar ---- */
#bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: var(--bar-h);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: var(--bar);
  border-bottom: 1px solid #0d1219;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand em { font-style: normal; font-weight: 600; color: var(--dim); }
.brand .dot {
  width: 12px; height: 12px; border-radius: 4px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(94, 194, 122, 0.18);
}

.spacer { flex: 1; }
.group { display: flex; gap: 4px; align-items: center; }
.group + .group { padding-left: 10px; border-left: 1px solid var(--line); }

button { font: inherit; cursor: pointer; }

.tool, .view {
  border: 1px solid transparent;
  background: transparent;
  color: var(--dim);
  border-radius: 9px;
  padding: 7px 11px;
  font-weight: 700;
}
.tool:hover, .view:hover { background: var(--bar-2); color: var(--ink); }
.tool.is-active, .view.is-active {
  background: var(--accent);
  color: #10251a;
  border-color: var(--accent);
}

.ghost {
  border: 1px solid var(--line);
  background: var(--bar-2);
  color: var(--ink);
  border-radius: 9px;
  padding: 7px 11px;
  font-weight: 700;
}
.ghost:hover { border-color: rgba(255, 255, 255, 0.22); }
.ghost.danger { color: #ffc7c1; border-color: rgba(224, 103, 92, 0.5); }
.ghost.danger:hover { background: rgba(224, 103, 92, 0.16); }

.primary {
  border: 0;
  background: var(--accent);
  color: #10251a;
  border-radius: 9px;
  padding: 7px 13px;
  font-weight: 800;
}
.primary:hover { background: var(--accent-deep); color: white; }

button.sm { padding: 6px 10px; font-size: 13px; }

button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- right panel ---- */
#panel {
  position: absolute;
  top: var(--bar-h);
  right: 0;
  bottom: 26px;
  width: var(--panel-w);
  z-index: 3;
  overflow-y: auto;
  background: var(--panel);
  border-left: 1px solid #0d1219;
  display: flex;
  flex-direction: column;
}

.pane { padding: 14px 14px 16px; border-bottom: 1px solid var(--line); }
.pane[hidden] { display: none; }

.pane h2 {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--dim);
  display: flex;
  align-items: center;
  gap: 8px;
}
.count { color: #6f8299; font-weight: 700; letter-spacing: 0; }

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--dim);
  flex: 1;
}
.field .lab { text-transform: uppercase; }
.field .val {
  text-transform: none;
  letter-spacing: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  padding-top: 2px;
}

input[type="text"], input[type="number"], input[type="search"] {
  width: 100%;
  border: 1px solid var(--line);
  background: #1a2431;
  color: var(--ink);
  border-radius: 8px;
  padding: 7px 9px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
input[type="range"] { width: 100%; accent-color: var(--accent); }

.row { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.row + .row { margin-top: 8px; }
.pane .row .field { margin: 0; }

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}
.check input { accent-color: var(--accent); width: 15px; height: 15px; }

.hint { margin: 8px 0 0; font-size: 12px; line-height: 1.4; color: var(--dim); }

/* holes tabs */
.holes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.holes button {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--dim);
  border-radius: 8px;
  min-width: 34px;
  padding: 6px 9px;
  font-weight: 800;
}
.holes button.is-active { background: var(--accent); color: #10251a; border-color: var(--accent); }

/* surface swatches */
.swatches { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.swatches button {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  border-radius: 9px;
  padding: 7px 9px;
  font-weight: 700;
  font-size: 13px;
  text-align: left;
}
.swatches button:hover { border-color: rgba(255, 255, 255, 0.22); }
.swatches button.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.swatches .chip { width: 14px; height: 14px; border-radius: 4px; flex: 0 0 auto; border: 1px solid rgba(0,0,0,0.25); }
.swatches .ob-chip { background-image: repeating-linear-gradient(45deg, #e0675c 0 4px, #7a2f2a 4px 8px); }

/* anchor segments */
.segs { display: flex; gap: 6px; }
.segs button {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--dim);
  border-radius: 9px;
  padding: 8px 4px;
  font-weight: 700;
  font-size: 12px;
}
.segs button.is-active { background: var(--accent); color: #10251a; border-color: var(--accent); }

/* sprite palette */
.palette {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 2px;
}
.palette button {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  background: #182230;
  border-radius: 9px;
  padding: 3px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.palette button:hover { border-color: rgba(255, 255, 255, 0.25); }
.palette button.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.palette img { max-width: 100%; max-height: 100%; image-rendering: auto; }
.palette span {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  font-size: 8px;
  line-height: 1.1;
  padding: 2px 1px;
  text-align: center;
  color: var(--dim);
  background: rgba(0, 0, 0, 0.55);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* layer list */
.list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.list li {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 9px;
  padding: 6px 8px;
  font-size: 12.5px;
}
.list li.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.list li.is-hidden { opacity: 0.45; }
.list .chip { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto; border: 1px solid rgba(0,0,0,0.3); }
.list .ob-chip { background-image: repeating-linear-gradient(45deg, #e0675c 0 3px, #7a2f2a 3px 6px); }
.list .label { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .meta { color: var(--dim); font-variant-numeric: tabular-nums; }
.list button.icon {
  border: 0;
  background: transparent;
  color: var(--dim);
  padding: 3px 5px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}
.list button.icon:hover { background: rgba(255, 255, 255, 0.08); color: var(--ink); }
.list button.icon.on { color: var(--accent); }

/* ---- canvas ---- */
#board {
  position: absolute;
  top: var(--bar-h);
  left: 0;
  right: var(--panel-w);
  bottom: 26px;
  width: auto;
  height: auto;
  display: block;
  cursor: crosshair;
  touch-action: none;
}
body.panning #board { cursor: grabbing; }

/* ---- status bar + toast ---- */
#statusbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 26px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 14px;
  background: var(--bar);
  border-top: 1px solid #0d1219;
  font-size: 12px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
#statusbar .note { margin-left: auto; color: var(--accent); font-weight: 700; }
#statusbar .keys { color: var(--dim); opacity: 0.7; }

#toast {
  position: absolute;
  left: 50%;
  bottom: 46px;
  transform: translateX(-50%);
  z-index: 6;
  background: #10251a;
  color: #d7f5e1;
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
#toast[hidden] { display: none; }

@media (max-width: 1120px) {
  :root { --panel-w: 250px; }
  .brand em { display: none; }
}
