/* Result and gallery extensions share the accepted underwater palette. */
.portrait, .gallery {
  --chart-line: #8db6c05c;
  --chart-fill: #d5a34e32;
  --panel: #0d293559;
}
.page-tabs { gap: 23px; }
.portrait .specimen-card { aspect-ratio: auto; height: 258px; padding: 8px 25px 14px; }
.portrait .specimen-meta { height: 22px; font-size: 9px; letter-spacing: 1px; }
.portrait .creature { max-height: 166px; }
.portrait .specimen-label { min-height: 49px; margin-top: 3px; }
.portrait .mini-label { font-size: 9px; }
.portrait .specimen-label h1 { font-size: 25px; margin-top: 2px; }
.portrait .stage-label { bottom: 0; font-size: 8px; }
.portrait .reveal-art[data-stage=shown] .stage-label { visibility: hidden; }
.portrait .result-copy { margin: 18px 0 0; }
.portrait .tagline { font-size: 19px; line-height: 1.6; margin: 0; }
.portrait .traits { gap: 6px; margin: 11px 0 17px; }
.portrait .trait { padding: 4px 8px; font-size: 10px; color: var(--paper); border-color: #d5a34e50; background: #d5a34e0b; }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.section-heading h2 { font-family: var(--serif); font-size: 15px; font-weight: 700; letter-spacing: .5px; color: var(--paper); }
.section-heading > span { font-size: 9px; color: var(--muted); }
.radar-panel { padding: 16px 13px 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.radar { display: block; width: 100%; height: auto; overflow: visible; }
.radar-panel .radar { margin-top: 13px; }
.radar-web polygon, .radar-web path { fill: none; stroke: var(--chart-line); stroke-width: 1; }
.radar-web polygon:last-of-type { stroke-width: 1.4; }
.radar-shape { fill: var(--chart-fill); stroke: var(--gold); stroke-width: 1.8; stroke-linejoin: round; }
.radar-dot { fill: var(--gold); stroke: var(--water); stroke-width: 1; }
.radar-label { fill: var(--white); font: 10px var(--font); }
.radar-arrow { fill: var(--muted); }
.radar-value { fill: var(--gold); font: 600 14px var(--font); }
.chart-note { text-align: center; color: var(--muted); font-size: 9px; line-height: 1.7; }
.index-panel, .sketch-panel { margin-top: 26px; }
.index-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; row-gap: 17px; margin-top: 18px; }
.index-label { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; }
.index-label h3 { font-size: 11px; font-weight: 500; margin: 0; }
.index-label > span { color: var(--paper); font-size: 14px; font-variant-numeric: tabular-nums; }
.index-label small { font-size: 8px; color: var(--muted); }
.index-track { height: 4px; border-radius: 4px; background: #8db6c029; overflow: hidden; margin-top: 8px; }
.index-track > span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.index-row:nth-child(2n) .index-track > span { background: var(--gold); }
.index-row > p { margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.7; }
.portrait-sketch { margin: 14px 0 0; }
.portrait-sketch > div { display: grid; grid-template-columns: 4em 1fr; gap: 13px; border-top: 1px solid var(--line); padding: 13px 0; }
.portrait-sketch dt { color: var(--muted); font-size: 10px; line-height: 2.05; padding-top: 1px; }
.portrait-sketch dd { margin: 0; font-size: 12px; line-height: 1.85; color: #d1dfdf; }
.portrait-fine { font-size: 12px; line-height: 2; color: #d1dfdf; padding-top: 13px; border-top: 1px solid var(--line); }
.portrait-score-note { color: var(--muted); font-size: 10px; line-height: 1.85; margin-top: 12px; }
.micro-example { margin-top: 15px; padding: 18px 16px; border: 1px solid var(--line); border-radius: 6px; background: #4e9b880d; }
.micro-example .mini-label { color: var(--gold); letter-spacing: 1px; }
.example-story { font-size: 12px; line-height: 1.95; margin-top: 9px; }
.micro-example blockquote { font-size: 15px; line-height: 1.8; margin: 15px 0; padding-left: 12px; }
.resident-footnote { padding-top: 10px; border-top: 1px solid var(--line); }
.resident-footnote p { font-size: 10px; line-height: 1.9; color: var(--muted); }
.resident-footnote span { color: var(--paper); margin-right: 8px; }
.sea-ending { display: flex; gap: 11px; align-items: center; margin: 14px 0 8px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sea-ending > span { color: var(--gold); font: 26px var(--serif); }
.sea-ending p { font-size: 11px; line-height: 1.85; color: #c4d7da; }
.result > .sea-ending { order: 0; }
.portrait .result-actions { margin-top: 20px; gap: 10px; }
.portrait .result-actions .text-button { min-height: 44px; padding: 5px; }
.portrait .result-actions .text-button + .text-button { margin-top: -10px; color: var(--muted); }
.gallery h1 { font-size: 28px; line-height: 1.5; color: var(--paper); margin-top: 10px; }
.gallery-intro { font-size: 12px; color: var(--muted); margin: 10px 0 18px; }
.gallery > .secondary, .gallery > .primary { width: 100%; font-size: 12px; }
.resident-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 12px; margin-top: 22px; }
.resident-tile { display: flex; flex-direction: column; align-items: center; position: relative; min-width: 0; padding: 10px 8px 8px; border: 1px solid var(--line); border-radius: 6px; background: linear-gradient(145deg, #41647538, #13303e88); text-align: center; }
.resident-tile.is-own { border-color: #d5a34eab; background: linear-gradient(145deg, #d5a34e1c, #13303e88); }
.tile-number { display: flex; width: 100%; justify-content: space-between; align-items: center; color: var(--muted); font-size: 9px; letter-spacing: 1px; }
.tile-number b { color: var(--paper); font-size: 8px; font-weight: 400; letter-spacing: 0; }
.resident-tile > img { width: 100%; height: 104px; object-fit: contain; margin: 4px 0; }
.resident-tile > strong { font-family: var(--serif); font-size: 15px; line-height: 1.6; color: var(--paper); }
.tile-keywords { font-size: 9px; color: var(--muted); line-height: 1.7; margin: 5px -2px 3px; }
.resident-tile .radar-mini { width: 66px; height: 57px; margin: auto 0 0; }
.tile-chart-note { font-size: 8px; color: var(--muted); line-height: 1.6; margin-top: 3px; }
.gallery-toolbar { display: flex; justify-content: space-between; align-items: center; margin: -14px 0 10px; }
.gallery-toolbar > span { font-size: 10px; color: var(--muted); letter-spacing: 2px; }
.gallery-toolbar .text-button { color: var(--muted); }
.own-note { color: var(--gold); font-size: 10px; line-height: 1.8; margin: 0 0 10px; }
.light-profile { text-align: center; }
.light-profile .traits { justify-content: center; }
.light-radar { border: 1px solid var(--line); border-radius: 6px; padding: 12px 10px; background: var(--panel); }
.light-radar .radar { max-width: 255px; margin: 0 auto -16px; }
.light-note { font-size: 11px; color: var(--muted); margin: 16px 0 0; line-height: 1.85; }
.resident-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.resident-pager .secondary { min-height: 46px; font-size: 12px; }
.gallery-profile > .text-button { width: 100%; color: var(--muted); margin-top: 9px; }
.gallery-profile > .primary { width: 100%; margin-top: 18px; }
@media (max-width: 374px) {
  .page-tabs { gap: 20px; }
  .section-heading > span { font-size: 8px; }
  .index-list { column-gap: 15px; }
  .portrait-sketch > div { gap: 10px; }
  .resident-tile > strong { font-size: 14px; }
}


/* Pokémon-style dex reveal: center silhouette → fill → dock → archive */
.result.portrait[data-revealing=true] {
  position: relative;
  min-height: min(70svh, 560px);
}
.result.portrait[data-revealing=true][data-stage=prepared] .specimen-card,
.result.portrait[data-revealing=true][data-stage=silhouette] .specimen-card,
.result.portrait[data-revealing=true][data-stage=fill] .specimen-card,
.result.portrait[data-revealing=true][data-stage=motion] .specimen-card {
  width: min(82%, 318px);
  height: min(58svh, 430px);
  aspect-ratio: 3 / 4;
  margin: clamp(28px, 10vh, 72px) auto 0;
  padding: 10px 22px 14px;
  transition: width .75s cubic-bezier(.22,.7,.2,1), height .75s cubic-bezier(.22,.7,.2,1), margin .75s cubic-bezier(.22,.7,.2,1), transform .75s cubic-bezier(.22,.7,.2,1);
}
.result.portrait[data-revealing=true][data-stage=prepared] .creature,
.result.portrait[data-revealing=true][data-stage=silhouette] .creature,
.result.portrait[data-revealing=true][data-stage=fill] .creature,
.result.portrait[data-revealing=true][data-stage=motion] .creature {
  max-height: min(46svh, 330px);
}

/* Character-card row: left specimen plate + right archive */
.dex-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 10px;
  align-items: stretch;
  width: 100%;
}

.dex-stats {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 228px;
  padding: 11px 11px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: linear-gradient(165deg, #16384a88, #0d293570);
  color: var(--white);
}
.dex-stats[data-stage=pending] {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}
.dex-stats[data-stage=shown] {
  opacity: 1;
  visibility: visible;
  transition: opacity .45s ease;
}
.dex-stats-kicker {
  margin: 0 0 6px;
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--gold);
  text-transform: none;
}
.dex-stats-list { margin: 0; flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.dex-stat-row {
  display: grid;
  grid-template-columns: 4.4em 1fr;
  gap: 7px;
  padding: 6px 0;
  border-top: 1px solid #8db6c029;
  align-items: start;
}
.dex-stat-row:first-child { border-top: 0; padding-top: 2px; }
.dex-stat-row dt {
  margin: 0;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.55;
  letter-spacing: .3px;
}
.dex-stat-row dd {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: #d8e6e6;
  word-break: break-word;
}
.dex-stat-row:last-child dd {
  color: var(--paper);
  font-size: 11.5px;
  line-height: 1.6;
}

/* During center reveal: hide archive, let card dominate */
.result.portrait[data-revealing=true][data-stage=prepared] .dex-top,
.result.portrait[data-revealing=true][data-stage=silhouette] .dex-top,
.result.portrait[data-revealing=true][data-stage=fill] .dex-top,
.result.portrait[data-revealing=true][data-stage=motion] .dex-top {
  display: block;
}
.result.portrait[data-revealing=true][data-stage=prepared] .dex-stats,
.result.portrait[data-revealing=true][data-stage=silhouette] .dex-stats,
.result.portrait[data-revealing=true][data-stage=fill] .dex-stats,
.result.portrait[data-revealing=true][data-stage=motion] .dex-stats {
  display: none;
}

/* Docked / final: left plate sits in grid cell */
.result.portrait[data-revealing=true][data-stage=dock] .specimen-card,
.result.portrait[data-stage=shown] .specimen-card,
.result.portrait[data-revealing=false]:not(.gallery-profile) .specimen-card {
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 228px;
  aspect-ratio: auto;
  margin: 0;
  align-self: stretch;
  padding: 8px 10px 9px;
  transition: width .75s cubic-bezier(.22,.7,.2,1), height .75s cubic-bezier(.22,.7,.2,1), margin .75s cubic-bezier(.22,.7,.2,1), max-width .75s cubic-bezier(.22,.7,.2,1);
}
.result.portrait { display: flex; flex-direction: column; align-items: stretch; }

/* Specimen plate typography when docked half-width */
.result.portrait[data-revealing=true][data-stage=dock] .specimen-meta,
.result.portrait[data-stage=shown] .specimen-meta,
.result.portrait[data-revealing=false]:not(.gallery-profile) .specimen-meta {
  height: auto;
  min-height: 18px;
  justify-content: space-between;
  padding: 0 2px;
  font-size: 9px;
  letter-spacing: .8px;
}
.result.portrait .specimen-no { font-variant-numeric: tabular-nums; color: var(--ink); opacity: .72; }
.result.portrait .specimen-who { color: var(--blue); letter-spacing: .4px; }
.result.portrait[data-revealing=true][data-stage=dock] .reveal-art,
.result.portrait[data-stage=shown] .reveal-art,
.result.portrait[data-revealing=false]:not(.gallery-profile) .reveal-art {
  flex: 1 1 auto;
  min-height: 108px;
}
.result.portrait[data-revealing=true][data-stage=dock] .creature,
.result.portrait[data-stage=shown] .creature,
.result.portrait[data-revealing=false]:not(.gallery-profile) .creature {
  max-height: 112px;
  transition: max-height .75s cubic-bezier(.22,.7,.2,1);
}
.result.portrait[data-revealing=true][data-stage=dock] .specimen-label,
.result.portrait[data-stage=shown] .specimen-label,
.result.portrait[data-revealing=false]:not(.gallery-profile) .specimen-label {
  flex-shrink: 0;
  min-height: 0;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid #2a5a6e22;
  text-align: center;
}
.result.portrait[data-revealing=true][data-stage=dock] .specimen-label .mini-label,
.result.portrait[data-stage=shown] .specimen-label .mini-label,
.result.portrait[data-revealing=false]:not(.gallery-profile) .specimen-label .mini-label {
  display: block;
  font-size: 8px;
  letter-spacing: 1.2px;
}
.result.portrait[data-revealing=true][data-stage=dock] .specimen-label h1,
.result.portrait[data-stage=shown] .specimen-label h1,
.result.portrait[data-revealing=false]:not(.gallery-profile) .specimen-label h1 {
  font-size: 17px;
  line-height: 1.25;
  margin: 3px 0 0;
}

.result.portrait.gallery-profile .dex-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 10px;
}
.result.portrait.gallery-profile .specimen-card {
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 228px;
  margin: 0;
}
.result.portrait.gallery-profile .dex-stats { min-height: 228px; }

@media (max-width: 374px) {
  .dex-top { gap: 8px; }
  .dex-stat-row { grid-template-columns: 3.8em 1fr; gap: 5px; }
  .dex-stats { padding: 10px 8px 9px; }
  .result.portrait[data-stage=shown] .specimen-label h1,
  .result.portrait[data-revealing=false]:not(.gallery-profile) .specimen-label h1 {
    font-size: 15px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .result.portrait .specimen-card,
  .result.portrait .creature {
    transition: none !important;
  }
  .dex-stats { transition: none !important; opacity: 1 !important; visibility: visible !important; }
}
