/* ============================================================
   ATLAS 1.0 — справочник взглядов и убеждений + арена
   тема: ночная библиотека (глубокий индиго + золото)
   ============================================================ */
:root {
  --bg: #12141C;
  --bg-deep: #0C0E14;
  --panel: #1A1D29;
  --panel-2: #222636;
  --panel-3: #2B3042;
  --line: #303650;
  --line-soft: #252a3d;
  --ink: #E8E4D8;
  --ink-dim: #A29E90;
  --ink-faint: #6C6A60;
  --gold: #D8B96A;
  --gold-dim: rgba(216,185,106,.14);
  --gold-line: rgba(216,185,106,.4);
  --ancient: #C8A86A; --medieval: #9B8BC5; --modern: #6A9BD8; --contemporary: #D87B6A; --eastern: #7FA184;
  --ok: #9CBF8E; --warn: #D8B96A; --bad: #D87B6A; --info: #6A9BD8;
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 18px; --r-pill: 999px;
  --m-fast: 150ms; --m-smooth: 240ms; --ease: cubic-bezier(.4,0,.2,1);
  --e2: 0 2px 8px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.3);
  --e4: 0 10px 30px rgba(0,0,0,.6), 0 24px 70px rgba(0,0,0,.5);
  --serif: "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 14.5px; line-height: 1.55; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg-deep); border: 1px solid var(--line); border-radius: var(--r-md); padding: 9px 12px; }
input:focus, select:focus { outline: none; border-color: var(--gold-line); }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: var(--panel-3); border-radius: 5px; }

.top {
  position: sticky; top: 0; z-index: 30; padding: 12px 22px 0;
  background: rgba(18,20,28,.94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-soft);
}
.top-inner { max-width: 1060px; margin: 0 auto; }
.brand { font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--gold); }
.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 14px 11px; font-size: 13.5px; color: var(--ink-dim); border-bottom: 2.5px solid transparent; white-space: nowrap; transition: color var(--m-fast); }
.nav button:hover { color: var(--ink); }
.nav button.active { color: var(--gold); border-bottom-color: var(--gold); font-weight: 600; }

.wrap { max-width: 1060px; margin: 0 auto; padding: 26px 22px 100px; }
h2.page { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 27px; margin-bottom: 6px; }
.lead { color: var(--ink-dim); margin-bottom: 20px; font-size: 14px; max-width: 720px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px;
  border-radius: var(--r-pill); font-size: 13.5px;
  background: var(--panel-2); border: 1px solid var(--line);
  transition: all var(--m-fast) var(--ease);
}
.btn:hover { border-color: var(--gold-line); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #241d0d; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-dim); }
.btn.ghost:hover { color: var(--ink); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip { padding: 5px 13px; border-radius: var(--r-pill); font-size: 12.5px; background: var(--panel); border: 1px solid var(--line); color: var(--ink-dim); cursor: pointer; transition: all var(--m-fast) var(--ease); }
.chip:hover { color: var(--ink); border-color: var(--gold-line); }
.chip.on { background: var(--gold-dim); border-color: var(--gold-line); color: var(--gold); }
.search-row { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.search-row input[type=search]{ flex: 1; min-width: 220px; }
.muted { color: var(--ink-faint); font-size: 12px; }

/* cards grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(250px,1fr)); gap: 11px; }
.tile {
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-lg);
  padding: 15px 16px; cursor: pointer; position: relative;
  transition: border-color var(--m-fast) var(--ease), transform var(--m-fast) var(--ease);
}
.tile:hover { border-color: var(--gold-line); transform: translateY(-2px); }
.tile .tname { font-family: var(--serif); font-size: 17px; }
.tile .tsub { font-family: var(--mono); font-size: 9.5px; color: var(--ink-faint); margin-top: 2px; letter-spacing: .5px; }
.tile .tdesc { font-size: 12px; color: var(--ink-dim); margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile .edge { position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 2px; }
.tagrow { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 9px; }
.mini-tag { font-family: var(--mono); font-size: 8.5px; padding: 2px 7px; border-radius: var(--r-pill); background: var(--bg-deep); color: var(--ink-faint); }

/* ================= ARENA ================= */
.arena-modes { display: grid; grid-template-columns: repeat(auto-fit,minmax(240px,1fr)); gap: 12px; margin-bottom: 22px; }
.arena-mode {
  background: var(--panel); border: 1.5px solid var(--line); border-radius: var(--r-xl);
  padding: 20px; text-align: left; cursor: pointer; transition: all var(--m-fast) var(--ease);
}
.arena-mode:hover { border-color: var(--gold-line); transform: translateY(-2px); }
.arena-mode.on { border-color: var(--gold); background: var(--gold-dim); }
.arena-mode .am-i { font-size: 24px; }
.arena-mode .am-t { font-family: var(--serif); font-size: 18px; margin-top: 6px; }
.arena-mode .am-d { font-size: 12.5px; color: var(--ink-dim); margin-top: 3px; }

.vs-row { display: grid; grid-template-columns: 1fr 54px 1fr; gap: 12px; align-items: start; margin-top: 18px; }
@media (max-width: 720px){ .vs-row { grid-template-columns: 1fr; } .vs-badge { display: none; } }
.vs-badge {
  font-family: var(--serif); font-style: italic; font-size: 21px; color: var(--gold);
  display: flex; align-items: center; justify-content: center; height: 54px; margin-top: 40px;
  background: var(--gold-dim); border: 1px solid var(--gold-line); border-radius: 50%;
  width: 54px;
}
.fighter {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: 18px 20px; box-shadow: var(--e2);
}
.fighter h4 { font-family: var(--serif); font-weight: 400; font-size: 19px; }
.fighter .fsub { font-family: var(--mono); font-size: 9.5px; color: var(--ink-faint); letter-spacing: .8px; text-transform: uppercase; margin: 2px 0 10px; }
.fighter .one { font-size: 14.5px; font-style: italic; color: var(--gold); margin-bottom: 10px; }
.fsec { margin-bottom: 10px; }
.fsec h6 { font-family: var(--mono); font-size: 9px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 3px; }
.fsec p, .fsec li { font-size: 13px; }
.fsec ul { padding-left: 17px; }
.fsec.strong h6 { color: var(--ok); } .fsec.weak h6 { color: var(--bad); }
.verdict { display: inline-block; padding: 3px 12px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 700; margin-bottom: 8px; }
.verdict.do { background: rgba(156,191,142,.16); color: var(--ok); border: 1px solid rgba(156,191,142,.4); }
.verdict.dont { background: rgba(216,123,106,.14); color: var(--bad); border: 1px solid rgba(216,123,106,.4); }
.verdict.depends { background: rgba(216,185,106,.13); color: var(--warn); border: 1px solid rgba(216,185,106,.4); }

.bridge-card {
  background: linear-gradient(160deg, rgba(127,161,132,.1), var(--panel));
  border: 1.5px solid rgba(127,161,132,.45); border-radius: var(--r-xl); padding: 20px 22px; margin-top: 16px;
}
.bridge-card h4 { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 19px; color: var(--eastern); margin-bottom: 10px; }
.danger-card {
  background: linear-gradient(160deg, rgba(216,123,106,.09), var(--panel));
  border: 1.5px solid rgba(216,123,106,.4); border-radius: var(--r-xl); padding: 20px 22px; margin-top: 16px;
}
.danger-card h4 { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 19px; color: var(--bad); margin-bottom: 10px; }
.phr { padding: 9px 13px; background: var(--bg-deep); border-radius: var(--r-md); margin-bottom: 6px; font-size: 13.5px; font-style: italic; }
.phr .cp { float: right; color: var(--ink-faint); cursor: pointer; font-size: 11px; font-style: normal; }
.phr .cp:hover { color: var(--gold); }

.scenario {
  background: var(--panel); border: 1px solid var(--gold-line); border-radius: var(--r-xl);
  padding: 20px 24px; margin-bottom: 6px; font-size: 15px;
}
.scenario .src { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); margin-top: 8px; }
.resp-strip { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 4px; }

/* metaphors */
.era-line { display: flex; gap: 3px; margin-top: 8px; }
.era-cell { flex: 1; height: 8px; border-radius: 2px; background: var(--panel-3); }
.era-cell.timeless { background: var(--gold); }
.era-cell.proven { background: var(--ok); }
.era-cell.experimental { background: var(--info); }
.era-cell.future { background: var(--medieval); }
.era-cell.dated-rhetoric, .era-cell.dated-cliche { background: var(--bad); opacity: .55; }

/* flashcards */
.fc-stage { perspective: 1200px; margin: 20px auto; max-width: 560px; }
.fc-card {
  position: relative; width: 100%; min-height: 260px; cursor: pointer;
  transform-style: preserve-3d; transition: transform 480ms var(--ease);
}
.fc-card.flip { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  background: var(--panel); border: 1.5px solid var(--gold-line); border-radius: var(--r-xl);
  padding: 30px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; box-shadow: var(--e2);
}
.fc-face.back { transform: rotateY(180deg); background: var(--panel-2); }
.fc-face .q { font-family: var(--serif); font-size: 19px; }
.fc-face .a { font-size: 15px; }
.fc-hint { text-align: center; color: var(--ink-faint); font-size: 11.5px; }

/* modal */
.modal-veil { position: fixed; inset: 0; background: rgba(6,8,14,.78); display: flex; align-items: center; justify-content: center; z-index: 100; opacity: 0; pointer-events: none; transition: opacity var(--m-smooth) var(--ease); }
.modal-veil.open { opacity: 1; pointer-events: auto; }
.modal { width: min(760px, 93vw); max-height: 86vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--e4); padding: 24px 28px; transform: translateY(12px); transition: transform var(--m-smooth) var(--ease); }
.modal-veil.open .modal { transform: none; }
.modal h3 { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 23px; margin-bottom: 4px; }
.modal .subline { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); margin-bottom: 14px; }
.modal .close { position: sticky; float: right; top: 0; color: var(--ink-faint); font-size: 18px; padding: 2px 8px; }
.modal .close:hover { color: var(--ink); }
.kv { margin-bottom: 13px; }
.kv h5 { font-family: var(--mono); font-size: 9.5px; letter-spacing: 1.2px; color: var(--gold); text-transform: uppercase; margin-bottom: 4px; }
.kv p, .kv li { font-size: 13.5px; }
.kv ul { padding-left: 18px; }
.kv code { display: block; font-family: var(--mono); font-size: 11.5px; background: var(--bg-deep); padding: 9px 11px; border-radius: var(--r-sm); color: var(--ink-dim); white-space: pre-wrap; }
.kv .warn { color: var(--bad); }
.phil-block { border-left: 2px solid var(--gold-line); padding-left: 14px; margin-bottom: 14px; }
.phil-block .pn { font-weight: 700; font-size: 14.5px; }
.phil-block .pd { font-family: var(--mono); font-size: 9.5px; color: var(--ink-faint); }
.concept { background: var(--panel-2); border-radius: var(--r-md); padding: 10px 13px; margin-top: 7px; }
.concept .cn { font-weight: 600; font-size: 13px; color: var(--gold); }
.concept .cd { font-size: 12.5px; margin-top: 2px; }
.concept .ce { font-size: 12px; color: var(--ink-dim); margin-top: 5px; font-style: italic; }
.concept .cs { font-family: var(--mono); font-size: 9px; color: var(--ink-faint); margin-top: 5px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

#toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%,70px); background: var(--panel-3); border: 1px solid var(--gold-line); padding: 9px 18px; border-radius: var(--r-pill); font-size: 12.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; }
.pick-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; }
.pick-row select { flex: 1; min-width: 230px; }

/* ============================================================
   v2.0 additions
   ============================================================ */
.welcome-veil { position: fixed; inset: 0; background: rgba(6,8,14,.85); z-index: 300; display: flex; align-items: center; justify-content: center; }
.welcome { width: min(560px,92vw); background: var(--panel); border: 1px solid var(--gold-line); border-radius: var(--r-xl); padding: 28px 30px; box-shadow: var(--e4); }
.welcome h2 { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 26px; color: var(--gold); margin-bottom: 4px; }
.welcome .wsub { color: var(--ink-dim); font-size: 13px; 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(--gold); color: #241d0d; min-width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.wstep .wt { font-weight: 600; font-size: 14px; }
.wstep .wd { font-size: 12.5px; color: var(--ink-dim); }
.hk-row { display: flex; justify-content: space-between; gap: 14px; padding: 6px 0; border-bottom: 1px dashed var(--line-soft); font-size: 13px; }

/* favorites */
.tile { padding-right: 34px; }
.tile .fav { position: absolute; top: 9px; right: 10px; font-size: 14px; opacity: .3; padding: 2px 5px; cursor: pointer; transition: opacity var(--m-fast); }
.tile .fav:hover, .tile .fav.on { opacity: 1; color: var(--gold); }

/* era sections */
.era-section { margin: 22px 0 10px; display: flex; align-items: center; gap: 10px; }
.era-section i { width: 12px; height: 12px; border-radius: 3px; }
.era-section h4 { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 18px; }
.era-section .muted { font-family: var(--mono); font-size: 9.5px; }

/* global search */
.gs-input { width: 100%; font-size: 16px; padding: 13px 16px; margin-bottom: 14px; }
.gs-group h6 { font-family: var(--mono); font-size: 9.5px; letter-spacing: 1.2px; color: var(--gold); text-transform: uppercase; margin: 12px 0 5px; }
.gs-item { display: flex; gap: 10px; align-items: baseline; padding: 8px 11px; border-radius: var(--r-md); cursor: pointer; font-size: 13.5px; }
.gs-item:hover { background: var(--panel-2); }
.gs-item .gsub { color: var(--ink-faint); font-size: 11.5px; }

/* metaphor legend */
.legend-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; font-size: 11.5px; color: var(--ink-dim); }
.legend-row .li { display: inline-flex; align-items: center; gap: 5px; }
.legend-row .li i { width: 11px; height: 8px; border-radius: 2px; display: inline-block; }

/* flashcards knowing */
.fc-know-row { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
.fc-progress { max-width: 560px; margin: 0 auto; }
.fc-progress .bar { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.fc-progress .bar i { display: block; height: 100%; background: var(--ok); }

/* school modal accordions */
.phil-acc { border: 1px solid var(--line-soft); border-radius: var(--r-md); margin-bottom: 8px; overflow: hidden; }
.phil-acc-head { width: 100%; text-align: left; padding: 11px 14px; display: flex; align-items: baseline; gap: 10px; }
.phil-acc-head:hover { background: var(--panel-2); }
.phil-acc-head .pn { font-weight: 700; font-size: 14px; }
.phil-acc-head .pd { font-family: var(--mono); font-size: 9.5px; color: var(--ink-faint); }
.phil-acc-head .chev { margin-left: auto; color: var(--ink-faint); transition: transform var(--m-smooth); }
.phil-acc.open .phil-acc-head .chev { transform: rotate(90deg); }
.phil-acc-body { display: none; padding: 0 14px 12px; }
.phil-acc.open .phil-acc-body { display: block; }

/* collapsible ladder */
.ladder-toggle { cursor: pointer; user-select: none; }
.resp-chip-strip { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
