/* Result HUD: measurement stays fixed; light and ambient artwork stay in motion. */
.api-cost {display:inline-block;padding:3px 8px;border:1px solid #446c66;border-radius:5px;background:#12342f;color:#d4ffd3;font-size:12px;line-height:1.5;font-variant-numeric:tabular-nums}
.preview-mode-banner {position:fixed;left:calc(var(--sidebar,0px) + 18px);right:18px;bottom:8px;z-index:100;padding:8px 12px;border:1px solid #ffc568;border-radius:6px;background:#342711;color:#ffe3a6;font-size:12px;line-height:1.6;box-shadow:0 3px 20px #0008}
.preview-mode-banner a {color:#b9fff0;text-decoration:underline;margin-left:6px}
.segmented-meter {
  position:relative;
  display:grid;
  grid-template-columns:repeat(var(--segment-count,20),minmax(0,1fr));
  align-items:stretch;
  gap:3px;
  overflow:hidden;
  isolation:isolate;
}
.segmented-meter .segment-cell {
  width:auto;
  height:100%;
  min-width:0;
  border:0;
  border-radius:2px;
  background:#203047;
  box-shadow:none;
  animation:none;
}
.segmented-meter .segment-cell.is-active {
  background:linear-gradient(180deg,#7cfff1,#1ac9d8);
  box-shadow:0 0 6px #20d9dc2e;
}
.segmented-meter::after {
  content:"";
  position:absolute;
  z-index:1;
  inset:0;
  pointer-events:none;
  background:linear-gradient(105deg,transparent 36%,#cfffff42 49%,transparent 62%);
  transform:translateX(-110%);
  animation:hud-meter-sweep 5.2s ease-in-out infinite;
}
.total-rank-module {
  padding:9px 16px;
  gap:18px;
  border:1px solid #3c5d79;
  border-radius:11px;
  background:linear-gradient(120deg,#142333,#0b1421);
  box-shadow:inset 0 1px #a2fff017,0 0 24px #25e2d208;
}
.total-rank-meta {gap:9px}
.total-rank-label {font-size:10px;letter-spacing:.14em;color:#7cfff1;text-shadow:none}
.total-rank-val {font-size:29px;color:#ddff70;text-shadow:0 0 15px #c6ff4540}
.total-segment-gauge {
  width:200px;
  height:28px;
  padding:5px;
  gap:3px;
  border:1px solid #324d66;
  border-radius:5px;
  background:#070f1b;
  transform:none;
}
.total-segment-gauge .segment-cell.is-active {
  background:linear-gradient(180deg,#e1ff6f,#8be8a4);
  box-shadow:0 0 7px #d8ff1e22;
}
.insights-grid {gap:12px}
.insights-grid .insight-item {
  min-width:0;
  padding:12px 13px;
  border-color:#2c4058;
  background:linear-gradient(135deg,#182638b3,#101b28cc);
}
.insight-item-header {gap:9px;align-items:baseline}
.insight-label {font-size:12px;line-height:1.6}
.insights-grid .insight-score {font-size:19px;white-space:nowrap;color:#94efec;text-shadow:none}
.insight-score small {font-size:10px;color:#829cb7;font-weight:500;margin-left:4px}
.insight-meter-bar.segmented-meter {
  width:100%;
  height:21px;
  padding:3px;
  margin:8px 0 9px;
  gap:3px;
  border:1px solid #2b4359;
  border-radius:4px;
  background:#081321;
}
#insight-asset-meter::after {animation-delay:1.4s}
#insight-expertise-meter::after {animation-delay:2.8s}
.insight-desc {font-size:11px;line-height:1.65;color:#a7bdd2}
.result-next-step {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  padding:14px 16px;
  margin:2px 0 16px;
  border:1px solid #3d6d72;
  border-radius:11px;
  background:linear-gradient(115deg,#15353d,#102334 65%,#111f2d);
  box-shadow:inset 3px 0 #84f5cb,0 0 25px #27e2c90a;
}
.next-step-copy {flex:1;min-width:150px}
.next-step-kicker {display:block;margin-bottom:5px;font:800 9px/1.2 ui-monospace,SFMono-Regular,Consolas,monospace;letter-spacing:.14em;color:#8df5d7}
.next-step-kicker i {display:inline-block;width:5px;height:5px;background:#a9ffbe;border-radius:50%;margin-right:5px;box-shadow:0 0 7px #a9ffbe;animation:hud-beacon 2s ease-in-out infinite}
.next-step-copy strong {display:block;color:#f0fff9;font-size:14px;line-height:1.65}
.next-step-copy p {font-size:10px;line-height:1.65;color:#9cbaca;margin:3px 0 0}
.next-step-actions {display:flex;align-items:stretch;justify-content:flex-end;gap:10px;flex-wrap:wrap}
.next-step-button,.result-next-step .result-chapter-btn {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:9px;
  position:relative;
  min-height:48px;
  max-width:100%;
  padding:11px 15px;
  border:1px solid #397283;
  border-radius:8px;
  background:#132b3a;
  color:#c8f5f0;
  font-size:12px;
  font-weight:700;
  line-height:1.5;
  text-align:left;
  box-shadow:none;
  transform:none;
  white-space:normal;
  transition:background .2s,border-color .2s,transform .2s;
}
.next-step-button .icon {width:17px;height:17px}
.next-step-button:hover:not(:disabled) {background:#1c4050;border-color:#7ff4df;transform:translateY(-2px)}
.next-step-button.is-recommended,.result-next-step .result-chapter-btn.is-recommended {
  color:#061d21;
  background:linear-gradient(115deg,#d9ff79,#83f5ce 70%,#74ede5);
  border-color:#b7ffcb;
  box-shadow:0 0 22px #77efce30,inset 0 1px #ffffffaa;
  animation:hud-action-beacon 3.2s ease-in-out infinite;
}
.next-step-arrow {font-size:18px;margin-left:3px;flex:none}
.is-recommended .next-step-arrow {animation:hud-action-arrow 1.8s ease-in-out infinite}
.next-step-button:disabled {animation:none;transform:none}
.insights-head {align-items:center;gap:20px;padding-bottom:13px;margin-bottom:13px}
.insights-title h3 {font-size:16px;line-height:1.7}
.insights-title .insights-tag {font-size:8px;transform:none;letter-spacing:.1em;margin-bottom:4px}
#insights-genre-badge {
  position:relative;
  isolation:isolate;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  justify-content:center;
  gap:5px;
  min-width:280px;
  max-width:55%;
  padding:12px 18px;
  border:1px solid #4d8f98;
  border-radius:9px;
  background:linear-gradient(110deg,#15353e,#102331);
  box-shadow:inset 3px 0 #7aefd1,0 0 20px #22dce512;
  animation:hud-genre-glow 5s ease-in-out infinite;
}
#insights-genre-badge::after {content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;background:linear-gradient(115deg,transparent 33%,#81f4db16 50%,transparent 66%);animation:hud-meter-sweep 7s ease-in-out infinite}
#insights-genre-badge .genre-kicker {border:0;padding:0;font:800 8px/1.2 ui-monospace,SFMono-Regular,Consolas,monospace;letter-spacing:.14em;color:#88dccf}
.genre-kicker i {display:inline-block;width:5px;height:5px;border-radius:50%;background:#a2ffd6;box-shadow:0 0 9px #a2ffd666;margin-right:4px;animation:hud-beacon 3s ease-in-out infinite}
#insights-genre-badge .genre-value {font-size:22px;line-height:1.4;font-weight:800;color:#eefffa;letter-spacing:.03em;overflow-wrap:anywhere}
.genre-caption {font-size:9px;font-weight:400;color:#b1d1d1;line-height:1.5}
#insights-genre-confidence {margin-left:9px;color:#8fb3bf}
.score-row {
  min-height:184px;
  padding:12px 58px 12px 14px;
  border-radius:12px;
  clip-path:none;
  overflow:hidden;
}
.score-row.needs-review {border-color:#33465c}
.score-row.needs-review::before {background:linear-gradient(90deg,#00d3dc,transparent)}
.score-row .score-gauge {position:relative;isolation:isolate;overflow:visible}
body[data-view="results"] .score-gauge::after {
  content:"";
  position:absolute;
  inset:-5px;
  pointer-events:none;
  border-radius:50%;
  background:radial-gradient(circle at 50% 3px,#a5fff2 0 1.5px,transparent 2.5px);
  animation:hud-orbit 14s linear infinite;
  opacity:.7;
}
body[data-view="results"] .score-row:nth-child(2n) .score-gauge::after {animation-direction:reverse;animation-duration:18s}
body[data-view="results"] .score-row:nth-child(3n) .score-gauge::after {animation-delay:-7s}
.score-row .axis-name {font-size:14px;line-height:1.55;overflow-wrap:anywhere}
.score-row .score-detail {margin:9px 0 0}
.score-row .score-detail summary {font-size:11px;line-height:1.7}
.score-row .score-detail p {text-align:left}
.score-row .conf-segment-meter {
  position:absolute;
  inset:9px 9px 9px auto;
  width:37px;
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:5px;
  padding:6px 5px;
  border:1px solid #36536d;
  border-radius:6px;
  background:#071321;
  box-shadow:inset 0 0 14px #001c322e;
}
.conf-meter-value {
  display:block;
  flex:none;
  font:700 13px/1.15 ui-monospace,SFMono-Regular,Consolas,monospace;
  color:#8effed;
  text-align:center;
  white-space:nowrap;
}
.conf-meter-value span {font-size:8px;margin-left:1px;color:#a6c0d5}
.conf-meter-track {
  position:relative;
  display:flex;
  flex:1;
  flex-direction:column;
  gap:2px;
  min-height:75px;
  overflow:hidden;
}
.conf-meter-track .conf-cell {
  display:block;
  flex:1;
  width:100%;
  min-height:1px;
  height:auto;
  border:0;
  border-radius:1px;
  background:#1b2a3c;
  box-shadow:none;
}
.conf-meter-track .conf-cell.is-active {background:linear-gradient(90deg,#20ced9,#80f9dc);box-shadow:none}
.conf-meter-track::after {
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(180deg,transparent 39%,#ffffff40 50%,transparent 61%);
  transform:translateY(110%);
  animation:hud-confidence-scan 5.5s ease-in-out infinite;
  pointer-events:none;
}
.conf-meter-label {font-size:7px;line-height:1.1;letter-spacing:.02em;color:#91abc1;white-space:nowrap;text-align:center}
.needs-review .conf-meter-value {color:#ffd18a}
.score-row.needs-review .conf-cell.is-active {background:linear-gradient(90deg,#e6a952,#ffd89c);border:0;box-shadow:none}
.score-row .conf-segment-meter.needs-review {border-color:#775b35}
.ambient-signal {display:none}
body[data-view="results"] .companion-panel {
  display:flex;
  flex-direction:column;
  gap:12px;
  padding:13px 11px;
  height:auto;
  min-height:0;
  max-height:none;
}
body[data-view="results"] .companion-heading {order:1;padding:7px 6px 4px}
body[data-view="results"] .companion-dialogue {order:2;margin:0;padding:16px 14px;min-height:0}
body[data-view="results"] .character-scene {
  order:3;
  display:block;
  flex:none;
  height:clamp(260px,32vh,310px);
  min-height:0;
  margin:3px 0 0;
  border:1px solid #5a8c9c;
  border-radius:11px;
  background:#f5fffd;
  box-shadow:0 0 25px #1ce8df0d;
}
body[data-view="results"] .character-image {
  height:102%;
  width:auto;
  top:0;
  right:-9px;
  left:auto;
  clip-path:none;
  object-fit:contain;
  animation:hud-character-float 6s ease-in-out infinite;
}
body[data-view="results"] .character-image[data-side="left"] {left:-9px;right:auto;clip-path:none}
body[data-view="results"] .character-scene::after {background:linear-gradient(0deg,#f5fffd 0%,transparent 9%);box-shadow:none}
body[data-view="results"] .scene-caption {left:8px;bottom:12px;font-size:5px;letter-spacing:.1em;max-height:80%}
body[data-view="results"] .scene-spark {display:none}
body[data-view="results"] .scene-orbit {opacity:.45}
body[data-view="results"] .ambient-signal {
  display:block;
  order:4;
  position:relative;
  flex:none;
  padding:12px 10px 9px;
  overflow:hidden;
  border:1px solid #284956;
  border-radius:9px;
  background:radial-gradient(ellipse at 50% 100%,#1ce5d815,transparent 75%),#0b1725;
}
.ambient-signal-head,.ambient-signal-foot {display:flex;justify-content:space-between;align-items:center;gap:8px;white-space:nowrap;font:600 7px/1.4 ui-monospace,SFMono-Regular,Consolas,monospace;letter-spacing:.05em;color:#7393ac}
.ambient-signal-head>span:first-child {color:#8cf5df}
.ambient-signal-head i {display:inline-block;width:4px;height:4px;margin-right:4px;border-radius:50%;background:#8cf5df;box-shadow:0 0 7px #8cf5df;animation:hud-beacon 2.4s ease-in-out infinite}
.ambient-signal-foot {margin-top:7px;font-size:6px;letter-spacing:.02em}
.ambient-equalizer {
  display:flex;
  align-items:flex-end;
  gap:3px;
  height:61px;
  margin-top:10px;
  border-bottom:1px solid #43dfd829;
  background:repeating-linear-gradient(0deg,transparent 0 14px,#77d8e20c 14px 15px);
}
.ambient-equalizer>i {
  flex:1;
  height:100%;
  transform-origin:bottom;
  transform:scaleY(.35);
  border-radius:2px 2px 0 0;
  background:linear-gradient(0deg,#19aabd,#7af6d5 74%,#d4ff6b);
  box-shadow:0 0 7px #41ebce22;
  animation:hud-equalizer 1.85s ease-in-out infinite alternate;
}
.ambient-equalizer>i:nth-child(3n) {animation-duration:1.25s;animation-delay:-.65s}
.ambient-equalizer>i:nth-child(3n+1) {animation-delay:-1.3s;animation-duration:2.3s}
.ambient-equalizer>i:nth-child(4n) {animation-delay:-.3s;animation-duration:1.5s}
.ambient-equalizer>i:nth-child(5n) {animation-delay:-1.8s;animation-duration:2.05s}
.ambient-equalizer>i:nth-child(even) {animation-direction:alternate-reverse}
body[data-view="results"] .assistant-bottom {order:5;padding:2px 1px;font-size:9px;line-height:1.6}
@keyframes hud-meter-sweep {0%,12%{transform:translateX(-110%)}72%,100%{transform:translateX(110%)}}
@keyframes hud-confidence-scan {0%,15%{transform:translateY(110%)}80%,100%{transform:translateY(-110%)}}
@keyframes hud-orbit {to{transform:rotate(360deg)}}
@keyframes hud-character-float {0%,100%{transform:translateY(0)}50%{transform:translateY(3px)}}
@keyframes hud-equalizer {0%{transform:scaleY(.17)}30%{transform:scaleY(.76)}60%{transform:scaleY(.38)}100%{transform:scaleY(.94)}}
@keyframes hud-beacon {0%,100%{opacity:.5}50%{opacity:1}}
@keyframes hud-action-beacon {0%,100%{box-shadow:0 0 12px #77efce20,inset 0 1px #ffffffaa}50%{box-shadow:0 0 26px #77efce50,inset 0 1px #ffffffaa}}
@keyframes hud-action-arrow {0%,100%{transform:translateX(0)}50%{transform:translateX(4px)}}
@keyframes hud-genre-glow {0%,100%{border-color:#447a87}50%{border-color:#8aebce}}
/* Compact result header and integrated character signal. */
:is(#results-panel,#thumb-results-panel) .insights-head {
  display:grid;
  grid-template-columns:190px minmax(210px,1fr) 220px auto;
  gap:14px;
  align-items:start;
  margin-bottom:10px;
  padding-bottom:10px;
}
:is(#results-panel,#thumb-results-panel) .insights-title {display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;height:64px;padding-top:7px;gap:6px}
:is(#results-panel,#thumb-results-panel) .insights-title .insights-tag {display:inline-flex;align-items:center;height:16px;margin:0;font-size:8px}
:is(#results-panel,#thumb-results-panel) .insights-title h2 {font-size:20px;line-height:1.35;margin:0;color:#f0fbff;white-space:nowrap}
:is(#results-panel,#thumb-results-panel) .insights-head .total-rank-module {display:flex;flex-direction:column;align-items:stretch;justify-content:space-between;height:64px;gap:3px;padding:7px 11px;min-width:0}
:is(#results-panel,#thumb-results-panel) .insights-head .total-rank-meta {justify-content:space-between;align-items:flex-start}
:is(#results-panel,#thumb-results-panel) .insights-head .total-rank-val {font-size:26px;line-height:1.1}
:is(#results-panel,#thumb-results-panel) .insights-head .total-segment-gauge {width:100%;height:18px;padding:3px;gap:3px}
:is(#results-panel,#thumb-results-panel) #insights-genre-badge {width:auto;min-width:0;max-width:none;height:64px;justify-content:space-between;gap:3px;padding:8px 11px}
:is(#results-panel,#thumb-results-panel) #insights-genre-badge .genre-value {font-size:21px;line-height:1.3}
:is(#results-panel,#thumb-results-panel) .genre-caption {font-size:8px}
:is(#results-panel,#thumb-results-panel) #insights-genre-confidence {position:absolute;top:8px;right:10px;margin:0;font-size:10px;font-weight:800;line-height:1.2;color:#d8ff1e;white-space:nowrap}
:is(#results-panel,#thumb-results-panel) .insights-card {margin-bottom:11px}
:is(#results-panel,#thumb-results-panel) .insights-head .gadget-thumb-cta {width:auto;height:64px;min-height:64px;padding:10px 12px;gap:8px;font-size:12px;isolation:isolate;justify-self:end;white-space:nowrap}
:is(#results-panel,#thumb-results-panel) .insights-head .gadget-thumb-cta>span {max-width:none;line-height:1.6;text-align:left;white-space:nowrap}
@property --cta-orbit-angle {syntax:"<angle>";initial-value:0deg;inherits:false}
.gadget-thumb-cta::after {
  content:"";
  position:absolute;
  inset:-2px;
  border-radius:inherit;
  padding:2px;
  background:conic-gradient(from var(--cta-orbit-angle),transparent 0deg 342deg,#74fff0 351deg,#f5ffb0 359deg,transparent 360deg);
  -webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);
  -webkit-mask-composite:xor;
  mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);
  mask-composite:exclude;
  pointer-events:none;
  animation:hud-cta-perimeter 5s linear infinite;
}
@keyframes hud-cta-perimeter {to{--cta-orbit-angle:360deg}}
.result-actions {flex-wrap:wrap;gap:9px;padding:12px 0 10px}
.result-actions>.secondary-button,.result-actions>.next-step-button {
  min-height:40px;
  padding:9px 14px;
  border:1px solid #438c9b;
  border-radius:7px;
  background:linear-gradient(135deg,#1a4351,#153141);
  color:#d5fff4;
  font-size:12px;
  font-weight:700;
  box-shadow:inset 0 1px #a3ffef17;
}
.result-actions>.secondary-button:hover:not(:disabled) {background:#245564;border-color:#8cf9df;color:#fff}
.result-actions>.gadget-reload {border-color:#7ebf8a;background:linear-gradient(135deg,#24513d,#173e37);color:#e5ffd4}
.result-actions>.next-step-button.is-recommended {border-color:#64cfe0;box-shadow:0 0 14px #2cdaee24;animation:hud-action-beacon 4s ease-in-out infinite}
:is(#results-panel,#thumb-results-panel) .result-toolbar {margin:0 0 5px;font-size:13px;line-height:1.6;min-height:0}
:is(#results-panel,#thumb-results-panel) #result-time {font-size:13px;line-height:1.6}
:is(#results-panel,#thumb-results-panel) .result-toolbar-left {display:flex;align-items:center;gap:12px;flex-wrap:wrap}
:is(#results-panel,#thumb-results-panel) .result-footnote {padding:8px 0;font-size:10px}
:is(#results-panel,#thumb-results-panel) .result-footer {display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:16px 24px;padding:12px 0 9px}
:is(#results-panel,#thumb-results-panel) .result-footer .result-actions {flex:0 1 auto;padding:0}
:is(#results-panel,#thumb-results-panel) .result-footer .result-footnote {flex:0 1 390px;margin:0;padding:0;border:0;text-align:left;font-size:10px;line-height:1.75}
:is(#results-panel,#thumb-results-panel) .result-toolbar {padding-top:7px;border-top:1px solid #263750}
body[data-view="results"] .ambient-signal {
  z-index:4;
  margin:-105px 0 0;
  padding:23px 10px 8px;
  min-height:105px;
  border:0;
  border-radius:0 0 10px 10px;
  background:linear-gradient(180deg,transparent,#071b2be8 23%,#071722f5);
  pointer-events:none;
}
.ambient-equalizer {height:49px;margin-top:6px}
.ambient-equalizer>i {animation-duration:4.8s}
.ambient-equalizer>i:nth-child(3n) {animation-duration:4.2s}
.ambient-equalizer>i:nth-child(3n+1) {animation-duration:6.1s}
.ambient-equalizer>i:nth-child(4n) {animation-duration:5.2s}
.ambient-equalizer>i:nth-child(5n) {animation-duration:5.7s}
@media(min-width:1200px) {
  body[data-view="results"] :is(#results-panel,#thumb-results-panel) .score-row {min-height:170px;padding-top:10px;padding-bottom:10px}
  body[data-view="results"] :is(#results-panel,#thumb-results-panel) .score-line {min-height:30px}
  body[data-view="results"] :is(#results-panel,#thumb-results-panel) .score-gauge {width:80px;height:80px}
}
@media(max-width:1500px) and (min-width:900px) {
  :is(#results-panel,#thumb-results-panel) .insights-head {grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
}
@media(min-width:600px) and (max-width:1199px) {
  body[data-view="results"] .ambient-signal {grid-column:2;grid-row:1/5;align-self:end;margin:0;min-height:105px;width:220px}
}
@media(max-width:899px) {
  :is(#results-panel,#thumb-results-panel) .insights-head {grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
}
@media(max-width:599px) {
  :is(#results-panel,#thumb-results-panel) .insights-head {grid-template-columns:minmax(0,1fr)}
  :is(#results-panel,#thumb-results-panel) .insights-head .gadget-thumb-cta {width:100%}
  body[data-view="results"] .ambient-signal {max-width:300px}
}
@media(min-width:900px) {
  body[data-view="results"] .companion-panel {align-self:start;position:sticky;top:12px}
  body.has-chapters .scores {grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
  body.has-chapters .score-row {padding:12px 55px 12px 12px;min-height:178px}
  body.has-chapters .score-gauge {width:80px;height:80px;margin-bottom:5px}
  body.has-chapters .score-gauge .score-value {font-size:26px}
  body.has-chapters .axis-name {font-size:13px;line-height:1.5}
}
@media(min-width:600px) and (max-width:1199px) {
  body[data-view="results"] .main-shell {grid-template-columns:minmax(0,1fr)}
  body[data-view="results"] .companion-panel {
    grid-column:1;grid-row:3;
    position:relative;top:auto;
    display:grid;
    grid-template-columns:minmax(0,1fr) 220px;
    grid-template-rows:auto auto 1fr auto;
    gap:12px 18px;
    width:100%;
  }
  body[data-view="results"] .companion-heading {grid-column:1;grid-row:1;padding:5px}
  body[data-view="results"] .companion-dialogue {grid-column:1;grid-row:2}
  body[data-view="results"] .character-scene {grid-column:2;grid-row:1/5;height:280px;margin:0}
  body[data-view="results"] .ambient-signal {grid-column:1;grid-row:3}
  body[data-view="results"] .assistant-bottom {grid-column:1;grid-row:4}
}
@media(max-width:899px) {
  .result-next-step {align-items:stretch;flex-direction:column;gap:12px}
  .next-step-actions {justify-content:stretch}
  .next-step-button {flex:1}
  .score-row {padding:12px 53px 12px 12px}
  .scores {grid-template-columns:repeat(2,minmax(0,1fr))}
  .insights-grid {grid-template-columns:1fr}
  .insights-grid .insight-item {display:grid;grid-template-columns:minmax(0,1fr) minmax(140px,1fr);gap:5px 16px}
  .insights-grid .insight-item-header {margin:0}
  .insights-grid .insight-meter-bar {margin:0;align-self:center}
  .insights-grid .insight-desc {grid-column:1/-1}
}
@media(max-width:599px) {
  .result-next-step {padding:14px 12px}
  .next-step-copy strong {font-size:13px}
  .next-step-actions {flex-direction:column;gap:9px}
  .next-step-button {font-size:12px;min-height:50px;width:100%}
  #insights-genre-badge {width:100%;max-width:none;min-width:0;padding:13px 15px}
  #insights-genre-badge .genre-value {font-size:23px}
  .results-panel .panel-head,.thumb-results-panel .panel-head {flex-wrap:wrap;gap:12px;padding:15px 14px!important}
  .results-head-right,.total-rank-module {width:100%}
  .total-rank-module {justify-content:space-between;gap:12px;padding:9px 12px}
  .total-segment-gauge {width:min(180px,53%);height:25px;gap:2px}
  .total-rank-val {font-size:25px}
  .scores {grid-template-columns:1fr;gap:11px}
  .score-row {min-height:176px;padding:13px 58px 13px 17px}
  .score-row .axis-name {font-size:15px}
  .score-row .score-gauge {width:88px;height:88px}
  .insights-grid .insight-item {display:block;padding:12px}
  .insights-grid .insight-meter-bar {margin:8px 0}
  .insights-head {flex-wrap:wrap}
  .insight-label {font-size:11px}
  .insight-score {font-size:17px}
  body[data-view="results"] .companion-panel {display:flex;position:relative;top:auto;width:100%;gap:14px}
  body[data-view="results"] .character-scene {width:100%;max-width:300px;height:300px;align-self:center}
  body[data-view="results"] .ambient-signal {width:100%;max-width:360px;align-self:center}
  .result-actions {flex-wrap:wrap}
}
@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after {animation:none!important;transition:none!important;scroll-behavior:auto!important}
  .segmented-meter::after,.conf-meter-track::after {display:none}
  .ambient-equalizer>i:nth-child(3n) {transform:scaleY(.7)}
  .ambient-equalizer>i:nth-child(4n) {transform:scaleY(.5)}
}

/* On wide result screens, extend the portrait stage to the results card baseline. */
@media(min-width:1200px) {
  body[data-view="results"] .main-shell,
  body[data-view="results"].has-chapters .main-shell {
    grid-template-columns:minmax(0,1fr) 390px;
  }
  body[data-view="results"] .companion-panel {
    align-self:stretch;
    height:auto;
    min-height:0;
    max-height:none;
    position:relative;
    top:auto;
  }
  body[data-view="results"] .character-scene {
    flex:1 1 280px;
    height:auto;
    min-height:280px;
  }
  body[data-view="results"] .character-image {
    height:100%;
    width:auto;
    top:0;
  }
}

/* Shared frame: score count may change without moving or scaling the assistant. */
.thumb-image-properties {
  display:flex;flex-direction:column;justify-content:space-between;gap:4px;
  height:64px;min-width:0;padding:8px 11px;
  border:1px solid #36596d;border-radius:9px;background:#112433;
}
.paste-diagnostics {margin:8px 16px;padding:10px 12px;border:1px solid #31586b;border-radius:8px;background:#10232e;color:#bcd8e4;font-size:12px;line-height:1.7}
.paste-diagnostics summary {cursor:pointer;color:#89ece3;font-weight:700}
.paste-diagnostics p {margin:6px 0 0;white-space:pre-line}
.ai-likeness-panel {
  display:grid;grid-template-columns:minmax(150px,.7fr) minmax(100px,2fr) auto;
  align-items:center;gap:14px;margin-top:10px;padding:10px 15px;
  border:1px solid #28656c;border-left:3px solid #51ddd6;border-radius:9px;
  background:linear-gradient(105deg,#12343c80,#101925 60%);min-height:74px;
}
.ai-likeness-panel[hidden] {display:none}
.ai-likeness-kicker {font-size:8px;font-weight:900;letter-spacing:.16em;color:#71dfd9}
.ai-likeness-copy h3 {margin:2px 0;font-size:17px;line-height:1.4;color:#c9fff7}
.ai-likeness-copy p {margin:0;font-size:10px;line-height:1.5;color:#aeb9bd}
.ai-likeness-preview {display:inline-block;margin-top:3px;color:#aeb9bd;font-size:9px}
.ai-likeness-kicker .ai-likeness-preview {margin:0 0 0 8px;font-weight:500;letter-spacing:0}
.ai-likeness-topline {display:flex;align-items:center;justify-content:space-between;margin-bottom:5px}
.ai-likeness-band {font-size:11px;font-weight:700;color:#71dfd9}
.ai-likeness-value {color:#9af8ed;font-size:24px;line-height:1;font-variant-numeric:tabular-nums;text-shadow:0 0 15px #44d6cf33}
.ai-likeness-value small {font-size:11px;font-weight:500;color:#adb7be}
.ai-likeness-meter.segmented-meter {height:15px;padding:2px;--meter-start:#7af5e5;--meter-end:#1eb8bd;border-color:#28656c}
.ai-likeness-meter .segment-cell.is-active {background:linear-gradient(180deg,#94ffeb,#25bfc1);box-shadow:0 0 6px #48dacb33}
.ai-likeness-scale {display:flex;justify-content:space-between;margin-top:4px;font-size:9px;line-height:1;color:#8ebdbd}
.ai-likeness-detail {color:#b8c8cf;font-size:11px;line-height:1.7}
.ai-likeness-detail summary {cursor:pointer;white-space:nowrap;color:#a6dfdb}
.ai-likeness-detail p {margin:6px 0 0}
.ai-likeness-detail[open] {grid-column:1/-1}
.ai-likeness-panel.is-unavailable .ai-likeness-meter::after {display:none}
.ai-likeness-panel.is-unavailable .ai-likeness-value {font-size:20px}
@media(max-width:700px) {
  .ai-likeness-panel {grid-template-columns:minmax(0,1fr);gap:10px}
  .ai-likeness-copy h3 {font-size:16px}
}
:is(#results-panel,#thumb-results-panel) .result-footer {gap:8px 16px;padding:10px 0 5px;flex-wrap:nowrap}
:is(#results-panel,#thumb-results-panel) .result-run-info {flex:1 1 300px;min-width:0;margin-left:auto}
:is(#results-panel,#thumb-results-panel) .result-footer .result-toolbar {margin:0;padding:0;border:0;font-size:11px;line-height:1.6}
:is(#results-panel,#thumb-results-panel) .result-footer .result-toolbar-left {justify-content:flex-end;gap:3px 10px}
:is(#results-panel,#thumb-results-panel) .result-footer :is(#result-time,#thumb-result-time) {font-size:11px;line-height:1.6;white-space:nowrap}
:is(#results-panel,#thumb-results-panel) .result-footer .api-cost {white-space:nowrap}
body[data-thumbnail-detail="open"] #companion {display:none}
body[data-thumbnail-detail="open"] #thumb-details-panel {grid-column:1/-1;grid-row:2;min-width:0}
body[data-view="results"][data-thumbnail-detail="open"] .main-shell {grid-template-columns:minmax(0,1fr)}
@media(max-width:899px) {
  :is(#results-panel,#thumb-results-panel) .result-footer {flex-wrap:wrap}
  :is(#results-panel,#thumb-results-panel) .result-run-info {flex-basis:100%;margin-left:0}
  :is(#results-panel,#thumb-results-panel) .result-footer .result-toolbar-left {justify-content:flex-start}
}
.thumb-image-properties .genre-kicker {font-size:8px;padding:0;border:0;line-height:1.2}
#thumb-image-size {color:#ecfff9;font-size:15px;line-height:1.3;white-space:nowrap}
#thumb-ratio-val {font-size:10px;line-height:1.3;color:#a9c6d5}
#thumb-metrics-grid {
  display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:9px;
}
#thumb-metrics-grid .insight-item {min-width:0;padding:9px 11px}
#thumb-metrics-grid .insight-item-header {gap:7px;margin-bottom:4px}
#thumb-metrics-grid .insight-label {font-size:11px;white-space:nowrap}
#thumb-metrics-grid .insight-score {font-size:16px;line-height:1.4;color:#8eece4;text-shadow:none;white-space:normal}
#thumb-metrics-grid .insight-desc {font-size:10px;line-height:1.5}
#thumb-results-panel #thumb-result-time {font-size:13px;line-height:1.6}
@media(min-width:1200px) {
  body[data-view="results"] {--analysis-frame-height:clamp(650px,calc(100dvh - 126px),820px)}
  body[data-view="results"] :is(#results-panel,#thumb-results-panel) {
    display:flex;flex-direction:column;
    grid-column:1;grid-row:2;
    height:var(--analysis-frame-height);min-height:0;max-height:none;overflow:hidden;
  }
  body[data-view="results"] .panel :is(#result-body,#thumb-result-body) {
    flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;
    padding:10px 16px 14px;scrollbar-width:thin;
  }
  body[data-view="results"] .companion-panel {
    grid-column:2;grid-row:2;
    height:var(--analysis-frame-height);min-height:0;max-height:none;align-self:start;
  }
  body[data-view="results"] .companion-heading {flex:none}
  body[data-view="results"] .companion-dialogue {
    flex:0 0 150px;height:150px;min-height:0;overflow-y:auto;scrollbar-width:thin;
  }
  body[data-view="results"] .character-scene {flex:1 1 0;height:auto;min-height:0}
  body[data-view="results"] .character-image {height:100%;width:auto;top:0}
  body[data-view="results"] :is(#results-panel,#thumb-results-panel) .scores {
    grid-template-columns:repeat(var(--score-columns,3),minmax(0,1fr));
  }
}
@media(max-width:899px) {
  #thumb-metrics-grid {grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:599px) {
  #thumb-metrics-grid {grid-template-columns:minmax(0,1fr)}
}

/* The sixth tile previews the existing diagnosis and opens its details. */
.thumbnail-detail-card {
  position:relative;isolation:isolate;overflow:hidden;display:block;
  width:100%;min-width:0;min-height:170px;padding:0;
  border:1px solid #54c8ca;border-radius:12px;
  background:#0c1b2c;color:#e1fffb;text-align:left;
  box-shadow:inset 0 0 18px #39d4d311,0 0 18px #32c9cb14;
  transition:border-color .2s,box-shadow .2s;
}
.thumbnail-detail-card:hover {border-color:#a3fff1;box-shadow:0 0 24px #4ce7dd38}
.thumbnail-detail-card:focus-visible {outline:3px solid #9effeb;outline-offset:3px}
.thumbnail-detail-card::after {
  content:"";position:absolute;z-index:1;inset:0;pointer-events:none;
  background:linear-gradient(110deg,transparent 40%,#b5fff52b 50%,transparent 60%);
  transform:translateX(-120%);animation:thumbnail-detail-sweep 6s ease-in-out infinite;
}
.thumbnail-detail-preview {position:absolute;inset:8px 10px 31px;opacity:.9}
.thumbnail-detail-preview svg {display:block;width:100%;height:100%}
.thumbnail-preview-box {fill:#56f1ff0b;stroke:#56f1ff;stroke-width:1.8}
.thumbnail-preview-box.is-headline {fill:#ff728a0d;stroke:#ff728a}
.thumbnail-preview-box.is-first-attention {fill:#ffd16613;stroke:#ffd166;stroke-dasharray:8 5}
.thumbnail-detail-kicker {
  position:absolute;z-index:2;top:10px;left:12px;padding:3px 6px;
  border:1px solid #4ba6ad66;border-radius:4px;background:#0b2333e8;
  color:#a6f8ed;font:800 8px/1.5 ui-monospace,Consolas,monospace;letter-spacing:.14em;
}
.thumbnail-detail-action {
  position:absolute;z-index:2;left:50%;top:50%;transform:translate(-50%,-35%);
  display:flex;align-items:center;gap:9px;padding:9px 15px;white-space:nowrap;
  border:1px solid #a2fff0;border-radius:7px;background:#102e3aea;
  color:#eafffb;font-size:15px;font-weight:800;
  box-shadow:0 2px 14px #0008,0 0 15px #4ce7dd38;
}
.thumbnail-detail-beacon {width:6px;height:6px;border-radius:50%;background:#81ffe5;box-shadow:0 0 8px #68ffe3;animation:hud-beacon 3.8s ease-in-out infinite}
.thumbnail-detail-arrow {font-size:18px;color:#8cf5e4}
.thumbnail-detail-caption {
  position:absolute;z-index:2;bottom:0;left:0;right:0;padding:7px 10px;
  border-top:1px solid #447c893d;background:#0b1b2cec;color:#b5dbdf;
  text-align:center;font-size:10px;line-height:1.5;
}
@keyframes thumbnail-detail-sweep {0%,35%{transform:translateX(-120%)}75%,100%{transform:translateX(120%)}}
@media(prefers-reduced-motion:reduce) {
  .thumbnail-detail-card::after {display:none}
  .thumbnail-detail-beacon {animation:none}
}

/* Chapter analysis has the same visual priority as the other next actions. */
.result-actions>#result-chapter-btn,
#chapter-results .chapter-table-details>summary {
  border:1px solid #b7ffcb;border-radius:8px;
  background:linear-gradient(115deg,#d9ff79,#83f5ce 70%,#74ede5);
  color:#061d21;box-shadow:0 0 18px #77efce30,inset 0 1px #ffffffaa;
  font-weight:800;
}
.result-actions>#result-chapter-btn:not(:disabled),
#chapter-results .chapter-table-details>summary {animation:hud-action-beacon 4s ease-in-out infinite}
.result-actions>#result-chapter-btn:hover:not(:disabled),
#chapter-results .chapter-table-details>summary:hover {
  background:linear-gradient(115deg,#e6ffa7,#a3ffe5 70%,#8cfff1);border-color:#edfff5;color:#061d21;
}
#chapter-results .chapter-table-details>summary {
  display:inline-flex;align-items:center;justify-content:space-between;gap:16px;
  min-height:42px;max-width:100%;padding:10px 14px;font-size:12px;line-height:1.5;list-style:none;
}
#chapter-results .chapter-table-details>summary::-webkit-details-marker {display:none}
#chapter-results .chapter-table-details>summary::after {content:'＋';font-size:17px;line-height:1}
#chapter-results .chapter-table-details[open]>summary::after {content:'−'}
#chapter-results .chapter-table-details>summary:focus-visible {outline:2px solid #a4ffeb;outline-offset:4px}
@media(prefers-reduced-motion:reduce) {
  .result-actions>#result-chapter-btn,
  #chapter-results .chapter-table-details>summary {animation:none}
}
