:root {
  color-scheme: light;
  --ink: #203a37;
  --muted: #617267;
  --line: #dfe5de;
  --surface: #fff;
  --canvas: #f7f8f5;
  --primary: #167267;
  --primary-dark: #14594f;
  --accent: #eaf3ed;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  font-synthesis: none;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; color: inherit; }
button, select, input[type="range"] { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
button, input, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid #80bdb0; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
button, label, input, select, section, aside, article, .workspace, .preview-panel { min-width: 0; }
svg { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.site-header, .workspace, .site-footer { width: min(1392px, calc(100% - 64px)); margin-inline: auto; }
.site-header { display: flex; align-items: center; justify-content: space-between; min-height: 98px; gap: 20px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; width: 41px; height: 41px; flex: none; place-items: center; border-radius: 12px; color: var(--primary); background: #e5eee6; }
.brand-mark svg { width: 28px; height: 28px; }
h1 { font-size: 20px; font-weight: 650; line-height: 1.45; letter-spacing: .055em; }
.brand p { color: var(--muted); margin-top: 3px; font-size: 10px; letter-spacing: .08em; }
.header-meta { display: flex; align-items: center; gap: 8px; color: #697a70; font-size: 11px; white-space: nowrap; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #528570; }
.header-separator { width: 1px; height: 12px; background: #cfd9d0; margin-inline: 6px; }

.workspace { display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 30px; align-items: start; padding-top: 27px; }
.control-panel { padding-right: 27px; border-right: 1px solid var(--line); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
h2 { font-size: 13px; font-weight: 650; letter-spacing: .03em; line-height: 1.5; }
.text-button { border: 0; padding: 4px 0 4px 10px; font-size: 11px; background: none; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.text-button:hover { color: var(--primary); }
.field-label { display: block; color: #53685d; font-size: 11px; font-weight: 500; margin-bottom: 8px; }
select { display: block; width: 100%; height: 40px; padding: 0 11px; font-size: 13px; line-height: normal; border: 1px solid #d7dfd7; border-radius: 6px; background-color: var(--surface); }
select:hover { border-color: #a4b8aa; }
.field-help { margin-top: 7px; font-size: 10px; color: var(--muted); line-height: 1.75; }
.fixating-group { margin-top: 17px; padding: 12px; background: #edf2eb; border-radius: 6px; }
.angle-control { min-width: 0; margin: 26px 0 0; border: 0; padding: 0; }
.angle-control legend { display: flex; gap: 7px; align-items: center; width: 100%; padding: 0 0 13px; margin-bottom: 14px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 650; }
.stage-dot { display: inline-block; width: 7px; height: 7px; flex: none; border-radius: 50%; }
.pre-dot { background: #93a399; }
.post-dot { background: var(--primary); }
.angle-label { margin-top: 15px; }
.number-field { display: flex; align-items: center; width: 100%; height: 48px; padding-right: 13px; background: var(--surface); border: 1px solid #d7dfd7; border-radius: 6px; }
.number-field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px #16726715; }
.number-field input { min-width: 0; width: 100%; height: 100%; padding: 0 13px; border: 0; border-radius: inherit; background: transparent; font-size: 24px; font-weight: 550; font-variant-numeric: tabular-nums; }
.number-field input:focus-visible { outline: none; }
.number-field > span { font-size: 15px; color: #76877b; }
.post-control .number-field input { color: var(--primary-dark); }
.angle-range { display: block; width: 100%; height: 22px; margin: 12px 0 0; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; }
.angle-range::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: #dce4da; }
.angle-range::-moz-range-track { height: 3px; border-radius: 2px; background: #dce4da; }
.angle-range::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6.5px; border: 3px solid var(--surface); border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 1px #b7cabb, 0 1px 3px #203a3714; }
.angle-range::-moz-range-thumb { width: 10px; height: 10px; border: 3px solid var(--surface); border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 1px #b7cabb; }
.angle-range:hover::-webkit-slider-thumb { box-shadow: 0 0 0 4px #16726715; }
.range-scale { display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: center; margin-top: 1px; color: #89958b; font-size: 9px; font-variant-numeric: tabular-nums; line-height: 1.6; }
.range-scale > span:last-child { text-align: right; }
.zero-button { justify-self: center; min-width: 44px; min-height: 44px; padding: 2px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--primary-dark); font-size: inherit; line-height: 1.5; }
.zero-button:hover { border-color: var(--primary); background: var(--accent); }
.angle-range { background: linear-gradient(var(--primary), var(--primary)) center / 2px 15px no-repeat; }
.unit-note { margin-top: 22px; font-size: 10px; color: var(--muted); }
.privacy-note { display: flex; align-items: center; gap: 6px; padding-top: 17px; margin-top: 17px; border-top: 1px solid var(--line); font-size: 10px; color: var(--muted); }
.privacy-note svg { width: 14px; height: 14px; }
.validation-message { margin-top: 17px; padding: 11px 12px; color: #975337; border: 1px solid #ebd7bf; border-radius: 6px; background: #fff7eb; font-size: 11px; line-height: 1.75; overflow-wrap: anywhere; }

.model-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.model-heading p { color: var(--muted); font-size: 10px; line-height: 1.5; }
.model-picker { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.model-button { display: grid; justify-items: center; align-content: start; width: 100%; padding: 5px 5px 6px; border: 1px solid transparent; border-radius: 8px; background: transparent; transition: background-color .15s ease, border-color .15s ease; }
.model-button:hover { background: #edf1e9; }
.model-button[aria-pressed="true"] { background: #e8f0e7; border-color: #719b80; }
.model-thumb { display: block; width: 100%; height: auto; max-height: 74px; aspect-ratio: 4 / 5; border-radius: 5px; object-fit: cover; object-position: center 32%; background: #e3e6df; }
.model-name { display: block; margin-top: 7px; color: #526458; font-size: 10px; font-weight: 550; line-height: 1.5; white-space: nowrap; }
.model-age { display: block; margin-top: 1px; color: #8a9488; font-size: 9px; line-height: 1.3; white-space: nowrap; }
.model-button[aria-pressed="true"] .model-name { color: #235c40; }
.model-button[aria-pressed="true"] .model-age { color: #608369; }

.comparison-section { margin-top: 22px; }
.comparison-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.comparison-heading h2 { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; }
.current-model { color: #7e8b80; font-size: 10px; font-weight: 400; letter-spacing: 0; }
#conditionSummary { margin-top: 5px; font-size: 10px; color: var(--muted); line-height: 1.6; }
.focus-button { display: flex; align-items: center; gap: 6px; flex: none; min-height: 33px; padding: 6px 10px; border: 1px solid #d5ded2; border-radius: 6px; color: #4a6655; background: transparent; font-size: 11px; }
.focus-button svg { width: 16px; height: 16px; }
.focus-button:hover, .focus-button[aria-pressed="true"] { background: #e8f0e7; border-color: #97b59c; color: var(--primary-dark); }
.comparison-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.comparison-card { overflow: hidden; border: 1px solid #dce2d9; border-radius: 9px; background: #fff; }
.post-card { border-color: #b2c5b6; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 45px; padding: 10px 14px; border-bottom: 1px solid #e0e5dd; }
.card-heading h3 { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 550; white-space: nowrap; }
.post-card .card-heading { background: #edf3ed; }
.post-card h3 { color: var(--primary-dark); }
.angle-summary { display: flex; align-items: baseline; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.angle-summary > span { color: #7a897e; font-size: 10px; }
.angle-summary strong { font-size: 19px; font-weight: 550; font-variant-numeric: tabular-nums; line-height: 1.2; letter-spacing: -.02em; }
.post-card .angle-summary strong { color: var(--primary-dark); }
.portrait { position: relative; width: 100%; aspect-ratio: 4 / 5; overflow: hidden; background: #e6e5e2; }
.portrait canvas { display: block; width: 100%; height: 100%; object-fit: contain; }
.portrait[aria-busy="true"]::after { content: "読み込み中…"; position: absolute; inset: 0; display: grid; place-items: center; color: #67776c; background: #eef0eaed; font-size: 12px; }
.portrait.is-error::after { content: "画像を読み込めませんでした"; position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; color: #8a5744; background: #f7f0e9; font-size: 12px; line-height: 1.8; text-align: center; }
.comparison-grid.eye-focus .portrait { aspect-ratio: 2.5 / 1; }
.comparison-caption { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 5px 12px; margin-top: 10px; color: #889287; font-size: 9px; line-height: 1.6; }
.image-state { margin-top: 8px; color: #778978; font-size: 11px; line-height: 1.6; }
.image-state:empty { display: none; }
.notice { display: flex; align-items: flex-start; gap: 7px; margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--line); color: #7a8276; font-size: 10px; line-height: 1.8; }
.notice svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.site-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 27px; padding-bottom: 21px; color: #98a091; font-size: 9px; letter-spacing: .02em; }

@media (min-width: 1100px) and (max-height: 950px) {
  .site-header { min-height: 82px; }
  .workspace { padding-top: 22px; }
  .model-thumb { max-height: 65px; }
  .comparison-section { margin-top: 17px; }
  .site-footer { margin-top: 20px; }
}

@media (min-width: 821px) and (max-height: 950px) {
  .site-header { min-height: 72px; }
  .workspace { padding-top: 18px; }
  .panel-heading { margin-bottom: 15px; }
  .angle-control { margin-top: 18px; }
  .angle-control legend { padding-bottom: 8px; margin-bottom: 10px; }
  .angle-label { margin-top: 11px; }
  .unit-note { margin-top: 15px; }
  .privacy-note { margin-top: 12px; padding-top: 12px; }
  .comparison-grid:not(.eye-focus) .portrait { aspect-ratio: auto; height: max(310px, calc(100svh - 390px)); }
}

@media (max-width: 1100px) {
  .site-header, .workspace, .site-footer { width: calc(100% - 40px); }
  .workspace { grid-template-columns: 236px minmax(0, 1fr); gap: 22px; }
  .control-panel { padding-right: 20px; }
  .model-picker { gap: 3px; }
  .model-button { padding-inline: 3px; }
  .model-thumb { max-height: 63px; }
  .model-heading p { font-size: 9px; }
  .model-age { font-size: 8px; }
  .comparison-grid { gap: 10px; }
  .card-heading { padding: 10px; }
  .angle-summary { gap: 5px; }
  .angle-summary > span { font-size: 9px; }
  .angle-summary strong { font-size: 17px; }
  .comparison-caption { font-size: 8px; }
}

@media (max-width: 820px) {
  .site-header { min-height: 84px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 25px; padding-top: 23px; }
  .control-panel { padding: 0 0 21px; border-right: 0; border-bottom: 1px solid var(--line); }
  .panel-heading { margin-bottom: 16px; }
  .controls { display: grid; grid-template-columns: .85fr 1fr 1fr; gap: 20px; align-items: start; }
  .eye-controls { padding-top: 39px; }
  .angle-control { margin: 0; }
  .angle-control legend { padding-bottom: 10px; margin-bottom: 11px; }
  .unit-note { margin-top: 15px; }
  .privacy-note { border: 0; padding: 0; margin-top: 6px; }
  .model-picker { gap: 6px; }
  .model-button { padding-inline: 5px; }
  .model-thumb { max-height: 81px; }
  .model-heading p { font-size: 10px; }
  .model-age { font-size: 9px; }
  .comparison-caption { font-size: 9px; }
  .card-heading { min-height: 45px; padding-inline: 14px; }
  .angle-summary > span { font-size: 10px; }
  .angle-summary strong { font-size: 19px; }
  .notice { margin-top: 16px; }
}

@media (max-width: 540px) {
  .site-header, .workspace, .site-footer { width: calc(100% - 28px); }
  .site-header { min-height: 79px; gap: 10px; }
  .brand { gap: 9px; }
  .brand-mark { width: 35px; height: 35px; border-radius: 10px; }
  .brand-mark svg { width: 24px; height: 24px; }
  h1 { font-size: 17px; }
  .brand p { font-size: 8px; }
  .header-meta { gap: 5px; font-size: 9px; }
  .header-separator { display: none; }
  .header-meta { max-width: 58px; flex-wrap: wrap; justify-content: flex-end; }
  .controls { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 19px 16px; }
  .eye-controls { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 0 10px; grid-column: 1 / -1; padding-top: 0; }
  .eye-controls > .field-label { margin: 0; }
  .eye-controls > .field-help { grid-column: 1 / -1; margin-top: 6px; }
  .fixating-group { grid-column: 1 / -1; margin-top: 10px; }
  .field-label { font-size: 10px; }
  .field-help { font-size: 9px; }
  select { min-height: 40px; font-size: 12px; }
  .angle-control legend { font-size: 12px; }
  .angle-label { min-height: 15px; font-size: 10px; margin-top: 13px; }
  .number-field { height: 45px; }
  .number-field input { font-size: 23px; }
  .unit-note, .privacy-note { font-size: 9px; }
  .model-heading { margin-bottom: 10px; gap: 8px; }
  .model-heading p { max-width: 175px; font-size: 9px; text-align: right; }
  .model-picker { display: grid; grid-template-columns: repeat(8, 64px); gap: 5px; overflow-x: auto; overscroll-behavior-inline: contain; padding: 2px 2px 8px; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: #c6d2c2 transparent; }
  .model-button { scroll-snap-align: start; }
  .model-thumb { max-height: 65px; }
  .model-name { font-size: 10px; }
  .comparison-section { margin-top: 18px; }
  .comparison-heading h2 { gap: 6px; }
  .current-model { font-size: 9px; }
  #conditionSummary { font-size: 9px; }
  .focus-button { padding: 6px 8px; font-size: 10px; }
  .focus-button svg { width: 14px; height: 14px; }
  .comparison-grid { gap: 8px; }
  .comparison-card { border-radius: 7px; }
  .card-heading { align-items: flex-start; flex-direction: column; gap: 7px; padding: 10px 10px 9px; }
  .card-heading h3 { gap: 5px; font-size: 11px; }
  .stage-dot { width: 6px; height: 6px; }
  .angle-summary { align-self: flex-end; gap: 7px; }
  .angle-summary > span { font-size: 9px; }
  .angle-summary strong { font-size: 18px; }
  .portrait[aria-busy="true"]::after, .portrait.is-error::after { font-size: 10px; }
  .comparison-caption { gap: 3px; margin-top: 9px; font-size: 8px; }
  .notice { font-size: 9px; }
  .site-footer { margin-top: 21px; font-size: 8px; }
}

/* 診察室でも条件と注意書きを読める文字サイズに統一する。 */
body { font-size: 1rem; }
.brand p, .header-meta, .field-help, .range-scale, .unit-note, .privacy-note,
.model-heading p, .model-age, .current-model, #conditionSummary,
.comparison-caption, .notice, .site-footer { font-size: .75rem; }
h2 { font-size: .9375rem; }
.text-button, .field-label, .angle-control legend, .model-name,
.focus-button, .card-heading h3, .angle-summary > span,
.validation-message, .image-state { font-size: .875rem; }
select { font-size: 1rem; }
.range-scale, .model-age, .current-model, .angle-summary > span,
.comparison-caption, .notice, .site-footer { color: var(--muted); }
.card-heading { flex-wrap: wrap; }
.angle-summary { margin-left: auto; }
.model-button { min-height: 44px; }
.model-heading { align-items: start; }
.preview-notice { margin: 0 0 14px; padding: 10px 12px; border: 1px solid #e1d4ba; border-radius: 6px; background: #fffaf0; color: #67573c; font-size: .875rem; }
.retry-button { margin-top: 10px; min-height: 44px; }
.model-button.image-failed .model-thumb { outline: 1px dashed #a67c55; background: #f6eade; }
.no-script { margin: 20px; padding: 16px; background: #fff2da; color: #67573c; }
.angle-range { height: 44px; margin-top: 6px; }
.focus-button { min-height: 44px; }
.vertical-control { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.vertical-summary { display: flex; width: 100%; justify-content: flex-end; align-items: baseline; gap: 8px; color: var(--muted); font-size: .8125rem; }
.vertical-summary strong { color: var(--ink); font-size: 1rem; font-weight: 550; font-variant-numeric: tabular-nums; }
.angle-summary { flex-wrap: wrap; }
@media (min-width: 821px) {
  .control-panel { max-height: calc(100svh - 115px); overflow-y: auto; scrollbar-width: thin; scrollbar-gutter: stable; overscroll-behavior-y: contain; }
}

@media (max-width: 540px) {
  .header-meta { max-width: 85px; }
  .brand p { font-size: .75rem; letter-spacing: 0; }
  .model-picker { grid-template-columns: repeat(8, 72px); }
  .model-heading p { max-width: 175px; }
  .comparison-heading { align-items: flex-start; flex-wrap: wrap; }
  .comparison-heading h2 { display: block; }
  .current-model { display: block; margin-top: 3px; }
  .focus-button { font-size: .8125rem; }
  .card-heading { padding-inline: 8px; }
  .card-heading h3, .angle-summary > span { font-size: .8125rem; }
  .angle-label { min-height: 2.7em; }
  .angle-summary { gap: 5px; }
  .angle-summary strong { font-size: 1.125rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
