:root {
  --ink: #f2eefb;
  --muted: #a99bcf;
  --paper: #07050e;
  --card: #150f24;
  --line: #372c54;
  --forest: #4a3a94;
  --forest-2: #b98cff;
  --lime: #d9c8ff;
  --sage: #1c1530;
  --amber: #e0b64a;
  --red: #ff5d72;
  --shadow: 0 16px 46px rgba(0, 0, 0, .5);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}
button, input, select { font: inherit; }
button { color: inherit; }
a { color: inherit; }
.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
header { padding: 25px 0 18px; border-bottom: 1px solid rgba(255,255,255,.15); }
.hero { color: white; background: linear-gradient(165deg, var(--forest), var(--paper)); position: relative; overflow: hidden; }
.hero::after {
  content: ""; position: absolute; width: 520px; height: 520px; right: -145px; top: -210px;
  border: 1px solid rgba(217,200,255,.2); border-radius: 50%; box-shadow: 0 0 0 70px rgba(217,200,255,.05), 0 0 0 140px rgba(217,200,255,.03);
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 750; letter-spacing: -.02em; }
.brand a { text-decoration: none; display: flex; align-items: center; gap: 11px; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; color: var(--forest); background: var(--lime); border-radius: 9px 9px 9px 2px; font-size: 13px; }
.as-of { margin-left: auto; color: rgba(255,255,255,.62); font-size: 12px; }
.header-row { display: flex; align-items: center; gap: 16px; }
.header-row .back-link { color: rgba(255,255,255,.75); font-size: 12px; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.3); }
.header-row .back-link:hover { color: white; border-color: var(--lime); }
.hero-copy { position: relative; z-index: 1; padding: 62px 0 66px; max-width: 860px; }
.eyebrow { color: var(--lime); text-transform: uppercase; letter-spacing: .14em; font-size: 11px; font-weight: 800; }
h1 { margin: 15px 0 20px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(38px, 6.4vw, 68px); line-height: 1; font-weight: 500; letter-spacing: -.045em; }
.hero-copy > p.lead { max-width: 700px; margin: 0; color: rgba(255,255,255,.72); font-size: 17px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.hero-stat { min-width: 150px; padding: 12px 16px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; backdrop-filter: blur(4px); }
.hero-stat strong { display: block; color: var(--lime); font-size: 22px; }
.hero-stat span { color: rgba(255,255,255,.65); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.tabs-wrap { position: sticky; top: 0; z-index: 10; background: rgba(7,5,14,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.tabs { display: flex; gap: 4px; padding: 10px 0; overflow-x: auto; }
.tab { border: 0; background: transparent; padding: 10px 17px; border-radius: 9px; font-size: 13px; font-weight: 720; white-space: nowrap; cursor: pointer; color: var(--muted); }
.tab.active { color: white; background: var(--forest); }
main { padding: 42px 0 72px; }
.panel { display: none; }
.panel.active { display: block; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 22px; }
h2 { margin: 5px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(28px, 3.8vw, 42px); font-weight: 500; letter-spacing: -.035em; line-height: 1.1; }
.section-head p { margin: 0; max-width: 480px; color: var(--muted); font-size: 13px; }
.notice { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 24px; padding: 14px 16px; color: #cbbdf0; background: var(--sage); border: 1px solid var(--line); border-radius: 12px; font-size: 12px; }
.notice strong { color: var(--ink); }

/* Comparison table */
.toolbar { display: flex; gap: 10px; margin-bottom: 18px; }
.search, .select { min-height: 42px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; outline: none; }
.search { flex: 1; padding: 0 14px; }
.select { padding: 0 34px 0 12px; }
.search:focus, .select:focus { border-color: var(--forest-2); box-shadow: 0 0 0 3px rgba(185,140,255,.18); }
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow-x: auto; box-shadow: var(--shadow); margin-bottom: 30px; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th { position: relative; padding: 0; color: var(--muted); background: #1c1530; border-bottom: 1px solid var(--line); text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.th-sort { display: flex; align-items: center; gap: 6px; width: 100%; padding: 13px 16px 13px 15px; border: 0; background: transparent; color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit; text-align: left; cursor: pointer; }
.th-sort:hover { color: var(--forest-2); }
.th-sort:focus-visible { outline: 2px solid var(--forest-2); outline-offset: -2px; }
.sort-arrow { opacity: .4; font-size: 10px; }
.sort-arrow.active { opacity: 1; color: var(--forest-2); }
.col-resizer { position: absolute; top: 0; right: -4px; width: 8px; height: 100%; cursor: col-resize; z-index: 2; touch-action: none; }
.col-resizer:hover, .col-resizer.dragging { background: rgba(185,140,255,.25); }
body.col-resizing { cursor: col-resize; user-select: none; }
td { padding: 15px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 12px; overflow-wrap: break-word; }
.table-hint { margin: 0 0 10px; color: var(--muted); font-size: 11px; }
.reset-table { margin: 12px 0 0; padding: 8px 14px; color: var(--forest-2); background: var(--card); border: 1px solid var(--line); border-radius: 8px; font-size: 11.5px; font-weight: 700; cursor: pointer; }
.reset-table:hover { border-color: var(--forest-2); background: var(--sage); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--sage); }
.co-cell { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.co-cell a { text-decoration: none; color: var(--forest-2); }
.co-cell a:hover { color: var(--lime); text-decoration: underline; }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; flex: none; color: var(--forest); background: var(--lime); border-radius: 9px 9px 9px 2px; font-size: 12px; font-weight: 800; }
.avatar-sm { width: 17px; height: 17px; font-size: 8px; border-radius: 5px 5px 5px 2px; }
.avatar-lg { width: 42px; height: 42px; font-size: 15px; }

/* Tags */
.tag { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.tag.active { color: var(--forest); background: var(--lime); }
.tag.discontinued { color: #ff9fae; background: rgba(255,93,114,.16); }
.tag.pivoted { color: #7fe0ab; background: rgba(79,214,143,.14); }
.tag.conf-high { color: #7fe0ab; background: rgba(79,214,143,.14); }
.tag.conf-medium { color: #f0c96b; background: rgba(224,182,74,.16); }
.tag.conf-low { color: #ff9fae; background: rgba(255,93,114,.16); }
.tag.sub-yes { color: #f0c96b; background: rgba(224,182,74,.16); }
.tag.sub-optional { color: #f0c96b; background: rgba(224,182,74,.16); }
.tag.sub-no { color: #7fe0ab; background: rgba(79,214,143,.14); }
.tag.sub-na { color: var(--muted); background: rgba(169,155,207,.12); }
.tag.sub-unclear { color: var(--muted); background: rgba(169,155,207,.12); font-style: italic; }

/* Landscape stats + charts */
.landscape { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 25px; }
.land-stat { padding: 17px; background: var(--card); border: 1px solid var(--line); border-radius: 13px; }
.land-stat span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.land-stat strong { display: block; margin-top: 4px; font-family: Georgia, serif; font-size: 26px; font-weight: 500; }
.chart-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 30px; align-items: start; }
.chart-card { padding: 22px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.chart-card.wide { grid-column: 1 / -1; }
.chart-card h3 { margin: 0 0 3px; font-size: 15px; }
.log-badge { display: inline-block; margin-left: 6px; padding: 2px 7px; color: var(--forest-2); background: var(--sage); border-radius: 999px; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; vertical-align: middle; }
.chart-card .chart-sub { margin: 0 0 16px; color: var(--muted); font-size: 11px; }

/* Shared SVG chrome (histogram + pie) */
.chart-svg { display: block; width: 100%; height: auto; }
.chart-svg .axis-label { fill: var(--muted); font-size: 9px; font-family: Inter, sans-serif; }
.chart-svg .grid-line { stroke: var(--line); stroke-width: 1; }
.chart-svg .axis-baseline { stroke: #4a3d68; stroke-width: 1; }
.chart-svg .bar-count-label { fill: var(--ink); font-size: 10px; font-weight: 700; font-family: Inter, sans-serif; }
.hist-bar-muted { fill: #3a2f5c; }

/* Ranked bar chart (real axis: shared gridlines drawn into each track + one tick row) */
.rbar-chart { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 76px; align-items: center; gap: 10px; }
.bar-row .bar-label { font-size: 12px; font-weight: 700; }
.bar-label-link { display: flex; align-items: flex-start; gap: 6px; text-decoration: none; color: inherit; }
.bar-label-link:hover { color: var(--forest-2); text-decoration: underline; }
.bar-label-link .avatar-sm { margin-top: 1px; }
.bar-track { position: relative; height: 12px; background: #241c3d; border-radius: 3px; overflow: hidden; background-repeat: no-repeat; background-size: 100% 100%; }
.bar-fill { display: block; height: 100%; border-radius: 2px; background: var(--forest-2); }
.bar-fill.zero { width: 3px !important; background: var(--muted); }
.bar-value { font-size: 11px; color: var(--muted); font-weight: 700; text-align: right; }
.axis-row { margin-top: 2px; }
.axis-ticks { position: relative; height: 14px; }
.axis-tick { position: absolute; top: 0; color: var(--muted); font-size: 10px; font-weight: 600; white-space: nowrap; }

/* Pie / donut */
.pie-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.pie-svg-holder { width: 150px; flex: none; }
.pie-svg-holder svg { width: 100%; height: auto; }
.pie-center-value { font-family: Georgia, serif; font-size: 26px; font-weight: 500; fill: var(--ink); }
.pie-center-label { font-size: 9px; fill: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.pie-legend { display: grid; gap: 8px; flex: 1; min-width: 160px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.legend-swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.legend-label { flex: 1; font-weight: 700; }
.legend-value { color: var(--muted); font-size: 11px; font-weight: 600; white-space: nowrap; }

/* Heatmap */
.heatmap-grid { display: grid; gap: 3px; }
.hm-corner { background: transparent; }
.hm-col-label { padding: 6px 4px; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; text-align: center; align-self: end; }
.hm-row-label { padding: 8px 10px 8px 0; color: var(--ink); font-size: 11.5px; font-weight: 700; display: flex; align-items: center; }
.hm-cell { display: flex; align-items: center; justify-content: center; min-height: 40px; border-radius: 6px; font-size: 13px; font-weight: 800; background: #201933; }

/* Clickable bin affordance (histogram bars, heatmap cells, pie slices/legend rows) */
.bin-clickable { cursor: pointer; }
.hist-bar.bin-clickable:hover { opacity: .82; }
.hm-cell.bin-clickable:hover { outline: 2px solid var(--forest-2); outline-offset: -2px; }
.pie-svg circle.bin-clickable:hover { opacity: .8; }
.legend-row.bin-clickable { padding: 3px 4px; margin: -3px -4px; border-radius: 7px; }
.legend-row.bin-clickable:hover { background: var(--sage); }

/* Bin-detail modal */
.bin-modal-overlay { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; background: rgba(4,3,9,.65); padding: 24px; }
.bin-modal-overlay.open { display: flex; }
.bin-modal { position: relative; width: min(560px, 100%); max-height: 82vh; overflow-y: auto; background: var(--card); border-radius: 18px; padding: 28px 26px; box-shadow: 0 30px 70px rgba(0,0,0,.5); }
.bin-modal-close { position: absolute; top: 16px; right: 16px; width: 30px; height: 30px; border: 1px solid var(--line); background: var(--paper); border-radius: 50%; font-size: 15px; color: var(--muted); cursor: pointer; line-height: 1; }
.bin-modal-close:hover { color: var(--forest-2); border-color: var(--forest-2); }
.bin-modal h3 { margin: 4px 0 6px; font-family: Georgia, serif; font-size: 22px; font-weight: 500; padding-right: 30px; }
.bin-modal-sub { margin: 0 0 18px; color: var(--muted); font-size: 12.5px; }
.bin-modal-list { display: grid; gap: 10px; }
.bin-modal-empty { margin: 0; color: var(--muted); font-size: 12.5px; padding: 10px 0; }
.bmc-row { display: flex; align-items: center; gap: 12px; padding: 11px 13px; background: var(--sage); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: inherit; transition: border-color .12s, transform .12s; }
.bmc-row:hover { border-color: var(--forest-2); transform: translateX(2px); }
.bmc-row .avatar { width: 30px; height: 30px; font-size: 12px; flex: none; }
.bmc-body { flex: 1; min-width: 0; }
.bmc-name { display: block; font-size: 13px; font-weight: 800; }
.bmc-meta { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }
.bmc-arrow { color: var(--forest-2); font-weight: 800; flex: none; }
body.modal-open { overflow: hidden; }
.bar-note { grid-column: 1 / -1; margin: -4px 0 0; color: var(--muted); font-size: 10px; }
.chart-foot { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10.5px; }
.chart-foot a { color: var(--forest-2); font-weight: 700; text-decoration: none; }
.chart-foot a:hover { text-decoration: underline; }

/* Company cards grid (overview "Companies" tab) */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.co-card { display: flex; flex-direction: column; gap: 12px; padding: 22px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 4px 18px rgba(0,0,0,.25); text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s; }
.co-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.co-card-top { display: flex; align-items: flex-start; gap: 12px; }
.co-card-top .avatar { width: 38px; height: 38px; font-size: 14px; }
.co-card h3 { margin: 0 0 3px; font-size: 17px; }
.co-card .co-product { margin: 0; color: var(--forest-2); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.co-card .kicker { display: flex; flex-wrap: wrap; gap: 6px; }
.co-card p.co-tagline { margin: 0; color: var(--muted); font-size: 12.5px; }
.co-card .co-mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.co-card .co-mini-stats div span { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.co-card .co-mini-stats div b { display: block; margin-top: 2px; font-size: 12.5px; }
.co-card .view-link { margin-top: 4px; color: var(--forest-2); font-size: 12px; font-weight: 800; }

/* Method grid (shared) */
.method-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
.method-card { padding: 23px; background: var(--card); border: 1px solid var(--line); border-radius: 15px; }
.method-card .num { color: var(--forest-2); font-family: Georgia, serif; font-size: 34px; }
.method-card h3 { margin: 7px 0; font-size: 15px; }
.method-card p { margin: 0; color: var(--muted); font-size: 12px; }

/* Company detail page */
.company-nav { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 26px; font-size: 12px; }
.company-nav a { display: inline-flex; align-items: center; gap: 6px; color: var(--forest-2); text-decoration: none; font-weight: 700; }
.company-nav a:hover { text-decoration: underline; }
.hero-name-row { display: flex; align-items: center; gap: 16px; margin: 15px 0 20px; }
.hero-name-row h1 { margin: 0; }
.stat-rail { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 26px; }
.stat-tile { padding: 15px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 13px; }
.stat-tile span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }
.stat-tile strong { display: block; margin-top: 5px; font-family: Georgia, serif; font-size: 19px; font-weight: 500; line-height: 1.15; }
.overlap-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 20px; margin-bottom: 26px; padding: 22px 23px; background: linear-gradient(165deg, var(--forest), var(--paper)); color: white; border-radius: 18px; box-shadow: var(--shadow); }
.overlap-card h3 { margin: 3px 0 8px; font-family: Georgia, serif; font-size: 21px; font-weight: 500; }
.overlap-card p { margin: 0; color: rgba(255,255,255,.72); font-size: 13px; max-width: 640px; }
.overlap-score { text-align: right; }
.overlap-score strong { display: block; color: var(--lime); font-size: 42px; line-height: 1; }
.overlap-score span { display: block; color: rgba(255,255,255,.55); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; margin-top: 4px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 16px; }
.panel-card { padding: 22px 23px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.panel-card.span-2 { grid-column: 1 / -1; }
.panel-card h3 { margin: 0 0 4px; font-size: 14px; }
.panel-card .panel-sub { margin: 0 0 14px; color: var(--muted); font-size: 11px; }
.founder-list { display: grid; gap: 12px; }
.founder-card { padding: 13px 14px; background: var(--sage); border: 1px solid var(--line); border-radius: 11px; }
.founder-card .fname { margin: 0; font-size: 13px; font-weight: 800; }
.founder-card .ftitle { margin: 1px 0 6px; color: var(--forest-2); font-size: 11px; font-weight: 700; }
.founder-card .funi { margin: 0 0 3px; color: var(--ink); font-size: 11.5px; }
.founder-card .fbg { margin: 0; color: var(--muted); font-size: 11.5px; }
.paper-card { padding: 16px 17px; background: var(--sage); border: 1px solid var(--line); border-radius: 11px; }
.paper-card h4 { margin: 0 0 6px; font-size: 13.5px; line-height: 1.35; }
.paper-card .paper-meta { margin: 0 0 10px; color: var(--muted); font-size: 11.5px; }
.paper-cite { display: inline-flex; align-items: center; gap: 8px; }
.paper-cite strong { font-family: Georgia, serif; font-size: 26px; color: var(--forest-2); }
.paper-cite span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.paper-link { display: inline-block; margin-top: 10px; color: var(--forest-2); font-weight: 800; font-size: 12px; text-decoration: none; border-bottom: 1px solid var(--muted); }
.paper-link:hover { color: var(--lime); border-color: var(--lime); }
.no-paper { padding: 16px 17px; background: var(--sage); border: 1px dashed var(--line); border-radius: 11px; color: var(--muted); font-size: 12px; }
.spec-table { width: 100%; border-collapse: collapse; }
.spec-table td { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; vertical-align: top; }
.spec-table td:first-child { width: 110px; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.spec-table tr:last-child td { border-bottom: 0; }
.press-list { display: grid; gap: 10px; }
.press-item { padding: 11px 13px; background: var(--sage); border: 1px solid var(--line); border-radius: 10px; font-size: 12px; }
.press-item .press-source { display: block; margin-bottom: 3px; color: var(--forest-2); font-weight: 800; font-size: 11.5px; }
.press-item a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--muted); }
.press-item a:hover { border-color: var(--lime); }
.callout { padding: 20px 22px; background: var(--sage); border: 1px solid var(--line); border-radius: 15px; }
.callout h3 { margin: 0 0 8px; font-size: 14px; color: var(--forest-2); }
.callout p { margin: 0; font-size: 13px; color: var(--ink); }
.confidence-note { margin-top: 10px; padding: 12px 14px; background: rgba(224,182,74,.12); border: 1px solid rgba(224,182,74,.4); border-radius: 10px; font-size: 11.5px; color: #f0c96b; }

footer { padding: 22px 0 38px; color: var(--muted); border-top: 1px solid var(--line); font-size: 11px; }
footer .shell { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .chart-grid, .detail-grid, .cards { grid-template-columns: 1fr; }
  .stat-rail { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
  .shell { width: min(100% - 24px, 1180px); }
  .hero-copy { padding: 48px 0 54px; }
  .section-head, footer .shell { align-items: flex-start; flex-direction: column; }
  .landscape { grid-template-columns: repeat(2, 1fr); }
  .method-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 84px 1fr 60px; }
  .overlap-card { grid-template-columns: 1fr; }
  .overlap-score { text-align: left; }
  .heatmap-grid { grid-template-columns: 96px repeat(3, 1fr) !important; }
  .hm-row-label { font-size: 10px; padding-right: 4px; }
  .hm-cell { min-height: 32px; font-size: 11px; }
}
@media (max-width: 520px) {
  .as-of { display: none; }
  .toolbar { flex-direction: column; }
  .landscape { grid-template-columns: 1fr 1fr; }
  .stat-rail { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* ---- Edit + comment layer (annotate.js) — local to this browser ---- */
.annot-wrap { position: relative; }
[data-edit-id][data-edit-type="graphic"] { position: relative; }
body.annot-edit-mode [data-edit-id][data-edit-type="text"] {
  outline: 1.5px dashed var(--forest-2);
  outline-offset: 4px;
  border-radius: 4px;
  cursor: text;
}
body.annot-edit-mode [data-edit-id][data-edit-type="text"]:hover { background: rgba(185,140,255,.06); }
body.annot-edit-mode [data-edit-id][data-edit-type="text"]:focus { outline-style: solid; background: rgba(185,140,255,.09); }
.annot-saved-flash { animation: annotFlash .9s ease; }
@keyframes annotFlash { 0% { background: rgba(79,214,143,.25); } 100% { background: transparent; } }

.annot-comment-btn {
  position: absolute; top: -10px; right: -10px; z-index: 5;
  display: grid; place-items: center; width: 26px; height: 26px;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--card); color: var(--muted);
  font-size: 12px; line-height: 1; cursor: pointer;
  opacity: 0; transition: opacity .15s;
  box-shadow: 0 4px 10px rgba(0,0,0,.25);
}
.annot-wrap:hover > .annot-comment-btn,
[data-edit-id][data-edit-type="graphic"]:hover > .annot-comment-btn,
.annot-comment-btn.has-comments,
body.annot-edit-mode .annot-comment-btn { opacity: 1; }
.annot-comment-btn .annot-count {
  position: absolute; top: -5px; right: -5px; min-width: 15px; height: 15px; padding: 0 3px;
  display: grid; place-items: center; border-radius: 999px;
  background: var(--forest-2); color: var(--forest); font-size: 9px; font-weight: 800;
}

.annot-popover {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 20;
  width: min(300px, 88vw); padding: 14px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow);
}
.annot-pop-list { display: grid; gap: 8px; max-height: 220px; overflow-y: auto; margin-bottom: 10px; }
.annot-empty { margin: 0; color: var(--muted); font-size: 11.5px; }
.annot-comment { padding: 8px 9px; background: var(--sage); border-radius: 8px; }
.annot-comment-head { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; font-size: 10.5px; color: var(--muted); }
.annot-comment-head b { color: var(--ink); font-size: 11.5px; }
.annot-comment-head .annot-del { margin-left: auto; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; padding: 2px; }
.annot-comment-head .annot-del:hover { color: var(--red); }
.annot-comment p { margin: 0; font-size: 12px; color: var(--ink); }
.annot-form { display: grid; gap: 6px; }
.annot-form input, .annot-form textarea { width: 100%; padding: 7px 9px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 7px; font: inherit; font-size: 12px; resize: vertical; }
.annot-form input:focus, .annot-form textarea:focus { outline: none; border-color: var(--forest-2); }
.annot-form button { padding: 7px; color: var(--forest); background: var(--lime); border: 0; border-radius: 7px; font-size: 12px; font-weight: 800; cursor: pointer; }
.annot-form button:hover { opacity: .9; }

.annot-fab { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.annot-hint { display: none; max-width: 300px; margin: 0; padding: 10px 13px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; font-size: 11.5px; box-shadow: var(--shadow); }
.annot-fab-row { display: flex; align-items: center; gap: 10px; }
.annot-comment-total { color: var(--muted); font-size: 11px; }
.annot-reset { padding: 9px 12px; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 999px; font-size: 11.5px; font-weight: 700; cursor: pointer; }
.annot-reset:hover { color: var(--red); border-color: var(--red); }
.annot-fab-btn { padding: 12px 18px; color: var(--forest); background: var(--lime); border: 0; border-radius: 999px; font-size: 13px; font-weight: 800; cursor: pointer; box-shadow: 0 10px 26px rgba(0,0,0,.35); }
.annot-fab-btn:hover { transform: translateY(-1px); }
@media (max-width: 520px) {
  .annot-fab { right: 12px; bottom: 12px; left: 12px; align-items: stretch; }
  .annot-hint { max-width: none; }
  .annot-fab-row { justify-content: flex-end; flex-wrap: wrap; }
}
