:root {
  color-scheme: light;
  --paper: #f8f5ee;
  --ink: #1f231d;
  --muted: #62685c;
  --line: #d8d1c3;
  --accent: #2f7d3a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #e8e1d4;
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  min-height: 100vh;
}

.viewer {
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
}

.calibration-stage {
  padding: 96px;
}

.art-shell {
  position: relative;
  width: min(72vh, calc(100vw - 432px));
  aspect-ratio: 2159 / 2940;
  overflow: visible;
  background: var(--paper);
  box-shadow: 0 16px 50px rgb(48 36 24 / 24%);
}

.painting {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.hotspots {
  position: absolute;
  inset: 0;
  overflow: visible;
}

.hotspots svg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform-origin: 0 0;
}

.hotspots path {
  cursor: crosshair;
  pointer-events: stroke;
  stroke-width: 9;
  stroke-opacity: 0.01;
  transition: stroke-opacity 140ms ease, filter 140ms ease;
}

.hotspots path.active-outline {
  stroke-opacity: 1;
  filter: none;
}

.hotspots.map-visible path {
  stroke-opacity: 0.32;
}

.hotspots.calibrating path {
  pointer-events: none;
  stroke-opacity: 0.44;
}

.hotspots path.is-active {
  stroke-opacity: 0.01;
  filter: none;
}

.tooltip {
  position: absolute;
  z-index: 5;
  max-width: min(280px, 78vw);
  padding: 10px 12px;
  border: 1px solid rgb(31 35 29 / 12%);
  border-radius: 8px;
  background: rgb(255 252 244 / 96%);
  box-shadow: 0 10px 24px rgb(38 29 20 / 22%);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  transform: translate(12px, 12px);
  opacity: 0;
  pointer-events: none;
}

.tooltip.is-visible {
  opacity: 1;
}

.calibration-pins {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 4;
}

.calibration-pins.is-visible {
  display: block;
}

.pin {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #1f231d;
  box-shadow: 0 2px 10px rgb(0 0 0 / 35%);
  cursor: grab;
  transform: translate(-50%, -50%);
  touch-action: none;
}

.pin:active {
  cursor: grabbing;
}

.pin::after {
  content: attr(data-label);
  position: absolute;
  left: 18px;
  top: -1px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgb(31 35 29 / 88%);
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
}

.tooltip strong {
  display: block;
  margin-bottom: 3px;
}

.tooltip a,
.selected-text a {
  color: #235f2d;
  font-weight: 700;
}

.selected-text a {
  display: block;
  margin-top: 8px;
}

.inspector {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 100vh;
  padding: 28px 24px;
  border-left: 1px solid var(--line);
  background: #fbf8f1;
}

.kicker {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1 {
  margin: -10px 0 0;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0;
}

.intro {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.selected {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.swatch {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border-radius: 50%;
  border: 1px solid rgb(0 0 0 / 18%);
  background: #bbb;
}

.selected-title,
.selected-text {
  margin: 0;
}

.selected-title {
  font-weight: 700;
}

.selected-text {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.controls {
  display: flex;
  gap: 8px;
}

button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

button[aria-pressed="true"] {
  border-color: #3d8b3d;
  background: #e6f1e4;
}

.stroke-list {
  display: grid;
  gap: 6px;
  min-height: 0;
  margin: 0;
  padding: 0 4px 0 0;
  overflow: auto;
  list-style: none;
}

.stroke-list button {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  align-items: center;
  width: 100%;
  min-height: 38px;
  text-align: left;
  gap: 9px;
  border-radius: 7px;
}

.stroke-list button.is-active {
  border-color: #8daa87;
  background: #edf4ea;
}

.mini-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgb(0 0 0 / 12%);
}

.day-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kind-label {
  color: var(--muted);
  font-size: 12px;
}

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

  .viewer {
    padding: 14px;
  }

  .calibration-stage {
    padding: 72px;
  }

  .art-shell {
    width: min(100%, 72vh);
  }

  .inspector {
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}
