:root {
  --black: #000000;
  --navy: #0A1838;
  --navy-2: #102454;
  --line: #1D3770;
  --blue: #2E6BFF;
  --sky: #9DBDFF;
  --white: #F4F7FF;
  --muted: #8797BD;
  --good: #3DDC97;
  --warn: #FFB547;
  --bad: #FF5C6C;
  --display: "Unbounded", "Golos Text", system-ui, sans-serif;
  --body: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --pad: 18px;
  --tab-h: 64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background-color: var(--black);
  background-image:
    linear-gradient(rgba(46, 107, 255, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46, 107, 255, .07) 1px, transparent 1px);
  background-size: 24px 24px;
  background-attachment: fixed;
  color: var(--white);
  font: 400 15px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
main { padding: 12px var(--pad) calc(var(--tab-h) + 32px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; outline: none; }
a { color: var(--sky); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }

/* ---------- Заголовки ---------- */
h1 { font: 700 22px/1.2 var(--display); letter-spacing: -.01em; margin: 12px 0 4px; }
h2 { font: 500 15px/1.3 var(--display); margin: 28px 0 10px; color: var(--white); }
.lead { color: var(--muted); margin: 0 0 18px; }
.back { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); text-decoration: none; font-size: 14px; padding: 6px 0; }

/* ---------- Переключатель разделов ---------- */
.seg { display: flex; gap: 4px; background: var(--navy); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin: 6px 0 18px; }
.seg a, .seg button { flex: 1; text-align: center; padding: 9px 6px; border-radius: 9px; border: 0; background: none; color: var(--muted); text-decoration: none; font-weight: 500; cursor: pointer; }
.seg .on { background: var(--blue); color: #fff; }

/* ---------- Панель-чертёж ---------- */
.panel { background: var(--navy); border: 1px solid var(--line); border-radius: 14px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-top: 1px solid var(--line); }
.rows > li:first-child { border-top: 0; }
.rows .grow { flex: 1; min-width: 0; }
.rows .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .sub { color: var(--muted); font-size: 13px; }
a.rowlink { color: inherit; text-decoration: none; }

/* ---------- Поля ---------- */
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
input[type=number], input[type=text], input[type=search], select {
  width: 100%; background: var(--black); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; outline: none;
}
input:focus, select:focus { border-color: var(--blue); }
input[type=number] { font-variant-numeric: tabular-nums; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { width: 36px; height: 36px; border: 0; background: var(--navy-2); cursor: pointer; font-size: 18px; }
.stepper output { min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 13px 18px; background: var(--blue); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--white); }
.btn.small { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.btn.wide { width: 100%; }
.iconbtn { border: 0; background: none; color: var(--muted); padding: 8px; cursor: pointer; border-radius: 8px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: none; }
.chip { flex: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px; background: none; color: var(--muted); cursor: pointer; font-size: 14px; }
.chip.on { border-color: var(--blue); color: var(--white); background: rgba(46, 107, 255, .18); }
.tag { display: inline-block; font-size: 12px; color: var(--sky); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; margin: 0 4px 4px 0; }

/* ---------- Главный результат рейда: крупная «шкала серы» ---------- */
.gauge { padding: 20px 18px 16px; margin: 18px 0 10px; position: relative; overflow: hidden; }
.gauge .num { font: 700 44px/1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.gauge .unit { color: var(--muted); margin-top: 6px; }
.gauge .bar { height: 6px; background: var(--black); border-radius: 3px; margin-top: 16px; overflow: hidden; }
.gauge .bar i { display: block; height: 100%; background: var(--blue); border-radius: 3px; transition: width .35s ease; }

.boom { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 12px; }
.boom .count { font: 700 22px/1 var(--display); font-variant-numeric: tabular-nums; text-align: right; }
.boom .best { color: var(--blue); }
.rows li.best { background: rgba(46, 107, 255, .12); }
.mats { color: var(--muted); font-size: 13px; }

/* ---------- Главная ---------- */
.countdown { padding: 18px; margin-top: 14px; }
.countdown .num { font: 700 30px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.countdown .sub { color: var(--muted); }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.quick a { text-decoration: none; color: var(--white); padding: 14px 12px; display: flex; flex-direction: column; gap: 8px; font-weight: 500; font-size: 14px; }
.quick svg { width: 22px; height: 22px; stroke: var(--blue); }

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: var(--good); box-shadow: 0 0 0 4px rgba(61, 220, 151, .15); }

/* ---------- Дома ---------- */
.hcard { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; }
.thumb { width: 96px; height: 72px; border-radius: 10px; object-fit: cover; background: var(--navy-2); display: block; }
.cover { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: 14px; background: var(--navy-2); display: block; margin-top: 8px; }
.gallery { display: flex; gap: 8px; overflow-x: auto; margin-top: 8px; scroll-snap-type: x mandatory; }
.gallery img { height: 110px; border-radius: 10px; scroll-snap-align: start; cursor: zoom-in; }
.costs { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; }
.costs div { padding: 12px 4px; border-left: 1px solid var(--line); }
.costs div:first-child { border-left: 0; }
.costs b { display: block; font: 700 16px/1.2 var(--display); font-variant-numeric: tabular-nums; }
.costs span { color: var(--muted); font-size: 12px; }
.guide { white-space: pre-wrap; line-height: 1.6; max-width: 70ch; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; padding: 14px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .92); display: grid; place-items: center; z-index: 50; }
.lightbox img { max-width: 100%; max-height: 100%; }

/* ---------- Активность игрока ---------- */
.hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; align-items: end; height: 90px; padding: 14px 16px 6px; }
.hours i { display: block; background: var(--blue); border-radius: 2px 2px 0 0; min-height: 2px; }
.hours-axis { display: flex; justify-content: space-between; padding: 0 16px 12px; color: var(--muted); font-size: 11px; }

/* ---------- Пусто, загрузка, тосты ---------- */
.empty { padding: 26px 18px; text-align: center; color: var(--muted); }
.empty .btn { margin-top: 14px; }
.skeleton { height: 64px; border-radius: 14px; background: var(--navy); margin-bottom: 10px; }
#toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--white); color: var(--black); padding: 10px 16px; border-radius: 10px; font-weight: 500; opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100% - 36px); z-index: 60; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.note { color: var(--muted); font-size: 13px; margin-top: 10px; }
.switch { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); }
.switch:first-child { border-top: 0; }
.switch input { width: 44px; height: 26px; appearance: none; background: var(--navy-2); border: 1px solid var(--line); border-radius: 13px; position: relative; cursor: pointer; flex: none; transition: .2s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: .2s; }
.switch input:checked { background: var(--blue); border-color: var(--blue); }
.switch input:checked::after { left: 21px; background: #fff; }

/* ---------- Нижнее меню ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: flex; background: rgba(0, 0, 0, .92); backdrop-filter: blur(10px); border-top: 1px solid var(--line); z-index: 40; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 11px; }
.tabbar svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.on { color: var(--white); }
.tabbar a.on svg { stroke: var(--blue); }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }
