:root {
  --bg: #121010;
  --card: #1d1918;
  --card2: #282220;
  --line: #352d2a;
  --text: #f3ece6;
  --muted: #a1938a;
  --accent: #d2452c;
  --accent2: #ee7d3c;
  --green: #5cc46a;
  --red: #ea5a43;
  --gold: #f5b947;
  --blue: #4f9cf0;
  --purple: #a77bf3;
  --teal: #38c3b4;
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

main { padding: 14px 14px 100px; max-width: 640px; margin: 0 auto; }
main.anim > * { animation: rise .28s ease both; }
main.anim > *:nth-child(2) { animation-delay: .03s; }
main.anim > *:nth-child(3) { animation-delay: .06s; }
main.anim > *:nth-child(4) { animation-delay: .09s; }
main.anim > *:nth-child(5) { animation-delay: .12s; }
main.anim > *:nth-child(n+6) { animation-delay: .15s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

h1 { font-size: 23px; margin: 4px 0 12px; letter-spacing: -.3px; }
h2 { font-size: 17px; margin: 22px 0 10px; }
h3 { font-size: 15px; margin: 0 0 4px; }
p { margin: 6px 0; }
a { color: var(--accent2); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11px; }
.center { text-align: center; }
.row { display: flex; gap: 8px; align-items: center; }
.row > .grow, .grow { flex: 1; min-width: 0; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.mt { margin-top: 12px; }
.mb0 { margin-bottom: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.click { cursor: pointer; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 22px 2px 10px; }
.section-title h2 { margin: 0; }
.section-title .link { font-size: 13px; color: var(--accent2); cursor: pointer; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}
.card.flat { background: var(--card2); border-color: transparent; }
.card.click:active { transform: scale(.985); }

.g-red { background: linear-gradient(135deg, #5a1d12 0%, #2a1714 75%); border-color: #6e2a1b; }
.g-orange { background: linear-gradient(135deg, #5c3313 0%, #2a1c14 75%); border-color: #74431c; }
.g-gold, .g-yellow { background: linear-gradient(135deg, #574010 0%, #2a2214 75%); border-color: #6f541b; }
.g-blue { background: linear-gradient(135deg, #173456 0%, #171d29 75%); border-color: #244a73; }
.g-purple { background: linear-gradient(135deg, #3a2264 0%, #1d172b 75%); border-color: #4f3388; }
.g-green { background: linear-gradient(135deg, #1b4626 0%, #16231a 75%); border-color: #2a6338; }
.g-teal { background: linear-gradient(135deg, #124741 0%, #14211f 75%); border-color: #1e655c; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 99px;
  font-size: 12px; font-weight: 600;
  background: var(--card2); color: var(--muted);
  white-space: nowrap;
}
.badge.gold { background: #4a3611; color: var(--gold); }
.badge.green { background: #1b3b20; color: var(--green); }
.badge.red { background: #47201a; color: var(--red); }
.badge.blue { background: #16304d; color: var(--blue); }
.badge.purple { background: #2f2150; color: var(--purple); }

button, .btn {
  font: inherit; border: 0; border-radius: 12px;
  padding: 11px 16px;
  background: var(--accent); color: #fff; font-weight: 600;
  cursor: pointer; transition: transform .08s, opacity .2s, background .2s;
}
button:active { transform: scale(.96); }
button:disabled { opacity: .5; }
button.secondary { background: var(--card2); color: var(--text); }
button.ghost { background: transparent; color: var(--muted); padding: 6px 10px; }
button.gold { background: linear-gradient(135deg, #f5b947, #ee7d3c); color: #2a1604; }
button.block { width: 100%; }
button.sm { padding: 7px 11px; font-size: 13px; border-radius: 10px; }
button.icon { width: 38px; height: 38px; padding: 0; border-radius: 12px; font-size: 17px; flex-shrink: 0; }

input, select, textarea {
  font: inherit; width: 100%;
  padding: 11px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card2); color: var(--text);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent2); }
textarea { min-height: 110px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }

/* чипы */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  background: var(--card2); color: var(--text); border: 1px solid var(--line);
  padding: 8px 12px; border-radius: 99px; font-size: 13px; font-weight: 500; white-space: nowrap;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* нижняя навигация */
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex;
  background: rgba(18, 16, 16, .94);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  z-index: 10;
}
#tabs button {
  flex: 1; background: none; color: var(--muted);
  padding: 4px 0; font-size: 11px; font-weight: 500;
  display: flex; flex-direction: column; align-items: center; gap: 3px; border-radius: 10px;
}
#tabs button .ico { font-size: 21px; line-height: 1; filter: grayscale(.7) opacity(.75); transition: .2s; }
#tabs button.active { color: var(--text); }
#tabs button.active .ico { filter: none; transform: translateY(-1px) scale(1.08); }

/* подвкладки */
.seg { display: flex; gap: 4px; background: var(--card2); padding: 4px; border-radius: 12px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1; background: transparent; color: var(--muted); padding: 8px 10px; white-space: nowrap; font-size: 13px; border-radius: 9px; }
.seg button.active { background: var(--card); color: var(--text); box-shadow: 0 1px 3px #0006; }

/* шапка */
.top { display: flex; align-items: center; gap: 12px; margin: 2px 0 14px; }
.ava {
  width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 19px; color: #fff; flex-shrink: 0; overflow: hidden;
}
.ava img { width: 100%; height: 100%; object-fit: cover; }
.ava.sm { width: 34px; height: 34px; font-size: 14px; }
.ava.xl { width: 74px; height: 74px; font-size: 30px; margin: 0 auto 8px; }

/* обратный отсчёт */
.countdown { font-size: 32px; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; margin: 4px 0; }
.countdown.md { font-size: 22px; }
.cd-units { display: flex; gap: 8px; margin: 8px 0 4px; }
.cd-units > div { flex: 1; background: #0005; border-radius: 12px; padding: 8px 4px; text-align: center; }
.cd-units b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.cd-units span { font-size: 11px; color: var(--muted); }

/* плитки инструментов */
.tools { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.tool {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; min-height: 96px; cursor: pointer;
  display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.tool:active { transform: scale(.97); }
.tool .ti { font-size: 26px; }
.tool .tn { font-weight: 700; font-size: 14px; margin-top: 8px; }
.tool .td { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.tool .lock { position: absolute; top: 10px; right: 10px; font-size: 13px; }
.tool-big { display: flex; gap: 12px; align-items: center; }
.tool-big .ti { font-size: 30px; width: 52px; height: 52px; border-radius: 14px; background: #0004; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* плитки статистики */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 10px; }
.tiles.three { grid-template-columns: repeat(3, 1fr); }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.tile .v { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tile .l { font-size: 11.5px; color: var(--muted); }

/* счётчики (рейд / стройка) */
.targets { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.target {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px; display: flex; flex-direction: column; gap: 8px; transition: .15s;
}
.target.on { border-color: var(--accent2); background: #2b1b15; }
.target .name { font-size: 13px; font-weight: 600; min-height: 34px; display: flex; gap: 6px; align-items: flex-start; }
.target .name .e { font-size: 18px; line-height: 1; }
.counter { display: flex; align-items: center; justify-content: space-between; }
.counter button { width: 36px; height: 36px; padding: 0; border-radius: 11px; font-size: 19px; }
.counter .n { font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }

.line { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); gap: 8px; }
.line:last-child { border-bottom: 0; }
.line.best { color: var(--gold); font-weight: 700; }
.line .v { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.res-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.res { background: var(--card2); border-radius: 10px; padding: 8px 10px; }
.res b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.res span { font-size: 11.5px; color: var(--muted); }

/* полоса прогресса */
.bar { height: 7px; background: var(--card2); border-radius: 99px; overflow: hidden; margin: 8px 0; }
.bar > div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--green), var(--gold)); transition: width .9s linear; }
.bar.purple > div { background: linear-gradient(90deg, var(--purple), #e07bf3); }

.code {
  font-family: ui-monospace, Consolas, monospace; font-size: 12px;
  background: var(--card2); padding: 7px 10px; border-radius: 9px; word-break: break-all;
}

/* таймеры */
.timer { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.timer:last-child { border-bottom: 0; }
.timer .ic { font-size: 22px; width: 40px; height: 40px; border-radius: 12px; background: #2f2150; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.timer .left { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 17px; }
.timer.done .left { color: var(--green); }

/* код для замка */
.lock-code { display: flex; gap: 10px; justify-content: center; margin: 10px 0 14px; }
.lock-code span {
  width: 58px; height: 74px; border-radius: 14px; background: #0006; border: 1px solid #2a6338;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 800; font-family: ui-monospace, Consolas, monospace; color: #d9ffe0;
  animation: flip .35s ease both;
}
.lock-code span:nth-child(2) { animation-delay: .05s; }
.lock-code span:nth-child(3) { animation-delay: .1s; }
.lock-code span:nth-child(4) { animation-delay: .15s; }
@keyframes flip { from { transform: rotateX(90deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* тарифы */
.plan { position: relative; cursor: pointer; }
.plan.best { border-color: var(--gold); }
.plan .price { font-size: 22px; font-weight: 800; }
.plan .old { text-decoration: line-through; color: var(--muted); font-size: 14px; margin-left: 6px; }
.plan .tag { position: absolute; top: -9px; right: 12px; }
.feat { display: grid; grid-template-columns: 1fr auto auto; gap: 8px 14px; font-size: 14px; align-items: center; }
.feat .h { color: var(--muted); font-size: 12px; }

/* списки */
.list-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }

/* графики */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 110px; padding-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.chart .b { width: 100%; border-radius: 4px 4px 0 0; background: var(--accent); min-height: 2px; }
.chart.stars .b { background: var(--gold); }
.chart.hours .b { background: #4a3a35; }
.chart.hours .b.low { background: var(--green); }
.chart .d { font-size: 9px; color: var(--muted); margin-top: 4px; }
.chart .t { font-size: 9px; color: var(--text); margin-bottom: 2px; }
svg.area { width: 100%; height: 150px; display: block; }
svg.area .grid { stroke: #ffffff12; }
svg.area text { fill: var(--muted); font-size: 10px; }

.teaser { position: relative; overflow: hidden; }
.teaser .blur { filter: blur(5px); opacity: .55; pointer-events: none; }
.teaser .over { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 16px; background: linear-gradient(transparent, #121010cc 40%); }

.empty { text-align: center; color: var(--muted); padding: 22px 8px; }
.empty .big { font-size: 40px; margin-bottom: 6px; }

#toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%) translateY(20px);
  background: #000d; color: #fff; padding: 10px 16px; border-radius: 12px;
  opacity: 0; transition: .25s; pointer-events: none; z-index: 20; max-width: 90%; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: #8c2a1c; }

.loader { display: flex; justify-content: center; padding: 50px 0; }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--accent2); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--card) 25%, var(--card2) 50%, var(--card) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); height: 74px; margin-bottom: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
td, th { text-align: left; padding: 7px 4px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; }
