:root {
  --ink: #231f20;
  --muted: #6a6461;
  --paper: #faf8f3;
  --panel: #ffffff;
  --line: #d9d1c6;
  --burgundy: #822328;
  --gold: #d7a550;
  --blue: #375f91;
  --shadow: 0 18px 48px rgba(35, 31, 32, .18);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
}

button,
select,
textarea {
  font: inherit;
}

button,
select {
  min-height: 38px;
}

button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: .55rem .8rem;
  font-weight: 750;
  cursor: pointer;
}

button[aria-pressed="true"],
button.active {
  background: var(--burgundy);
  border-color: var(--burgundy);
  color: #fff;
}

body.inspecting .comparison-shell {
  cursor: crosshair;
}

.editor-bar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(300px, 1fr);
  align-items: center;
  gap: 1rem;
  height: 64px;
  padding: .7rem 1rem;
  background: rgba(250, 248, 243, .96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.editor-brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  min-width: 0;
  color: var(--burgundy);
  text-decoration: none;
  font-weight: 850;
}

.editor-brand img {
  width: 72px;
  height: 34px;
  object-fit: contain;
  background: #fff;
}

.segmented,
.bar-actions,
.form-row {
  display: flex;
  align-items: center;
  gap: .35rem;
}

.segmented {
  padding: .25rem;
  border: 1px solid var(--line);
  background: #fff;
}

.segmented button {
  border-color: transparent;
}

.bar-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.comparison-shell {
  position: fixed;
  inset: 64px 360px 0 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1px;
  background: var(--line);
}

.comparison-shell[data-mode="mock"] {
  grid-template-columns: 1fr;
}

.comparison-shell[data-mode="reference"] {
  grid-template-columns: 1fr;
}

.comparison-shell[data-mode="mock"] .pane-reference,
.comparison-shell[data-mode="reference"] .pane-mock {
  display: none;
}

.pane {
  position: relative;
  min-width: 0;
  background: #fff;
}

.pane-header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 42px;
  padding: 0 .8rem;
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--line);
}

.pane-header a {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

iframe {
  position: absolute;
  inset: 42px 0 0;
  width: 100%;
  height: calc(100% - 42px);
  border: 0;
  background: #fff;
}

.comment-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

.inspect-hint {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  z-index: 25;
  display: none;
  transform: translateX(-50%);
  padding: .65rem .85rem;
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(35, 31, 32, .9);
  color: #fff;
  font-size: .82rem;
  font-weight: 800;
  box-shadow: var(--shadow);
  pointer-events: none;
}

body.inspecting .inspect-hint {
  display: block;
}

.comments-hidden .comment-layer {
  display: none;
}

.marker {
  position: absolute;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .24);
  font-size: .78rem;
  font-weight: 900;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.marker[data-side="reference"] {
  background: var(--blue);
  color: #fff;
}

.marker.active {
  outline: 3px solid var(--burgundy);
  outline-offset: 2px;
}

.review-panel {
  position: fixed;
  inset: 64px 0 0 auto;
  z-index: 15;
  display: grid;
  grid-template-rows: auto minmax(150px, auto) auto minmax(0, 1fr);
  width: 360px;
  border-left: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-hidden .comparison-shell {
  inset-right: 0;
}

.panel-hidden .review-panel {
  display: none;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

.panel-head p {
  margin: 0 0 .1rem;
  color: var(--muted);
  font-size: .82rem;
}

.section-panel {
  display: grid;
  gap: .7rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

.section-panel-head {
  display: flex;
  justify-content: space-between;
  gap: .8rem;
  align-items: baseline;
}

.section-panel-head span {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 750;
  text-align: right;
}

.sections-list {
  display: grid;
  gap: .35rem;
  max-height: 230px;
  overflow: auto;
  padding-right: .15rem;
}

.section-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .45rem;
  align-items: center;
  width: 100%;
  min-height: 34px;
  padding: .48rem .55rem;
  border-radius: 0;
  text-align: left;
}

.section-button span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-button small {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 850;
}

.section-button.active small {
  color: rgba(255,255,255,.8);
}

.comment-form {
  display: grid;
  gap: .8rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

label {
  display: grid;
  gap: .35rem;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 800;
}

textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: .75rem;
}

.form-row select {
  flex: 1;
}

.comments-list {
  overflow: auto;
  padding: .75rem;
}

.empty {
  margin: .25rem;
  color: var(--muted);
  line-height: 1.45;
}

.comment-card {
  display: grid;
  gap: .55rem;
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.comment-card + .comment-card {
  margin-top: .65rem;
}

.comment-card.active {
  border-color: var(--burgundy);
  box-shadow: 0 0 0 2px rgba(130, 35, 40, .14);
}

.comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.comment-card p {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
}

.comment-actions {
  display: flex;
  gap: .4rem;
}

.comment-actions button {
  min-height: 32px;
  padding: .35rem .55rem;
}

@media (max-width: 1100px) {
  body {
    overflow: auto;
  }

  .editor-bar {
    position: sticky;
    grid-template-columns: 1fr;
    height: auto;
  }

  .segmented,
  .bar-actions {
    justify-content: flex-start;
  }

  .comparison-shell,
  .review-panel {
    position: static;
    width: auto;
  }

  .comparison-shell {
    height: 72vh;
  }

  .review-panel {
    min-height: 320px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .comparison-shell {
    grid-template-columns: 1fr;
    height: 1050px;
  }
}
