/* ============================================================
   Theme tokens — light is the default, dark via system or toggle
   ============================================================ */
:root {
  /* Light (white-gray) */
  --bg-gradient:
    radial-gradient(1200px 600px at 82% -12%, #ffffff 0%, rgba(255, 255, 255, 0) 58%),
    radial-gradient(1000px 560px at 0% -6%, #f4f6f9 0%, rgba(244, 246, 249, 0) 55%),
    linear-gradient(180deg, #f8f9fb 0%, #e8ebf1 100%);
  --surface: #ffffff;
  --surface-2: #f5f7f9;
  --surface-hover: #eef1f5;
  --border: #e4e7ec;
  --border-strong: #d4d9e1;
  --text: #1b2230;
  --text-muted: #5a6474;
  --text-dim: #8a93a3;
  --accent: #2b2f3a;
  --accent-strong: #3a4150;
  --accent-dim: rgba(43, 47, 58, 0.10);
  --accent-ring: rgba(43, 47, 58, 0.26);
  --on-accent: #ffffff;
  --icon-bg: #eceef2;
  --shadow: 0 18px 50px -28px rgba(30, 41, 59, 0.45);
  --shadow-sm: 0 6px 20px -14px rgba(30, 41, 59, 0.4);
  --skeleton-a: #edeff2;
  --skeleton-b: #f6f7f9;
  --header-bg: rgba(248, 249, 251, 0.82);
  --footer-bg: rgba(255, 255, 255, 0.55);

  --radius: 14px;
  --radius-sm: 10px;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* Dark values shared by an explicit dark toggle and by system preference */
:root[data-theme="dark"] {
  --bg-gradient: radial-gradient(circle at top, #3f3f46 0%, #18181b 35%, #09090b 100%);
  --surface: #18181b;
  --surface-2: #27272a;
  --surface-hover: #3f3f46;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  --accent: #d4d4d8;
  --accent-strong: #f4f4f5;
  --accent-dim: rgba(212, 212, 216, 0.12);
  --accent-ring: rgba(212, 212, 216, 0.24);
  --on-accent: #18181b;
  --icon-bg: #0c0c0e;
  --shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.8);
  --shadow-sm: 0 10px 30px -18px rgba(0, 0, 0, 0.75);
  --skeleton-a: #1c1c1f;
  --skeleton-b: #27272a;
  --header-bg: rgba(9, 9, 11, 0.82);
  --footer-bg: rgba(24, 24, 27, 0.6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-gradient: radial-gradient(circle at top, #3f3f46 0%, #18181b 35%, #09090b 100%);
    --surface: #18181b;
    --surface-2: #27272a;
    --surface-hover: #3f3f46;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.12);
    --text: #f4f4f5;
    --text-muted: #a1a1aa;
    --text-dim: #71717a;
    --accent: #d4d4d8;
    --accent-strong: #f4f4f5;
    --accent-dim: rgba(212, 212, 216, 0.12);
    --accent-ring: rgba(212, 212, 216, 0.24);
    --on-accent: #18181b;
    --icon-bg: #0c0c0e;
    --shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.8);
    --shadow-sm: 0 10px 30px -18px rgba(0, 0, 0, 0.75);
    --skeleton-a: #1c1c1f;
    --skeleton-b: #27272a;
    --header-bg: rgba(9, 9, 11, 0.82);
    --footer-bg: rgba(24, 24, 27, 0.6);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  color: var(--text);
  background: var(--bg-gradient);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body, .header, .panel, .card, .product, .btn, .footer, .ip-box, .stat, .nav__link, .theme-toggle {
  transition: background-color .25s ease, border-color .25s ease, color .2s ease, box-shadow .25s ease;
}

::selection { background: var(--accent-dim); color: var(--text); }
a { color: inherit; text-decoration: none; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ---------- Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-strong);
  backdrop-filter: blur(12px);
}
.header__inner { display: flex; align-items: center; gap: 18px; height: 70px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand__logo { width: 40px; height: 40px; border-radius: 11px; object-fit: cover; border: 1px solid var(--border-strong); }
.brand__name { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.1; }
.brand__tag { font-size: 11px; font-weight: 600; color: var(--text-dim); }

.nav { display: flex; gap: 4px; margin-left: 14px; }
.nav__link {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px; border-radius: 9px;
  font-size: 14px; font-weight: 600;
  color: var(--text-muted); cursor: pointer;
}
.nav__link:hover { color: var(--text); background: var(--surface-2); }
.nav__link.is-active { color: var(--text); }
.nav__link.is-active::after {
  content: ""; position: absolute; left: 13px; right: 13px; bottom: -1px;
  height: 2px; border-radius: 2px 2px 0 0; background: var(--accent);
}
.nav__ext::after { content: "↗"; font-size: 10px; color: var(--text-dim); }

.header__right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.theme-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: inherit; font-size: 13px; font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 8px 13px;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent-ring); }
.theme-toggle__icon { font-size: 14px; line-height: 1; }
.header__ip { text-align: right; line-height: 1.15; }
.header__ip-label { font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--text-dim); }
.header__ip-value { font-size: 15px; font-weight: 800; }

/* Server IP shown in pure white on dark theme */
:root[data-theme="dark"] .header__ip-value,
:root[data-theme="dark"] .ip-box__value { color: #ffffff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .header__ip-value,
  :root:not([data-theme="light"]) .ip-box__value { color: #ffffff; }
}

/* ---------- Layout ---------- */
.main { flex: 1; padding: 46px 24px 60px; }
.tab { display: none; animation: fade .25s ease; }
.tab.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- Hero ---------- */
.hero { text-align: center; max-width: 760px; margin: 0 auto; padding: 24px 0 12px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 15px; border-radius: 999px;
  font-size: 13px; font-weight: 700; color: var(--text);
  background: var(--accent-dim); border: 1px solid var(--accent-ring);
}
.status-pill.is-offline { background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.3); color: #dc2626; }
:root[data-theme="dark"] .status-pill.is-offline { color: #fca5a5; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent-ring); animation: pulse 1.8s infinite; }
.status-pill.is-offline .status-dot { background: #ef4444; animation: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 var(--accent-ring); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.hero__title { margin: 22px 0 14px; font-size: clamp(38px, 6vw, 62px); font-weight: 800; line-height: 1.02; letter-spacing: -0.03em; }
.hero__title span {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__subtitle { margin: 0 auto; max-width: 560px; font-size: 16px; line-height: 1.6; color: var(--text-muted); }

.ip-box {
  display: inline-flex; align-items: center; gap: 14px;
  margin-top: 26px; padding: 8px 8px 8px 20px; font-family: inherit;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px; cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.ip-box:hover { border-color: var(--accent-ring); transform: translateY(-1px); }
.ip-box__label { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--text-dim); }
.ip-box__value { font-size: 17px; font-weight: 800; }
.ip-box__copy { font-size: 12.5px; font-weight: 700; color: var(--on-accent); background: var(--accent); border-radius: 999px; padding: 8px 16px; transition: background .15s ease; }
.ip-box.is-copied .ip-box__copy { background: var(--accent-strong); }

.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 26px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14px; font-weight: 700; border-radius: 11px; padding: 13px 24px;
  cursor: pointer; border: 1px solid transparent; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-strong); }
.btn--ghost { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.btn--ghost:hover { border-color: var(--accent-ring); background: var(--surface-hover); }
.btn--buy { background: var(--accent); color: var(--on-accent); width: 100%; max-width: 220px; }
.btn--buy:hover { background: var(--accent-strong); }
.btn--buy[disabled] { opacity: .6; cursor: wait; }

/* ---------- Cards ---------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 54px; }
.card {
  display: flex; flex-direction: column; gap: 10px; padding: 24px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.card:hover { border-color: var(--accent-ring); transform: translateY(-3px); }
.card__icon {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px;
  background: var(--accent-dim); border: 1px solid var(--accent-ring); font-size: 22px;
}
.card__title { font-size: 17px; font-weight: 800; }
.card__text { font-size: 14px; line-height: 1.55; color: var(--text-muted); flex: 1; }
.card__link { font-size: 13.5px; font-weight: 700; color: var(--accent); }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 18px; }
.stat { padding: 22px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.stat__value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.stat__value .accent { color: var(--accent); }
.stat__label { margin-top: 4px; font-size: 12.5px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .08em; }

/* ---------- Store chooser (RU / EU) ---------- */
.store-chooser { max-width: 760px; margin: 0 auto; text-align: center; padding: 26px 0 8px; }
.store-chooser__title { margin: 0; font-size: clamp(26px, 4vw, 36px); font-weight: 800; letter-spacing: -0.02em; }
.store-chooser__subtitle { margin: 10px 0 0; font-size: 15px; color: var(--text-muted); }
.store-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 30px; }
.store-option {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 34px 24px; font-family: inherit; cursor: pointer; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, transform .12s ease, box-shadow .2s ease;
}
.store-option:hover { border-color: var(--accent-ring); transform: translateY(-3px); box-shadow: var(--shadow); }
.store-option__flag {
  width: 76px; height: 51px; object-fit: cover;
  border-radius: 9px; border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm); margin-bottom: 4px;
}
.store-option__name { font-size: 20px; font-weight: 800; color: var(--text); }
.store-option__desc { font-size: 13px; color: var(--text-muted); }

/* White store labels on the dark theme */
:root[data-theme="dark"] .store-chooser__title,
:root[data-theme="dark"] .store-option__name { color: #ffffff; }
:root[data-theme="dark"] .store-chooser__subtitle,
:root[data-theme="dark"] .store-option__desc { color: #e4e4e7; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .store-chooser__title,
  :root:not([data-theme="light"]) .store-option__name { color: #ffffff; }
  :root:not([data-theme="light"]) .store-chooser__subtitle,
  :root:not([data-theme="light"]) .store-option__desc { color: #e4e4e7; }
}

.store-back {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 16px;
  font-family: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer;
  color: var(--text-muted); background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: 999px; padding: 8px 15px;
  transition: color .15s ease, border-color .15s ease;
}
.store-back:hover { color: var(--text); border-color: var(--accent-ring); }

/* RU buy form (nickname + coupon) inside the details panel */
.ru-buy { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.ru-input {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease;
}
.ru-input::placeholder { color: var(--text-dim); }
.ru-input:focus { border-color: var(--accent-ring); }

/* ---------- Shop ---------- */
.shop-head { margin-bottom: 22px; }
.shop-head h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.shop-head p { margin: 6px 0 0; font-size: 14px; color: var(--text-muted); }

.shop { display: grid; grid-template-columns: 350px 1fr; gap: 20px; align-items: start; }
.products { padding: 18px; }
.panel__title { margin: 4px 4px 14px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--text-dim); }
.product-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.product {
  display: flex; align-items: center; gap: 13px; padding: 11px 13px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); cursor: pointer;
}
.product:hover { border-color: var(--border-strong); transform: translateY(-1px); background: var(--surface-hover); }
.product.is-active { border-color: var(--accent); background: var(--accent-dim); box-shadow: 0 0 0 1px var(--accent-ring); }
.product__icon { width: 36px; height: 36px; border-radius: 9px; object-fit: contain; image-rendering: pixelated; background: var(--icon-bg); flex: none; }
.product__meta { display: flex; flex-direction: column; line-height: 1.2; }
.product__name { font-weight: 700; font-size: 15px; }
.product__sub { font-size: 12px; color: var(--text-dim); }
.product__price { margin-left: auto; font-weight: 800; font-size: 14px; color: var(--accent); white-space: nowrap; }

.details { padding: 26px 28px; min-height: 440px; display: flex; flex-direction: column; }
.details__placeholder { margin: auto; color: var(--text-dim); font-size: 15px; }
.details__head { display: flex; align-items: center; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.details__icon { width: 54px; height: 54px; border-radius: 12px; object-fit: contain; image-rendering: pixelated; background: var(--icon-bg); border: 1px solid var(--border); }
.details__titles h3 { margin: 0; font-size: 22px; font-weight: 800; }
.details__tag { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-dim); border: 1px solid var(--accent-ring); padding: 3px 11px; border-radius: 999px; }
.rank-desc { padding: 20px 2px; font-size: 14.5px; line-height: 1.65; color: var(--text-muted); overflow-wrap: anywhere; }
.rank-desc--pre { white-space: pre-wrap; font-variant-numeric: tabular-nums; }
.rank-desc h1, .rank-desc h2, .rank-desc h3, .rank-desc h4 { margin: 14px 0 6px; font-size: 15px !important; font-weight: 700; color: var(--text); }
.rank-desc span { font-size: 14.5px !important; color: inherit !important; }
.rank-desc p { margin: 6px 0; }
.rank-desc ul { margin: 6px 0; padding-left: 18px; }
.rank-desc img { max-width: 100%; border-radius: 8px; }
.rank-desc a { color: var(--accent); }

.details__foot { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.price-box { display: flex; flex-direction: column; }
.price-box__label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .1em; }
.price-box__value { font-size: 28px; font-weight: 800; color: var(--text); }
.price-box__old { font-size: 15px; color: var(--text-dim); text-decoration: line-through; margin-left: 8px; font-weight: 600; }

.product-skeleton {
  height: 60px; border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--skeleton-a) 25%, var(--skeleton-b) 37%, var(--skeleton-a) 63%);
  background-size: 400% 100%; animation: shimmer 1.3s ease infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ---------- Footer ---------- */
.footer { margin-top: auto; border-top: 1px solid var(--border); background: var(--footer-bg); backdrop-filter: blur(8px); }
.footer__inner { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 18px; padding: 22px 24px; font-size: 14px; color: var(--text-muted); }
.footer__inner a { font-weight: 600; cursor: pointer; transition: color .15s ease; }
.footer__inner a:hover { color: var(--text); }
.footer__sep { color: var(--text-dim); }
.footer__copy { width: 100%; text-align: center; font-size: 12px; color: var(--text-dim); padding-bottom: 18px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong);
  padding: 12px 18px; border-radius: 10px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; z-index: 60;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .shop { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
  .store-options { grid-template-columns: 1fr; }
  .details { min-height: auto; }
}
@media (max-width: 620px) {
  .nav { display: none; }
  .brand__tag { display: none; }
}
