/* 白内障シミュレータ Web Edition（第 1 版）。色のシミュレータ Web の app.css を写し、色名・強度の札・色空間の設定を外し、研究向けの設定の脇の板（#lab）を足した。 */
:root { --fs-title: 18px; --fs-section: 16px; --fs-item: 14px; --fs-text: 13px; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Hiragino Kaku Gothic Pro", "ヒラギノ角ゴ Pro W3", Meiryo, "メイリオ", system-ui, sans-serif; color: #404040; font-size: 14px; line-height: 1.6; background: #fff; }
a { color: #cd562c; }
button { font: inherit; }
[hidden] { display: none !important; }
.bar { background: linear-gradient(#404040, #c0c0c0); height: 44px; display: flex; align-items: center; justify-content: center; position: relative; }
.brand { color: #fff; font-size: 16px; text-shadow: 0 -1px 0 rgba(0,0,0,.25); } .brand small { margin-left: 8px; font-size: 11px; opacity: .85; }
#main { padding: 12px 0 0; }
.toolbar { margin: 0 auto; max-width: 1200px; padding: 0 12px; }
.seg-btn span { pointer-events: none; }
.plate.txt { font-weight: bold; font-size: calc(15px * var(--u)); color: #404040; } .plate.txt[aria-pressed="true"] { color: #fff; }
#stage { position: relative; margin: 12px 0 0; background: var(--ui-screen-background); overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
#canvas { display: block; width: 100%; height: 100%; }
#labels > div { position: absolute; color: #fff; font-weight: bold; line-height: 1.3; white-space: nowrap; pointer-events: none; text-shadow: 2px 2px 2.5px #000; }
#labels > div.zoom { font-weight: normal; }
#msg { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); max-width: 90%; padding: 14px 18px; background: rgba(0,0,0,.75); color: #fff; border-radius: 8px; text-align: center; }
#video { position: fixed; left: 0; bottom: 0; width: 2px; height: 2px; opacity: 0; pointer-events: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

dialog { border: 1px solid #aaa; border-radius: 8px; padding: 16px 20px; max-width: min(94vw, 560px); color: #404040; }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog h3 { margin: 0 0 10px; font-size: var(--fs-title); }
.preview { text-align: center; } #saveimg { max-width: 100%; height: auto; background: #fff; }
.actions { margin-top: 14px; display: flex; justify-content: flex-end; gap: 8px; }
.actions button { min-width: 6em; padding: 6px 14px; border: 1px solid #999; border-radius: 6px; background: #f2f2f2; cursor: pointer; }
.actions button.primary { background: var(--ui-selection-blue); border-color: var(--ui-selection-blue); color: #fff; }
dialog.settings { width: min(94vw, 460px); padding: 0 0 16px; }
.dhead { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 10px 14px; border-bottom: 1px solid #ccc; background: #f4f4f4; position: sticky; top: 0; }
.dhead h3 { margin: 0; font-size: var(--fs-title); } .dhead button { justify-self: start; border: 0; background: none; color: var(--ui-selection-blue); font-size: 15px; cursor: pointer; padding: 4px 0; }
dialog.settings h4 { margin: 18px 16px 6px; font-size: var(--fs-section); color: #777; }
dialog.settings .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 16px; background: #fff; border-top: 1px solid #e4e4e4; border-bottom: 1px solid #e4e4e4; }
dialog.settings .list > * { display: block; width: 100%; text-align: left; padding: 10px 16px; border: 0; border-top: 1px solid #e4e4e4; border-bottom: 1px solid #e4e4e4; background: #fff; font: inherit; color: var(--ui-selection-blue); cursor: pointer; }
.seg2 { display: flex; margin: 0 16px; border: 1px solid var(--ui-selection-blue); border-radius: 7px; overflow: hidden; }
.seg2 button { flex: 1; padding: 7px 0; border: 0; background: #fff; color: var(--ui-selection-blue); cursor: pointer; font-size: var(--fs-item); }
.seg2 button + button { border-left: 1px solid var(--ui-selection-blue); }
.seg2 button[aria-checked="true"] { background: var(--ui-selection-blue); color: #fff; }
dialog.settings .applink { display: flex; align-items: center; gap: 10px; }
dialog.settings .applink img { height: 22px; width: auto; border-radius: 4px; }
@font-face { font-family: "RobotoBoldLatin"; src: url("../fonts/roboto_bold_latin.ttf"); font-weight: bold; }   /* 保存の画像の字体（色のシミュレータ Web と同じ） */
.footer-note { margin: 10px 16px 0; font-size: var(--fs-text); color: #777; line-height: 1.5; }

/* 研究向けの設定の板（見ながら動かせる。狭い画面では下から半分を覆う） */
#lab { position: fixed; z-index: 5; right: 0; top: 44px; bottom: 0; width: min(380px, 100vw); overflow: auto; background: rgba(255,255,255,.97); border-left: 1px solid #aaa; box-shadow: -2px 0 8px rgba(0,0,0,.25); padding: 0 14px 24px; }
#lab header { display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: #f4f4f4; margin: 0 -14px; padding: 8px 14px; border-bottom: 1px solid #ccc; }
#lab h3 { margin: 0; font-size: var(--fs-title); } #lab h4 { margin: 14px 0 4px; font-size: var(--fs-section); color: #777; }
#lab header button, .labrow button { padding: 4px 12px; border: 1px solid #999; border-radius: 6px; background: #f2f2f2; cursor: pointer; }
.labnote { font-size: var(--fs-text); color: #666; line-height: 1.5; margin: 8px 0; white-space: pre-line; }
.lf { display: grid; grid-template-columns: 1fr 5.5em; gap: 2px 8px; align-items: center; margin: 5px 0; font-size: var(--fs-item); }
.lf input[type="range"] { grid-column: 1 / 3; width: 100%; accent-color: var(--ui-selection-blue); margin: 0; }
.lf input[type="number"], #seedIn { width: 100%; padding: 2px 4px; text-align: right; }
.lf .u { color: #888; font-size: 11px; }
.labrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } #seedIn { width: 10em; }
@media (max-width: 640px) { #lab { top: 50%; width: 100vw; border-left: 0; border-top: 1px solid #aaa; } }

.plate svg { width: calc(48px * var(--u)); height: calc(36px * var(--u)); display: block; color: #404040; pointer-events: none; }
.plate[aria-pressed="true"] svg { color: #fff; }

/* 比較の線: 44px 幅の当たりの帯の真ん中に 2px の白い線とつまみ */
#cmpLine { position: absolute; top: 0; width: 44px; margin-left: -22px; cursor: ew-resize; touch-action: none; z-index: 2; }
#cmpLine::before { content: ""; position: absolute; left: 21px; top: 0; bottom: 0; width: 2px; background: #fff; box-shadow: 0 0 3px #000, 0 0 1px #000; }
#cmpLine i { position: absolute; left: 6px; top: calc(50% - 16px); width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.92); box-shadow: 0 0 4px #000; }
#cmpLine i::before, #cmpLine i::after { content: ""; position: absolute; top: 11px; border: 5px solid transparent; }
#cmpLine i::before { left: 2px; border-right-color: #404040; } #cmpLine i::after { right: 2px; border-left-color: #404040; }
#cmpLine:focus-visible i { outline: 3px solid #f5c518; }
#cloudMap { position: absolute; left: 8px; bottom: 8px; width: 104px; height: 104px; border-radius: 8px; background: rgba(0,0,0,.45); pointer-events: none; z-index: 1; }
#stage.cloud { cursor: crosshair; }

/* ---- ツールバー（色のシミュレータ Web・色のめがね Web と同じ組分け。toolbar.css・ui-web/js/toolbar_fit.js）の追加分 ---- */
#canvas { transition: opacity .3s ease; } #canvas.fade { opacity: 0; }
dialog.samples { width: min(96vw, 640px); max-height: 90vh; overflow: auto; }
#sampleList h4 { margin: 14px 16px 6px; font-size: var(--fs-section); color: #777; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; padding: 0 16px; }
.thumb { border: 2px solid transparent; border-radius: 8px; padding: 0; background: none; cursor: pointer; text-align: center; font-size: 12px; color: #404040; }
.thumb img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 6px; }
.thumb[aria-pressed="true"] { border-color: var(--ui-selection-blue); }
.thumb span { display: block; padding-top: 2px; line-height: 1.2; }

/* ポップアップ（色のめがね Web の .popup と同じ見た目。イメージソース） */
.popup { position: fixed; z-index: 20; background: #fff; color: #404040; border: 2px solid #fff; border-radius: 7px; box-shadow: 2.5px 2.5px 6px rgba(0,0,0,.5); min-width: 220px; max-width: min(94vw, 380px); max-height: 70vh; display: flex; flex-direction: column; }
.popup h5 { margin: 0; padding: 6px 10px; font-size: 14px; background: linear-gradient(#f4f4f4, #dadada); border-radius: 5px 5px 0 0; }
.popup ul { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.popup li button { width: 100%; text-align: left; min-height: 44px; padding: 0 10px; border: 0; border-top: 1px solid #e4e4e4; background: #fff; font-size: 14px; color: #404040; cursor: pointer; }
.popup li button:active, .popup li button:hover { background: #dcdcdc; }
.popup .hint { font-size: 11px; color: #777; padding: 4px 10px 6px; }
.thumbs, .thumb { }
#canvas.fade { opacity: 0; }
dialog.samples { width: min(96vw, 640px); max-height: 90vh; overflow: auto; }
#sampleList h4 { margin: 14px 16px 6px; font-size: var(--fs-section); color: #777; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; padding: 0 16px; }
.thumb { border: 2px solid transparent; border-radius: 8px; padding: 0; background: none; cursor: pointer; text-align: center; font-size: 12px; color: #404040; }
.thumb img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 6px; }
.thumb[aria-pressed="true"] { border-color: var(--ui-selection-blue); }
.thumb span { display: block; padding-top: 2px; line-height: 1.2; }

/* 表示の 3 連と型の 3 連は、同じ幅にそろえる */
#viewGroup .seg-btn, #typeGroup .seg-btn { width: calc(112px * var(--u)); padding: 0 2px; font-size: calc(11px * var(--u)); line-height: 1.1; white-space: nowrap; }
#typeGroup .seg-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.seg-btn.typ .tn { font-size: calc(11px * var(--u)); } .seg-btn.typ .tp { font-size: calc(13px * var(--u)); font-variant-numeric: tabular-nums; }
.seg-btn.typ.off:not([aria-pressed="true"]) { opacity: .6; }
.plate.txt { font-size: calc(14px * var(--u)); }

/* 研究向けの板: 区分ごとに折りたためる */
#labFields details { border-top: 1px solid #e4e4e4; margin: 0 -2px; } #labFields summary { cursor: pointer; font-size: var(--fs-section); font-weight: bold; color: #555; padding: 8px 2px; }
/* 2 行目のスライダー: 幅が足りなければ折り返す。左の札 = 年齢・型の名前 */
.sliders { flex-wrap: wrap; justify-content: center; max-width: 100%; row-gap: 2px; }
.slider .tag { font-size: calc(12px * var(--u)); font-weight: bold; color: #404040; white-space: nowrap; min-width: 1.1em; text-align: center; }
.slider .tag.s-left { grid-column: 1; grid-row: 2; } .slider .tag.s-right { grid-column: 3; grid-row: 2; }
.slider[hidden] { display: none; }

.cluster.equal { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; }   /* 暗所散瞳と色順応は同じ幅（広い方に合わせる） */
.plate.txt.wide { width: auto; min-width: calc(52px * var(--u)); padding: 0 calc(8px * var(--u)); white-space: nowrap; font-size: calc(13px * var(--u)); }

#caption { position: absolute; left: 8px; bottom: 6px; color: #fff; font-size: 12px; line-height: 1.3; text-shadow: 1px 1px 2px #000, 0 0 3px #000; pointer-events: none; max-width: 80%; z-index: 1; }

dialog.settings .list > a.linkrow { display: block; padding: 10px 16px; border-top: 1px solid #e4e4e4; border-bottom: 1px solid #e4e4e4; background: #fff; color: var(--ui-selection-blue); text-decoration: none; }
/* 使い方のページの例（長い名前のボタンは幅を内容に合わせる） */
.manual .seg.demo .seg-btn { width: auto; padding: 0 10px; font-size: 12px; white-space: nowrap; }
.manual .plate.demo.txt { width: auto; padding: 0 10px; white-space: nowrap; font-size: 12px; }

/* 型のボタンの ▼（進み具合のスライダーのポップアップを開く。色のめがね Web の ▲（.upbtn）と同じ文字の印）。本体 = オン・オフ */
.seg-btn.typ { position: relative; }
.seg-btn .dd { position: absolute; z-index: 1; right: 0; top: 0; bottom: 0; width: calc(22px * var(--u)); display: flex; align-items: center; justify-content: center; font-size: calc(10px * var(--u)); pointer-events: auto; cursor: pointer; opacity: .85; }
.seg-btn.typ.off:not([aria-pressed="true"]) { opacity: .5; }
.popup .slider { --u: 1; padding: 10px; }   /* 棒の長さは main.js が行ごとに決める（toolbar_fit.js の BAR_MIN〜BAR_MAX） */

