:root {
  --violet-bg: #f3f0ff; --violet-text: #6741d9;
  --bg: #f2f3ef; --surface: #ffffff; --surface-2: #f5f6f3;
  --text: #1b1f1d; --text-2: #5b635f; --text-3: #8b928e;
  --border: #e2e5e0; --border-strong: #cfd4ce;
  --brand: #0f5f55; --brand-hover: #0b4a42; --on-brand: #ffffff; --header: #133c36;
  --green: #2f9e44; --green-hover: #2b8a3e; --green-bg: #ebfbee; --green-text: #2b8a3e;
  --red: #e03131; --red-hover: #c92a2a; --red-bg: #fff5f5; --red-text: #c92a2a; --red-border: #ffa8a8;
  --amber: #f08c00; --amber-bg: #fff4e6; --amber-text: #a65300; --amber-border: #ffc078;
  --blue: #1c7ed6; --blue-bg: #e7f5ff; --blue-text: #1971c2;
  --gray: #adb5bd; --gray-bg: #f1f3f5; --gray-text: #5b635f;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 24, 20, .06), 0 4px 16px rgba(16, 24, 20, .05);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --violet-bg: rgba(132, 94, 247, .18); --violet-text: #b197fc;
    --bg: #121614; --surface: #1b201e; --surface-2: #232927;
    --text: #e8ece9; --text-2: #a7b0ab; --text-3: #7c8580;
    --border: #2c3431; --border-strong: #3d4743;
    --brand: #12796c; --brand-hover: #15907f; --header: #0e2622;
    --green: #37b24d; --green-hover: #40c057; --green-bg: rgba(55, 178, 77, .15); --green-text: #69db7c;
    --red: #f03e3e; --red-hover: #fa5252; --red-bg: rgba(240, 62, 62, .12); --red-text: #ff8787; --red-border: rgba(240, 62, 62, .5);
    --amber: #fd7e14; --amber-bg: rgba(253, 126, 20, .14); --amber-text: #ffc078; --amber-border: rgba(253, 126, 20, .55);
    --blue: #339af0; --blue-bg: rgba(51, 154, 240, .15); --blue-text: #74c0fc;
    --gray: #5c6662; --gray-bg: #2a302d; --gray-text: #a7b0ab;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); }
h1 { font-size: 24px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.muted { color: var(--text-2); }
.hint { color: var(--text-3); font-size: 13px; margin: 2px 0 0; display: flex; align-items: center; gap: 6px; }
.i { width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: -.2em; }

/* шапка */
header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; background: var(--header); color: #e9f3f1; }
header.top .brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; font-size: 17px; text-decoration: none; }
header.top .brand .i { width: 26px; height: 26px; padding: 4px; border-radius: 8px; background: rgba(255, 255, 255, .12); }
header.top .who { display: flex; align-items: center; gap: 12px; font-size: 14px; color: #cfe3df; }
header.top .who > span { display: flex; align-items: center; gap: 6px; }
header.top .who { min-width: 0; }
header.top .email { min-width: 0; }
header.top .email > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 36vw; }
header.top form { flex-shrink: 0; }
/* на телефоне длинная почта обрезается, а на самых узких экранах прячется: «Выйти» всегда на месте */
@media (max-width: 560px) { header.top { padding: 10px 16px; } header.top .email > span { max-width: 32vw; } }
@media (max-width: 380px) { header.top .who > .email { display: none; } }
main { max-width: 1080px; margin: 0 auto; padding: 28px 20px 56px; }

/* кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-size: 14px; font-weight: 600;
  padding: 9px 16px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  cursor: pointer; transition: background .15s, border-color .15s, color .15s, transform .05s; text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.success { background: var(--green); border-color: var(--green); color: #fff; }
.btn.success:hover { background: var(--green-hover); border-color: var(--green-hover); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger:hover { background: var(--red-hover); border-color: var(--red-hover); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-hover); }
.btn.ghost { background: transparent; border-color: rgba(255, 255, 255, .25); color: #fff; padding: 6px 12px; }
.btn.ghost:hover { background: rgba(255, 255, 255, .1); }
.btn.wide { width: 100%; padding: 11px 16px; font-size: 15px; }
.btn.htmx-request, .btn[disabled] { opacity: .7; cursor: progress; }
.htmx-request .spin, .spinning { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* формы */
input[type=email], input[type=password], input[type=text], input[type=number] { font: inherit; width: 100%; padding: 10px 12px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s; }
input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
label { display: block; font-size: 14px; font-weight: 600; margin: 16px 0 6px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin-top: 18px; }
label.check input { margin-top: 3px; accent-color: var(--brand); }

/* вход */
.login { max-width: 420px; margin: 7vh auto 0; text-align: center; }
.login .logo { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; display: grid; place-items: center; background: var(--brand); color: #fff; box-shadow: var(--shadow); }
.login .logo .i { width: 36px; height: 36px; }
.login .panel { text-align: left; margin-top: 22px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px 26px; box-shadow: var(--shadow); }

/* плашки */
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); font-size: 14px; border: 1px solid transparent; }
.banner .i { width: 20px; height: 20px; margin-top: 1px; }
.banner strong { display: block; }
.banner.warn { background: var(--amber-bg); color: var(--amber-text); border-color: var(--amber-border); }
.banner.bad { background: var(--red-bg); color: var(--red-text); border-color: var(--red-border); }
.banner.info { background: var(--blue-bg); color: var(--blue-text); }
.banner a { color: inherit; font-weight: 600; }

/* список миров */
.toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 20px 20px 18px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); --stripe: var(--gray); }
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--stripe); }
.card.tone-ok { --stripe: var(--green); }
.card.tone-info { --stripe: var(--blue); }
.card.tone-warn { --stripe: var(--amber); }
.card.tone-bad { --stripe: var(--red); }
.card.maintenance { border-color: var(--amber-border); --stripe: var(--amber); }
.card-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card .title { font-size: 17px; font-weight: 700; margin: 0; line-height: 1.3; }
.card .title a { color: inherit; text-decoration: none; }
/* В лобби вся карточка — ссылка на страницу мира: ссылка заголовка растянута на карточку, кнопки лежат поверх. */
.card .title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.card .actions, .card .banner a { position: relative; z-index: 2; }
.card:has(.title a) { transition: border-color .15s, box-shadow .15s, transform .15s; }
.card:has(.title a):hover { border-color: var(--brand); transform: translateY(-1px); }
.card:has(.title a:focus-visible) { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); outline-offset: 2px; }
.card .title a:focus-visible { outline: none; }
.card .avatar { margin: 4px 0 0; color: var(--text-2); font-size: 14px; display: flex; align-items: center; gap: 6px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.ok { background: var(--green-bg); color: var(--green-text); }
.status.info { background: var(--blue-bg); color: var(--blue-text); }
.status.warn { background: var(--amber-bg); color: var(--amber-text); }
.status.bad { background: var(--red-bg); color: var(--red-text); }
.status.neutral { background: var(--gray-bg); color: var(--gray-text); }
.status.live .dot { animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); } 100% { box-shadow: 0 0 0 7px transparent; } }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.chip.speed { background: var(--amber-bg); border-color: var(--amber-border); color: var(--amber-text); font-weight: 600; }
.era { display: flex; flex-direction: column; gap: 6px; }
.era-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.era-row > span:first-child { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.progress { height: 6px; border-radius: 999px; background: var(--gray-bg); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.actions { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }
.actions .btn { flex: 1; }
details.ended { margin-top: 28px; color: var(--text-2); }
details.ended summary { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
details.ended ul { margin: 10px 0 0; padding-left: 26px; }
.empty { text-align: center; padding: 48px 20px; }
.empty .i { width: 44px; height: 44px; color: var(--text-3); }
.error-box { margin-bottom: 16px; }

/* доступ ботов к игре */
.access { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px 16px;
  margin-bottom: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.access.paused { border-color: var(--blue); background: var(--blue-bg); }
.access-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.access-label { display: inline-flex; align-items: center; gap: 6px; }
.access-row .btn.small:first-of-type { margin-left: auto; }
.access-note { margin: 0; }
.pause-buttons { display: inline-flex; gap: 6px; margin-left: auto; }
.btn.small { padding: 5px 12px; font-size: 13px; }
.narrow { max-width: 560px; margin: 0 auto; }
select { font: inherit; width: 100%; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); }

/* страница бота */
.bot-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; grid-template-rows: auto 1fr;
  grid-template-areas: "tasks card" "tasks journal"; gap: 16px 24px; align-items: start; margin-top: 12px; }
.bot-card { grid-area: card; }
.bot-tasks { grid-area: tasks; display: flex; flex-direction: column; gap: 14px; }
.bot-journal { grid-area: journal; display: flex; flex-direction: column; gap: 10px; }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 18px; margin: 0; }
.bot-journal .modal-sheet { display: flex; flex-direction: column; gap: 10px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.modal-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-head .section-title { min-width: 0; }
.modal-close { padding: 6px; }
.modal-close .i { width: 20px; height: 20px; }
.bot-journal .modal-close, .journal-fab { display: none; }

/* Модальное окно (static/app.js): журнал на странице миров, а на телефоне и на странице бота. */
.modal-root { display: none; }
.modal-root.open { display: flex; position: fixed; inset: 0; z-index: 50; padding: 12px; background: rgba(10, 16, 14, .55); }
.modal-root.open .modal-sheet { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 640px;
  margin: auto; max-height: min(100%, 860px); min-height: 0; background: var(--bg); border-radius: 16px; padding: 14px;
  box-shadow: var(--shadow); }
.modal-root.open .journal { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.modal-root.open .modal-close { display: inline-flex; }
.modal-loading { margin: 24px auto; }
body.modal-open { overflow: hidden; }
.bot-journal.modal-root:not(.open) { display: flex; }  /* на компьютере журнал бота — просто колонка справа */

/* На телефоне журнал бота — окно по кнопке «Журнал», чтобы не листать до него через все задачи. */
@media (max-width: 900px) {
  .bot-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "card" "tasks";
    margin-bottom: 72px; }
  .bot-journal.modal-root:not(.open) { display: none; }
  .modal-root.open .modal-sheet { max-height: 100%; }
  .journal-fab { display: inline-flex; position: fixed; right: 16px; bottom: 16px; z-index: 40; border-radius: 999px;
    padding: 12px 18px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
  .journal-fab .count { background: rgba(255, 255, 255, .2); color: inherit; }
}
.count { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--gray-bg); color: var(--gray-text); }

.task { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--gray); border-radius: 16px;
  padding: 16px 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.task.on { border-left-color: var(--green); }
.task-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.task h3 { margin: 0; font-size: 16px; }
.task-desc { margin: 2px 0 0; font-size: 14px; }
.task-state { display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; border-radius: var(--radius); background: var(--surface-2); }
.task-state .hint { margin: 0; color: var(--text-2); }
.task-state .last { margin: 0; font-size: 14px; }
.task-state .last.warn { color: var(--amber-text); }
.task-state .last.bad { color: var(--red-text); }
.task-form { display: flex; flex-direction: column; gap: 4px; }
.task-form label.check { margin-top: 8px; }
.task-form .field label { margin-top: 10px; }
.task-form input[type=number] { max-width: 180px; }
.field-hint { display: block; color: var(--text-3); font-size: 13px; font-weight: 400; margin: 4px 0 0; }
.field-error { display: flex; align-items: center; gap: 6px; color: var(--red-text); font-size: 13px; margin: 4px 0 0; }
.field.invalid input { border-color: var(--red); }
.task-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.task-actions .field-error { margin: 0; }
.saved { display: inline-flex; align-items: center; gap: 4px; color: var(--green-text); font-size: 14px; font-weight: 600; }

.switch { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--gray-bg); color: var(--gray-text); font: inherit; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.switch .knob { width: 34px; height: 20px; border-radius: 999px; background: var(--gray); position: relative; transition: background .15s; }
.switch .knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch[aria-checked=true] { background: var(--green-bg); border-color: var(--green); color: var(--green-text); }
.switch[aria-checked=true] .knob { background: var(--green); }
.switch[aria-checked=true] .knob::after { transform: translateX(14px); }
.switch:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); outline-offset: 2px; }

.journal { padding: 4px 16px 14px; }
.journal-day { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin: 14px 0 4px; }
.journal-list { list-style: none; margin: 0; padding: 0; }
.entry { display: grid; grid-template-columns: 40px 18px minmax(0, 1fr); gap: 8px; align-items: start; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.journal-list:last-of-type .entry:last-child { border-bottom: 0; }
.entry time { color: var(--text-3); font-variant-numeric: tabular-nums; }
.entry-icon .i { width: 16px; height: 16px; margin-top: 2px; }
.entry.info .entry-icon { color: var(--blue); }
.entry.warn .entry-icon { color: var(--amber); }
.entry.bad .entry-icon { color: var(--red); }
.entry.bad .entry-text { color: var(--red-text); }
.entry-task { display: inline-block; font-size: 12px; font-weight: 600; padding: 0 8px; margin-right: 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.entry-text { overflow-wrap: anywhere; }
.btn.more { margin-top: 12px; }
.empty-small { padding: 20px 0 8px; text-align: center; }
.actions a.btn, .actions button.btn:not(.success):not(.danger) { flex: 0 0 auto; }
.card { container-type: inline-size; }
/* узкая карточка: у вторичных кнопок остаются иконки (подсказка — в title) */
@container (max-width: 330px) { .actions .btn-text { display: none; } .actions .btn:not(.success):not(.danger) { padding: 9px 12px; } }
@media (max-width: 480px) { .modal-head-actions .btn-text { display: none; } }

/* страница мира */
.crumbs { gap: 8px; }
.world-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 12px; }
.world-side { display: flex; flex-direction: column; gap: 12px; }
.world-actions { display: flex; flex-direction: column; gap: 8px; }
.world-schedule { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px 8px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; font-size: 14px; }
.world-schedule.paused { border-color: var(--blue); background: var(--blue-bg); }
.schedule-text { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 2px 0; }
.schedule-text > span { min-width: 0; line-height: 1.35; }
.schedule-text small { display: block; color: var(--text-3); font-size: 12px; }
.world-schedule .btn { flex-shrink: 0; }
.schedule-body { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; }
.schedule-body p { margin: 0; }
.modal-head .soon { margin-left: 4px; }
.world-blocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.block { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.block.wide { grid-column: 1 / -1; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.block h2 { display: flex; align-items: center; gap: 8px; font-size: 17px; margin: 0; }
.block p { margin: 0; }
.soon { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--gray-bg); color: var(--gray-text); white-space: nowrap; }
.block-fact { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.block-fact .hint { margin: 0; }
.block-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.block-controls .pause-buttons { margin-left: 0; }
.btn[disabled]:not(.htmx-request) { opacity: .5; cursor: not-allowed; }
.skeleton-list { list-style: none; margin: 0; padding: 0; }
.skeleton-list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 14px;
  color: var(--text-2); border-bottom: 1px dashed var(--border); }
.skeleton-list li:last-child { border-bottom: 0; }
.skeleton-list li span:last-child { color: var(--text-3); }
@media (max-width: 900px) { .world-layout { grid-template-columns: minmax(0, 1fr); } }
.schedule-text strong.time { white-space: nowrap; }

/* окно «Расписание и пауза» мира */
.schedule-body h3 { margin: 0; font-size: 15px; }
.schedule-form { display: flex; flex-direction: column; gap: 4px; }
.schedule-form label.check { margin-top: 8px; }
.schedule-form .own-windows { margin-left: 26px; }
/* поле часов нужно только при своём расписании */
.schedule-form:has(input[value=account]:checked) .own-windows { display: none; }
.schedule-pause { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.world-schedule .btn + .btn { margin-left: -4px; }

/* блок и окно «Станция» */
.station-summary { display: flex; flex-direction: column; gap: 6px; }
.station-summary .hint { margin: 0 0 0 8px; display: inline; }
.station-body { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; overflow-y: auto; min-height: 0; }
.station-body h3 { margin: 6px 0 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.station-body p { margin: 0; }
.station-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; }
.station-list, .queue-list { list-style: none; margin: 0; padding: 0; }
.station-list li, .queue-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.station-list li:last-child, .queue-list li:last-child { border-bottom: 0; }
.station-name { display: flex; flex-direction: column; min-width: 0; }
.station-next { display: flex; align-items: center; gap: 10px; flex-shrink: 0; text-align: right; font-size: 13px; }
.queue-list { counter-reset: queue; }
.queue-list li { counter-increment: queue; }
.queue-list li::before { content: counter(queue); flex: 0 0 22px; height: 22px; border-radius: 50%; display: grid;
  place-items: center; font-size: 12px; font-weight: 600; background: var(--gray-bg); color: var(--gray-text); }
.queue-list li.building::before { background: var(--green-bg); color: var(--green-text); }
.queue-text { flex: 1; min-width: 0; }
.queue-text .muted { display: block; font-size: 13px; }
.queue-actions { display: flex; gap: 4px; flex-shrink: 0; }
.btn.icon-only { padding: 5px 9px; min-width: 32px; }
.btn.icon-only .i { width: 16px; height: 16px; }
@media (max-width: 520px) {
  .station-list li { flex-direction: column; align-items: stretch; }
  .station-next { justify-content: space-between; text-align: left; }
}
.station-summary .block-fact { flex-wrap: nowrap; align-items: flex-start; }
.station-summary .block-fact .i { margin-top: 3px; }

/* блок, который целиком открывает окно: кнопка заголовка растянута на весь блок */
.block.clickable { position: relative; cursor: pointer; transition: border-color .15s, transform .15s; }
.block.clickable:hover { border-color: var(--brand); transform: translateY(-1px); }
.block-open { display: inline-flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none; color: inherit;
  font: inherit; cursor: pointer; text-align: left; }
.block-open::after { content: ""; position: absolute; inset: 0; border-radius: 16px; }
.block-open:focus-visible { outline: none; }
.block.clickable:has(.block-open:focus-visible) { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); outline-offset: 2px; }
.block-arrow { color: var(--text-3); display: flex; }
.block.clickable:hover .block-arrow { color: var(--brand); }
.btn.danger-outline { color: var(--red-text); border-color: var(--red-border); }
.btn.danger-outline:hover { background: var(--red-bg); }
.btn.small.primary { padding: 5px 12px; }
.station-next { flex-wrap: wrap; justify-content: flex-end; }

/* плашки «уровень · цена · время · престиж» в окне «Станция» */
.stats { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.stat { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 13px;
  font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; background: var(--gray-bg); color: var(--gray-text); }
.stat .i { width: 14px; height: 14px; }
.stat.money { background: var(--amber-bg); color: var(--amber-text); }
.stat.time { background: var(--blue-bg); color: var(--blue-text); }
.stat.prestige { background: var(--violet-bg); color: var(--violet-text); }
.queue-text { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.queue-text .stats { margin-top: 0; }
.queue-state { font-size: 13px; color: var(--text-2); }
.queue-state.on { color: var(--green-text); font-weight: 600; }
.queue-total { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; font-weight: 600; margin: 0; }
.queue-total .stats { margin-top: 0; }

/* миниатюры зданий (rnbot/panel/static/station, делает tools/station_art.py) */
.station-pic { flex: 0 0 72px; width: 72px; height: 48px; object-fit: contain; }
.station-pic.small { flex-basis: 48px; width: 48px; height: 32px; }
.station-list li .station-name { flex: 1; }
@media (max-width: 520px) {
  .station-list li { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .station-list li .station-name { flex: 1 1 0; }
  .station-list li .station-next { flex: 1 1 100%; }
}
@media (max-width: 520px) {
  .queue-list li { flex-wrap: wrap; }
  .queue-list .queue-text { flex: 1 1 0; }
  .queue-list .queue-actions { flex: 1 1 100%; justify-content: flex-end; }
}

/* Окно «Пути»: сворачиваемые группы участков («от точки …», «Ваши пути»). */
.rail-group { border: 1px solid var(--border); border-radius: 12px; margin-top: 10px; padding: 0 14px; }
.rail-group summary { cursor: pointer; padding: 10px 0; display: flex; align-items: center; gap: 8px; }
.rail-group[open] summary { border-bottom: 1px solid var(--border); }

/* Окно «Пути», планировщик: шаги, способы стройки, города, план с итогом. */
.station-body h3 .step { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 8px;
  border-radius: 50%; background: var(--gray-bg); color: var(--gray-text); font-size: 12px; font-weight: 700; }
.mode-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.mode-card { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 10px 12px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: inherit; font: inherit; }
.mode-card strong { display: flex; align-items: center; gap: 6px; }
.mode-card small { color: var(--text-2); }
.mode-card:hover { border-color: var(--text-2); }
.mode-card.on { border-color: var(--green-text); box-shadow: inset 0 0 0 1px var(--green-text); background: var(--green-bg); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 5px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.chip.on { background: var(--green-bg); color: var(--green-text); border-color: var(--green-text); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 1px 8px;
  border-radius: 999px; white-space: nowrap; }
.tag.near, .tag.picked { background: var(--green-bg); color: var(--green-text); }
.station-list li.picked { background: var(--green-bg); border-radius: 10px; padding-left: 10px; padding-right: 10px; }
.rail-plan { border: 1px solid var(--border); border-radius: 12px; padding: 4px 14px 14px; }
.plan-lines { list-style: none; margin: 0 0 12px; padding: 0; }
.plan-lines li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.plan-lines li.done { color: var(--text-2); }
.plan-lines input[type=checkbox] { width: 18px; height: 18px; flex: 0 0 18px; }
.plan-mark { flex: 0 0 18px; display: grid; place-items: center; }
.plan-mark.ok { color: var(--green-text); }
.plan-text { display: flex; flex-direction: column; min-width: 0; }
.plan-text small { color: var(--text-2); overflow-wrap: anywhere; }
.plan-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 0 0 10px; }
.plan-totals div { background: var(--gray-bg); border-radius: 10px; padding: 8px 12px; }
.plan-totals dt { font-size: 12px; color: var(--text-2); }
.plan-totals dd { margin: 0; font-weight: 700; }
.plan-totals .ok { background: var(--green-bg); }
.plan-totals .ok dd, .plan-totals .ok dt { color: var(--green-text); }
.plan-totals .warn { background: var(--amber-bg, #fdf1d6); }
.plan-totals .warn dd, .plan-totals .warn dt { color: var(--amber-text, #7a4d00); }
.plan-actions { display: flex; justify-content: flex-end; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--link, inherit); text-decoration: underline;
  cursor: pointer; }

.banner.ok { background: var(--green-bg); color: var(--green-text); }

/* Окно «Исследования». */
.tag.plain { background: var(--gray-bg); color: var(--gray-text); }
.research-options { margin-top: 10px; }
.research-options li:last-child { border-bottom: 0; }
.research-options label { cursor: pointer; }
.research-goal { border: 1px solid var(--border); border-radius: 12px; padding: 8px 14px; margin-top: 10px; }
.goal-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 2px 0 4px; }
.goal-title .muted { margin-left: auto; font-size: 13px; }
.goal-more { margin: 6px 0 2px; font-size: 13px; }
/* Сворачиваемые группы: стрелка показывает, что строку можно раскрыть. */
.rail-group summary { list-style: none; }
.rail-group summary::-webkit-details-marker { display: none; }
.rail-group summary::before { content: ""; flex: 0 0 8px; width: 8px; height: 8px; margin: 0 4px 2px 2px;
  border-right: 2px solid var(--text-2); border-bottom: 2px solid var(--text-2); transform: rotate(-45deg);
  transition: transform .15s; }
.rail-group[open] summary::before { transform: rotate(45deg); }
.rail-group summary:hover { color: var(--green-text); }

/* Окно «Лицензии». */
.bid-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 8px; }
.bid-form input[type=number] { width: 150px; }
.want-form { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.want-form label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.want-form select { max-width: 100%; }
.rail-group.wanted { border-color: var(--green-text); }
.rail-group summary { flex-wrap: wrap; }
