/* Общая база: чёрный / жёлтый / голубой. Страницы переопределяют переменные. */
:root {
  --bg: #07080B;
  --bg2: #0E1117;
  --panel: #12151C;
  --panel2: #1A1E27;
  --line: #262B36;
  --text: #F5F7FA;
  --muted: #9AA3B2;
  --yellow: #FFD60A;
  --yellow2: #FFB800;
  --blue: #5CD6FF;
  --blue2: #2FA8FF;
  --danger: #FF5470;
  --ok: #3DDC97;
  --accent: var(--yellow);
  --accent-ink: #0A0A0A;
  --accent2: var(--blue);
  --radius: 18px;
  --radius-sm: 12px;
  --font-display: 'Unbounded', 'Rubik', system-ui, sans-serif;
  --font-body: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --btn-shadow: 0 6px 0 #B38F00;
  --card-shadow: 0 20px 60px rgba(0,0,0,.45);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 16px; line-height: 1.5;
  overflow-x: hidden;
}
body.modal-open { overflow: hidden; }
a { color: var(--accent2); }
img, svg { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent2); outline-offset: 2px; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* ---------- Шапка ---------- */
.topbar { position: sticky; top: 0; z-index: 50; backdrop-filter: blur(12px); background: color-mix(in srgb, var(--bg) 78%, transparent); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; color: var(--text); text-decoration: none; letter-spacing: .02em; white-space: nowrap; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: #FFD60A; color: #07080B; flex: none; }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.nav { display: none !important; }
body.is-admin .nav { display: flex !important; }
.nav { gap: 6px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; padding: 8px 12px; border-radius: 10px; white-space: nowrap; }
.nav a:hover { color: var(--text); background: var(--panel2); }
.nav a.active { color: var(--accent-ink); background: var(--accent); }

/* ---------- Карточка активации ---------- */
.act-card {
  position: relative; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px; box-shadow: var(--card-shadow);
  width: 100%; max-width: 560px;
}
.act-title { font-family: var(--font-display); font-size: 26px; font-weight: 800; line-height: 1.15; }
.act-sub { color: var(--muted); margin-top: 6px; font-size: 15px; }
.act-prefixes { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 16px; }
.act-prefixes:empty { display: none; margin: 0; }
.chip {
  font: inherit; font-size: 13px; cursor: pointer; color: var(--text);
  background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px;
  transition: .15s;
}
.chip b { color: var(--accent); font-family: var(--font-mono); margin-right: 4px; }
.chip:hover, .chip.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panel2)); }
.act-form { display: flex; flex-direction: column; gap: 12px; }
.act-input-wrap { position: relative; }
.act-input {
  width: 100%; font-family: var(--font-mono); font-size: 22px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text); background: var(--bg2);
  border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 16px 70px 16px 16px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.act-input::placeholder { color: #4B5262; letter-spacing: .08em; }
.act-input:focus { border-color: var(--accent2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent2) 25%, transparent); }
.act-count { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.act-count.ok { color: var(--ok); }
.act-btn {
  position: relative; font: inherit; font-family: var(--font-display); font-size: 18px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .04em; cursor: pointer;
  color: var(--accent-ink); background: var(--accent); border: 0; border-radius: var(--radius-sm);
  padding: 16px 20px; box-shadow: var(--btn-shadow); transition: transform .08s, box-shadow .08s, filter .15s;
}
.act-btn:hover { filter: brightness(1.06); }
.act-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #B38F00; }
.act-btn:disabled { cursor: wait; filter: saturate(.6); }
.is-loading .act-btn span { visibility: hidden; }
.is-loading .act-btn::after {
  content: ''; position: absolute; inset: 0; margin: auto; width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.act-hint { min-height: 22px; margin-top: 10px; font-size: 14px; color: var(--muted); }
.act-hint b { color: var(--accent2); }
.act-hint .warn { color: var(--yellow2); }
.act-msg { font-size: 15px; font-weight: 600; color: var(--danger); min-height: 0; }
.act-msg:not(:empty) { margin-top: 4px; padding: 10px 14px; border-radius: 10px; background: color-mix(in srgb, var(--danger) 12%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); }
.act-msg a { color: var(--text); font-weight: 700; }
.is-error .act-card { animation: shake .4s; }
.is-error .act-input { border-color: var(--danger); }
@keyframes shake { 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }

.act-history { margin-top: 18px; }
.act-history:empty { display: none; }
.hist-h { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.hist-item {
  display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: left; cursor: pointer;
  font: inherit; font-size: 14px; color: var(--text); background: var(--bg2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 6px;
}
.hist-item:hover { border-color: var(--accent2); }
.hist-item small { color: var(--muted); white-space: nowrap; }

/* ---------- Окно выдачи ---------- */
.modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.72); backdrop-filter: blur(6px); opacity: 0; transition: opacity .25s; }
.modal-box {
  position: relative; width: 100%; max-width: 620px; max-height: calc(100dvh - 32px); overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  transform: translateY(24px) scale(.96); opacity: 0; transition: transform .3s cubic-bezier(.2,1.4,.4,1), opacity .25s;
  display: flex; flex-direction: column; gap: 16px;
}
.modal-box > * { flex-shrink: 0; }
.modal.show .modal-backdrop { opacity: 1; }
.modal.show .modal-box { transform: none; opacity: 1; }
.modal.fresh .modal-box { animation: pop .6s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { 0% { transform: scale(.7); } 60% { transform: scale(1.04); } 100% { transform: none; } }
.modal-x { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-size: 16px; cursor: pointer; }
.modal-x:hover { border-color: var(--accent); }
.m-top { padding-right: 40px; }
.m-badge { display: inline-block; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; padding: 5px 10px; border-radius: 999px; background: color-mix(in srgb, var(--accent2) 18%, transparent); color: var(--accent2); }
.m-badge.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.m-title { font-family: var(--font-display); font-size: 26px; margin: 10px 0 4px; line-height: 1.15; }
.m-meta { color: var(--muted); font-size: 14px; }
.m-meta code { font-family: var(--font-mono); color: var(--text); }
.m-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.m-steps li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 13px; color: var(--muted); }
.m-steps li::before { content: ''; position: absolute; top: 11px; left: -50%; width: 100%; height: 3px; background: var(--line); z-index: 0; }
.m-steps li:first-child::before { display: none; }
.m-steps li.done::before, .m-steps li.now::before { background: var(--accent); }
.m-steps i { position: relative; z-index: 1; width: 24px; height: 24px; border-radius: 50%; background: var(--panel2); border: 3px solid var(--line); }
.m-steps li.done i { background: var(--accent); border-color: var(--accent); }
.m-steps li.done i::after { content: '✓'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 900; color: var(--accent-ink); font-style: normal; }
.m-steps li.now i { border-color: var(--accent2); animation: pulse 1.4s infinite; }
.m-steps li.done, .m-steps li.now { color: var(--text); }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent2) 60%, transparent); } 50% { box-shadow: 0 0 0 8px transparent; } }

.m-issued { border: 2px dashed var(--ok); border-radius: var(--radius-sm); padding: 14px; background: color-mix(in srgb, var(--ok) 7%, transparent); }
.m-issued-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 800; }
.m-copy { font: inherit; font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 8px; border: 0; background: var(--ok); color: #04150D; cursor: pointer; }
.m-issued-text { margin: 10px 0 0; white-space: pre-wrap; word-break: break-word; font-family: var(--font-mono); font-size: 15px; user-select: all; }

.chat { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg2); }
.chat-h { padding: 10px 14px; font-weight: 700; font-size: 14px; border-bottom: 1px solid var(--line); }
.chat-log { height: 260px; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 82%; padding: 8px 12px; border-radius: 14px; font-size: 15px; }
.msg-text { white-space: pre-wrap; word-break: break-word; }
.msg-time { font-size: 11px; opacity: .6; margin-top: 2px; text-align: right; }
.msg-who { font-size: 11px; font-weight: 800; color: var(--accent2); margin-bottom: 2px; }
.msg.buyer { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.msg.admin { align-self: flex-start; background: var(--panel2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.system { align-self: center; max-width: 92%; text-align: center; font-size: 13px; color: var(--muted); background: transparent; border: 1px dashed var(--line); }
.msg.system .msg-time { text-align: center; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: var(--panel); }
.chat-input { flex: 1; resize: none; font: inherit; font-size: 15px; color: var(--text); background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none; max-height: 120px; }
.chat-input:focus { border-color: var(--accent2); }
.chat-send { width: 46px; flex: none; border: 0; border-radius: 10px; background: var(--accent2); color: #001826; font-size: 18px; cursor: pointer; }
.m-foot { font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- Рамка со ссылкой ---------- */
.linkbox { display: flex; gap: 6px; padding: 6px; border: 2px solid var(--accent2); border-radius: var(--radius-sm); background: var(--bg2); }
.linkbox-in { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 13px; color: var(--text); background: transparent; border: 0; outline: none; padding: 6px 8px; text-overflow: ellipsis; }
.linkbox-btn { flex: none; display: inline-grid; place-items: center; font: inherit; font-size: 13px; font-weight: 800; text-decoration: none; cursor: pointer; border: 0; border-radius: 8px; padding: 8px 12px; background: var(--accent2); color: #001826; white-space: nowrap; }
.linkbox-btn.go { background: var(--accent); color: var(--accent-ink); }
.linkbox.big { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.linkbox.big .linkbox-in { font-size: 14px; }

.m-save { border: 1px dashed var(--accent2); border-radius: var(--radius-sm); padding: 12px; background: color-mix(in srgb, var(--accent2) 7%, transparent); display: grid; gap: 8px; }
.m-save-h { font-weight: 800; }
.m-save-sub { font-size: 13px; color: var(--muted); }
.m-save.pulse { animation: savepulse 1.2s ease-in-out 5; }
@keyframes savepulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent2) 35%, transparent); border-color: var(--accent); } }

/* ---------- Робуксы со входом ---------- */
.rb { border: 2px solid var(--accent); border-radius: var(--radius-sm); padding: 16px; background: color-mix(in srgb, var(--accent) 6%, var(--bg2)); display: grid; gap: 10px; }
.rb[hidden], .sc[hidden], .m-issued[hidden] { display: none; }

/* ---------- Supersell: почта → код ---------- */
.sc { border: 2px solid var(--accent2); border-radius: var(--radius-sm); padding: 16px; background: color-mix(in srgb, var(--accent2) 6%, var(--bg2)); display: grid; gap: 10px; }
.sc-game { font-family: var(--font-display); font-weight: 900; font-size: 20px; color: var(--accent2); }
.sc-title { font-weight: 800; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.sc-sub { font-size: 14px; color: var(--muted); }
.sc-sub b { color: var(--text); }
.sc-form { display: grid; gap: 8px; }
.sc-in { font: inherit; font-size: 17px; font-weight: 600; color: var(--text); background: var(--bg2); border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; outline: none; }
.sc-in:focus { border-color: var(--accent2); }
.sc-err { color: var(--danger); font-size: 14px; font-weight: 600; }
.sc-err:empty { display: none; }
.rbw-amount { font-family: var(--font-display); font-weight: 900; font-size: 30px; line-height: 1; color: var(--accent); }
.rbw-amount small { font-size: .55em; }
.rbw-title { font-weight: 800; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.rbw-sub { font-size: 14px; color: var(--muted); }
.rbw-sub b { color: var(--text); }
.rbw-notice { font-size: 14px; padding: 8px 12px; border-radius: 8px; background: color-mix(in srgb, var(--yellow2) 14%, transparent); color: var(--text); }
.rbw-form { display: grid; gap: 8px; }
.rbw-nick { font: inherit; font-family: var(--font-mono); font-size: 18px; font-weight: 700; color: var(--text); background: var(--bg2); border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; outline: none; }
.rbw-nick:focus { border-color: var(--accent2); }
.rbw-err { color: var(--danger); font-size: 14px; font-weight: 600; }
.rbw-err:empty { display: none; }
.rbw-steps { margin: 0; padding-left: 20px; font-size: 14px; display: grid; gap: 4px; }
.spin { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 3px solid var(--accent2); border-right-color: transparent; animation: spin .7s linear infinite; }

/* ---------- Помощь / тикет ---------- */
.m-help { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.m-ticket-form { flex-basis: 100%; display: grid; gap: 8px; }
.m-ticket-form[hidden] { display: none; }
.m-ticket-form .chat-input { max-height: none; }
.m-tk-row { display: flex; gap: 8px; }
.help-btn { font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.help-btn:hover { border-color: var(--accent2); }
.help-btn[hidden] { display: none; }
.act-ticket { margin-top: 12px; display: grid; gap: 10px; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg2); }
.act-ticket[hidden], .act-ticket-form[hidden] { display: none; }
.act-ticket-h { font-weight: 700; font-size: 15px; }
.act-ticket-row { display: flex; flex-wrap: wrap; gap: 8px; }
.act-ticket-form { display: grid; gap: 8px; }
.act-ticket-form .chat-input { max-height: none; }

/* ---------- Плашка доверия ---------- */
.trust { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.trust span {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 14px;
  padding: 7px 12px; border-radius: 999px; background: rgba(0,0,0,.45); border: 1px solid var(--line); color: var(--text);
}
.trust span::before { content: '✓'; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; background: var(--yellow); color: #000; }
.trust span.main { background: var(--yellow); color: #000; border-color: var(--yellow); }
.trust span.main::before { content: '★'; background: #000; color: var(--yellow); }

/* ---------- Подвал ---------- */
.footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: 14px; margin-top: 60px; }
.footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }

@media (max-width: 600px) {
  .act-card { padding: 20px; }
  .act-title { font-size: 22px; }
  .act-input { font-size: 18px; letter-spacing: .08em; padding: 14px 62px 14px 14px; }
  .modal { padding: 0; align-items: end; }
  .modal-box { max-height: 94dvh; border-radius: var(--radius) var(--radius) 0 0; padding: 18px 16px; }
  .m-title { font-size: 21px; }
  .chat-log { height: 38dvh; }
  .msg { max-width: 90%; }
  .linkbox.big { flex-wrap: wrap; }
  .linkbox.big .linkbox-in { flex-basis: 100%; }
  .linkbox.big .linkbox-btn { flex: 1; padding: 10px; }
}
/* Окно активации по центру: заголовок → окно ввода кода → остальное */
.stage {
  display: flex !important; flex-direction: column; align-items: center; text-align: center;
  gap: 22px !important; padding-top: 48px !important;
}
.stage > div:first-child { display: contents; }
.stage #activator { order: 1; width: 100%; display: flex; justify-content: center; margin: 10px 0 8px; text-align: left; }
.stage > div:first-child > :not(:first-child):not(h1):not(.tag) { order: 2; }
.stage > div:first-child > p { margin: 0 auto; }
.stage .trust, .stage .games, .stage .models, .stage .logo-rb { justify-content: center; }
.stage .tiles, .stage .term { margin-left: auto; margin-right: auto; width: 100%; }
.stage .term { text-align: left; }
.stage h1 { transform-origin: center !important; }
.stage .tag + h1, .stage .ai-title { margin-top: 0; }
@media (max-width: 520px) {
  .brand { font-size: 0; gap: 0; }
  .brand-mark { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.chat[hidden], .sc-summary[hidden] { display: none !important; }
.sc-summary { padding: 16px; margin-bottom: 12px; border: 2px solid var(--accent, #ffdc34); border-radius: 12px; background: #ffdc341a; overflow-wrap: anywhere; }
.sc-summary strong { display: block; margin-bottom: 8px; }
.sc-actions { display: flex; gap: 8px; flex-wrap: wrap; }

