/* Тёмно-синие тона + оранжевые акценты. Цвета свои, не 1 в 1 с Cybershoke и FACEIT. */
:root {
  --bg: #070d1c;
  --bg-2: #0b1430;
  --surface: #0f1a36;
  --surface-2: #152349;
  --surface-3: #1b2c5a;
  --line: rgba(130, 160, 255, 0.12);
  --line-2: rgba(130, 160, 255, 0.22);
  --text: #eaf0ff;
  --muted: #8a98c7;
  --dim: #5d6a98;
  --blue: #4f7cff;
  --blue-2: #2f5ce0;
  --orange: #ff8a1f;
  --orange-2: #ffb13b;
  --ember: #ff4d1a;
  --ok: #34d399;
  --danger: #ff4d6a;
  --gold: #ffc94a;
  --silver: #c9d3ec;
  --bronze: #e39a62;
  --radius: 18px;
  --radius-sm: 12px;
  --display: 'Russo One', 'Manrope', system-ui, sans-serif;
  --body: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(79, 124, 255, 0.22), transparent 60%),
    radial-gradient(80% 50% at 100% 100%, rgba(255, 138, 31, 0.07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.4;
  min-height: 100vh;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--blue); }
[hidden] { display: none !important; }

.screen {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--nav-h) + var(--safe-b) + 24px);
  animation: screenIn 0.28s ease-out;
}
.screen.no-nav { padding-bottom: 32px; }
@keyframes screenIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* --- общие элементы ---------------------------------------------------------- */
.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.card + .card, .section + .section { margin-top: 14px; }
.section-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 22px 4px 10px;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px;
  border-radius: 14px;
  font-weight: 700;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  transition: transform 0.12s ease, opacity 0.2s, background 0.2s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn.primary {
  background: linear-gradient(180deg, var(--orange-2), var(--orange) 45%, var(--ember));
  border: 0;
  color: #1a0b00;
  box-shadow: 0 8px 24px rgba(255, 106, 31, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn.blue { background: linear-gradient(180deg, #6a91ff, var(--blue-2)); border: 0; color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: rgba(255, 77, 106, 0.35); background: rgba(255, 77, 106, 0.06); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.big { height: 56px; font-size: 17px; border-radius: 18px; }

.input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: rgba(7, 13, 28, 0.6);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.2); }
.input::placeholder { color: var(--dim); }

.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  object-fit: cover; flex: none;
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--display); font-size: 15px; color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.08);
}
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.lg { width: 84px; height: 84px; font-size: 30px; border-width: 3px; }

.chip {
  height: 34px; padding: 0 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-weight: 700; font-size: 13px; color: var(--muted);
  white-space: nowrap; flex: none;
  transition: all 0.2s;
}
.chip.on { background: rgba(255, 138, 31, 0.14); border-color: rgba(255, 138, 31, 0.5); color: var(--orange-2); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.chips::-webkit-scrollbar { display: none; }

.segmented {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  padding: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
}
.segmented button { height: 36px; border-radius: 10px; font-weight: 800; color: var(--muted); transition: all 0.2s; }
.segmented button.on { background: var(--surface-3); color: var(--text); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); }

.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--ember); color: #fff; font-size: 11px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}

.banner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 14px; margin-bottom: 12px;
  background: rgba(79, 124, 255, 0.1); border: 1px solid rgba(79, 124, 255, 0.35);
  font-size: 13px; font-weight: 600;
}
.banner.warn { background: rgba(255, 138, 31, 0.1); border-color: rgba(255, 138, 31, 0.45); }
.banner .btn { flex: none; }

/* --- нижняя навигация -------------------------------------------------------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  height: calc(var(--nav-h) + var(--safe-b));
  padding: 6px 8px var(--safe-b);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(7, 13, 28, 0.86);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.nav button {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 700; color: var(--dim);
  transition: color 0.2s;
}
.nav button svg { width: 24px; height: 24px; transition: transform 0.2s; }
.nav button.on { color: var(--orange-2); }
.nav button.on svg { transform: translateY(-1px) scale(1.06); }
.nav .badge { position: absolute; top: 4px; left: calc(50% + 6px); }

/* --- огонёк ------------------------------------------------------------------------ */
.flame { display: block; transform-origin: 50% 92%; }
.flame.lit { animation: flicker 1.6s ease-in-out infinite; filter: drop-shadow(0 0 18px rgba(255, 110, 30, 0.55)); }
.flame.lit .flame-inner { animation: innerFlicker 1.1s ease-in-out infinite; transform-origin: 50% 90%; }
.flame.off { filter: grayscale(1) brightness(0.55); opacity: 0.75; }
@keyframes flicker {
  0%, 100% { transform: scale(1, 1) skewX(0deg); }
  25% { transform: scale(1.02, 1.05) skewX(-1.5deg); }
  50% { transform: scale(0.99, 0.97) skewX(1deg); }
  75% { transform: scale(1.01, 1.03) skewX(-0.5deg); }
}
@keyframes innerFlicker {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.94, 1.06); opacity: 0.9; }
}
.flame-mini { width: 14px; height: 18px; display: inline-block; vertical-align: -3px; }

/* --- главный экран --------------------------------------------------------------- */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.topbar .name { font-weight: 800; }
.topbar .pid { font-size: 12px; color: var(--muted); }
.topbar .best { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--muted); padding: 6px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }

.hero { position: relative; display: flex; flex-direction: column; align-items: center; padding: 8px 0 4px; }
.ring-wrap { position: relative; width: 260px; height: 260px; }
.ring-wrap svg.ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring-track { stroke: rgba(130, 160, 255, 0.1); }
.ring-progress { stroke: url(#ringGrad); transition: stroke-dashoffset 1.2s cubic-bezier(0.22, 1, 0.36, 1); filter: drop-shadow(0 0 6px rgba(255, 120, 30, 0.45)); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-center .flame { width: 92px; height: 120px; margin-top: -8px; }
.streak-num { font-family: var(--display); font-size: 44px; line-height: 1; margin-top: 2px; letter-spacing: 0.02em; }
.streak-num.off { color: var(--muted); }
.streak-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.glow-bg { position: absolute; inset: 30px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 120, 30, 0.18), transparent 70%); pointer-events: none; transition: opacity 0.6s; }
.glow-bg.off { opacity: 0; }

.today { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin-top: 6px; }
.today .num { font-family: var(--display); font-size: 30px; }
.today .of { font-family: var(--display); font-size: 18px; color: var(--muted); }
.today-sub { text-align: center; font-weight: 700; font-size: 14px; color: var(--muted); }
.today-sub.done { color: var(--ok); }

.reset { display: flex; justify-content: center; gap: 8px; margin: 14px 0 16px; font-size: 13px; color: var(--muted); font-weight: 600; }
.reset b { font-family: var(--display); font-weight: 400; color: var(--text); letter-spacing: 0.04em; }
.hint { margin-top: 10px; font-size: 12px; color: var(--dim); text-align: center; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(26, 11, 0, 0.25); border-top-color: #1a0b00; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.log { list-style: none; margin: 0; padding: 0; }
.log li { display: flex; justify-content: space-between; gap: 8px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.log li:last-child { border-bottom: 0; }
.log .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.log .d { font-weight: 800; color: var(--orange-2); }

/* --- оверлеи: +N и огонёк ------------------------------------------------------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 45%, rgba(21, 35, 73, 0.92), rgba(7, 13, 28, 0.96));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 0.25s ease-out;
  padding: 24px;
  text-align: center;
}
.overlay.out { animation: fadeOut 0.3s ease-in forwards; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
.plus {
  font-family: var(--display);
  font-size: 92px; line-height: 1;
  background: linear-gradient(180deg, #fff3d6, var(--orange-2) 40%, var(--ember));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 28px rgba(255, 120, 30, 0.55));
  animation: pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.plus-sub { margin-top: 10px; font-size: 18px; font-weight: 700; color: var(--muted); }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } }
.overlay .flame { width: 150px; height: 195px; }
.ignite-flame { position: relative; }
.ignite-flame .flame { animation: ignite 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) both, flicker 1.6s ease-in-out 0.9s infinite; }
@keyframes ignite {
  0% { transform: scale(0.3); filter: grayscale(1) brightness(0.5); }
  60% { transform: scale(1.15); filter: grayscale(0) brightness(1.3) drop-shadow(0 0 40px rgba(255, 120, 30, 0.9)); }
  100% { transform: scale(1); filter: drop-shadow(0 0 22px rgba(255, 110, 30, 0.6)); }
}
.ignite-title { font-family: var(--display); font-size: 30px; margin-top: 18px; animation: pop 0.5s 0.35s both cubic-bezier(0.34, 1.56, 0.64, 1); }
.ignite-days { font-family: var(--display); font-size: 64px; line-height: 1; color: var(--orange-2); margin-top: 6px; animation: pop 0.5s 0.5s both cubic-bezier(0.34, 1.56, 0.64, 1); }
.ignite-sub { color: var(--muted); font-weight: 600; margin: 6px 0 24px; animation: fadeIn 0.4s 0.7s both; }
.spark {
  position: absolute; left: 50%; top: 55%;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--orange-2); box-shadow: 0 0 10px var(--orange);
  animation: spark 1s ease-out forwards;
}
@keyframes spark {
  from { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2); opacity: 0; }
}

/* --- онбординг --------------------------------------------------------------------- */
.brand { display: flex; flex-direction: column; align-items: center; margin: 24px 0 8px; }
.brand .flame { width: 76px; height: 99px; }
.brand h1 { font-family: var(--display); font-weight: 400; font-size: 34px; letter-spacing: 0.08em; margin: 10px 0 2px; }
.brand p { margin: 0; color: var(--orange-2); font-weight: 700; }
.steps { list-style: none; padding: 0; margin: 22px 0; display: grid; gap: 10px; }
.steps li { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.steps .n { flex: none; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--display); background: rgba(255, 138, 31, 0.15); color: var(--orange-2); }
.label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 4px 8px; }
.form-row { display: flex; gap: 8px; }
.preview { margin-top: 14px; text-align: center; animation: screenIn 0.3s ease-out; }
.preview .avatar { margin: 0 auto 8px; }
.preview .nick { font-family: var(--display); font-size: 22px; }
.preview .kills { color: var(--orange-2); font-weight: 700; margin: 4px 0 14px; }
.preview .btns { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; }
.error { color: var(--danger); font-size: 13px; font-weight: 600; margin: 8px 4px 0; }
.footnote { font-size: 12px; color: var(--dim); text-align: center; margin-top: 18px; }

/* --- топ ---------------------------------------------------------------------------- */
.top-controls { display: grid; gap: 10px; margin-bottom: 14px; }
.top-list { display: grid; gap: 8px; position: relative; }
.top-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
  will-change: transform;
}
.top-row.me { border-color: rgba(79, 124, 255, 0.6); background: linear-gradient(90deg, rgba(79, 124, 255, 0.16), var(--surface)); }
.top-row .rank { width: 28px; text-align: center; font-family: var(--display); color: var(--muted); flex: none; }
.top-row.r1 .rank { color: var(--gold); text-shadow: 0 0 12px rgba(255, 201, 74, 0.5); }
.top-row.r2 .rank { color: var(--silver); }
.top-row.r3 .rank { color: var(--bronze); }
.top-row .who .n { font-weight: 800; }
.top-row .who .p { font-size: 12px; color: var(--muted); }
.top-row .val { font-family: var(--display); font-size: 18px; text-align: right; }
.top-row .val small { font-family: var(--body); font-size: 11px; color: var(--muted); margin-left: 3px; font-weight: 700; }
.top-me-sticky { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 8px); margin-top: 10px; box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4); }
.top-note { font-size: 12px; color: var(--dim); text-align: center; margin-top: 14px; }

/* --- друзья ------------------------------------------------------------------------ */
.invite { background: linear-gradient(135deg, rgba(79, 124, 255, 0.22), rgba(255, 138, 31, 0.14)), var(--surface); }
.invite h3 { margin: 0 0 4px; font-family: var(--display); font-weight: 400; font-size: 20px; }
.invite .link { margin: 12px 0; padding: 10px 12px; border-radius: 10px; background: rgba(7, 13, 28, 0.55); font-size: 13px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
.invite .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.people { display: grid; gap: 8px; }
.person { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.person .n { font-weight: 800; }
.person .p { font-size: 12px; color: var(--muted); }
.person .acts { display: flex; gap: 6px; flex: none; }
.mini-bar { height: 5px; border-radius: 999px; background: rgba(130, 160, 255, 0.12); margin-top: 6px; overflow: hidden; }
.mini-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--orange)); transition: width 0.8s ease; }
.mini-bar.done i { background: linear-gradient(90deg, var(--orange-2), var(--ember)); }
.more { color: var(--dim); font-size: 18px; padding: 4px 6px; }

/* --- профиль ------------------------------------------------------------------------ */
.profile-head { display: flex; flex-direction: column; align-items: center; text-align: center; margin: 8px 0 16px; }
.profile-head .nick { font-family: var(--display); font-size: 24px; margin-top: 10px; }
.profile-head .pid { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 700; margin-top: 2px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 14px 8px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); text-align: center; }
.stat b { display: block; font-family: var(--display); font-weight: 400; font-size: 24px; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; }
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: rgba(79, 124, 255, 0.55); transform-box: fill-box; transform-origin: bottom; animation: grow 0.6s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes grow { from { transform: scaleY(0); } }
.chart .bar.done { fill: url(#ringGrad); }
.chart .norm { stroke: var(--orange); stroke-dasharray: 4 4; stroke-width: 1.5; opacity: 0.8; }
.chart text { fill: var(--dim); font-size: 9px; font-family: var(--body); font-weight: 700; }
.chart .normlabel { fill: var(--orange-2); }
details.day { border-bottom: 1px solid var(--line); }
details.day:last-child { border-bottom: 0; }
details.day summary { list-style: none; display: flex; justify-content: space-between; padding: 12px 2px; cursor: pointer; font-weight: 700; }
details.day summary::-webkit-details-marker { display: none; }
details.day summary .k { font-family: var(--display); font-weight: 400; }
details.day summary .k.done { color: var(--orange-2); }
details.day .log { padding: 0 2px 10px; }
.about { font-size: 13px; color: var(--muted); }
.edit-id { display: flex; gap: 8px; margin-top: 10px; width: 100%; max-width: 340px; }

/* --- тост ---------------------------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); z-index: 60;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 16px; border-radius: 14px;
  background: var(--surface-3); border: 1px solid var(--line-2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  font-weight: 700; font-size: 14px; text-align: center;
  animation: toastIn 0.25s ease-out;
}
.toast.error { border-color: rgba(255, 77, 106, 0.5); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } }

.skeleton { height: 56px; border-radius: 14px; background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
