/* SECOND OPINION — workshop clipboard over an ink schematic.
   Gate law: no DOM text under 12px; #coach and #keys never eat clicks. */

:root {
  --paper: #f2e9d8;
  --ink: #2b2620;
  --ink-soft: #5a5044;
  --brass: #a67c2e;
  --water: #2e6f9e;
  --amber: #c98a1b;
  --red: #b3402e;
  --green: #3d7a4a;
  --card: #faf4e6;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: #17130e;
  font-family: "Avenir Next", "Trebuchet MS", Verdana, sans-serif;
  color: var(--ink);
}

#stage {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#frame {
  position: relative;
  width: 1280px;
  height: 720px;
  max-width: 100vw;
  max-height: 100vh;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.panel {
  position: absolute;
  background: var(--card);
  border: 1px solid #c9b98f;
  border-radius: 6px;
  box-shadow: 0 3px 10px rgba(20, 12, 0, 0.25);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
}

.panel-head {
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

#complaint {
  top: 14px;
  left: 14px;
  width: 330px;
}

#case-title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
}

#customer {
  color: var(--brass);
  font-weight: 600;
  margin-top: 4px;
}

#complaint-text {
  font-style: italic;
  margin-top: 2px;
}

#first-quote {
  margin-top: 6px;
  padding: 4px 8px;
  background: #efdfc2;
  border-left: 3px solid var(--red);
  font-size: 12px;
}

#obs-lines {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-soft);
}

#obs-lines .obs-live {
  color: var(--ink);
}

#status {
  top: 14px;
  right: 14px;
  width: 300px;
  text-align: right;
}

#tokens-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
}

#token-pips {
  letter-spacing: 0.15em;
  color: var(--brass);
  font-size: 15px;
}

#probe-count,
#suspect-count {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 3px;
}

#mute {
  position: absolute;
  left: -34px;
  top: 0;
  width: 28px;
  height: 28px;
  border: 1px solid #c9b98f;
  border-radius: 6px;
  background: var(--card);
  cursor: pointer;
  font-size: 14px;
}

#mute.off {
  opacity: 0.45;
}

#notebook {
  top: 118px;
  right: 14px;
  width: 300px;
  max-height: 420px;
  overflow-y: auto;
}

#notebook-lines .nb-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
  border-bottom: 1px dashed #ddcda6;
  font-variant-numeric: tabular-nums;
}

#notebook-lines .nb-line .nb-val {
  font-weight: 700;
}

#notebook-lines .nb-line .nb-spec {
  color: var(--ink-soft);
  font-size: 12px;
}

.nb-empty {
  color: var(--ink-soft);
  font-style: italic;
  font-size: 12px;
}

#levels {
  bottom: 52px;
  left: 14px;
  display: flex;
  gap: 6px;
  padding: 6px 8px;
}

#levels button {
  width: 30px;
  height: 30px;
  border: 1px solid #c9b98f;
  border-radius: 4px;
  background: #efe3c8;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink);
}

#levels button.current {
  background: var(--brass);
  color: #fff;
}

#levels button.locked {
  opacity: 0.35;
  cursor: default;
}

#levels button .stars {
  display: block;
  font-size: 8px;
  line-height: 1;
  color: var(--brass);
}

#levels button.current .stars {
  color: #ffe9b0;
}

#tooltip {
  position: absolute;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 40;
  max-width: 260px;
}

#coach {
  position: absolute;
  bottom: 92px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 620px;
  background: rgba(43, 38, 32, 0.94);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
  pointer-events: none;
  z-index: 30;
}

#keys {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 12px;
  color: #cbbc9d;
  background: rgba(23, 19, 14, 0.72);
  padding: 5px 12px;
  border-radius: 6px;
  pointer-events: none;
  z-index: 30;
}

#popover {
  z-index: 45;
  width: 240px;
}

#popover .pop-title {
  font-weight: 700;
}

#popover .pop-sub {
  font-size: 12px;
  color: var(--ink-soft);
  margin: 2px 0 8px;
}

#popover button {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 6px 8px;
  border: 1px solid #c9b98f;
  border-radius: 4px;
  background: #efe3c8;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
}

#popover button:hover {
  background: #e6d5ae;
}

#popover button:disabled {
  opacity: 0.45;
  cursor: default;
}

.overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 560px;
  max-height: 620px;
  overflow-y: auto;
  background: var(--card);
  border: 2px solid var(--brass);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(10, 6, 0, 0.5);
  padding: 18px 22px;
  z-index: 50;
}

.overlay h2 {
  margin: 0 0 6px;
  font-size: 18px;
  letter-spacing: 0.08em;
}

#commit-hint,
#manual-note {
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

#commit-comps,
#commit-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

#commit-comps button,
#commit-modes button {
  padding: 8px 10px;
  border: 1px solid #c9b98f;
  border-radius: 5px;
  background: #efe3c8;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
}

#commit-comps button.sel,
#commit-modes button.sel {
  background: var(--brass);
  color: #fff;
}

#commit-comps button:disabled {
  opacity: 0.4;
  cursor: default;
  text-decoration: line-through;
}

#commit-modes {
  margin-top: 10px;
  grid-template-columns: 1fr;
}

#commit-modes .mode-manual {
  font-size: 12px;
  color: var(--ink-soft);
  font-style: italic;
}

#commit-buttons,
#manual-buttons,
#report-buttons {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

#commit-buttons button,
#manual-buttons button,
#report-buttons button {
  padding: 8px 16px;
  border: 1px solid var(--brass);
  border-radius: 5px;
  background: var(--brass);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

#commit-buttons #btn-cancel,
#manual-buttons button,
#report-buttons #btn-again {
  background: #efe3c8;
  color: var(--ink);
  border-color: #c9b98f;
}

#btn-call:disabled {
  opacity: 0.4;
  cursor: default;
}

#manual-body .man-type {
  margin-top: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  font-size: 13px;
}

#manual-body .man-mode {
  font-size: 13px;
  padding-left: 12px;
  margin-top: 2px;
}

#manual-body .man-mode em {
  color: var(--ink-soft);
}

#report {
  text-align: center;
  width: 460px;
}

#report-stars {
  font-size: 34px;
  color: var(--brass);
  letter-spacing: 0.2em;
  margin: 4px 0 8px;
}

#report-lines {
  text-align: left;
  font-size: 13px;
}

#report-lines .rep-verdict {
  font-weight: 700;
  margin-bottom: 8px;
}

#report-lines .rep-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed #ddcda6;
  padding: 3px 0;
}

#report-buttons {
  justify-content: center;
}

.shake {
  animation: shake 0.35s;
}

@keyframes shake {
  0%,
  100% {
    transform: translate(-50%, -50%);
  }
  25% {
    transform: translate(calc(-50% - 8px), -50%);
  }
  75% {
    transform: translate(calc(-50% + 8px), -50%);
  }
}
