#studio { padding-block: 20px clamp(48px,7vw,98px); }
#studio, #modal { --edge: 10px; --mono: "Cascadia Mono", Consolas, monospace; }
.topline { display: flex; align-items: center; gap: 1rem; border-bottom: 1px solid var(--line); min-height: 46px; margin-bottom: clamp(26px,4vw,58px); }
.topline a, .topline button { font-size: .88rem; text-decoration: none; }
.topline button, .rp-download { border: 0; background: none; padding: 5px 0; color: var(--plum); text-decoration: underline; text-underline-offset: 3px; font-weight: 650; }
#context { margin-left: auto; color: var(--muted); font-size: .78rem; }
.workspace { display: grid; grid-template-columns: minmax(0,.94fr) minmax(0,1.06fr); gap: clamp(25px,5.3vw,85px); align-items: start; }
.panel, #assessment, #report-map { min-width: 0; }
.panel h1 { max-width: 12ch; }
.panel .intro { max-width: 47ch; font-size: clamp(1rem,1.25vw,1.16rem); color: var(--muted); margin: 16px 0 20px; }
.file-actions, .check { display: flex; align-items: center; gap: 12px; }
.file-actions { flex-wrap: wrap; }
.small, .rp-pref-hint, .rp-match-scope, .rp-meta, #range { font-size: .865rem; color: var(--muted); }
.rp-filters { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
#setup-filters, #result-filters { margin: 21px 0; }
.rp-filters label, .rp-map-fields label { display: grid; min-width: 0; gap: 5px; font-size: .825rem; font-weight: 650; }
#studio select { color: var(--ink); background: var(--light); border: 1px solid #bcb2b8; border-radius: 7px; padding: 8px; width: 100%; min-width: 0; min-height: 42px; font-weight: 450; }
.rp-pref-hint { margin-top: 8px; }
.check { margin: 18px 0 14px; }
.check input { flex: none; width: 18px; height: 18px; accent-color: var(--plum); }
#studio button:disabled { opacity: .5; cursor: default; }
#error:not(:empty) { color: #923f28; padding: 9px 0; }
.stage { overflow: hidden; border-radius: var(--edge); border: 1px solid var(--line); background: var(--light); margin: 0; width: 100%; min-width: 0; }
.empty img, .imagewrap #photo { display: block; width: 100%; height: 100%; object-fit: contain; }
.empty img { height: auto; }
.imagewrap { position: relative; background: #e9e4de; }
.imagewrap #photo { max-height: min(67vh,670px); }
.imagewrap #mesh { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.imagewrap .beam { display: none; position: absolute; left: 0; right: 0; height: 2px; background: #ffe1ca; box-shadow: 0 0 4px #fff, 0 -7px 16px 3px #ffdac9a3; }
.revealing #mesh { animation: mask-down 1.07s linear both; }
.revealing .beam { display: block; animation: scan-down 1.07s linear both; }
@keyframes mask-down { from { clip-path: inset(0 0 100%); } to { clip-path: inset(0); } }
@keyframes scan-down { from { top: 0; } to { top: 99%; } }
.stagecap { font-size: .84rem; color: var(--muted); padding: 10px 15px; }
.rp-head { margin-bottom: clamp(18px,2.2vw,30px); }
.rp-title { font-size: clamp(2.6rem,5.5vw,5.6rem); }
.rp-tabs { display: flex; flex-wrap: wrap; gap: clamp(12px,3vw,42px); border-bottom: 1px solid var(--line); margin-top: 18px; }
.rp-tab, .rp-guide { background: transparent; color: var(--muted); border: 0; }
.rp-tab { min-height: 44px; padding: 6px 0; font-size: .96rem; font-weight: 650; }
.rp-tab[aria-selected=true] { color: var(--plum); box-shadow: inset 0 -2px var(--plum); }
.has-rating .workspace { gap: clamp(18px,2.5vw,40px); }
#studio[data-report-view=overview] .workspace { grid-template-columns: minmax(0,1.19fr) minmax(0,1fr); }
.has-rating #assessment { grid-column: 1; grid-row: 1; }
.has-rating .stage { grid-column: 2; grid-row: 1; }
#studio[data-report-view=overview] .stage #imagewrap, #studio[data-report-view=overview] .stage #stagecap, #studio[data-report-view=matches] .workspace { display: none; }
.score-card { overflow: hidden; background: var(--light); border-radius: var(--edge); border: 1px solid var(--line); }
.score-summary { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(0,1fr); align-items: stretch; }
.score-info { padding: clamp(15px,2.2vw,32px); min-width: 0; }
.score-label, .rp-map-kicker { color: var(--plum); font: bold .72rem/1.4 var(--mono); letter-spacing: .065em; text-transform: uppercase; }
.rp-value { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 8px 0 15px; }
.rp-value strong { font: 600 clamp(3.9rem,6.8vw,7.2rem)/.98 var(--body); letter-spacing: -.075em; font-variant-numeric: tabular-nums; }
.rp-value span { color: var(--muted); white-space: nowrap; font-size: .92rem; }
.score-context { border-top: 1px solid var(--line); padding-top: 12px; margin: 0 0 5px; font-size: clamp(1rem,1.4vw,1.26rem); line-height: 1.3; }
.score-reference, .score-actions span, .download-status { color: var(--muted); font-size: .87rem; line-height: 1.5; }
.score-summary lm-point-view { width: 100%; max-width: none; border-radius: 0; display: grid; }
.score-actions { border-top: 1px solid var(--line); padding: 15px clamp(14px,2vw,25px); display: flex; align-items: center; gap: 8px 15px; flex-wrap: wrap; }
.score-actions .primary { min-height: 42px; padding: 7px 15px; }
.download-status:not(:empty) { padding: 0 20px 11px; }
.rp-route { display: flex; align-items: center; justify-content: space-between; width: 100%; text-align: left; margin: 13px 0; border: 1px solid var(--line); border-radius: 8px; color: var(--plum); background: var(--light); padding: 12px 17px; font-weight: 650; }
.rp-route span { font-size: 1.1rem; }
.rp-about, .rp-map-about { border-block-start: 1px solid var(--line); color: var(--ink); padding: 9px 0; }
summary { cursor: pointer; font-weight: 650; }
.rp-about p, .rp-map-about p { color: var(--muted); font-size: .92rem; margin: .55rem 0; }
#repeat-area { margin-top: 12px; }
#repeat-note:not(:empty) { margin-top: 6px; }
.rp-pair-preview { padding: clamp(15px,1.7vw,25px); }
.rp-pair-head, .rp-pair-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; }
.rp-pair-head, .rp-compare h2, .rp-detail h2 { margin-bottom: 12px; }
.rp-pair-tag { color: var(--muted); font-size: .78rem; }
.rp-pair-head h2, .rp-detail h2, .rp-compare h2, .rp-section-title, .rp-match-head h2, .rp-pair-preview > h2 { font: 500 clamp(1.5rem,2.5vw,2.2rem)/1.15 var(--serif); letter-spacing: -.035em; }
.rp-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; min-width: 0; }
.rp-pair > figure { min-width: 0; }
.rp-pair img, .rp-pair canvas { display: block; width: 100%; aspect-ratio: 4 / 4.9; object-fit: contain; background: #e8e4df; border-radius: 6px; }
.rp-pair-preview .rp-pair img, .rp-pair-preview .rp-pair canvas { object-fit: cover; }
.rp-pair-preview .rp-pair img { object-position: center 40%; }
.rp-pair figcaption { display: grid; margin-top: 6px; font-weight: 650; }
.rp-pair-age, .rp-pair-score { font-size: .83rem; font-weight: 500; color: var(--muted); }
.rp-pair-score { color: var(--plum); }
.rp-match-scope { margin: 12px 0; }
.rp-pair-actions { border-top: 1px solid var(--line); padding-top: 12px; }
.rp-pair-actions .secondary { min-height: 40px; padding: 6px 13px; }
.rp-guides, .rp-map-fields { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.rp-guide { min-height: 38px; padding: 5px 13px; border-radius: 22px; border: 1px solid var(--line); background: var(--light); font-size: .87rem; }
.rp-guide[aria-pressed=true] { background: var(--plum); color: var(--light); border-color: var(--plum); }
.rp-map-fields label { max-width: 100%; }
.rp-map-answer { margin: 5px 0 6px; font: 500 clamp(1.5rem,2.6vw,2.2rem)/1.13 var(--serif); }
.rp-map-meaning, .rp-map-relationship, .rp-map-retakes { color: var(--muted); font-size: .98rem; }
.rp-map-reading { padding-top: 14px; border-top: 1px solid var(--line); }
.rp-map-data { display: flex; gap: 15px 28px; flex-wrap: wrap; border-block: 1px solid var(--line); padding: 11px 0; margin: 13px 0; }
.rp-map-data dt { color: var(--muted); font-size: .82rem; }
.rp-map-data dd { margin: 0; font-weight: 650; }
.rp-map-about { margin-top: 14px; }
.rp-map-caption { display: block; color: var(--ink); font-weight: 600; }
.rp-map-legend, .rp-map-legend > span { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 13px; }
.rp-map-legend > span { gap: 5px; }
.rp-map-legend i { width: 16px; border-top: 3px solid #64f4d4; filter: drop-shadow(0 0 1px #152b35); }
.rp-map-legend i.dashed { border-top: 3px dashed #fff1c2; }
.rp-map-legend i.dot, .rp-map-legend i.ring { width: 10px; height: 10px; background: #64f4d4; border-radius: 50%; border: 1px solid #373236; }
.rp-map-legend i.ring { background: none; border: 2px solid #fff1c2; }
.rp-match-head p { color: var(--muted); margin-top: 4px; }
#result-filters .rp-filters { grid-template-columns: repeat(auto-fit,minmax(135px,1fr)); }
#range { margin-bottom: 12px; }
.rp-match-recovery { display: flex; gap: 8px; flex-wrap: wrap; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(180px,100%),1fr)); gap: 14px; }
.rp-portrait { border: 1px solid var(--line); border-radius: 8px; background: var(--light); text-align: left; color: var(--ink); overflow: hidden; padding: 0; min-width: 0; }
.rp-portrait-frame { position: relative; }
.rp-portrait-frame img { display: block; width: 100%; aspect-ratio: 4/4.7; object-fit: cover; object-position: center 40%; background: #e7e2dc; }
.rp-order, .rp-tile-score { position: absolute; background: var(--light); color: var(--ink); padding: 3px 6px; border-radius: 4px; font-size: .77rem; }
.rp-order { bottom: 6px; left: 6px; }
.rp-tile-score { top: 6px; right: 6px; font-weight: 650; }
.rp-caption { display: grid; padding: 8px 10px; }
.rp-caption > span { color: var(--muted); font-size: .84rem; }
.rp-more { margin-top: 16px; }
#modal { padding: clamp(15px,3vw,36px); width: min(92vw,670px); max-height: 92dvh; border: 1px solid var(--line); border-radius: var(--edge); background: var(--light); color: var(--ink); }
#modal::backdrop { background: #27202bcc; }
#close { float: right; border: 1px solid var(--line); background: var(--paper); min-height: 37px; min-width: 37px; border-radius: 50%; font-size: 1.2rem; }
#dialog-body h2 { padding-right: 40px; }
.rp-compare p { margin-top: 10px; }
.rp-zoom { display: block; width: 100%; position: relative; background: none; border: 0; padding: 0; }
.rp-zoom-label { position: absolute; bottom: 5px; right: 5px; border-radius: 5px; color: var(--ink); padding: 3px 7px; background: var(--light); font-size: .75rem; }
.rp-detail img { display: block; margin: 12px auto; max-width: 100%; max-height: 68dvh; }
.site-footer { border-top: 1px solid var(--line); }
@media(max-width:800px) {
  .workspace, #studio[data-report-view=overview] .workspace { grid-template-columns: 1fr; gap: 19px; }
  .has-rating .stage, .has-rating #assessment { grid-column: auto; grid-row: auto; }
  .has-rating #assessment { order: -1; }
  .rp-pair-preview .rp-pair img, .rp-pair-preview .rp-pair canvas { aspect-ratio: 1.08; }
  .rp-tabs { gap: 18px; }
  .stage { max-width: 660px; }
  .panel h1 { max-width: 100%; }
  .score-summary { grid-template-columns: minmax(0,1.2fr) minmax(0,1fr); }
  .score-info { padding: clamp(15px,3.5vw,26px); }
  #studio[data-report-view=map] #assessment, #studio[data-report-view=map] #report-map { display: contents; }
  #studio[data-report-view=map] .rp-map-controls { grid-row: 1; }
  #studio[data-report-view=map] .rp-map-reading { grid-row: 2; }
  #studio[data-report-view=map] .stage { grid-row: 3; }
  #studio[data-report-view=map] .rp-map-context, #studio[data-report-view=map] #report-map > .rp-map-data { grid-row: 4; }
  .gallery { grid-template-columns: repeat(auto-fit,minmax(min(144px,43%),1fr)); gap: 8px; }
}
@media(max-width:440px) {
  .rp-value { gap: 4px; }
  .rp-value span, .score-actions span, .score-reference { font-size: .77rem; }
  .score-label { font-size: .64rem; }
  .rp-tab { font-size: .88rem; }
  .rp-pair { gap: 6px; }
}
@media(prefers-reduced-motion:reduce) {
  .revealing #mesh, .revealing .beam { animation: none; }
  .revealing .beam { display: none; }
}
