:root {
  --navy: #1f3864; --blue: #2e75b6; --pale: #f3f8fc; --text: #1d2430; --muted: #5b6575;
  --glass: rgba(255,255,255,.92); --line: rgba(31,56,100,.12); --warn: #d9480f; --ok: #2b8a3e;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--text); background: #cfe3f2; }
#scene { position: fixed; inset: 0; }
button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--navy); border-radius: 8px; padding: 7px 12px; font-weight: 600; font-size: 13px; transition: .15s; }
button:hover { border-color: var(--blue); }
button.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
button.primary:hover { background: var(--navy); }
button:disabled { opacity: .45; cursor: default; }

.topbar { position: fixed; top: 12px; left: 12px; right: 12px; display: flex; align-items: center; gap: 16px; padding: 10px 14px; background: var(--glass); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(8px); box-shadow: 0 6px 24px rgba(20,40,80,.12); z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--blue), var(--navy)); color: #fff; display: grid; place-items: center; font-weight: 800; }
.brand-title { font-weight: 800; color: var(--navy); font-size: 15px; white-space: nowrap; }
.brand-sub { font-size: 12px; color: var(--muted); white-space: nowrap; }
.modes { display: flex; gap: 6px; margin-left: auto; }
.modes button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.progress { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 110px; }
.bar { height: 6px; border-radius: 4px; background: #e3ebf4; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), #39b37a); transition: width .4s; }

.outline { position: fixed; top: 84px; left: 12px; width: 250px; max-height: calc(100% - 140px); overflow: auto; padding: 14px; background: var(--glass); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(8px); z-index: 9; }
.outline h3 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.outline ol { list-style: none; padding: 0; margin: 0; }
.outline li { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; font-size: 13px; cursor: pointer; }
.outline li:hover { background: var(--pale); }
.outline li.active { background: #dcebf8; color: var(--navy); font-weight: 700; }
.outline li .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: #e6eef7; color: var(--navy); font-size: 11px; font-weight: 700; flex: none; }
.outline li.done .n { background: var(--ok); color: #fff; }
.outline li.hazard .n { box-shadow: 0 0 0 2px var(--warn); }
.legend { margin-top: 12px; display: grid; gap: 4px; font-size: 11.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.panel { position: fixed; top: 84px; right: 12px; width: 380px; max-height: calc(100% - 140px); display: flex; flex-direction: column; background: var(--glass); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(8px); box-shadow: 0 6px 24px rgba(20,40,80,.12); z-index: 9; }
.panel-head { display: flex; gap: 12px; align-items: center; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.badge { width: 36px; height: 36px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
.kicker { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.panel h2 { margin: 2px 0 0; font-size: 17px; color: var(--navy); line-height: 1.25; }
.panel-body { padding: 12px 16px; overflow: auto; font-size: 13.5px; line-height: 1.55; }
.panel-body h4 { margin: 12px 0 4px; font-size: 12px; color: var(--blue); text-transform: uppercase; letter-spacing: .04em; }
.panel-body ul { margin: 0; padding-left: 18px; }
.panel-body li { margin: 2px 0; }
.params { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; background: var(--pale); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.params b { color: var(--navy); text-align: right; font-variant-numeric: tabular-nums; }
.risk { background: #fff4e6; border-left: 3px solid var(--warn); border-radius: 6px; padding: 8px 10px; margin-top: 4px; }
.ppe { display: flex; flex-wrap: wrap; gap: 6px; }
.ppe span { background: #e7f5ec; color: #1e6b34; border-radius: 999px; padding: 3px 9px; font-size: 12px; font-weight: 600; }
.panel-foot { display: flex; justify-content: space-between; gap: 8px; padding: 10px 16px 14px; border-top: 1px solid var(--line); }

.label3d { pointer-events: auto; cursor: pointer; display: flex; align-items: center; gap: 6px; transform: translateY(-6px); }
.label3d .dot { width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff; font: 700 12px/26px system-ui, sans-serif; text-align: center; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.label3d .txt { background: rgba(255,255,255,.95); color: var(--navy); font: 600 12px system-ui, sans-serif; padding: 3px 8px; border-radius: 6px; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.label3d.active .dot { background: #f08c00; transform: scale(1.15); }
.label3d.done .dot { background: var(--ok); }
.hz { pointer-events: auto; cursor: help; background: var(--warn); color: #fff; font: 700 11px system-ui, sans-serif; padding: 4px 8px; border-radius: 6px; white-space: nowrap; box-shadow: 0 0 0 0 rgba(217,72,15,.6); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(217,72,15,.55); } 70% { box-shadow: 0 0 0 12px rgba(217,72,15,0); } 100% { box-shadow: 0 0 0 0 rgba(217,72,15,0); } }
body:not(.safety) .hz { display: none; }
body.free .label3d .txt { display: none; }
body.free .label3d:hover .txt { display: block; }

.quiz { position: fixed; inset: 0; background: rgba(15,30,55,.45); display: grid; place-items: center; z-index: 20; }
.quiz-card { width: min(560px, 92vw); background: #fff; border-radius: 16px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.quiz-card h2 { margin: 6px 0 14px; color: var(--navy); font-size: 18px; line-height: 1.35; }
.opt { display: block; width: 100%; text-align: left; margin: 6px 0; padding: 10px 12px; font-weight: 500; color: var(--text); }
.opt.right { background: #e7f5ec; border-color: var(--ok); }
.opt.wrong { background: #fff0f0; border-color: #e03131; }
.explain { margin-top: 10px; padding: 10px 12px; background: var(--pale); border-radius: 8px; font-size: 13.5px; line-height: 1.5; }
.quiz-foot { display: flex; justify-content: space-between; margin-top: 14px; }
.score { font-size: 42px; font-weight: 800; color: var(--blue); text-align: center; margin: 10px 0; }
.hidden { display: none !important; }

.hint { position: fixed; bottom: 34px; left: 50%; transform: translateX(-50%); background: rgba(31,56,100,.82); color: #fff; font-size: 12.5px; padding: 6px 14px; border-radius: 999px; z-index: 8; transition: opacity .6s; }
.credit { position: fixed; bottom: 8px; left: 0; right: 0; text-align: center; font-size: 11px; color: rgba(20,40,70,.7); z-index: 8; pointer-events: none; }
.loading { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; background: #e9f2fa; color: var(--navy); font-weight: 600; z-index: 50; transition: opacity .5s; }
.spinner { width: 38px; height: 38px; border: 4px solid #cfe0f0; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1000px) {
  .outline { display: none; }
  .brand-sub, .progress { display: none; }
  .panel { top: auto; bottom: 30px; left: 12px; right: 12px; width: auto; max-height: 45%; }
  .modes button { padding: 6px 8px; font-size: 12px; }
  .hint { display: none; }
}
@media (max-width: 640px) {
  .brand-title { display: none; }
  .modes button { white-space: nowrap; font-size: 11px; padding: 6px 7px; }
  .topbar { gap: 8px; }
}
