:root {
  color-scheme: light;
  --paper: #f3f5f2;
  --surface: #ffffff;
  --ink: #17201d;
  --muted: #68736e;
  --line: #d8ded9;
  --line-strong: #aab5ae;
  --green: #0b6b50;
  --green-soft: #d7eee5;
  --red: #c43131;
  --red-soft: #ffdddd;
  --amber: #a06000;
  --blue: #2a6fbb;
  --violet: #7353b6;
  --teal: #16877c;
  --gold: #b17814;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); color: var(--ink); }
button { font: inherit; }
.topbar { height: 64px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.88); backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 750; letter-spacing: -.03em; }
.brand-mark { display: grid; place-items: center; width: 31px; height: 31px; border: 1px solid var(--ink); border-radius: 8px; font-size: 10px; letter-spacing: -.04em; }
.thesis { margin: 0; color: var(--muted); font-size: 14px; }
.webmcp-status { justify-self: end; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.status-dot--ok { background: #1aa370; box-shadow: 0 0 0 4px #d7f5e8; }
.status-dot--waiting { background: var(--amber); }
.status-dot--off { background: var(--line-strong); }
.explanation { min-height: 52px; display: flex; align-items: center; gap: 8px; padding: 10px 28px; border-bottom: 1px solid var(--line); background: #fbfcfa; font-size: 14px; }
.legend { margin-left: auto; display: flex; gap: 16px; color: var(--muted); font-size: 12px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend-swatch { width: 11px; height: 11px; border-radius: 3px; background: #cae2f7; border: 1px solid #76a8d4; }
.legend-swatch--blocked { background: repeating-linear-gradient(135deg,#fff 0 3px,#aab5ae 3px 5px); }
.legend-swatch--invalid { background: var(--red-soft); border-color: var(--red); }
.legend-symbol { color: var(--green); font-style: normal; }
.workspace { display: grid; grid-template-columns: 248px minmax(610px, 1fr) 270px; gap: 16px; padding: 16px; max-width: 1500px; margin: 0 auto; }
.panel, .plate-section { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.panel { padding: 20px; }
.eyebrow { margin: 0 0 7px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
h1, h2 { margin: 0; letter-spacing: -.035em; }
h1 { font-size: 24px; line-height: 1.08; }
h2 { font-size: 18px; }
.panel-copy { margin: 12px 0 18px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.metrics { margin: 0; border-top: 1px solid var(--line); }
.metrics div { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); }
.metrics dt { color: var(--muted); font-size: 13px; }
.metrics dd { margin: 0; font-size: 13px; font-weight: 700; }
.human-controls { margin-top: 22px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.segmented button { min-height: 34px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(22,32,29,.12); font-weight: 700; }
.mode-help { min-height: 36px; margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.button-stack { display: grid; gap: 8px; margin-top: 18px; }
.button { min-height: 40px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--ink); cursor: pointer; font-size: 13px; font-weight: 650; }
.button:hover:not(:disabled) { border-color: var(--ink); }
.button:disabled { cursor: not-allowed; opacity: .4; }
.button--primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.button--quiet { border-color: transparent; color: var(--muted); }
.plate-section { padding: 18px; min-width: 0; }
.plate-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.validation { min-width: 94px; display: flex; align-items: baseline; justify-content: center; gap: 5px; padding: 7px 10px; border: 1px solid; border-radius: 9px; font-size: 12px; font-weight: 700; }
.validation-count { font-size: 20px; line-height: 1; }
.validation--waiting { color: var(--muted); border-color: var(--line-strong); background: var(--paper); }
.validation--valid { color: var(--green); border-color: #a9d7c5; background: #eef9f4; }
.validation--invalid { color: var(--red); border-color: #efb2b2; background: #fff2f2; }
.plate-shell { position: relative; padding: 14px; border: 1px solid #bdc7c0; border-radius: 25px; background: linear-gradient(145deg,#eef1ed,#fff 42%,#e9eeea); box-shadow: inset 0 1px 0 #fff, inset 0 -2px 6px rgba(42,58,50,.08); }
.plate-grid { display: grid; grid-template-columns: 24px repeat(12, minmax(36px, 1fr)); gap: 5px; align-items: center; }
.axis-label { display: grid; place-items: center; color: #79847e; font-size: 11px; font-weight: 750; }
.well { position: relative; aspect-ratio: 1; min-width: 0; display: grid; place-items: center; padding: 0; overflow: hidden; border: 1px solid #b8c1bc; border-radius: 50%; background: #fafcf9; color: #5e6963; cursor: pointer; transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.well:hover { z-index: 3; transform: scale(1.1); border-color: var(--ink); }
.well:focus-visible { outline: 3px solid rgba(42,111,187,.35); outline-offset: 2px; z-index: 4; }
.well-id { position: absolute; top: 11%; font-size: clamp(6px,.55vw,9px); opacity: .65; }
.well-code { padding-top: 7px; font-size: clamp(8px,.8vw,12px); font-weight: 800; }
.well--control { background: #d7eee5; border-color: #63a98d; color: #07543e; }
.well--group-1 { background: #dcebf8; border-color: #75a6cf; color: #174f82; }
.well--group-2 { background: #e7dff7; border-color: #9b83ca; color: #55378e; }
.well--group-3 { background: #d8f0ed; border-color: #63afa7; color: #0b655e; }
.well--group-4 { background: #f5e8ca; border-color: #c8a45c; color: #74500c; }
.well--locked { box-shadow: inset 0 0 0 3px var(--ink); }
.well-lock { position: absolute; right: 7%; bottom: 5%; font-size: 10px; font-weight: 900; }
.well--blocked { background: repeating-linear-gradient(135deg,#f8faf8 0 4px,#9da8a2 4px 6px); color: #59635e; border-style: dashed; }
.well-block { font-size: clamp(16px,1.6vw,25px); line-height: 1; }
.well--invalid { border: 3px solid var(--red); box-shadow: 0 0 0 3px rgba(196,49,49,.16); background: var(--red-soft); animation: pulse-invalid 1.4s ease-in-out infinite; }
.well--moved { animation: arrive .7s ease-out both; }
@keyframes pulse-invalid { 50% { box-shadow: 0 0 0 6px rgba(196,49,49,.06); } }
@keyframes arrive { 0% { transform: scale(.65); filter: saturate(2); } 70% { transform: scale(1.08); } 100% { transform: scale(1); } }
.empty-state { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; background: rgba(248,250,247,.8); border-radius: inherit; backdrop-filter: blur(2px); }
.empty-state strong { font-size: 17px; }
.empty-state span { margin-top: 5px; color: var(--muted); font-size: 13px; }
.activity-heading { display: flex; justify-content: space-between; align-items: start; }
.revision { padding: 5px 7px; border-radius: 6px; background: var(--paper); color: var(--muted); font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; }
.receipt { display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 9px; min-height: 70px; margin-top: 16px; padding: 12px; border: 1px dashed var(--line-strong); border-radius: 10px; color: var(--muted); }
.receipt--active { border-style: solid; color: var(--ink); background: #f8faf8; }
.receipt-icon { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-weight: 900; }
.receipt p { margin: 0; font-size: 13px; line-height: 1.4; }
.constraint-list { margin-top: 16px; border-top: 1px solid var(--line); }
.constraint-list div { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.constraint-list span { color: var(--muted); }
.violations-list { margin-top: 19px; }
.all-clear { display: flex; gap: 8px; align-items: center; color: var(--green); font-size: 13px; font-weight: 650; }
.violation-row { display: grid; grid-template-columns: 30px 1fr; gap: 6px; margin: 7px 0; color: #7d2828; font-size: 12px; line-height: 1.35; }
.violation-row span { font-weight: 800; }
.agent-prompt { margin-top: 20px; padding: 13px; border-left: 3px solid var(--blue); background: #f2f7fb; border-radius: 0 9px 9px 0; }
.agent-prompt p:last-child { margin: 0; color: #31546e; font-size: 12px; line-height: 1.5; }
@media (max-width: 1100px) {
  .workspace { grid-template-columns: 220px minmax(580px, 1fr); }
  .activity-panel { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
  .activity-panel .agent-prompt { margin-top: 0; }
  .legend { gap: 9px; }
}
@media (max-width: 850px) {
  .topbar { grid-template-columns: 1fr auto; }
  .thesis { display: none; }
  .explanation { align-items: flex-start; flex-wrap: wrap; }
  .legend { width: 100%; margin-left: 0; overflow-x: auto; }
  .workspace { display: block; padding: 10px; }
  .panel, .plate-section { margin-bottom: 10px; }
  .plate-section { overflow-x: auto; }
  .plate-shell { min-width: 650px; }
  .activity-panel { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
