:root {
  --bg: #0d1422; --card: #141e33; --line: #1f2b45; --chip: #22304d; --field: #0f1729;
  --text: #e8edf5; --dim: #7f8ba3; --accent: #ff8a1f;
  --ok-bg: #123b26; --ok: #6fe39b; --meh-bg: #47360f; --meh: #ffcf6b; --bad-bg: #4a1f16; --bad: #ff9f80;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: -apple-system, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }

.top { position: sticky; top: 0; z-index: 5; background: var(--card); border-bottom: 1px solid #22304d; padding: 10px 14px 0; padding-top: max(10px, env(safe-area-inset-top)); }
.top-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
h1 { font-size: 20px; margin: 0; }
.seg { display: flex; gap: 6px; }
.seg button { padding: 7px 12px; border-radius: 8px; background: var(--chip); font-size: 14px; white-space: nowrap; }
.seg button.on { background: var(--accent); color: #111; font-weight: bold; }
.seg button .mk { font-size: 11px; margin-left: 4px; }
.tabs { display: flex; margin-top: 8px; }
.tabs button { flex: 1; padding: 10px 4px; color: var(--dim); border-bottom: 3px solid transparent; font-size: 15px; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); font-weight: bold; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 12px 12px 90px; }
.cols { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.cols > div { flex: 1 1 340px; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.card h2 { font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--dim); margin: 0 0 10px; display: flex; justify-content: space-between; align-items: center; }
.card h2 small { text-transform: none; letter-spacing: 0; font-size: 12px; }
.banner { background: #1c2a48; border: 1px dashed #3a5288; border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

canvas { width: 100%; display: block; border-radius: 10px; background: #0a101c; touch-action: manipulation; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.btn { display: inline-block; padding: 8px 12px; border-radius: 8px; background: var(--chip); font-size: 14px; }
.btn.on { background: #33466f; }
.btn.go { background: var(--accent); color: #111; font-weight: bold; }
.btn.warn { background: #4a2a1a; color: var(--bad); }
.hint { font-size: 12px; color: var(--dim); }
.pick { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--field); font-size: 14px; min-height: 20px; }
.step { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; color: var(--dim); }
.step input { flex: 1; min-width: 0; accent-color: var(--accent); }
.step-l { margin-top: 4px; font-size: 13px; color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.4em; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; font-size: 12px; color: var(--dim); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.stats { display: flex; flex-wrap: wrap; gap: 8px; }
.stat { flex: 1 1 120px; background: var(--field); border-radius: 10px; padding: 10px; }
.stat b { display: block; font-size: 21px; }
.stat span { font-size: 12px; color: var(--dim); }
.meter { height: 6px; background: var(--chip); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); }
.verdict { font-size: 18px; font-weight: bold; padding: 12px; border-radius: 10px; text-align: center; margin-top: 10px; }
.verdict small { display: block; font-size: 13px; font-weight: normal; margin-top: 4px; }
.ok { background: var(--ok-bg); color: var(--ok); }
.meh { background: var(--meh-bg); color: var(--meh); }
.bad { background: var(--bad-bg); color: var(--bad); }
.tip { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: #172742; font-size: 14px; line-height: 1.4; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 14px; }
.opt .seg button { padding: 6px 10px; font-size: 13px; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.chips button { padding: 7px 12px; border-radius: 18px; background: var(--chip); white-space: nowrap; font-size: 14px; }
.chips button.on { background: var(--accent); color: #111; font-weight: bold; }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; margin-top: 10px; }
.quick button { padding: 10px 8px; border-radius: 10px; background: var(--field); border: 1px solid #2a3a5e; text-align: left; font-size: 14px; line-height: 1.25; }
.quick button small { display: block; color: var(--dim); font-size: 11px; }
.quick button:active { background: #22304d; }

.room-h { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 0 2px; font-weight: bold; }
.room-h:first-child { margin-top: 0; }
.room-h span { font-weight: normal; font-size: 12px; color: var(--dim); }
.row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.sw { width: 14px; height: 14px; border-radius: 4px; flex: 0 0 14px; }
.nm { flex: 1; min-width: 0; text-align: left; padding: 0; }
.nm .sub { font-size: 12px; color: var(--dim); margin-top: 2px; }
.q { width: 30px; text-align: center; font-weight: bold; }
.pm { width: 34px; height: 34px; border-radius: 8px; background: var(--chip); font-weight: bold; font-size: 18px; flex: 0 0 34px; }

.list { margin: 0; padding: 0; list-style: none; }
.list li { padding: 7px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; }
.list li:last-child { border-bottom: 0; }
.list li b { white-space: nowrap; }
.sec { margin-bottom: 10px; }
.sec h3 { font-size: 14px; margin: 0 0 4px; }
.sec p { margin: 0; color: #c5cee0; font-size: 14px; line-height: 1.45; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); text-align: left; width: 100%; line-height: 1.4; }
.check .box { flex: 0 0 22px; height: 22px; border-radius: 6px; border: 2px solid #3a4b70; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.check.done { color: var(--dim); }
.check.done .box { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }

.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 16px 16px max(16px, env(safe-area-inset-bottom)); }
.sheet h3 { margin: 0 0 12px; font-size: 18px; }
.f { display: flex; flex-wrap: wrap; gap: 8px; }
.f label { flex: 1 1 28%; font-size: 12px; color: var(--dim); min-width: 0; }
.f label.w { flex: 1 1 100%; }
.f label.h { flex: 1 1 45%; }
.f input, .f select, .f textarea { width: 100%; margin-top: 3px; padding: 9px; border-radius: 8px; border: 1px solid #2a3a5e; background: var(--field); color: var(--text); font-size: 16px; font-family: inherit; }
.f input::placeholder { color: #5d6a85; }
.tog { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 15px; width: 100%; }
.tog small { display: block; font-size: 12px; color: var(--dim); }
.switch { position: relative; width: 46px; height: 28px; flex: 0 0 46px; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; background: #2a3a5e; border-radius: 14px; transition: background .15s; }
.switch i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); }
.acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.acts .btn { padding: 11px 14px; font-size: 15px; }
.acts .grow { flex: 1; text-align: center; }

.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: #2a3a5e; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 30; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
.busy { color: var(--dim); font-size: 12px; }
