:root {
  color-scheme: dark;
  --background: #0b111a;
  --surface: #161f26;
  --field: #080d11;
  --line: #3f4038;
  --field-line: #796a4b;
  --muted: #9ba5a3;
  --text: #e8e0c9;
  --accent: #d9bd80;
  --accent-hover: #e1c489;
  --accent-ink: #0b1013;
  --focus: #e6d29b;
  --control-hover: #373225;
  --danger: #ffb3b0;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% 2%, #1c3444 0, transparent 42rem),
    var(--background);
  color: var(--text);
  font: 1rem/1.5 "Segoe UI", system-ui, sans-serif;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.site-header {
  border-bottom: 1px solid var(--line);
  background: #0b111ad9;
}

.header-inner {
  max-width: 68rem;
  margin: 0 auto;
  min-height: 4.25rem;
  padding: .7rem clamp(1rem, 4vw, 2.5rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .55rem 1rem;
}

.wordmark {
  display: inline-flex;
  gap: .7rem;
  align-items: center;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.025em;
}

.brand-accent { color: var(--accent); }

.brand-icon { display: block; width: 2.5rem; height: 2.5rem; flex: none; }

.header-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: .6rem; margin-inline-start: auto; }
.language-switch {
  display: inline-flex;
  gap: .15rem;
  padding: .17rem;
  border: 1px solid var(--line);
  border-radius: .55rem;
  background: var(--field);
}

.language-switch button {
  min-width: 2.15rem;
  min-height: 2rem;
  padding: 0 .35rem;
  border: 0;
  border-radius: .34rem;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
}

.language-switch button:hover { color: var(--text); }
.language-switch button[aria-current="true"] { background: var(--control-hover); color: var(--accent); }

.auth-main {
  display: grid;
  justify-items: center;
  padding: clamp(1.7rem, 7vh, 4.75rem) 1rem 3rem;
}

.auth-card, .dashboard-card {
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  background: var(--surface);
  box-shadow: 0 1.4rem 3.5rem #02070f52;
}

.auth-card { width: min(100%, 30rem); padding: clamp(1.15rem, 5vw, 2rem); }

h1 {
  margin: 0 0 1.25rem;
  font-size: clamp(1.55rem, 5.5vw, 2rem);
  font-weight: 600;
  letter-spacing: -.025em;
  line-height: 1.17;
}

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .25rem;
  margin-bottom: 1.35rem;
  padding: .25rem;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: .7rem;
}

.auth-switch a {
  padding: .5rem .4rem;
  border-radius: .45rem;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
}

.auth-switch a:hover { color: var(--text); }
.auth-switch a[aria-current="page"] { background: var(--control-hover); color: var(--accent); }

.field + .field { margin-top: 1rem; }
.field label { display: block; margin: 0 0 .4rem; font-size: .94rem; font-weight: 600; }
.field input {
  display: block;
  width: 100%;
  min-height: 2.9rem;
  padding: .6rem .72rem;
  border: 1px solid var(--field-line);
  border-radius: .55rem;
  background: var(--field);
  color: var(--text);
}

:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.field input:focus { border-color: var(--focus); }
.field-error input { border-color: #ce767b; }
.field-hint { color: var(--muted); margin: .35rem 0 0; font-size: .9rem; }

.captcha-slot { margin-top: 1.25rem; }
.captcha-slot .g-recaptcha { min-height: 4.9rem; transform-origin: left top; }
.captcha-slot iframe[src*="/anchor?"] { clip-path: inset(0 2px 2px 0 round .35rem); }
.captcha-error { margin: .4rem 0 0; color: var(--danger); font-size: .94rem; }

@media (max-width: 390px) {
  .captcha-slot .g-recaptcha { min-height: 4.2rem; transform: scale(.82); }
}

@media (max-width: 320px) {
  .captcha-slot .g-recaptcha { transform: scale(.78); }
}

.errorlist {
  color: var(--danger);
  font-size: .94rem;
  margin: .38rem 0 .8rem;
  padding: 0;
  list-style: none;
}

.notice {
  margin: 0 0 1rem;
  padding: .72rem .85rem;
  border: 1px solid var(--field-line);
  border-radius: .55rem;
  background: var(--control-hover);
  color: var(--focus);
  font-size: .94rem;
}

.primary-button, .secondary-button {
  display: inline-flex;
  min-height: 2.8rem;
  align-items: center;
  justify-content: center;
  padding: .6rem 1rem;
  border: 1px solid transparent;
  border-radius: .56rem;
  cursor: pointer;
  font-weight: 600;
}

.primary-button { width: 100%; margin-top: 1.35rem; background: var(--accent); color: var(--accent-ink); }
.primary-button:hover { background: var(--accent-hover); }
.secondary-button { border-color: var(--line); background: var(--surface); color: var(--text); }
.secondary-button:hover { background: var(--control-hover); }

.dashboard-main { max-width: 68rem; padding: clamp(2rem, 6vw, 4rem) clamp(1rem, 4vw, 2.5rem); margin: auto; }
.dashboard-nav { display: flex; gap: 1.35rem; border-bottom: 1px solid var(--line); margin-bottom: 1.35rem; }
.dashboard-nav a { padding: .55rem .15rem .68rem; font-weight: 600; }
.dashboard-nav a[aria-current="page"] { color: var(--accent); border-bottom: 2px solid var(--accent); }
.dashboard-main > .notice { max-width: 44rem; }
.dashboard-card { max-width: 44rem; padding: 1.25rem clamp(1rem, 4vw, 1.5rem); }
details.dashboard-card { padding-block: 0; }
details.dashboard-card[open] { padding-bottom: 1.25rem; }
.dashboard-card > h2, .dashboard-card > summary { color: var(--accent); }
.dashboard-card > summary { padding: 1.05rem 0; cursor: pointer; }
.dashboard-card > summary:hover { color: var(--focus); }
.dashboard-card h2 { margin: 0; font-size: 1.2rem; font-weight: 600; }
.dashboard-card summary h2 { display: inline; }
.dashboard-card dl { margin: 0; }
.dashboard-card dl > div { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 0; }
.dashboard-card dl > div + div { border-top: 1px solid var(--line); }
.dashboard-card dt, .client-status, .error-card p { color: var(--muted); }
.dashboard-card dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.dashboard-card + .dashboard-card { margin-top: 1rem; }
.password-change-form { max-width: 28rem; }

.cart-button, .discord-link {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--field);
  color: var(--accent);
}
.cart-button:hover, .discord-link:hover { border-color: var(--field-line); background: var(--control-hover); }

.subscription-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.subscription-heading h2 { color: var(--accent); }
.subscription-notice { margin: .65rem 0 0; }
.bots-table { width: 100%; table-layout: fixed; border-collapse: collapse; margin-top: .65rem; font-size: .88rem; }
.bots-table th, .bots-table td { padding: .46rem .35rem; text-align: left; vertical-align: middle; }
.bots-table thead th { color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); }
.bots-table tbody tr + tr, .bots-table tfoot { border-top: 1px solid var(--line); }
.bots-table tbody th { font-weight: 600; }
.bots-table .bot-empty, .bot-no-term { color: var(--muted); }
.subscription-bots thead th { font-size: .82rem; }
.subscription-bots .bot-action-column { width: 2.6rem; }
.subscription-bots .bot-name-column { width: 18%; }
.subscription-bots .bot-expiry-column { width: 6.5rem; }
.subscription-bots .bot-activation-cell { padding-inline-end: 0; }
.subscription-bots tfoot { background: #20282d; color: var(--muted); }
.bot-term, .bot-name { overflow-wrap: anywhere; }
.bot-expiry { font-variant-numeric: tabular-nums; }
.bot-icon-button {
  display: grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: .4rem;
  background: var(--field);
  color: var(--accent);
  cursor: pointer;
}
.bot-icon-button:enabled:hover { background: var(--control-hover); border-color: var(--field-line); }
.bot-icon-button:disabled { color: var(--muted); opacity: .45; cursor: default; }
.bot-name-editor {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1.4rem;
  align-items: center;
  gap: .16rem;
}
.bot-name-editor input[name="name"] {
  width: 100%;
  min-width: 0;
  height: 2rem;
  padding: 0 .22rem;
  border: 1px solid transparent;
  border-radius: .4rem;
  color: var(--text);
  background: transparent;
  text-overflow: ellipsis;
}
.bot-name-editor input[readonly] { cursor: default; }
.bot-name-editor input[name="name"]:not([readonly]) {
  grid-column: 1 / -1;
  border-color: var(--field-line);
  background: var(--field);
  text-overflow: clip;
}
.bot-name-pencil {
  display: grid;
  place-items: center;
  width: 1.4rem;
  height: 1.7rem;
  padding: 0;
  border: 0;
  border-radius: .3rem;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}
.bot-name-pencil:hover { background: var(--control-hover); }
.bot-name-pencil[aria-disabled="true"] { opacity: .55; cursor: default; }
.bot-name-pencil[hidden], .bot-name-error[hidden] { display: none; }
.bot-name-error {
  position: absolute;
  z-index: 1;
  top: 100%;
  left: 0;
  width: max-content;
  max-width: min(14rem, 55vw);
  padding: .3rem .45rem;
  border: 1px solid var(--line);
  border-radius: .35rem;
  color: var(--danger);
  background: var(--field);
  font-size: .76rem;
}
.bot-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .4rem; }
.bot-form input, .bot-form .primary-button { min-width: 0; min-height: 2rem; padding: .35rem .48rem; font-size: .82rem; }
.bot-form input[aria-invalid="true"] { border-color: var(--danger); }
.bot-form .primary-button { width: auto; margin: 0; }
.bot-activation-cell input { padding-inline: .3rem; font-family: Consolas, "Courier New", monospace; font-size: .75rem; }
.bot-activation-cell .primary-button { padding-inline: .42rem; font-size: .8rem; }
.account-bots { margin-top: 0; }
.client-status { margin: .85rem 0 0; }

.client-notice { padding-block: .8rem; border-inline-start: 3px solid var(--accent); }
.dashboard-card.client-notice h2 { font-size: 1rem; }
.client-notice p { margin: .4rem 0 0; font-size: .875rem; line-height: 1.5; }

.client-card { padding-block: .8rem; }
.client-card-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: .25rem .65rem; }
.client-card-heading h2 { color: var(--accent); }
.client-card-heading span { color: var(--muted); font-size: .75rem; }
.client-build { margin-top: .3rem; }
.client-build table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .84rem; }
.client-build th, .client-build td { padding: .2rem .25rem; text-align: left; }
.client-build th { color: var(--muted); font-size: .72rem; font-weight: 600; border-bottom: 1px solid var(--line); }
.client-build :is(th, td):first-child { padding-inline-start: 0; }
.client-build .client-version { text-align: center; }
.client-build th.client-version { width: 5.5rem; padding-inline: .12rem; white-space: nowrap; }
.client-build th:last-child { width: 4.35rem; }
.client-build :is(th, td) + :is(th, td) { position: relative; }
.client-build :is(th, td) + :is(th, td)::before {
  content: "";
  position: absolute;
  inset-block: 26%;
  inset-inline-start: 0;
  width: 1px;
  background: #3f403873;
}
.client-build th:last-child::before { content: none; }
.client-build td:last-child { text-align: center; }
html:lang(en) .client-build td:last-child { padding-inline-end: 0; text-align: right; }
.client-build code { display: block; overflow-wrap: anywhere; font: .6875rem/1.4 Consolas, monospace; }
.client-download { padding: 0; border: 0; background: none; color: var(--accent); cursor: pointer; font-weight: 600; white-space: nowrap; }
.client-download:disabled { opacity: .6; cursor: wait; }
.client-build [hidden], .client-download-message [hidden] { display: none; }
.client-download-message { width: min(26rem, calc(100% - 2rem)); color: var(--text); }
.client-download-message::backdrop { background: rgb(5 9 14 / .7); }
.client-download-message p { line-height: 1.5; }
.client-download-message form { margin: 0; }
.client-download-message .secondary-button { width: auto; }

@media (max-width: 480px) {
  .client-build th.client-version { width: 3.45rem; padding-inline: .25rem; white-space: normal; }
  html:lang(ru) .client-build th:last-child { width: 4.1rem; }
}

@media (max-width: 48rem) {
  .subscription-bots, .subscription-bots :is(thead, tbody, tfoot) { display: block; }
  .subscription-bots tr { display: grid; grid-template-columns: 2.3rem minmax(0, 1fr) 6.8rem; align-items: center; }
  .subscription-bots thead { border-bottom: 1px solid var(--line); }
  .subscription-bots thead th { border-bottom: 0; }
  .subscription-bots :is(.bot-action-column, .bot-name-column, .bot-expiry-column) { width: auto; }
  .subscription-bots .bot-code-column {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .subscription-bots :is(.bot-activation-cell, .bot-empty) { grid-column: 1 / -1; }
  .subscription-bots .bot-activation-cell { padding-block-start: 0; padding-inline-start: 0; }
  .subscription-bots tfoot td:last-child { grid-column: 2 / -1; }
}

@media (max-width: 480px) {
  .bots-table { font-size: .8rem; }
  .bots-table th, .bots-table td { padding-inline: .2rem; }
  .bot-form { grid-template-columns: minmax(0, 1fr); }
  .bot-form .primary-button { padding-inline: .28rem; font-size: .78rem; }
}

@media (max-width: 360px) {
  .bot-activation-cell input { font-size: .7rem; }
}
