/* ============================================================
   NEURO-ATLAS 1.0 — регулятор конфликтов
   спокойная тёплая тема, низкая сенсорная нагрузка
   ============================================================ */
:root {
  --bg: #F5EFE3;
  --bg-soft: #EFE7D7;
  --panel: #FDFAF3;
  --panel-2: #F7F2E7;
  --line: #E0D6C2;
  --line-soft: #EAE1CF;
  --ink: #372C1E;
  --ink-dim: #7A6F5C;
  --ink-faint: #A99D86;
  --accent: #7FA184;        /* шалфей — спокойствие */
  --accent-deep: #5D7F63;
  --accent-soft: #E4ECE2;
  --calm: #8B7BB5;          /* лаванда — практики */
  --calm-soft: #EAE5F2;
  --warm: #C8A86A;          /* янтарь — внимание */
  --warm-soft: #F3EAD6;
  --sos: #C97B6E;           /* мягкий терракот — SOS */
  --sos-soft: #F6E3DE;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px; --r-pill: 999px;
  --m-fast: 150ms; --m-smooth: 240ms; --m-slow: 400ms;
  --ease: cubic-bezier(.4,0,.2,1);
  --e1: 0 1px 3px rgba(80,60,30,.08), 0 2px 8px rgba(80,60,30,.06);
  --e2: 0 4px 14px rgba(80,60,30,.10), 0 10px 30px rgba(80,60,30,.08);
  --serif: "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.55; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 10px 13px; width: 100%; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; }

/* header */
.top {
  position: sticky; top: 0; z-index: 30;
  background: rgba(245,239,227,.92); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line-soft);
  padding: 12px 18px 0;
}
.top-inner { max-width: 760px; margin: 0 auto; }
.brand { font-family: var(--serif); font-style: italic; font-size: 21px; color: var(--accent-deep); }
.brand small { font-family: var(--mono); font-style: normal; font-size: 10px; color: var(--ink-faint); margin-left: 8px; }
.nav { display: flex; gap: 2px; margin-top: 8px; overflow-x: auto; }
.nav button {
  padding: 9px 15px 11px; font-size: 13.5px; color: var(--ink-dim); white-space: nowrap;
  border-bottom: 2.5px solid transparent; transition: color var(--m-fast) var(--ease);
}
.nav button:hover { color: var(--ink); }
.nav button.active { color: var(--accent-deep); border-bottom-color: var(--accent); font-weight: 600; }
.nav button.sos-tab.active { color: var(--sos); border-bottom-color: var(--sos); }

.wrap { max-width: 760px; margin: 0 auto; padding: 26px 18px 90px; }
h2.page { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 26px; margin-bottom: 6px; }
.lead { color: var(--ink-dim); margin-bottom: 22px; font-size: 14.5px; }

.card {
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-lg);
  padding: 18px 20px; margin-bottom: 12px; box-shadow: var(--e1);
}
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 11px 20px; border-radius: var(--r-pill); font-size: 14.5px;
  background: var(--panel); border: 1.5px solid var(--line); color: var(--ink);
  transition: all var(--m-fast) var(--ease);
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-deep); }
.btn.sos { background: var(--sos); border-color: var(--sos); color: #fff; font-weight: 600; }
.btn.ghost { border-color: transparent; color: var(--ink-dim); }
.btn.ghost:hover { color: var(--ink); background: var(--panel-2); }
.btn.big { padding: 16px 26px; font-size: 16px; border-radius: var(--r-lg); width: 100%; }

/* SOS home */
.sos-hero {
  background: linear-gradient(150deg, var(--sos-soft), var(--panel)); border: 1px solid #ecd4cd;
  border-radius: var(--r-xl); padding: 26px 24px; margin-bottom: 16px; box-shadow: var(--e1);
}
.sos-hero h3 { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 22px; margin-bottom: 4px; }
.sos-hero p { color: var(--ink-dim); font-size: 14px; margin-bottom: 16px; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 620px){ .quick-grid { grid-template-columns: 1fr; } }
.quick {
  background: var(--panel); border: 1.5px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 18px; text-align: left; cursor: pointer;
  transition: border-color var(--m-fast) var(--ease), transform var(--m-fast) var(--ease);
}
.quick:hover { border-color: var(--accent); transform: translateY(-1px); }
.quick .qi { font-size: 22px; }
.quick .qt { font-weight: 700; margin-top: 6px; }
.quick .qd { font-size: 12.5px; color: var(--ink-dim); margin-top: 2px; }

/* flow (one question at a time) */
.flow-q { font-family: var(--serif); font-size: 22px; font-style: italic; margin: 6px 0 18px; }
.flow-opt {
  display: block; width: 100%; text-align: left; padding: 15px 18px; margin-bottom: 9px;
  background: var(--panel); border: 1.5px solid var(--line); border-radius: var(--r-lg);
  font-size: 15px; transition: all var(--m-fast) var(--ease);
}
.flow-opt:hover { border-color: var(--accent); background: var(--accent-soft); }
.crumb { font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 10px; }
.answer-card { background: var(--accent-soft); border: 1.5px solid var(--accent); border-radius: var(--r-xl); padding: 22px 24px; }
.answer-card h3 { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 21px; margin-bottom: 10px; color: var(--accent-deep); }
.answer-card p { white-space: pre-line; font-size: 15px; }

/* protocol stepper */
.proto-step { display: flex; align-items: center; gap: 14px; }
.proto-num { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); }
.proto-text { font-family: var(--serif); font-style: italic; font-size: 24px; line-height: 1.4; margin: 14px 0 22px; }
.dots { display: flex; gap: 7px; margin: 4px 0 18px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); transition: background var(--m-fast); }
.dots i.on { background: var(--accent); }
.dots i.past { background: var(--accent-soft); border: 1px solid var(--accent); }

/* timer */
.timer-disp { font-family: var(--mono); font-size: 56px; text-align: center; letter-spacing: 3px; color: var(--accent-deep); margin: 10px 0; font-weight: 300; }
.timer-note { text-align: center; color: var(--ink-dim); font-size: 13px; margin-bottom: 14px; }
.rule { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; border-bottom: 1px dashed var(--line-soft); font-size: 14px; }
.rule:last-child { border-bottom: none; }
.rule .ri { font-size: 17px; }

/* translator */
.tr-card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 16px 18px; margin-bottom: 10px; box-shadow: var(--e1); }
.tr-before { color: var(--sos); font-size: 14.5px; text-decoration: line-through; text-decoration-color: rgba(201,123,110,.5); }
.tr-after { font-size: 16px; font-weight: 600; margin: 7px 0; color: var(--accent-deep); }
.tr-why { font-size: 13px; color: var(--ink-dim); border-top: 1px dashed var(--line-soft); padding-top: 8px; margin-top: 8px; }
.tr-copy { float: right; font-size: 12px; color: var(--ink-faint); padding: 3px 8px; border-radius: var(--r-pill); }
.tr-copy:hover { color: var(--accent-deep); background: var(--accent-soft); }

/* decks */
.deck-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(210px,1fr)); gap: 10px; }
.deck-tile {
  background: var(--panel); border: 1.5px solid var(--line); border-radius: var(--r-lg);
  padding: 18px; text-align: left; cursor: pointer; transition: all var(--m-fast) var(--ease);
}
.deck-tile:hover { border-color: var(--calm); transform: translateY(-1px); }
.deck-tile .de { font-size: 26px; }
.deck-tile .dn { font-weight: 700; margin-top: 6px; }
.deck-tile .dc { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); }
.practice-card {
  background: linear-gradient(160deg, var(--calm-soft), var(--panel));
  border: 1.5px solid var(--calm); border-radius: var(--r-xl); padding: 28px 26px;
  min-height: 210px; display: flex; flex-direction: column; justify-content: center;
  box-shadow: var(--e2);
}
.practice-card .pt { font-weight: 700; font-size: 17px; color: var(--calm); margin-bottom: 8px; }
.practice-card .pb { font-size: 16.5px; line-height: 1.6; }

/* quiz */
.q-progress { height: 6px; background: var(--bg-soft); border-radius: 3px; overflow: hidden; margin-bottom: 20px; }
.q-progress i { display: block; height: 100%; background: var(--accent); transition: width var(--m-smooth) var(--ease); }
.result-hero { background: linear-gradient(150deg, var(--accent-soft), var(--panel)); border: 1.5px solid var(--accent); border-radius: var(--r-xl); padding: 24px; margin-bottom: 14px; }
.result-hero h3 { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 24px; }
.tip { padding: 12px 14px; background: var(--panel-2); border-radius: var(--r-md); margin-bottom: 8px; }
.tip b { display: block; margin-bottom: 2px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; font-size: 13px; }
.bar-row .nm { min-width: 130px; }
.bar-row .bar { flex: 1; height: 9px; background: var(--bg-soft); border-radius: 5px; overflow: hidden; }
.bar-row .bar i { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.next-rec { display: flex; gap: 12px; align-items: flex-start; padding: 13px 15px; background: var(--panel); border: 1.5px solid var(--line); border-radius: var(--r-lg); margin-bottom: 9px; cursor: pointer; transition: border-color var(--m-fast); }
.next-rec:hover { border-color: var(--accent); }
.next-rec.primary { border-color: var(--warm); background: var(--warm-soft); }
.next-rec .ni { font-size: 20px; }
.next-rec .nt { font-weight: 700; font-size: 14px; }
.next-rec .nd { font-size: 12.5px; color: var(--ink-dim); }

/* guide accordion */
.acc { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-lg); margin-bottom: 9px; overflow: hidden; }
.acc-head { width: 100%; text-align: left; padding: 15px 18px; font-weight: 600; font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.acc-head:hover { background: var(--panel-2); }
.acc-head .chev { color: var(--ink-faint); transition: transform var(--m-smooth) var(--ease); }
.acc.open .acc-head .chev { transform: rotate(90deg); }
.acc-body { display: none; padding: 0 20px 16px; color: var(--ink); font-size: 14.5px; }
.acc.open .acc-body { display: block; }
.acc-body ul { padding-left: 20px; margin: 6px 0; }
.acc-body li { margin-bottom: 5px; }

/* debrief */
.debrief-entry { border-left: 3px solid var(--accent); padding: 6px 0 6px 14px; margin-bottom: 14px; }
.debrief-entry .dd { font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); }
.debrief-entry .dq { font-size: 12px; color: var(--ink-dim); margin-top: 6px; }
.debrief-entry .da { font-size: 14px; }

label.f { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: 1px; color: var(--ink-faint); margin: 14px 0 5px; text-transform: uppercase; }
.next-action {
  padding: 12px 15px; background: var(--warm-soft); border: 1.5px solid var(--warm);
  border-radius: var(--r-md); font-size: 14px; margin-bottom: 18px;
}
.next-action b { display: block; font-family: var(--mono); font-size: 9.5px; letter-spacing: 1.2px; color: var(--warm); margin-bottom: 3px; }

#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translate(-50%,70px);
  background: var(--ink); color: var(--panel); padding: 10px 20px; border-radius: var(--r-pill);
  font-size: 13.5px; z-index: 200; transition: transform var(--m-smooth) var(--ease), opacity var(--m-smooth); opacity: 0;
}
#toast.show { transform: translate(-50%,0); opacity: 1; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.center { text-align: center; }
.muted { color: var(--ink-faint); font-size: 12.5px; }
.export-pre { width: 100%; height: 40vh; font-family: var(--mono); font-size: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; }

/* ============================================================
   v2.0 additions
   ============================================================ */
/* text size toggle */
body.big-text { font-size: 17px; }
body.big-text .flow-q { font-size: 25px; }
body.big-text .proto-text { font-size: 28px; }
body.big-text .flow-opt { font-size: 17px; padding: 18px 20px; }

/* welcome */
.welcome-veil { position: fixed; inset: 0; background: rgba(60,48,32,.5); z-index: 300; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
.welcome { width: min(540px,92vw); background: var(--panel); border: 1.5px solid var(--accent); border-radius: var(--r-xl); padding: 28px 30px; box-shadow: var(--e2); }
.welcome h2 { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 25px; color: var(--accent-deep); margin-bottom: 4px; }
.welcome .wsub { color: var(--ink-dim); font-size: 13.5px; margin-bottom: 18px; }
.wstep { display: flex; gap: 13px; margin-bottom: 14px; align-items: flex-start; }
.wstep .wn { font-family: var(--mono); font-size: 11px; background: var(--accent); color: #fff; min-width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.wstep .wt { font-weight: 700; font-size: 14.5px; }
.wstep .wd { font-size: 13px; color: var(--ink-dim); }

/* breathing circle */
.breath-wrap { display: flex; flex-direction: column; align-items: center; padding: 8px 0 4px; }
.breath-circle {
  width: 130px; height: 130px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft) 30%, transparent 70%);
  border: 2.5px solid var(--accent); display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--accent-deep); font-weight: 600;
  animation: breathe 10s ease-in-out infinite;
}
@keyframes breathe {
  0%   { transform: scale(0.72); }
  40%  { transform: scale(1.0); }   /* вдох 4с */
  100% { transform: scale(0.72); }  /* выдох 6с */
}
.breath-label { margin-top: 10px; color: var(--ink-dim); font-size: 12.5px; }

/* sos pulse */
.btn.sos.big { animation: sospulse 3s ease-in-out infinite; }
@keyframes sospulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(201,123,110,.35); }
  50% { box-shadow: 0 0 0 9px rgba(201,123,110,0); }
}

/* codeword */
.codeword-pill { display: inline-flex; align-items: center; gap: 8px; background: var(--warm-soft); border: 1.5px solid var(--warm); border-radius: var(--r-pill); padding: 6px 15px; font-size: 14px; }
.codeword-pill b { font-family: var(--serif); font-style: italic; font-size: 16px; }

/* personalization tip */
.ptip { display: flex; gap: 10px; background: var(--calm-soft); border: 1.5px solid var(--calm); border-radius: var(--r-md); padding: 11px 14px; font-size: 13.5px; margin: 12px 0; }
.ptip .pi { font-size: 17px; }

/* favorites on phrases */
.tr-star { float: right; font-size: 15px; opacity: .35; padding: 2px 7px; cursor: pointer; transition: opacity .15s; }
.tr-star:hover, .tr-star.on { opacity: 1; color: var(--warm); }

.hk-row { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; border-bottom: 1px dashed var(--line-soft); font-size: 13.5px; }
.hk-row:last-child { border-bottom: none; }
.modal-veil { position: fixed; inset: 0; background: rgba(60,48,32,.45); display: flex; align-items: center; justify-content: center; z-index: 200; opacity: 0; pointer-events: none; transition: opacity var(--m-smooth) var(--ease); }
.modal-veil.open { opacity: 1; pointer-events: auto; }
.modal { width: min(620px,93vw); max-height: 84vh; overflow-y: auto; background: var(--panel); border: 1.5px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--e2); padding: 24px 26px; }
.modal h3 { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 22px; margin-bottom: 4px; }
.modal .subline { font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); margin-bottom: 14px; }
.modal .close { float: right; color: var(--ink-faint); font-size: 18px; padding: 2px 8px; }
.kv { margin-bottom: 13px; }
.kv h5 { font-family: var(--mono); font-size: 10px; letter-spacing: 1.2px; color: var(--accent-deep); text-transform: uppercase; margin-bottom: 4px; }
