/* ===========================================================
   Luna Chem Lab 3D — Silver UI (LUNA TECH 톤)
   포토샵식 도킹 패널 + 툴팁 + HUD. --ui3d-scale 로 전체 UI 확대
   =========================================================== */
:root {
    --ui3d-scale: 1;
    --a11y-text-scale: 1;
    --bg: #f4f6f9;
    --card: #ffffff;
    --line: #e2e6ec;
    --line2: #d3d9e2;
    --silver: #d7dde6;
    --silver2: #aeb7c6;
    --ink: #20262f;
    --sub: #6b7484;
    --acc: #2b6fd4;          /* tech blue */
    --teal: #2f9fb0;
    --warn: #d8a53f;
    --danger: #d65f5f;
    --shadow: 0 10px 30px rgba(32, 38, 47, 0.14);
}
.pref-reduced-motion *, .pref-reduced-motion *::before, .pref-reduced-motion *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .001ms !important; }
.pref-high-contrast { --ink:#101820; --sub:#172b3d; --line:#111827; --line2:#31465a; --panel:#ffffff; --panel2:#f7fbff; --acc:#004f9e; --danger:#9b111e; --warn:#6b3b00; }
.pref-high-contrast #topbar, .pref-high-contrast .dk-panel, .pref-high-contrast .preference-panel { border-width:2px; box-shadow:0 0 0 1px #111827; }
.pref-high-contrast .tb-btn:focus-visible, .pref-high-contrast button:focus-visible, .pref-high-contrast input:focus-visible, .pref-high-contrast select:focus-visible { outline:3px solid #000; outline-offset:2px; }
.pref-large-text #topbar, .pref-large-text .dk-panel, .pref-large-text .preference-panel, .pref-large-text #toast3d { font-size:calc(1em * 1.15); }
.preference-panel { position:fixed; z-index:1200; top:58px; right:12px; width:min(330px, calc(100vw - 24px)); padding:14px; background:var(--panel); color:var(--ink); border:1px solid var(--line2); border-radius:12px; box-shadow:0 14px 40px rgba(0,0,0,.25); }
.preference-head { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.preference-head h2 { margin:0; font-size:1.05em; }
.preference-close { min-width:36px; min-height:36px; border:1px solid var(--line2); border-radius:8px; background:var(--panel2); color:var(--ink); font-size:1.2em; }
.preference-options { display:grid; gap:8px; margin:12px 0; }
.preference-options label { display:flex; align-items:center; gap:8px; min-height:36px; font-weight:700; }
.preference-options input { width:20px; height:20px; accent-color:var(--acc); }
.preference-note { margin:8px 0 12px; color:var(--sub); font-size:.86em; line-height:1.45; }
.preference-reset { min-height:38px; padding:6px 10px; border:1px solid var(--line2); border-radius:8px; background:var(--panel2); color:var(--ink); font-weight:750; }
@media (pointer:coarse) { .preference-close, .preference-options label, .preference-reset { min-height:44px; } }

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: auto; }
body {
    font-family: 'Space Grotesk', 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    user-select: none;
}

/* ── 3D 캔버스 ── */
#app3d { position: fixed; inset: 0; }
#app3d canvas { display: block; touch-action: none; }
.sr-only {
    position: absolute !important; width: 1px !important; height: 1px !important;
    padding: 0 !important; margin: -1px !important; overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
}
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid #1769c2; outline-offset: 2px;
    box-shadow: 0 0 0 2px #fff;
}

/* ── 부트 로더 ── */
#boot {
    position: fixed; inset: 0; z-index: 300;
    background: var(--bg);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
    transition: opacity .5s;
}
#boot.off { opacity: 0; pointer-events: none; }
#boot .flask { font-size: 52px; animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-10px) rotate(-6deg); } }
#boot .bar { width: 210px; height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; }
#boot .bar i { display: block; height: 100%; width: 40%; border-radius: 4px; background: linear-gradient(90deg, var(--acc), var(--teal)); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(540%); } }
#boot small { color: #5f6877; letter-spacing: .06em; }
#boot > button { min-height: 42px; padding: 0 16px; border: 1px solid #d8bcbc; border-radius: 10px; background: #fff; color: #8b3030; font: inherit; font-weight: 800; cursor: pointer; }
#boot > button[hidden] { display: none; }
#boot > button:focus-visible { outline: 3px solid rgba(43, 111, 212, .35); outline-offset: 3px; }

/* ── 현실 모방 방지 시작 경계 ── */
.reality-boundary {
    position:fixed; inset:0; z-index:410; display:grid; place-items:center; padding:24px;
    background:rgba(24,29,38,.56); backdrop-filter:blur(9px); -webkit-backdrop-filter:blur(9px);
}
.reality-boundary[hidden] { display:none; }
.rb-card {
    width:min(640px, 96vw); max-height:92vh; overflow:auto; padding:28px 30px;
    border:1px solid #e2c7a5; border-radius:20px; background:#fffdf8;
    box-shadow:0 28px 90px rgba(18,24,34,.36); color:var(--ink);
}
.rb-icon { font-size:38px; text-align:center; margin-bottom:6px; }
.rb-card h2 { text-align:center; font-size:21px; margin:0 0 16px; color:#743d24; }
.rb-copy { display:grid; gap:9px; }
.rb-copy p { margin:0; padding:9px 11px; border-left:4px solid #dcab6f; border-radius:7px; background:#fff7e9; line-height:1.55; font-size:13.5px; }
.rb-copy p.emergency { border-color:#bc4d4d; background:#fff0f0; color:#7d3030; }
.rb-source { margin-top:12px; font-size:11.5px; line-height:1.7; color:var(--sub); }
.rb-source a { color:#76502d; font-weight:750; text-decoration:underline; text-underline-offset:2px; }
.rb-check { display:flex; align-items:flex-start; gap:9px; margin-top:17px; padding:11px; border:1px solid #dbc49e; border-radius:10px; background:#fff; line-height:1.45; font-size:13px; font-weight:750; cursor:pointer; }
.rb-check input { flex:none; width:20px; height:20px; margin:0; accent-color:#925c27; }
.rb-card > button { width:100%; min-height:46px; margin-top:12px; border:0; border-radius:11px; background:#673d28; color:#fff; font:inherit; font-weight:850; cursor:pointer; }
.rb-card > button:disabled { opacity:.42; cursor:not-allowed; }
.rb-card > button:not(:disabled):hover { background:#4f2c1d; }
.reality-watermark {
    position:fixed; right:12px; bottom:10px; z-index:28; pointer-events:none;
    padding:4px 9px; border:1px solid rgba(111,63,39,.25); border-radius:999px;
    background:rgba(255,250,241,.84); color:#704a34; font-size:10px; font-weight:800;
    backdrop-filter:blur(7px); -webkit-backdrop-filter:blur(7px);
}

/* ── WebGL 유실·복구 ── */
.webgl-recovery {
    position: fixed; inset: 0; z-index: 420;
    display: grid; place-items: center; padding: 24px;
    background: rgba(24, 29, 38, .48);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.webgl-recovery[hidden] { display: none; }
.wr-card {
    width: min(440px, 100%); padding: 28px;
    border: 1px solid var(--line2); border-radius: 18px;
    background: #fff; box-shadow: 0 24px 70px rgba(18, 24, 34, .3);
    text-align: center;
}
.wr-icon { font-size: 42px; margin-bottom: 10px; }
.wr-card h2 { font-size: 20px; margin-bottom: 10px; }
.wr-card p { color: var(--sub); line-height: 1.6; font-size: 14px; }
.wr-card button {
    margin-top: 20px; min-height: 44px; padding: 0 18px;
    border: 0; border-radius: 11px; background: var(--ink); color: #fff;
    font: inherit; font-weight: 700; cursor: pointer;
}
.wr-card button:focus-visible { outline: 3px solid rgba(43, 111, 212, .35); outline-offset: 3px; }
.webgl-recovery[data-state="restored"] .wr-icon { filter: hue-rotate(95deg); }

/* ── Stage 038 데이터 검증·복구 ── */
.data-recovery {
    position: fixed; inset: 0; z-index: 430;
    display: grid; place-items: center; padding: 24px;
    background: rgba(24, 29, 38, .5);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.data-recovery[hidden] { display: none; }
.dr-card {
    width: min(560px, 100%); max-height: 90vh; overflow: auto; padding: 28px;
    border: 1px solid #dfc79d; border-radius: 18px; background: #fffdf8;
    box-shadow: 0 24px 70px rgba(18, 24, 34, .32); text-align: center;
}
.dr-icon { font-size: 42px; margin-bottom: 8px; }
.dr-card h2 { margin: 0 0 10px; font-size: 20px; color: #69451f; }
.dr-card p { margin: 8px 0; color: var(--sub); line-height: 1.6; font-size: 14px; }
.dr-detail { padding: 9px 11px; border-radius: 8px; background: #f6f1e7; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.dr-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 18px; }
.dr-actions button { min-height: 44px; padding: 0 16px; border: 1px solid var(--line2); border-radius: 10px; background: #fff; color: var(--ink); font: inherit; font-weight: 750; cursor: pointer; }
.dr-actions button:last-child { border-color: #69451f; background: #69451f; color: #fff; }
.dr-actions button[hidden] { display: none; }
.dr-actions button:focus-visible { outline: 3px solid rgba(43, 111, 212, .35); outline-offset: 3px; }

/* ── Stage 049 첫 진입 3갈래 ── */
.onboarding {
    position: fixed; inset: 0; z-index: 450; display: grid; place-items: center; padding: 20px;
    background: rgba(24, 29, 38, .62); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.onboarding[hidden] { display: none; }
.on-card {
    width: min(680px, 96vw); max-height: 92vh; overflow: auto; padding: 28px;
    border: 1px solid #cbd8e8; border-radius: 22px; background: #fbfdff;
    box-shadow: 0 28px 90px rgba(18, 24, 34, .38); color: var(--ink);
}
.on-kicker { color: var(--acc); font-size: 11px; font-weight: 850; letter-spacing: .12em; text-align: center; }
.on-icon { margin: 4px 0 2px; font-size: 42px; text-align: center; }
.on-card h2 { margin: 0 0 7px; text-align: center; font-size: 22px; }
.on-subtitle { margin: 0 auto 12px; max-width: 520px; color: var(--sub); line-height: 1.55; text-align: center; }
.on-status { margin: 0 0 14px; padding: 8px 10px; border-radius: 9px; background: #eef5ff; color: #315f8d; font-size: 13px; font-weight: 750; text-align: center; }
.on-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.on-option {
    min-height: 164px; display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 8px;
    padding: 14px 12px; border: 1px solid var(--line2); border-radius: 14px; background: #fff;
    color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.on-option:hover:not(:disabled) { border-color: var(--acc); box-shadow: 0 8px 22px rgba(43, 111, 212, .13); transform: translateY(-2px); }
.on-option:disabled { opacity: .55; cursor: not-allowed; background: #f4f6f9; }
.on-option-icon { font-size: 25px; line-height: 1; }
.on-option-copy { display: grid; gap: 6px; min-width: 0; }
.on-option-copy b { font-size: 15px; }
.on-option-copy span, .on-option-copy small { line-height: 1.45; }
.on-option-copy span { color: var(--sub); font-size: 12.5px; }
.on-option-copy small { color: #2f7b67; font-size: 11px; font-weight: 750; }
.on-option:disabled .on-option-copy small { color: var(--sub); }
.on-chevron { color: var(--acc); font-size: 24px; line-height: 1; }
.on-boundary { margin: 15px 0 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--sub); font-size: 11.5px; line-height: 1.55; text-align: center; }
@media (max-width: 620px) {
    .on-card { padding: 22px 17px; }
    .on-options { grid-template-columns: 1fr; }
    .on-option { min-height: 0; }
}
@media (pointer: coarse) { .on-option { min-height: 64px; } }
@media (pointer: coarse) { .in-actions .eq-btn { min-height: 44px; } }

/* ── 상단바 ── */
#topbar {
    position: fixed; top: 0; left: 0; right: 0; height: 46px; z-index: 90;
    display: flex; align-items: center; gap: 8px; padding: 0 10px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line2);
    font-size: calc(13px * var(--ui3d-scale));
}
#topbar .tb-title {
    display: flex; align-items: center; gap: 8px;
    font-weight: 700; letter-spacing: .02em; white-space: nowrap;
}
#topbar .tb-title .beta {
    font-size: .68em; padding: 2px 7px; border-radius: 20px;
    background: linear-gradient(90deg, var(--acc), var(--teal)); color: #fff;
    letter-spacing: .1em;
}
.preset-dialog { position: fixed; inset: 0; z-index: 450; display: grid; place-items: center; padding: 20px; background: rgba(24,29,38,.48); backdrop-filter: blur(7px); }
.preset-dialog[hidden] { display: none; }
.preset-card { width: min(520px, 96vw); max-height: 88vh; overflow: auto; padding: 20px; border: 1px solid var(--line2); border-radius: 16px; background: #fff; box-shadow: 0 24px 70px rgba(18,24,34,.3); }
.preset-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.preset-head h2 { font-size: 20px; }
.preset-head button { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 20px; cursor: pointer; }
.preset-boundary { margin: 12px 0; padding: 9px 10px; border-left: 4px solid #d3a15b; border-radius: 7px; background: #fff7e9; color: #704a34; font-size: 12px; line-height: 1.5; }
.preset-create { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13px; font-weight: 700; }
.preset-create input { min-width: 0; min-height: 36px; padding: 0 9px; border: 1px solid var(--line2); border-radius: 8px; font: inherit; }
.preset-create button, .pr-row button { min-height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--acc); font: inherit; font-weight: 750; cursor: pointer; }
.preset-create button:hover, .pr-row button:hover { border-color: var(--acc); background: #f0f6ff; }
.preset-list { display: grid; gap: 7px; }
.pr-empty { padding: 18px 8px; color: var(--sub); text-align: center; font-size: 13px; }
.pr-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 7px; padding: 9px; border: 1px solid var(--line); border-radius: 10px; }
.pr-row b, .pr-row small { display: block; }
.pr-row small { margin-top: 3px; color: var(--sub); font-size: 11px; font-weight: 500; }
.pr-row button:last-child { width: 34px; padding: 0; color: var(--danger); }

/* 교사 수업 관리 — 과제·학생 입장·로컬 제출 검토 */
.teacher-workspace { position: fixed; inset: 0; z-index: 470; display: grid; place-items: center; padding: 18px; background: rgba(24,29,38,.58); backdrop-filter: blur(8px); }
.teacher-workspace[hidden] { display: none; }
.tw-card { width: min(980px, 97vw); max-height: min(92dvh, 860px); overflow: auto; border: 1px solid var(--line2); border-radius: 18px; background: #fff; box-shadow: 0 28px 80px rgba(18,24,34,.38); color: var(--ink); }
.tw-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line2); background: rgba(255,255,255,.96); }
.tw-head h2 { margin: 0; font-size: 21px; }
.tw-head p { margin: 3px 0 0; color: var(--sub); font-size: 12px; }
.tw-close { width: 40px; height: 40px; border: 1px solid var(--line2); border-radius: 10px; background: #fff; color: var(--ink); font-size: 23px; cursor: pointer; }
.tw-tabs { display: flex; gap: 7px; padding: 12px 18px 0; overflow-x: auto; }
.tw-tab { min-height: 40px; padding: 0 14px; border: 1px solid var(--line2); border-radius: 10px 10px 0 0; background: #f5f7fa; color: var(--sub); font-weight: 800; cursor: pointer; white-space: nowrap; }
.tw-tab[aria-selected="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.tw-body { padding: 16px 18px 22px; }
.tw-view[hidden] { display: none; }
.tw-grid { display: grid; grid-template-columns: minmax(280px, .88fr) minmax(320px, 1.12fr); gap: 16px; align-items: start; }
.tw-section { min-width: 0; padding: 15px; border: 1px solid var(--line2); border-radius: 13px; background: #fbfcfe; }
.tw-section h3 { margin: 0 0 10px; font-size: 16px; }
.tw-boundary { margin: 0 0 13px; padding: 9px 11px; border-left: 4px solid #d39a49; border-radius: 8px; background: #fff8e8; color: #684b1f; font-size: 12px; line-height: 1.5; }
.tw-form { display: grid; gap: 10px; }
.tw-form label { display: grid; gap: 5px; color: #3f4858; font-size: 12px; font-weight: 800; }
.tw-form input, .tw-form select, .tw-form textarea { width: 100%; min-width: 0; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line2); border-radius: 9px; background: #fff; color: var(--ink); font: inherit; }
.tw-form textarea { min-height: 78px; resize: vertical; }
.tw-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.tw-primary, .tw-action, .tw-danger { min-height: 40px; padding: 7px 12px; border: 1px solid var(--line2); border-radius: 9px; background: #fff; color: var(--ink); font: inherit; font-weight: 800; cursor: pointer; }
.tw-primary { border-color: var(--ink); background: var(--ink); color: #fff; }
.tw-danger { color: var(--danger); }
.tw-primary:hover, .tw-action:hover { filter: brightness(.96); border-color: var(--acc); }
.tw-list { display: grid; gap: 9px; }
.tw-empty { padding: 18px 10px; border: 1px dashed var(--line2); border-radius: 10px; color: var(--sub); text-align: center; font-size: 12px; }
.tw-item { padding: 11px; border: 1px solid var(--line2); border-radius: 11px; background: #fff; }
.tw-item-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.tw-item h4 { margin: 0; font-size: 14px; }
.tw-meta { margin-top: 4px; color: var(--sub); font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
.tw-chip { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border-radius: 999px; background: #edf4fb; color: #315f8d; font-size: 10px; font-weight: 850; white-space: nowrap; }
.tw-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.tw-actions button { min-height: 36px; }
.tw-status { margin: 12px 0 0; padding: 9px 10px; border-radius: 9px; background: #edf8f2; color: #275e43; font-size: 12px; font-weight: 750; }
.tw-status[data-state="error"] { background: #fff0f0; color: #8a3030; }
.tw-active { padding: 13px; border: 2px solid #9fb8ca; border-radius: 12px; background: #eef6fb; }
.tw-active h3 { margin: 0 0 5px; }
.tw-code { font: 850 15px/1.2 ui-monospace,SFMono-Regular,Menlo,monospace; letter-spacing: .08em; }
.tw-review textarea { width: 100%; min-height: 66px; margin-top: 8px; padding: 8px 10px; border: 1px solid var(--line2); border-radius: 8px; resize: vertical; font: inherit; }
.tw-file { display: inline-flex; align-items: center; min-height: 40px; padding: 7px 11px; border: 1px dashed var(--silver2); border-radius: 9px; background: #fff; color: var(--ink); font-size: 12px; font-weight: 800; cursor: pointer; }
.tw-file input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
@media (max-width: 760px) { .teacher-workspace { padding: 8px; align-items: end; } .tw-card { width: 100%; max-height: calc(100dvh - 16px); border-radius: 16px 16px 10px 10px; } .tw-grid, .tw-pair { grid-template-columns: 1fr; } .tw-head { padding: 13px; } .tw-tabs, .tw-body { padding-left: 13px; padding-right: 13px; } }
@media (pointer: coarse) { .tw-close, .tw-tab, .tw-primary, .tw-action, .tw-danger, .tw-file, .tw-form input, .tw-form select { min-height: 44px; } }
#topbar .tb-sp { flex: 0 0 4px; }
.topbar-actions {
    display: flex; flex: 1 1 auto; min-width: 0; align-items: center; gap: 6px;
    overflow-x: auto; overflow-y: hidden; padding: 2px 1px;
    scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.topbar-actions > * { flex: 0 0 auto; }
.tb-btn {
    height: 32px; padding: 0 11px; border-radius: 9px;
    border: 1px solid var(--line2); background: #fff; color: var(--ink);
    font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
    display: inline-flex; align-items: center; gap: 6px;
    transition: all .15s;
}
.tb-btn:hover { border-color: var(--silver2); background: #f6f8fb; transform: translateY(-1px); }
.tb-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tb-btn:disabled { cursor: not-allowed; opacity: .38; transform: none; background: #f4f5f7; border-color: var(--line2); }
.tb-btn.icon { width: 32px; padding: 0; justify-content: center; }
#topbarActions .tb-btn.icon {
    width: auto; min-width: max-content; padding: 0 7px; gap: 4px;
}
#topbarActions .tb-btn.icon::after {
    content: attr(data-ui-label); display: block; max-width: 7em;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 9px; line-height: 1; font-weight: 750; color: var(--sub);
}
#topbarActions .tb-btn.icon.active::after { color: inherit; }
/* 📸 캡처 개수 뱃지 (사진 버튼) */
.tb-badge {
    min-width: 16px; height: 16px; padding: 0 4px; border-radius: 9px;
    background: var(--acc); color: #fff; font-size: .74em; font-weight: 700;
    line-height: 16px; text-align: center; font-variant-numeric: tabular-nums;
}
.tb-badge[hidden] { display: none; }
.tb-scale { display: inline-flex; align-items: center; gap: 7px; padding: 0 4px; color: var(--sub); }
.tb-scale input[type=range] {
    width: 92px; height: 4px; -webkit-appearance: none; appearance: none;
    background: var(--line2); border-radius: 4px; outline: none; cursor: pointer;
}
.tb-scale input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
    background: var(--ink); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); cursor: grab;
}
.tb-scale b { min-width: 42px; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ── Stage 069 터치 명령 툴바 ── */
.touch-command-toolbar {
    display: none; position: fixed; left: 8px; right: 8px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 10px); z-index: 115;
    align-items: center; justify-content: center; gap: 6px; padding: 6px;
    border: 1px solid rgba(174,183,198,.9); border-radius: 14px;
    background: rgba(255,255,255,.9); box-shadow: 0 8px 26px rgba(32,38,47,.2);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    pointer-events: none; overflow-x: auto; scrollbar-width: none;
}
.touch-command-toolbar::-webkit-scrollbar { display: none; }
.touch-command-toolbar[data-support="desktop-hidden"] { visibility: hidden; }
.touch-command-group { display: flex; flex: none; align-items: center; gap: 4px; }
.touch-command-group + .touch-command-group { margin-left: 2px; padding-left: 5px; border-left: 1px solid var(--line2); }
.touch-command-btn {
    min-width: 44px; min-height: 44px; padding: 4px 6px;
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    border: 1px solid var(--line2); border-radius: 10px; background: #fff; color: var(--ink);
    font: inherit; font-size: 13px; font-weight: 800; line-height: 1;
    cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.touch-command-btn[data-touch-target="preferred"] { min-width: 44px; min-height: 44px; }
.touch-command-btn[data-pointer-intent="tap"] { touch-action: manipulation; }
.touch-command-btn small { max-width: 4.3em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; font-weight: 700; color: var(--sub); }
.touch-command-btn:hover, .touch-command-btn:active { border-color: var(--acc); background: #f0f6ff; }
.touch-command-btn:focus-visible { outline: 3px solid rgba(43,111,212,.35); outline-offset: 2px; }
@media (pointer: coarse) and (max-width: 850px) { .touch-command-toolbar { display: flex; } }

/* ── 도킹 패널 ── */
.dk-panel {
    position: fixed; z-index: 40;
    min-width: 170px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--line2);
    border-radius: 14px;
    box-shadow: var(--shadow);
    display: flex; flex-direction: column;
    overflow: hidden;
    font-size: calc(13px * var(--ui3d-scale));
}
.dk-head {
    display: flex; align-items: center; gap: 7px;
    padding: .6em .7em;
    background: linear-gradient(180deg, #fbfcfe, #eef1f6);
    border-bottom: 1px solid var(--line);
    cursor: move; flex: none;
}
.dk-ico { font-size: 1.05em; }
.dk-title { font-weight: 700; letter-spacing: .02em; }
.dk-drag-copy {
    flex: none; max-width: 5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    padding: .18em .42em; border: 1px solid var(--line2); border-radius: 999px;
    color: var(--sub); background: rgba(255,255,255,.7); font-size: .7em; font-weight: 700;
}
.dk-spacer { flex: 1; }
.dk-btn {
    width: max(1.7em, 24px); height: max(1.7em, 24px); border-radius: 6px; border: none;
    background: transparent; color: var(--sub); font-size: 1em; font-weight: 700;
    cursor: pointer; line-height: 1;
}
.dk-btn:hover { background: var(--line); color: var(--ink); }
.dk-body { padding: .65em; overflow: auto; flex: 1; }
.dk-panel[data-panel="inspector"] { height: min(320px, calc(100dvh - 400px)); }
.dk-panel.collapsed .dk-body, .dk-panel.collapsed .dk-resize { display: none; }
.dk-resize {
    position: absolute; right: 0; bottom: 0; width: 17px; height: 17px;
    cursor: nwse-resize;
    background:
        linear-gradient(135deg, transparent 52%, var(--silver2) 53%, transparent 58%,
            transparent 66%, var(--silver2) 67%, transparent 72%,
            transparent 80%, var(--silver2) 81%, transparent 86%);
}

/* ── 시약장 ── */
.rg-cat {
    font-size: .78em; font-weight: 800; letter-spacing: .08em;
    color: var(--sub); text-transform: uppercase;
    margin: .7em 0 .35em; padding-bottom: .25em;
    border-bottom: 1px solid var(--line);
}
.rg-cat:first-child { margin-top: 0; }
.rg-browser { margin-bottom: .55em; }
.rg-search { display: grid; gap: .25em; color: var(--sub); font-size: .76em; font-weight: 800; }
.rg-search input { width: 100%; min-height: 34px; padding: .45em .65em; border: 1px solid var(--line2); border-radius: 9px; background: #fff; color: var(--ink); font: inherit; }
.rg-search input:focus { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(43,111,212,.14); outline: none; }
.rg-quick { display: flex; flex-wrap: wrap; align-items: center; gap: .3em; margin: .25em 0 .5em; color: var(--sub); font-size: .75em; }
.rg-quick b { flex-basis: 100%; color: var(--ink); }
.rg-quick button { padding: .28em .55em; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--acc); font: inherit; cursor: pointer; }
.rg-quick button:hover { border-color: var(--acc); background: #f0f6ff; }
.rg-item {
    display: flex; align-items: center; gap: .6em; width: 100%;
    padding: .55em .6em; margin-bottom: .35em;
    border: 1px solid var(--line); border-radius: 10px;
    background: #fff; font: inherit; color: var(--ink);
    cursor: pointer; text-align: left; transition: all .15s;
}
.rg-item:hover { border-color: var(--acc); background: #f4f8ff; transform: translateX(2px); }
.rg-chip {
    width: 1.15em; height: 1.15em; border-radius: 50%;
    border: 2px solid rgba(32, 38, 47, .18); flex: none;
    box-shadow: inset 0 -2px 3px rgba(0,0,0,.12);
}
.rg-name { flex: 1; font-weight: 600; font-size: .92em; line-height: 1.25; }
.rg-name small { display: block; color: var(--sub); font-size: .8em; font-weight: 500; }
.rg-add, .rg-mol {
    flex: none; width: max(1.9em, 24px); height: max(1.9em, 24px); border-radius: 8px;
    border: 1px solid var(--line); background: #fff;
    font-size: .95em; cursor: pointer; line-height: 1;
    display: inline-flex; align-items: center; justify-content: center;
    transition: all .15s;
}
.rg-fav { flex: none; width: max(1.9em, 24px); height: max(1.9em, 24px); padding: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #bf8b1e; font-size: .95em; cursor: pointer; line-height: 1; }
.rg-fav:hover, .rg-fav.on { border-color: #d3a52c; background: #fff8df; }
.hazard-mini {
    flex:none; min-width:24px; height:24px; padding:0 4px; border:1px solid #dfc1c1; border-radius:8px;
    background:#fff7f7; color:#853737; font:inherit; font-size:.78em; font-weight:900; cursor:pointer;
    display:inline-flex; align-items:center; justify-content:center; gap:1px;
}
.hazard-mini:hover, .hazard-mini:focus-visible { border-color:#b64c4c; background:#ffeded; outline:none; }
.hazard-mini.level-0 { border-color:#c7dccd; background:#f2faf4; color:#33704a; }
.hazard-mini.level-1 { border-color:#e3d49d; background:#fff9e8; color:#7c631b; }
.hazard-mini.level-2 { border-color:#e2bd92; background:#fff2e2; color:#8b511c; }
.hazard-mini span { font-size:.8em; }
.noncolor-result { position:relative; isolation:isolate; }
.noncolor-result::after { content:""; position:absolute; inset:0; z-index:-1; pointer-events:none; opacity:.22; border-radius:inherit; }
.noncolor-dots::after { background-image:radial-gradient(currentColor 1px, transparent 1px); background-size:5px 5px; }
.noncolor-check::after { background-image:linear-gradient(135deg, transparent 42%, currentColor 43%, currentColor 48%, transparent 49%), linear-gradient(45deg, transparent 42%, currentColor 43%, currentColor 48%, transparent 49%); background-size:11px 11px; }
.noncolor-stripe::after { background-image:repeating-linear-gradient(135deg, currentColor 0 2px, transparent 2px 7px); }
.noncolor-crosshatch::after { background-image:repeating-linear-gradient(45deg, currentColor 0 1px, transparent 1px 6px), repeating-linear-gradient(-45deg, currentColor 0 1px, transparent 1px 6px); }
.noncolor-double-stripe::after { background-image:repeating-linear-gradient(90deg, currentColor 0 2px, transparent 2px 6px); border:2px double currentColor; }
.noncolor-result-sr { position:absolute!important; width:1px!important; height:1px!important; padding:0!important; margin:-1px!important; overflow:hidden!important; clip:rect(0,0,0,0)!important; white-space:nowrap!important; border:0!important; }
.hazard-mini.noncolor-result { overflow:hidden; }

/* 공유 글로벌 내비게이션의 세로 도크 탭도 이 페이지에서는 24px 최소 표적을 지킨다. */
#gnavDockTab { min-width: 24px !important; }
.rg-add { color: var(--acc); font-weight: 800; }
.rg-add:hover { border-color: var(--acc); background: #f0f6ff; }
.rg-mol:hover { border-color: var(--teal); background: #effafb; transform: scale(1.08); }

/* ── 분자 뷰어 ── */
.mol-wrap {
    width: 100%; height: calc(100% - 3.6em);
    min-height: 150px;
    border-radius: 10px; overflow: hidden;
    background: radial-gradient(ellipse at 50% 30%, #ffffff, #e8ecf2);
    border: 1px solid var(--line);
}
.mol-wrap canvas { display: block; width: 100% !important; height: 100% !important; }
.mol-cap {
    padding: .5em .2em 0; text-align: center;
    font-size: .95em; line-height: 1.4; color: var(--ink);
}
.mol-cap small { color: var(--sub); }

/* ── 인스펙터 성분 목록 ── */
.in-comps {
    display: flex; flex-wrap: wrap; gap: .3em;
    margin: .45em 0;
}
.in-comp {
    display: inline-flex; align-items: center; gap: .35em;
    font-size: .82em; font-weight: 600; color: var(--ink);
    background: #f2f5f9; border: 1px solid var(--line);
    border-radius: 14px; padding: .22em .6em;
}
.in-comp i {
    width: .8em; height: .8em; border-radius: 50%;
    border: 1.5px solid rgba(32,38,47,.15);
}

/* ── 장비/인스펙터 버튼 ── */
.eq-btn {
    display: flex; align-items: center; gap: .5em; width: 100%;
    padding: .55em .65em; margin-bottom: .35em;
    border: 1px solid var(--line); border-radius: 10px;
    background: #fff; font: inherit; font-weight: 600; color: var(--ink);
    cursor: pointer; text-align: left; transition: all .15s;
}
.eq-btn:hover { border-color: var(--silver2); background: #f6f8fb; transform: translateX(2px); }
.eq-btn.warn { border-color: #ecd9a4; background: #fffaf0; }
.eq-btn.warn:hover { border-color: var(--warn); }
.eq-btn.danger { color: var(--danger); border-color: #f0d4d4; background: #fff8f8; }
.eq-btn.danger:hover { border-color: var(--danger); }
.in-actions { display: grid; gap: .2em; margin-bottom: .45em; padding-bottom: .25em; border-bottom: 1px solid var(--line); }
.in-action-hint { color: var(--sub); font-size: .78em; font-weight: 600; }
.eq-hr { border: none; border-top: 1px dashed var(--line2); margin: .55em 0; }

/* ── 인스펙터 ── */
.in-title { font-weight: 800; font-size: 1.06em; margin-bottom: .55em; }
.in-title small { color: var(--sub); font-weight: 600; }
.in-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: .34em 0; border-bottom: 1px dashed var(--line);
    font-size: .95em;
}
.in-row span { color: var(--sub); }
.in-row b.hot { color: #d8562f; }
.in-bar {
    height: .5em; border-radius: 5px; background: var(--line);
    margin: .6em 0 .7em; overflow: hidden;
}
.in-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--acc)); border-radius: 5px; transition: width .3s; }
.in-empty { color: var(--sub); font-size: .92em; line-height: 1.5; padding: .4em 0 .6em; }
.object-a11y-region { margin:.65em 0 0; padding:.55em; border:1px solid #c8d8e8; border-radius:9px; background:#f6faff; }
.object-a11y-heading { display:flex; justify-content:space-between; gap:.5em; margin-bottom:.35em; color:#315a7c; font-size:.82em; }
.object-a11y-heading span { color:#657080; font-variant-numeric:tabular-nums; }
.object-a11y-list { display:grid; gap:.22em; max-height:13em; overflow:auto; margin:0; padding:0; list-style:none; }
.object-a11y-item { display:grid; grid-template-columns:auto minmax(0,1fr); gap:.1em .35em; width:100%; padding:.35em .4em; border:1px solid transparent; border-radius:7px; background:#fff; color:var(--ink); font:inherit; text-align:left; cursor:pointer; }
.object-a11y-item:hover, .object-a11y-item:focus-visible { border-color:#8db7d4; background:#edf6fd; outline:2px solid rgba(43,111,212,.18); }
.object-a11y-item.is-selected { border-color:#55a1c8; background:#e9f6ff; }
.object-a11y-name { min-width:0; overflow-wrap:anywhere; font-size:.8em; font-weight:800; }
.object-a11y-item small { grid-column:2; color:var(--sub); font-size:.7em; line-height:1.25; }
.object-a11y-empty { padding:.5em; color:var(--sub); font-size:.78em; text-align:center; }
.form-alt-region { margin:.65em 0 0; padding:.55em; border:1px solid #d6c8e9; border-radius:9px; background:#fbf9ff; }
.form-alt-heading { display:flex; justify-content:space-between; gap:.5em; margin-bottom:.35em; color:#604b83; font-size:.82em; }
.form-alt-heading span { color:var(--sub); font-size:.9em; }
.form-alt-region form { display:grid; grid-template-columns:1fr 1fr; gap:.28em; }
.form-alt-region label { display:grid; gap:.15em; color:var(--sub); font-size:.7em; font-weight:750; }
.form-alt-region input, .form-alt-region select { min-width:0; width:100%; padding:.3em; border:1px solid var(--line2); border-radius:6px; background:#fff; color:var(--ink); font:inherit; }
.form-alt-region button { min-height:34px; padding:.3em .45em; border:1px solid #c4b5dd; border-radius:6px; background:#f1ecfa; color:#503c70; font:inherit; font-size:.74em; font-weight:750; cursor:pointer; }
.form-alt-region button:hover, .form-alt-region button:focus-visible { background:#e4daf4; outline:2px solid rgba(96,75,131,.22); }
.form-alt-region label:nth-of-type(3), .form-alt-region button[data-form-action="pour"] { grid-column:1 / -1; }
@media (pointer: coarse) { .form-alt-region input, .form-alt-region select, .form-alt-region button { min-height:44px; } }
.in-hint {
    font-size: .85em; color: var(--sub); line-height: 1.5;
    background: #f2f5f9; border-radius: 8px; padding: .55em .6em; margin: .5em 0;
}
.in-warn {
    font-size: .87em; color: #9a6a10; font-weight: 700;
    background: #fff6e2; border: 1px solid #f0dfae; border-radius: 8px;
    padding: .5em .6em; margin: .5em 0;
}

/* ── 미션 ── */
.ms-filter { display:grid; gap:.45em; margin-bottom:.55em; padding-bottom:.55em; border-bottom:1px solid var(--line); }
.ms-filter-search, .ms-filter-status { display:flex; align-items:center; gap:.4em; color:var(--sub); font-size:.78em; font-weight:750; }
.ms-filter-search > span, .ms-filter-status > span { flex:none; }
.ms-filter-search input, .ms-filter-status select { min-width:0; flex:1; padding:.45em .55em; border:1px solid var(--line2); border-radius:8px; background:#fff; color:var(--ink); font:inherit; }
.ms-filter-search input:focus, .ms-filter-status select:focus { border-color:var(--acc); outline:2px solid rgba(43,111,212,.14); }
.ms-filter-count { color:var(--sub); font-size:.76em; font-weight:700; text-align:right; font-variant-numeric:tabular-nums; }
.ms-empty { padding:1.1em .5em; color:var(--sub); font-size:.86em; line-height:1.5; text-align:center; }
.ms-list { margin:0; padding:0; list-style:none; }
.ms-card { gap:.45em; padding:.6em .3em; }
.ms-card-main { display:grid; gap:.38em; min-width:0; flex:1; }
.ms-card-title { font-weight:800; line-height:1.35; }
.ms-card-grid { display:grid; grid-template-columns:1fr 1fr; gap:.28em .45em; color:var(--sub); font-size:.76em; line-height:1.35; }
.ms-card-grid > span { min-width:0; padding:.28em .35em; border-radius:6px; background:#f5f7fa; }
.ms-card-grid b, .ms-card-grid small { display:block; }
.ms-card-grid b { color:#556274; font-size:.9em; }
.ms-card-grid small { overflow-wrap:anywhere; color:#596576; }
.ms-card-grid .ms-card-safety { background:#fff7e9; color:#805d20; }
.ms-card-grid .ms-card-safety.level-2, .ms-card-grid .ms-card-safety.level-3 { background:#fff0f0; color:#8b3636; }
.ms-item.done.ms-card { color:var(--ink); text-decoration:none; }
.ms-item.done.ms-card .ms-card-title { color:var(--sub); }
.ms-item {
    display: flex; gap: .5em; align-items: flex-start;
    padding: .45em .3em; font-size: .93em; line-height: 1.45;
    border-bottom: 1px dashed var(--line); color: var(--ink);
}
.ms-mission-button {
    display:flex; flex:1; min-width:0; align-items:flex-start; gap:.5em;
    width:100%; border:0; border-bottom:0; background:transparent;
    color:inherit; font:inherit; text-align:left; cursor:pointer;
}
.ms-item:is(button) {
    width: 100%; border-top: 0; border-right: 0; border-left: 0;
    background: transparent; font-family: inherit; text-align: left;
}
.ms-item:last-child { border-bottom: none; }
.ms-item.done { color: var(--sub); text-decoration: line-through; }
.ms-item.done .ms-chk { text-decoration: none; }
.ms-chk { flex: none; }

/* ── 미션 클릭 → 가이드 ── */
.ms-item.ms-click { cursor: pointer; border-radius: 8px; transition: background .15s; }
.ms-item.ms-click:hover { background: #eef4fb; }

/* ── 🎓 교육과정 배지 (실버 pill) ── */
.ms-body { display: flex; flex-direction: column; gap: .3em; min-width: 0; }
.ms-txt { line-height: 1.42; }
.ms-badges { display:flex; flex-wrap:wrap; gap:.28em; align-items:flex-start; }
.ms-card-actions { display:flex; justify-content:flex-end; }
.ms-setup-btn { border:1px solid #b9c9e8; border-radius:7px; background:#eef4ff; color:#274c87; padding:.32em .55em; font:inherit; font-size:.78em; font-weight:700; cursor:pointer; }
.ms-setup-btn:hover, .ms-setup-btn:focus-visible { background:#dce9ff; }
.ms-completion { margin:.45em 0 .65em; padding:.65em .7em; border:1px solid #c6d7ea; border-radius:9px; background:linear-gradient(135deg,#f7fbff,#eef5ff); color:var(--ink); }
.ms-completion h3 { display:flex; justify-content:space-between; gap:.4em; margin:0 0 .28em; font-size:.88em; }
.ms-completion h3 strong { color:#31578f; font-variant-numeric:tabular-nums; }
.ms-completion p { margin:.25em 0 .45em; color:var(--sub); font-size:.74em; line-height:1.35; }
.ms-completion ul { display:grid; gap:.2em; margin:.35em 0; padding:0; list-style:none; max-height:9em; overflow:auto; }
.ms-completion li { display:grid; grid-template-columns:1fr auto; gap:.2em .4em; padding:.25em .35em; border-radius:5px; background:#fff; font-size:.74em; }
.ms-completion li small { grid-column:1 / -1; color:var(--sub); overflow-wrap:anywhere; }
.ms-completion li .ms-badges { grid-column:1 / -1; }
.ms-completion footer { color:#805d20; font-size:.7em; line-height:1.3; }
.gd-action { margin:.35em 0; padding:.45em .55em; border-radius:7px; font-size:.82em; font-weight:700; background:#eef4ff; color:#31578f; }
.gd-action-ready { background:#eaf8ef; color:#277246; }
.gd-action-blocked { background:#fff0f0; color:#963d3d; }
.gd-action-pending { background:#fff7e9; color:#805d20; }
.gd-hint { margin:.3em 0 .5em; padding:.45em .55em; border:1px dashed #c5cfdd; border-radius:7px; color:var(--sub); font-size:.8em; line-height:1.4; }
.gd-fix { margin-left:.35em; border:1px solid #b9c9e8; border-radius:6px; background:#eef4ff; color:#274c87; padding:.25em .45em; font:inherit; font-weight:700; cursor:pointer; }
.gd-fix:hover, .gd-fix:focus-visible { background:#dce9ff; }
@media (pointer: coarse) { .ms-filter-search input, .ms-filter-status select { min-height:44px; } }
@media (pointer: coarse) {
    .rg-fav, .rg-add, .rg-mol, .rg-quick button,
    .preset-head button, .preset-create button, .pr-row button,
    .ms-setup-btn, .gd-fix { min-width:44px; min-height:44px; }
}
.cur-badge {
    display: inline-flex; align-items: center; gap: .3em; align-self: flex-start;
    max-width: 100%; font-size: .76em; font-weight: 700; line-height: 1.3;
    padding: .14em .55em; border-radius: 999px;
    background: linear-gradient(180deg, #f7f9fc, #eaeef4);
    border: 1px solid var(--silver2); color: var(--sub);
    text-decoration: none; letter-spacing: -.01em; white-space: normal; cursor: help;
}
.cur-badge .cur-code { color: var(--acc); font-weight: 800; font-variant-numeric: tabular-nums; text-decoration: none; }
.cur-badge .cur-state { padding-left:.45em; border-left:1px solid #ccd3dd; color:#8a6418; font-size:.9em; font-weight:800; }
.cur-badge.safe { border-color: #ead9ae; background: linear-gradient(180deg, #fbf6e9, #f4ecd6); color: #9a7b2f; }
.ms-item.done .cur-badge { text-decoration: none; opacity: .85; }
.ms-item.done .model-badge { text-decoration:none; opacity:.85; }
.gd-cur { margin: -.2em 0 .5em; }
.gd-cur .cur-badge { font-size: .82em; }
.curriculum-disclosure {
    margin:.5em 0; border:1px solid #d8c98e; border-radius:10px; background:#fffaf0;
    color:var(--ink); font-size:.84em; line-height:1.5; overflow:hidden;
}
.curriculum-disclosure > summary {
    min-height:36px; display:flex; align-items:center; gap:.35em; padding:.48em .6em;
    color:#775c18; font-weight:800; cursor:pointer;
}
.curriculum-disclosure .pending { color:#9b6812; }
.curriculum-disclosure-body { padding:.05em .7em .75em; border-top:1px solid #eadfb7; }
.curriculum-disclosure-body p { margin:.6em 0; }
.curriculum-review-note { padding:.55em .65em; border-radius:8px; background:#fff1ce; color:#765817; }
.curriculum-source { color:#315f8d; font-weight:800; text-decoration:underline; text-underline-offset:2px; }

/* ── 모델 정확도·가정 표시 (중립색: 즉시 위험 경고와 시각적으로 분리) ── */
.model-badge {
    display:inline-flex; align-items:center; gap:.25em; align-self:flex-start;
    max-width:100%; padding:.14em .55em; border:1px solid #bed2e5; border-radius:999px;
    background:#edf5fc; color:#315f8d; font-size:.76em; font-weight:800; line-height:1.3;
    white-space:normal; text-decoration:none;
}
.model-badge.grade-quantitative { background:#e8f7f1; border-color:#b6dfce; color:#217258; }
.model-badge.grade-approximate { background:#edf5fc; border-color:#bed2e5; color:#315f8d; }
.model-badge.grade-conceptual-visualization { background:#f1eef9; border-color:#d8cce9; color:#6b4b8f; }
.model-badge.grade-unclassified-beta { background:#f1f2f4; border-color:#d5d8dd; color:#566170; }
.model-disclosure {
    margin:.55em 0; border:1px solid #cbdbe9; border-radius:10px; background:#f5f9fc;
    color:var(--ink); font-size:.86em; line-height:1.5; overflow:hidden;
}
.model-disclosure > summary {
    min-height:36px; display:flex; align-items:center; gap:.45em; padding:.48em .6em;
    cursor:pointer; font-weight:800; color:#365d7c; list-style-position:inside;
}
.model-disclosure > summary:focus-visible { outline:3px solid rgba(46,126,181,.35); outline-offset:-3px; }
.model-disclosure[open] > summary { border-bottom:1px solid #d8e4ee; background:#edf5fb; }
.model-disclosure > :not(summary) { margin-left:.7em; margin-right:.7em; }
.model-disclosure ul { margin:.25em .7em .55em 1.7em; padding:0; }
.model-status { margin-top:.65em; color:#49647e; }
.model-review-gate { display:grid; gap:.26em; margin-top:.5em; margin-bottom:.55em; padding:.6em; border:1px solid #e2b0b0; border-radius:7px; background:#fff3f3; color:#823737; }
.model-review-gate > span { color:#733a3a; }
.model-review-gate small { color:#6e4e4e; }
.model-review-gate a { color:#8f2f2f; font-weight:800; text-decoration:underline; text-underline-offset:2px; }
.model-review-gate code { width:max-content; max-width:100%; padding:.1em .35em; border-radius:4px; background:#f6dfdf; color:#6e3333; overflow-wrap:anywhere; }
.model-boundary { padding:.5em .6em; border-radius:7px; background:#eaf2f8; color:#49647e; }
.model-section-title { display:block; margin-top:.55em; color:#3b5268; }
.model-claim { display:grid; gap:.12em; margin-top:.45em; padding:.45em .55em; border-radius:7px; }
.model-claim.allowed { background:#eaf7f1; color:#2c725d; }
.model-claim.forbidden { background:#f2f3f5; color:#596271; margin-bottom:.65em; }
.model-safety-link { margin-bottom:.7em; padding:.55em .6em; border:1px solid #efc6c6; border-radius:7px; background:#fff2f2; color:#9b3838; }
.model-reference { display:grid; gap:.28em; margin-bottom:.6em; padding:.6em; border:1px solid #bad8c3; border-radius:7px; background:#f2fbf5; color:#285b39; }
.model-reference > span { color:#294638; }
.model-reference small { color:#735b16; font-weight:700; }
.model-reference a { color:#176394; font-weight:700; text-decoration:underline; text-underline-offset:2px; }
.model-disclosure.compact { margin:0 0 .65em; }
.model-disclosure.compact > summary { min-height:34px; }
.gd-guide-pending { margin:.6em 0; padding:.65em; border:1px dashed #bdcad7; border-radius:9px; color:var(--sub); line-height:1.5; }

/* ── 시약·생성물 위험 계약 v1 ── */
.hazard-disclosure, .mission-hazards {
    margin:.55em 0; border:1px solid #ddc2a0; border-radius:10px; background:#fffaf2;
    color:var(--ink); font-size:.86em; line-height:1.5; overflow:hidden;
}
.hazard-disclosure.level-3, .mission-hazards.level-3 { border-color:#dfaaaa; background:#fff5f5; }
.hazard-disclosure > summary, .mission-hazards > summary {
    min-height:38px; padding:.52em .65em; cursor:pointer; font-weight:850; color:#764b1e;
}
.hazard-disclosure.level-3 > summary, .mission-hazards.level-3 > summary { color:#8c3030; }
.hazard-disclosure[open] > summary, .mission-hazards[open] > summary { border-bottom:1px solid rgba(125,75,30,.16); }
.hazard-disclosure > :not(summary), .mission-hazards > :not(summary) { margin-left:.75em; margin-right:.75em; }
.hazard-disclosure ul { margin:.35em .7em .55em 1.65em; padding:0; }
.hazard-disclosure p { margin-top:.55em; margin-bottom:.55em; }
.hazard-formula { color:var(--sub); font-variant-numeric:tabular-nums; }
.hazard-boundary { padding:.55em .65em; border-radius:8px; background:#ffebeb; color:#843838; font-weight:700; }
.hazard-review { color:#6f5555; overflow-wrap:anywhere; }
.hazard-review code { white-space:normal; overflow-wrap:anywhere; }
.hazard-sources { margin-bottom:.7em; line-height:1.7; }
.hazard-sources a { color:#8c3c2f; font-weight:750; text-decoration:underline; text-underline-offset:2px; }
.hazard-emergency {
    margin:0 0 .8em; padding:.8em; border:2px solid #a92f2f; border-radius:11px; background:#ffeaea;
    color:#6f2020; box-shadow:0 0 0 3px rgba(169,47,47,.09);
}
.hazard-emergency h3 { margin:0 0 .45em; font-size:1.05em; }
.hazard-emergency p { margin:.4em 0; line-height:1.55; }
.mission-hazard-list { display:flex; align-items:center; flex-wrap:wrap; gap:.35em; padding-top:.6em; }
.mission-hazard-list > span { flex:1 1 150px; color:#71543c; }
.mission-hazards > p { margin-top:.55em; margin-bottom:.7em; color:#7d3b3b; font-weight:650; }
@media (pointer: coarse) { .hazard-mini { min-width:44px; min-height:44px; } .hazard-disclosure > summary, .mission-hazards > summary { min-height:44px; } }

/* ── 실험 가이드 패널 ── */
.gd-mission { font-weight: 800; font-size: 1.02em; margin-bottom: .55em; line-height: 1.4; }
.gd-step {
    display: flex; gap: .55em; align-items: flex-start;
    padding: .45em .55em; border-radius: 9px;
    font-size: .9em; line-height: 1.45; color: var(--sub);
    border: 1px solid transparent; margin-bottom: .25em;
}
.gd-step.cur { background: #fff6e2; border-color: #f0dfae; color: var(--ink); }
.gd-step.past { opacity: .6; }
.gd-step .n {
    flex: none; width: 1.55em; height: 1.55em; border-radius: 50%;
    background: var(--line); color: var(--ink);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: .82em;
}
.gd-step.cur .n { background: var(--warn); color: #fff; }
.gd-step.past .n { background: #bfe3cd; color: #2a7a4b; }
.gd-nav { display: flex; gap: .35em; margin-top: .55em; }
.gd-nav .eq-btn { margin-bottom: 0; justify-content: center; padding: .45em .5em; }
.gd-nav .eq-btn:disabled { opacity: .45; cursor: default; transform: none; }
.gd-done {
    background: #effaf3; border: 1px solid #bfe3cd; color: #2a7a4b;
    border-radius: 10px; padding: .6em; font-weight: 800; text-align: center; margin-top: .45em;
}

/* ── 🧮 몰 계산기 ── */
.mc-h {
    font-size: .84em; font-weight: 800; letter-spacing: .03em;
    color: var(--ink); margin: 0 0 .55em;
    display: flex; align-items: baseline; gap: .5em;
}
.mc-h small { color: var(--sub); font-weight: 700; letter-spacing: .02em; }
.mc-h2 { margin-top: .95em; padding-top: .75em; border-top: 1px solid var(--line); }
.mc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5em; }
.mc-f { display: flex; flex-direction: column; gap: .28em; font-size: .82em; color: var(--sub); font-weight: 600; }
.mc-inp {
    display: flex; align-items: center; gap: .3em;
    border: 1px solid var(--line2); border-radius: 9px; background: #fff;
    padding: .05em .55em; transition: border-color .15s, box-shadow .15s, background .15s;
}
.mc-inp:focus-within { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(43, 111, 212, .12); }
.mc-inp input {
    width: 100%; min-width: 0; border: none; outline: none; background: transparent;
    font: inherit; font-weight: 700; color: var(--ink);
    padding: .42em 0; font-variant-numeric: tabular-nums;
}
.mc-inp input::placeholder { color: var(--teal); font-weight: 700; opacity: .75; }
.mc-inp i { color: var(--sub); font-style: normal; font-weight: 700; font-size: .9em; flex: none; }
.mc-inp.hl { border-color: var(--teal); background: #effafb; box-shadow: 0 0 0 3px rgba(47, 159, 176, .14); }
.mc-out {
    margin-top: .6em; padding: .5em .65em; border-radius: 9px;
    font-size: .9em; font-weight: 700; line-height: 1.45; text-align: center;
    background: #f2f5f9; color: var(--sub); border: 1px solid var(--line);
    font-variant-numeric: tabular-nums;
}
.mc-out.ok { background: #effafb; border-color: #bfe6ec; color: #1c6e7d; }
.mc-out.warn { background: #fff6e2; border-color: #f0dfae; color: #9a6a10; }
.mc-live { margin-top: .1em; }
.mc-empty { color: var(--sub); font-size: .9em; line-height: 1.5; padding: .5em .1em; }
.mc-vhead { font-size: .86em; font-weight: 700; color: var(--ink); margin-bottom: .45em; font-variant-numeric: tabular-nums; }
.mc-vhead small { color: var(--sub); font-weight: 600; }
.mc-tbl { width: 100%; border-collapse: collapse; font-size: .86em; }
.mc-tbl th {
    text-align: left; color: var(--sub); font-weight: 700; font-size: .92em;
    padding: .2em .3em; border-bottom: 1.5px solid var(--line);
}
.mc-tbl td {
    padding: .32em .3em; border-bottom: 1px dashed var(--line);
    color: var(--ink); font-variant-numeric: tabular-nums;
}
.mc-tbl th:not(:first-child), .mc-tbl td:not(:first-child) { text-align: right; }
.mc-tbl td:first-child { font-weight: 700; }
.mc-tbl td b { color: var(--acc); }
.mc-tbl td.sol { color: var(--sub); font-weight: 600; font-style: italic; text-align: center; }

/* ── 📈 온도 기록계 ── */
.rc-top { display: flex; flex-direction: column; gap: .5em; margin-bottom: .5em; }
.rc-status {
    display: flex; align-items: center; gap: .4em; font-size: .84em; font-weight: 700;
    color: var(--ink); font-variant-numeric: tabular-nums;
}
.rc-status b { color: var(--acc); }
.rc-dot { width: .62em; height: .62em; border-radius: 50%; background: var(--silver2); flex: none; }
.rc-dot.on { background: var(--danger); box-shadow: 0 0 0 3px rgba(214,95,95,.18); animation: rcPulse 1.1s infinite; }
@keyframes rcPulse { 50% { opacity: .45; } }
.rc-btns { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: .4em; }
.rc-btn {
    display: flex; align-items: center; justify-content: center; gap: .3em;
    padding: .5em .35em; border: 1px solid var(--line2); border-radius: 9px;
    background: #fff; font: inherit; font-weight: 700; font-size: .84em; color: var(--ink);
    cursor: pointer; transition: border-color .15s, background .15s, transform .1s;
}
.rc-btn:hover:not(:disabled) { border-color: var(--silver2); background: #f6f8fb; transform: translateY(-1px); }
.rc-btn:disabled { opacity: .42; cursor: default; }
.rc-btn.rc-start { color: #b23b3b; border-color: #f0d4d4; background: #fff8f8; }
.rc-btn.rc-start:hover:not(:disabled) { border-color: var(--danger); background: #fff1f1; }
.rc-wrap {
    width: 100%; height: 210px; border: 1px solid var(--line); border-radius: 10px;
    background: #fff; overflow: hidden; box-shadow: inset 0 1px 3px rgba(32,38,47,.04);
}
.rc-wrap canvas { display: block; width: 100%; height: 100%; }
.rc-hint { margin-top: .5em; font-size: .8em; line-height: 1.45; color: var(--sub); }

/* ── 전역 툴팁 (UI 버튼) ── */
#uiTip {
    position: fixed; z-index: 200; max-width: 260px;
    background: var(--ink); color: #f4f6f9;
    padding: 7px 11px; border-radius: 9px;
    font-size: calc(12px * var(--ui3d-scale)); line-height: 1.45; font-weight: 500;
    box-shadow: 0 6px 20px rgba(0,0,0,.25);
    opacity: 0; pointer-events: none; transform: translateY(3px);
    transition: opacity .15s, transform .15s;
}
#uiTip.on { opacity: 1; transform: none; }

/* ── 3D 오브젝트 툴팁 ── */
#objTip {
    position: fixed; z-index: 120; max-width: 280px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--line2); border-radius: 10px;
    padding: 8px 12px;
    font-size: calc(12.5px * var(--ui3d-scale)); line-height: 1.5;
    color: var(--ink); box-shadow: var(--shadow);
    opacity: 0; pointer-events: none; transition: opacity .12s;
}
#objTip.on { opacity: 1; }
#objTip small { color: var(--sub); }

/* ── HUD 칩 (비커 위 온도) ── */
#chips3d { position: fixed; inset: 0; pointer-events: none; z-index: 30; }
.obj-chip {
    position: absolute; transform: translate(-50%, -100%);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--line2); border-radius: 20px;
    padding: 3px 11px;
    font-size: calc(11.5px * var(--ui3d-scale)); font-weight: 700;
    color: var(--ink); white-space: nowrap;
    box-shadow: 0 3px 10px rgba(32, 38, 47, 0.12);
    font-variant-numeric: tabular-nums;
}
.obj-chip.hot { border-color: #f0bfa4; background: #fff6ef; color: #c04a1e; }

/* ── 토스트 ── */
#toast3d {
    position: fixed; left: 50%; bottom: 26px; z-index: 210;
    transform: translate(-50%, 16px);
    background: var(--ink); color: #fff;
    padding: 11px 20px; border-radius: 12px;
    font-size: calc(13.5px * var(--ui3d-scale)); font-weight: 600;
    box-shadow: 0 10px 30px rgba(0,0,0,.3);
    opacity: 0; pointer-events: none;
    transition: all .25s cubic-bezier(.2, .9, .3, 1.2);
    max-width: min(560px, 90vw); text-align: center;
}
#toast3d.on { opacity: 1; transform: translate(-50%, 0); }
#toast3d.warn { background: #8a4a12; }
#toast3d.success { background: #236b4a; }
#toast3d[data-live-channel="assertive"] { border:2px solid #fff; box-shadow:0 0 0 3px rgba(138,74,18,.35),0 8px 24px rgba(0,0,0,.28); font-weight:800; }
#toast3d[data-live-channel="polite"] { border:1px solid rgba(255,255,255,.35); }

/* ── 창 메뉴 ── */
.dk-menu {
    position: fixed; z-index: 220; min-width: 200px;
    background: rgba(255,255,255,.95); backdrop-filter: blur(14px);
    border: 1px solid var(--line2); border-radius: 12px;
    box-shadow: var(--shadow); padding: 6px;
    display: none;
    font-size: calc(13px * var(--ui3d-scale));
}
.dk-menu.on { display: block; }
.dk-menu-item {
    display: flex; align-items: center; gap: 7px; width: 100%;
    padding: 8px 10px; border: none; border-radius: 8px;
    background: transparent; font: inherit; font-weight: 600; color: var(--ink);
    cursor: pointer; text-align: left;
}
.dk-menu-item:hover { background: #eef2f7; }
.dk-menu-item .chk { width: 1.1em; color: var(--teal); font-weight: 800; }

/* ── 도움말 오버레이 ── */
#helpOverlay {
    position: fixed; inset: 0; z-index: 250;
    background: rgba(32, 38, 47, 0.45);
    backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
    display: none; align-items: center; justify-content: center; padding: 24px;
}
#helpOverlay.on { display: flex; }
.hp-card {
    width: min(720px, 94vw); max-height: 86vh; overflow: auto;
    background: var(--card); border-radius: 20px;
    border: 1px solid var(--line2); box-shadow: 0 30px 80px rgba(0,0,0,.35);
    padding: 26px 28px;
    font-size: calc(13.5px * var(--ui3d-scale));
}
.hp-card h2 { font-size: 1.45em; margin-bottom: 4px; letter-spacing: -.01em; }
.hp-card .hp-sub { color: var(--sub); margin-bottom: 18px; }
.hp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 26px; }
@media (max-width: 640px) { .hp-grid { grid-template-columns: 1fr; } }
.hp-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: .5em 0; border-bottom: 1px dashed var(--line);
}
.hp-row span { color: var(--ink); font-weight: 500; }
.hp-keys { display: flex; gap: 4px; flex: none; }
kbd {
    display: inline-block; min-width: 1.7em; text-align: center;
    padding: .18em .5em; border-radius: 7px;
    background: linear-gradient(180deg, #fff, #eef1f6);
    border: 1px solid var(--line2); border-bottom-width: 2.5px;
    font-family: inherit; font-size: .88em; font-weight: 700; color: var(--ink);
}
.hp-close {
    margin-top: 18px; width: 100%; padding: 12px;
    border: none; border-radius: 12px;
    background: var(--ink); color: #fff; font: inherit; font-weight: 700;
    cursor: pointer; font-size: 1.05em;
}
.hp-close:hover { background: #333c4c; }
.hp-science {
    margin-top:18px; width:100%; padding:11px 12px; border:1px solid #a8bfd2; border-radius:12px;
    background:#eef6fc; color:#254d6b; font:inherit; font-weight:800; cursor:pointer;
}
.hp-science:hover { background:#e2f0fa; border-color:#779dbb; }
.hp-tip {
    background: linear-gradient(90deg, #eef6ff, #eefaf7);
    border: 1px solid #d7e6f5; border-radius: 12px;
    padding: 12px 15px; margin: 14px 0 4px; line-height: 1.6; font-size: .95em;
}
.hp-reality { margin:0 0 14px; padding:13px 15px; border:2px solid #ddb681; border-radius:12px; background:#fff8ec; color:#67442d; }
.hp-reality h3 { margin:0 0 7px; font-size:1.03em; }
.hp-reality p { margin:5px 0; line-height:1.55; }
.hp-reality a { color:#754a25; font-weight:750; text-decoration:underline; text-underline-offset:2px; }
.reality-badge { display:inline-flex; align-items:center; gap:.25em; padding:.14em .5em; border:1px solid #dbc49e; border-radius:999px; background:#fff8e8; color:#77501f; font-size:.75em; font-weight:850; }
.reality-badge.level-3 { border-color:#e1adad; background:#fff0f0; color:#8a3333; }
.mission-reality { margin:.55em 0; border:1px solid #dfc28f; border-radius:10px; background:#fff9ed; color:#65472d; overflow:hidden; font-size:.86em; line-height:1.5; }
.mission-reality.level-3 { border-color:#dfa8a8; background:#fff4f4; color:#763131; }
.mission-reality > summary { min-height:38px; padding:.52em .65em; cursor:pointer; font-weight:850; }
.mission-reality[open] > summary { border-bottom:1px solid rgba(117,75,35,.15); }
.mission-reality > :not(summary) { margin-left:.75em; margin-right:.75em; }
.mission-reality p { margin-top:.55em; margin-bottom:.55em; }
.mission-reality .real-stop { padding:.55em .65em; border-radius:8px; background:#ffebeb; color:#803838; font-weight:700; }
.mission-reality .policy-sources { margin-bottom:.7em; }
.mission-reality a { color:#7e482b; font-weight:750; text-decoration:underline; text-underline-offset:2px; }
.hazard-reality-stop { margin:.55em .75em; padding:.6em .7em; border:2px solid #d49b9b; border-radius:8px; background:#fff0f0; color:#7b3030; line-height:1.5; font-weight:700; }
@media (max-width:520px) { .rb-card { padding:21px 18px; } .rb-card h2 { font-size:18px; } }
@media (pointer:coarse) { .mission-reality > summary { min-height:44px; } }
.hp-model-legend { margin:14px 0 4px; padding:12px 15px; border:1px solid #ceddea; border-radius:12px; background:#f4f8fb; }
.hp-model-legend h3 { margin:0 0 4px; font-size:1em; }
.hp-model-legend > p { margin:0 0 8px; color:var(--sub); line-height:1.5; }
.hp-grade-row { display:grid; grid-template-columns:minmax(120px, auto) 1fr; align-items:center; gap:10px; padding:6px 0; border-top:1px dashed var(--line); }
.hp-grade-row .model-badge { font-size:.8em; }
@media (max-width: 520px) { .hp-grade-row { grid-template-columns:1fr; gap:4px; } }
@media (pointer: coarse) { .model-disclosure > summary { min-height:44px; } }

/* ── Stage 032: 과학 오류 신고·공개 수정 이력 ── */
.science-integrity {
    position:fixed; inset:0; z-index:270; display:flex; align-items:center; justify-content:center;
    padding:24px; background:rgba(26,33,43,.58); backdrop-filter:blur(6px); -webkit-backdrop-filter:blur(6px);
}
.science-integrity[hidden] { display:none; }
.si-card {
    width:min(1120px,96vw); max-height:92vh; overflow:auto; padding:24px;
    background:#f8fafc; color:var(--ink); border:1px solid #c9d2dd; border-radius:20px;
    box-shadow:0 30px 90px rgba(0,0,0,.4); font-size:calc(13px * var(--ui3d-scale));
}
.si-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.si-head h2 { margin:2px 0 0; font-size:1.55em; }
.si-kicker { margin:0; color:#51738d; font-size:.76em; font-weight:900; letter-spacing:.08em; }
.si-close { width:38px; height:38px; flex:none; border:1px solid #c6ced8; border-radius:10px; background:#fff; color:#394453; font-size:24px; cursor:pointer; }
.si-close:hover { background:#edf1f5; }
.si-boundary { margin:15px 0; padding:11px 13px; border:2px solid #d39797; border-radius:11px; background:#fff2f2; color:#743333; line-height:1.55; }
.si-layout { display:grid; grid-template-columns:minmax(0,1.05fr) minmax(0,.95fr); gap:18px; align-items:start; }
.si-report, .si-history { padding:17px; border:1px solid #d4dce5; border-radius:14px; background:#fff; }
.si-report h3, .si-history h3 { margin:0 0 9px; font-size:1.15em; }
.si-privacy { margin:0 0 12px; padding:9px 10px; border-radius:9px; background:#fff7e8; color:#6c521b; line-height:1.5; }
#scienceReportForm { display:grid; gap:10px; }
#scienceReportForm label { display:grid; gap:5px; color:#344050; font-weight:750; }
#scienceReportForm input, #scienceReportForm select, #scienceReportForm textarea {
    width:100%; padding:9px 10px; border:1px solid #bdc8d5; border-radius:8px; background:#fff;
    color:#1d2733; font:inherit; line-height:1.4;
}
#scienceReportForm textarea { resize:vertical; min-height:58px; }
#scienceReportForm input:focus, #scienceReportForm select:focus, #scienceReportForm textarea:focus { outline:3px solid rgba(57,132,181,.23); border-color:#397fae; }
.si-pair { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.si-primary { padding:11px 13px; border:0; border-radius:9px; background:#213d55; color:#fff; font:inherit; font-weight:850; cursor:pointer; }
.si-primary:hover { background:#315775; }
.si-error { margin:0; padding:8px 10px; border-radius:8px; background:#ffeded; color:#8a2626; font-weight:750; }
.si-receipt { margin-top:12px; padding:10px 11px; border:1px solid #91b6a4; border-radius:9px; background:#eef9f2; color:#245b3c; line-height:1.5; }
.si-export-actions { display:flex; gap:8px; margin-top:9px; }
.si-export-actions[hidden] { display:none; }
.si-export-actions button, .si-delete {
    padding:8px 10px; border:1px solid #aebbc9; border-radius:8px; background:#fff; color:#354658; font:inherit; font-weight:750; cursor:pointer;
}
.si-local-reports { display:grid; gap:7px; margin-top:12px; }
.si-local-item { display:grid; grid-template-columns:1fr auto; gap:5px 10px; padding:9px 10px; border:1px solid #d8e0e8; border-radius:9px; background:#f7f9fb; }
.si-local-item b, .si-local-item span { overflow-wrap:anywhere; }
.si-local-item small { grid-column:1; color:#687486; }
.si-delete { grid-column:2; grid-row:1 / span 2; align-self:center; color:#813838; border-color:#d8b3b3; }
.si-gate { margin-bottom:11px; padding:10px; border:2px solid #b87f7f; border-radius:9px; background:#fff0f0; color:#7c2c2c; font-weight:850; line-height:1.5; }
.si-correction { margin:0 0 9px; border:1px solid #cdd8e1; border-radius:10px; overflow:hidden; }
.si-correction > summary { padding:10px 11px; background:#f1f6fa; cursor:pointer; font-weight:850; line-height:1.45; }
.si-correction-body { padding:10px 11px; line-height:1.5; }
.si-correction-body p { margin:6px 0; }
.si-status { display:inline-block; margin-top:3px; padding:3px 7px; border-radius:999px; background:#fff0d7; color:#765315; font-size:.82em; font-weight:850; }
.si-workflow { margin:12px 0; padding:9px 10px; border:1px solid #cad5df; border-radius:9px; background:#f7f9fb; }
.si-workflow summary { cursor:pointer; font-weight:800; }
.si-workflow p { margin:8px 0 0; line-height:1.55; }
.si-sources { display:grid; gap:4px; font-size:.88em; }
.si-sources a { display:flex; align-items:center; min-height:26px; color:#315f82; font-weight:700; overflow-wrap:anywhere; }
@media (max-width:850px) { .si-layout { grid-template-columns:1fr; } .science-integrity { padding:10px; } .si-card { padding:17px; } }
@media (max-width:520px) { .si-pair { grid-template-columns:1fr; } .si-export-actions { flex-direction:column; } }
@media (pointer:coarse) { .si-close, .si-primary, .si-export-actions button, .si-delete, .hp-science { min-height:44px; } }

/* 최소 지원 폭에서는 기능을 버리지 않고 라벨만 접어 한 줄에 유지한다. */
@media (max-width: 1200px) {
    #tbScience { display:none; }
    #topbar .tb-btn:not(.icon) {
        width: 32px; padding: 0; justify-content: center;
    }
    #topbar .tb-btn:not(.icon) > span { display: none; }
    #topbar .tb-scale { display: none; }
}

/* 모바일 안내 최소화 (PC+아이패드 우선) */
@media (max-width: 700px) {
    #topbar { flex-wrap: wrap; height: auto; padding: 6px 8px; row-gap: 5px; }
    .tb-scale { display: none; }
}

/* iPad touch: title and commands get separate rows; only the command row scrolls. */
@media (pointer: coarse) and (max-width: 1200px) {
    #topbar {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-rows: 36px 46px;
        align-items: center;
        height: 90px;
        min-height: 90px;
        overflow: hidden;
        gap: 4px 8px;
        padding: 4px 8px;
    }
    #topbar > .tb-btn.icon {
        grid-column: 1;
        grid-row: 1;
        width: 48px;
        min-width: 48px;
        height: 32px;
        flex-direction: row;
    }
    #topbar > .tb-btn.icon::after { display: none; }
    #topbar .tb-title {
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    #topbar .tb-sp { display: none; }
    #topbarActions {
        grid-column: 1 / -1;
        grid-row: 2;
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 6px;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 1px 1px 3px;
        scrollbar-width: thin;
    }
    #topbarActions .tb-btn:not(.icon) {
        width: auto;
        min-width: max-content;
        height: 44px;
        padding: 0 9px;
        justify-content: center;
    }
    #topbarActions .tb-btn:not(.icon) > span { display: inline !important; }
    #topbarActions .tb-btn.icon {
        width: auto;
        min-width: 62px;
        height: 44px;
        padding: 3px 7px;
        flex-direction: column;
        gap: 1px;
        justify-content: center;
        line-height: 1.05;
    }
#topbarActions .tb-btn.icon::after {
        content: attr(data-ui-label);
        max-width: 9em;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 9px;
        font-weight: 750;
        color: var(--sub);
    }
    #topbarActions #tbScience { display: inline-flex !important; }
    #topbarActions .tb-scale { display: none; }
}

.save-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 82px;
    height: 32px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--sub);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}
.save-status-saving { color: var(--accent); }
.save-status-saved { color: #49d99a; }
.save-status-recovery, .save-status-error { color: #ff8e8e; border-color: #a84a5b; }
.save-status-offline { color: #f0c56e; border-color: #80652b; }
@media (pointer: coarse) and (max-width: 1200px) {
    #topbarActions .save-status { min-width: 88px; height: 40px; font-size: 11px; }
}

/* iPad/phone: visible dock panels become a reachable bottom-sheet stack. */
@media (pointer: coarse) and (max-width: 1200px) {
    .dk-sheet-mode .dk-panel {
        left: 6px !important; right: auto !important; top: auto !important;
        bottom: calc(env(safe-area-inset-bottom, 0px) + var(--dk-sheet-offset, 0px)) !important;
        width: calc(100vw - 12px) !important; height: var(--dk-sheet-height, 46vh) !important;
        max-height: calc(100dvh - 56px) !important; border-radius: 14px 14px 0 0;
        z-index: var(--dk-sheet-z, 40) !important;
    }
    .dk-sheet-mode .dk-panel[data-sheet-active="false"] .dk-body,
    .dk-sheet-mode .dk-panel[data-sheet-active="false"] .dk-resize { display: none; }
    .dk-sheet-mode .dk-panel[data-sheet-active="false"] { opacity: .94; }
    .dk-sheet-mode .dk-head { min-height: 44px; cursor: pointer; }
}
