/* Радар рисков — оформление в стиле тренажёров Iowa Solutions (wbs-game). */
:root {
    --bg: #eef3f8;
    --panel: #ffffff;
    --ink: #1d2733;
    --muted: #6a7a8c;
    --line: #d5dfea;
    --brand: #0f4c81;
    --brand-soft: #e6eef7;
    --accent: #1a9e8f;
    --warn: #c2410c;
    --err: #d64545;
    --ok: #2f9e44;
    --card: #f4f8fc;
    --z0: #d8f0dc;
    --z1: #fbf1c4;
    --z2: #fcd9b6;
    --z3: #f6b9b9;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(20, 40, 70, .08), 0 6px 18px rgba(20, 40, 70, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}
a { color: var(--brand); }
.wrap { max-width: 1280px; margin: 0 auto; padding: 16px 18px 40px; }

/* ---------- шапка ---------- */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding: 6px 0 14px; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; min-width: 0; }
.brand .mark {
    position: relative; overflow: hidden; flex: none;
    width: 38px; height: 38px; border-radius: 9px; background: var(--brand); color: #fff;
    display: grid; place-items: center; font-weight: 700; font-size: 17px; letter-spacing: .5px;
}
.brand .mark .sweep {
    position: absolute; inset: -20%;
    background: conic-gradient(from 0deg, rgba(26, 158, 143, .0) 0deg, rgba(26, 158, 143, .55) 40deg, rgba(26, 158, 143, 0) 60deg);
    animation: sweep 3.2s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg); } }
.brand h1 { margin: 0; font-size: 19px; line-height: 1.2; }
.brand p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.home-link { color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.home-link:hover { color: var(--brand); }

.lang button, .btn {
    font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
    border-radius: 8px; padding: 8px 13px; transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn:hover, .lang button:hover { border-color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #0c3d68; }
.btn.big { padding: 11px 20px; font-weight: 600; }
.btn.demo { border-color: #f3c4c4; background: #fff4f4; color: #9c2b2b; font-weight: 600; }
.btn.demo.exit { background: #f1fbf3; border-color: #bfe3c6; color: #1f6b2c; }
.lang { display: inline-flex; border: 1px solid var(--line); background: var(--panel); border-radius: 9px; overflow: hidden; }
.lang button { border: 0; border-radius: 0; padding: 8px 14px; }
.lang button + button { border-left: 1px solid var(--line); }
.lang button.on { background: var(--brand); color: #fff; }

/* ---------- правила ---------- */
.rules {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 10px 14px; margin-bottom: 12px; box-shadow: var(--shadow); font-size: 14px;
}
.rules summary { cursor: pointer; font-weight: 600; color: var(--brand); }
.rules ol { margin: 10px 0 4px; padding-left: 22px; }
.rules li { margin-bottom: 6px; }

/* ---------- этапы ---------- */
.stages { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.stages button {
    font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; border: 1px solid var(--line);
    background: var(--panel); color: var(--ink); border-radius: 9px; padding: 8px 13px; display: inline-flex; align-items: center; gap: 7px;
}
.stages button .n {
    display: inline-grid; place-items: center; width: 21px; height: 21px; border-radius: 50%;
    background: var(--brand-soft); color: var(--brand); font-size: 12px;
}
.stages button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.stages button.on .n { background: #fff; }
.stages button.done:not(.on) { border-color: #bfe3c6; background: #f1fbf3; color: #1f6b2c; }
.stages button[disabled] { opacity: .5; cursor: default; }

.project { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); }
.banner {
    margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius); background: #fff4f4;
    border: 1px solid #f3c4c4; color: #9c2b2b; font-size: 14px; font-weight: 600;
}
.roundIntro {
    padding: 12px 14px; margin: 0 0 12px; background: var(--brand-soft); border: 1px solid var(--line);
    border-left: 4px solid var(--brand); border-radius: var(--radius); font-size: 14px; line-height: 1.55;
}

.bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; background: var(--panel);
    border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin: 12px 0;
}
.bar .spacer, .seedBar .spacer { flex: 1; }
.score { font-size: 13.5px; color: var(--muted); }
.msg {
    margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius); background: var(--brand-soft);
    border: 1px solid #cfe0f0; color: #1b3c5c; font-size: 14px; animation: rise .35s ease-out;
}
.msg.ok { background: #e7f6ea; border-color: #bfe3c6; color: #1f6b2c; }
.msg.err { background: #fdeaea; border-color: #f3c4c4; color: #9c2b2b; }
.note { font-size: 13.5px; color: var(--warn); margin: 0 0 10px; }
.panel {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 12px; min-width: 0;
}
.panel h3 { margin: 0 0 10px; font-size: 15px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 1. выявление ---------- */
.cands { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.cand {
    position: relative; text-align: left; font: inherit; font-size: 14px; cursor: pointer;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 38px 12px 12px;
    box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; color: var(--ink);
    transition: border-color .15s, transform .15s, background .15s;
}
.cand:hover { border-color: var(--brand); transform: translateY(-1px); }
.cand .no { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.cand .tick {
    position: absolute; top: 10px; right: 10px; width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--line);
}
.cand.picked { border-color: var(--brand); background: #f3f8fe; }
.cand.picked .tick { background: var(--brand); border-color: var(--brand); }
.cand.picked .tick::after {
    content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.cand[aria-disabled="true"] { cursor: default; transform: none; }
.cand.isRisk { border-color: #9dd4a8; background: #f2fbf4; animation: rise .35s ease-out; }
.cand.isDis { border-color: #f0b4b4; background: #fff6f6; animation: wobble .5s ease-out; }
.cand.isDis .tick { background: var(--err); border-color: var(--err); }
.cand.skipped { opacity: .55; }
@keyframes wobble { 0%, 100% { transform: none; } 25% { transform: rotate(-1deg); } 75% { transform: rotate(1deg); } }
.badge { align-self: flex-start; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 20px; }
.badge.threat { background: #fde4d4; color: #9a3412; }
.badge.opp { background: #d7f2ee; color: #0f6b60; }
.badge.dis { background: #fdeaea; color: #9c2b2b; }
.why { font-size: 13px; color: #43515f; }

/* ---------- матрица ---------- */
.assess { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 14px; align-items: start; }
.side .hint { margin: 0 0 8px; font-size: 13.5px; color: var(--muted); }
.chips { display: flex; flex-direction: column; gap: 8px; }
.chip {
    display: inline-block; cursor: grab; user-select: none; touch-action: none; font-size: 13px; font-weight: 600;
    padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow);
}
.chip.threat { border-left: 4px solid var(--warn); }
.chip.opp { border-left: 4px solid var(--accent); }
.chip.sel { outline: 3px solid var(--brand); outline-offset: 1px; }
.chip.small { padding: 2px 6px; font-size: 11.5px; box-shadow: none; }
.chip.pop { animation: pop .35s ease-out; }
.chip.ghost { position: fixed; z-index: 50; pointer-events: none; transform: translate(-50%, -50%) scale(1.1); opacity: .9; }
@keyframes pop { 0% { transform: scale(.5); } 70% { transform: scale(1.15); } 100% { transform: none; } }
.matrixWrap { min-width: 0; }
.matrix { display: grid; grid-template-columns: 22px minmax(0, 1fr); grid-template-rows: auto auto; gap: 4px; }
.matrix .yLabel {
    writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; font-size: 12.5px; color: var(--muted); font-weight: 600;
}
.matrix .xLabel { grid-column: 2; text-align: center; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.mgrid { display: grid; grid-template-columns: 18px repeat(5, minmax(0, 1fr)); gap: 4px; }
.rowLab, .colLab { font-size: 12px; color: var(--muted); display: grid; place-items: center; }
.cell {
    position: relative; min-height: 64px; border-radius: 7px; padding: 16px 4px 4px; display: flex; flex-wrap: wrap;
    align-content: flex-start; gap: 3px; border: 1px solid rgba(0, 0, 0, .05);
}
.matrix.live .cell { cursor: pointer; }
.matrix.live .cell:hover { outline: 2px dashed var(--brand); }
.cell .sc { position: absolute; top: 2px; right: 5px; font-size: 10.5px; color: rgba(0, 0, 0, .4); font-weight: 700; }
.cell.z0 { background: var(--z0); }
.cell.z1 { background: var(--z1); }
.cell.z2 { background: var(--z2); }
.cell.z3 { background: var(--z3); }
.truth {
    font-size: 11px; font-weight: 700; padding: 1px 5px; border-radius: 6px; border: 2px dashed var(--brand); color: var(--brand);
    background: rgba(255, 255, 255, .7); animation: pop .4s ease-out;
}
.gaps { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 6px; font-size: 13.5px; }
.gaps li { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.gaps li.ok { border-color: #bfe3c6; }
.gaps li.bad { border-color: #f3c4c4; background: #fff6f6; }
.mark {
    font-size: 11px; font-weight: 700; padding: 1px 5px; border-radius: 6px; background: #fff; border: 1px solid var(--line);
}
.mark.opp { border-color: var(--accent); color: #0f6b60; }
.mark.threat { border-color: var(--warn); color: #9a3412; }
.mark.unid { border-style: dashed; }
.mark.fired { background: #b42318; color: #fff; border-color: #b42318; animation: pulse 1.6s ease-out infinite; }
.mark.opp.fired { background: var(--accent); border-color: var(--accent); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(180, 35, 24, .55); } 100% { box-shadow: 0 0 0 9px rgba(180, 35, 24, 0); } }
.legend { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }

/* ---------- 3. реагирование ---------- */
.reserve {
    position: relative; height: 34px; border-radius: 9px; background: #fdeaea; border: 1px solid var(--line); overflow: hidden; margin-bottom: 10px;
}
.reserve .rfill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #bfe3c6, #8fd19e); transition: width .4s ease; }
.reserve span { position: relative; display: block; text-align: center; line-height: 32px; font-weight: 700; font-size: 14px; }
.resp { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; }
.rrow { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); min-width: 0; }
.rhead { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rhead .code { font-weight: 800; color: var(--brand); }
.zone, .watch, .kind { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 20px; }
.zone.z0 { background: var(--z0); } .zone.z1 { background: var(--z1); } .zone.z2 { background: var(--z2); } .zone.z3 { background: var(--z3); }
.watch { background: var(--brand-soft); color: var(--brand); }
.kind.threat { background: #fde4d4; color: #9a3412; }
.kind.opp { background: #d7f2ee; color: #0f6b60; }
.rt { margin: 8px 0 4px; font-size: 14px; }
.rmeta { margin: 0 0 8px; font-size: 12.5px; color: var(--muted); }
.strats { display: flex; flex-wrap: wrap; gap: 6px; }
.strat {
    font: inherit; font-size: 13px; cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--ink);
    border-radius: 8px; padding: 6px 9px; display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.2;
}
.strat small { font-size: 11.5px; color: var(--muted); }
.strat:hover { border-color: var(--brand); }
.strat.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.strat.on small { color: #d6e6f5; }
.strat[disabled] { opacity: .4; cursor: not-allowed; }
.eff { margin: 8px 0 0; font-size: 12.5px; color: #43515f; }

/* ---------- 4. исполнение ---------- */
.seedBar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.seedBar label, .bar label { font-weight: 600; font-size: 13.5px; }
#seedInput { font: inherit; width: 110px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; }
.ruler { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 3px; margin-bottom: 6px; }
.ruler .tick {
    text-align: center; font-size: 11.5px; padding: 4px 0; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); color: var(--muted);
    transition: background .3s;
}
.ruler .tick.past { background: var(--brand-soft); color: var(--brand); }
.ruler .tick.now { background: var(--brand); color: #fff; border-color: var(--brand); transform: scale(1.06); }
.monthNow { font-weight: 700; font-size: 16px; margin: 4px 0 8px; min-height: 22px; }
.lanes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lane { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; min-width: 0; }
.lane h3 { margin: 0 0 8px; font-size: 15.5px; }
.lane0 h3 { color: var(--brand); }
.lane1 h3 { color: #8a3b12; }
.lane.shake { animation: shake .5s ease-in-out; }
@keyframes shake {
    0%, 100% { transform: none; box-shadow: var(--shadow); }
    20% { transform: translateX(-5px); box-shadow: 0 0 0 3px rgba(214, 69, 69, .45); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(2px); }
}
.gauges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.gauge { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; min-width: 0; }
.gauge .gl { display: block; font-size: 11.5px; color: var(--muted); }
.gauge .gv { font-size: 18px; }
.gauge .gb { display: block; height: 6px; border-radius: 4px; background: #e2e9f1; overflow: hidden; margin-top: 4px; }
.gauge .gb i { display: block; height: 100%; background: var(--accent); transition: width .5s ease; }
.gauge.bad .gv { color: var(--err); }
.gauge.bad .gb i { background: var(--err); }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 520px; overflow-y: auto; }
.ev { display: flex; gap: 8px; font-size: 13.5px; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--line); background: #fff; animation: slidein .45s ease-out; }
.ev.instant { animation: none; }
.ev .mb, .issues .mb {
    flex: none; display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 50%; background: var(--brand-soft);
    color: var(--brand); font-size: 11.5px; font-weight: 700;
}
.ev.surprise { background: #fff1f1; border-color: #f0b4b4; }
.ev.surprise .mb { background: var(--err); color: #fff; }
.ev.hit { background: #fff8ef; border-color: #f6d3a8; }
.ev.dodge { background: #f1fbf3; border-color: #bfe3c6; }
.ev.gain, .ev.gainHalf { background: #eefaf8; border-color: #a9ddd5; }
.ev.issue, .ev.boom { background: #f6f3fb; border-color: #d9cdeb; }
.ev.quiet { color: var(--muted); font-style: italic; background: var(--card); }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.tg { font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 20px; white-space: nowrap; }
.tg.neg { background: #fdeaea; color: #9c2b2b; }
.tg.pos { background: #d7f2ee; color: #0f6b60; }
.over { margin: 4px 0 0; font-size: 12px; color: var(--err); font-weight: 600; }
@keyframes slidein { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }
.finish { font-weight: 700; margin: 10px 0 0; }
.issues ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; }
.issues li { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.issues li.empty { color: var(--muted); }

/* ---------- 5. разбор ---------- */
.verdict {
    position: relative; overflow: hidden; border-radius: 14px; padding: 18px 20px; margin-bottom: 12px; color: #fff;
    background: linear-gradient(120deg, #0f4c81, #1a9e8f); box-shadow: var(--shadow); animation: rise .5s ease-out;
}
.verdict.tier2 { background: linear-gradient(120deg, #7a5a0b, #c2410c); }
.verdict.tier3, .verdict.tier4 { background: linear-gradient(120deg, #7f1d1d, #c2410c); }
.verdict .vt { font-size: 26px; font-weight: 800; line-height: 1.15; animation: stamp .6s cubic-bezier(.2, 1.6, .4, 1); }
.verdict .vl { margin: 8px 0 4px; font-size: 15px; }
.verdict .cmp { margin: 0; font-size: 14px; opacity: .92; }
@keyframes stamp { from { transform: scale(1.6) rotate(-4deg); opacity: 0; } to { transform: none; opacity: 1; } }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.chart { width: 100%; height: auto; display: block; }
.chart .ct { font-size: 11px; font-weight: 700; fill: var(--ink); }
.chart .cl, .chart .cv { font-size: 10.5px; fill: #43515f; }
.chart .bar0 { fill: var(--brand); }
.chart .bar1 { fill: #e8590c; }
.chart rect { transform-origin: 110px 0; animation: grow .9s ease-out; }
.chart .base { stroke: #1d2733; stroke-dasharray: 3 3; stroke-width: 1; }
@keyframes grow { from { transform: scaleX(0); } to { transform: none; } }
.mis ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; font-size: 14px; }
.mis li::marker { color: var(--err); }
.mis li.none::marker { color: var(--ok); }
.tableWrap { overflow-x: auto; }
table.reg { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
table.reg th, table.reg td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.reg th { font-size: 12px; color: var(--muted); }
table.reg tr.fired td:last-child { color: var(--err); font-weight: 700; }
table.reg tr.gained td:last-child { color: #0f6b60; font-weight: 700; }
table.reg tr.unid td:first-child { text-decoration: underline dotted var(--err); }

/* ---------- ссылки и подвал ---------- */
.crosslink { margin: 12px 0; padding: 9px 14px; border: 1px solid #cfe3d6; border-radius: var(--radius); background: #f2f9f5; font-size: 13px; }
.crosslink a { font-weight: 600; }
footer { margin-top: 24px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; }
footer a { color: var(--muted); }
footer .legal { font-size: 11.5px; }

/* ---------- узкие экраны ---------- */
@media (max-width: 900px) {
    .assess, .grid2 { grid-template-columns: minmax(0, 1fr); }
    .chips { flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 720px) {
    .wrap { padding: 12px 12px 30px; }
    .lanes { grid-template-columns: minmax(0, 1fr); }
    .resp, .cands, .gaps { grid-template-columns: minmax(0, 1fr); }
    .ruler { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .brand h1 { font-size: 17px; }
    .cell { min-height: 48px; padding: 14px 2px 2px; }
    .stages button { padding: 6px 9px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
