/* ── Tokens ── */
:root {
  --bg: #060d17;
  --surface: #0b1929;
  --surface2: #0f2035;
  --border: rgba(196,151,58,.16);
  --border-hi: rgba(196,151,58,.38);
  --gold: #c4973a;
  --gold-lt: #ddb050;
  --jade: #7baa9e;
  --jade-dk: #4e7a70;
  --text: #cfdbd6;
  --muted: #4e6e7a;
  --label: #6a8e9a;
  --in-bg: #05101a;
  --in-border: #162e44;
  --notice-bg: rgba(196,151,58,.07);
  --notice-border: rgba(196,151,58,.28);
  --err-bg: rgba(190,55,55,.1);
  --err: #d86060;
  --ok-bg: rgba(70,150,110,.1);
  --ok: #60b888;
  --shadow: 0 0 0 1px rgba(196,151,58,.05) inset, 0 48px 120px rgba(0,0,16,.9);
}

@media (prefers-color-scheme: light) { :root {
  --bg: #ede6d8;
  --surface: #faf5eb;
  --surface2: #f0e9d8;
  --border: rgba(140,95,20,.18);
  --border-hi: rgba(140,95,20,.42);
  --gold: #9a6e1a;
  --gold-lt: #b8832a;
  --jade: #3a7a6e;
  --jade-dk: #2a5a50;
  --text: #1a1208;
  --muted: #7a6a50;
  --label: #8a7050;
  --in-bg: #f5f0e5;
  --in-border: #d8cdb0;
  --notice-bg: rgba(140,95,20,.07);
  --notice-border: rgba(140,95,20,.25);
  --err-bg: rgba(150,40,40,.07);
  --err: #963030;
  --ok-bg: rgba(40,110,70,.08);
  --ok: #287850;
  --shadow: 0 4px 28px rgba(60,40,10,.14), 0 1px 0 rgba(255,255,255,.7) inset;
}}

:root[data-theme=dark] {
  --bg: #060d17; --surface: #0b1929; --surface2: #0f2035;
  --border: rgba(196,151,58,.16); --border-hi: rgba(196,151,58,.38);
  --gold: #c4973a; --gold-lt: #ddb050; --jade: #7baa9e; --jade-dk: #4e7a70;
  --text: #cfdbd6; --muted: #4e6e7a; --label: #6a8e9a;
  --in-bg: #05101a; --in-border: #162e44;
  --notice-bg: rgba(196,151,58,.07); --notice-border: rgba(196,151,58,.28);
  --err-bg: rgba(190,55,55,.1); --err: #d86060;
  --ok-bg: rgba(70,150,110,.1); --ok: #60b888;
  --shadow: 0 0 0 1px rgba(196,151,58,.05) inset, 0 48px 120px rgba(0,0,16,.9);
}

:root[data-theme=light] {
  --bg: #ede6d8; --surface: #faf5eb; --surface2: #f0e9d8;
  --border: rgba(140,95,20,.18); --border-hi: rgba(140,95,20,.42);
  --gold: #9a6e1a; --gold-lt: #b8832a; --jade: #3a7a6e; --jade-dk: #2a5a50;
  --text: #1a1208; --muted: #7a6a50; --label: #8a7050;
  --in-bg: #f5f0e5; --in-border: #d8cdb0;
  --notice-bg: rgba(140,95,20,.07); --notice-border: rgba(140,95,20,.25);
  --err-bg: rgba(150,40,40,.07); --err: #963030;
  --ok-bg: rgba(40,110,70,.08); --ok: #287850;
  --shadow: 0 4px 28px rgba(60,40,10,.14), 0 1px 0 rgba(255,255,255,.7) inset;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ── */
body {
  min-height: 100vh;
  background: var(--bg);
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  color: var(--text);
  transition: background .3s, color .3s;
}

/* ── Stars canvas ── */
#sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; transition: opacity .4s; }
@media (prefers-color-scheme: light) { #sky { opacity: 0; } }
:root[data-theme=light] #sky { opacity: 0; }
:root[data-theme=dark]  #sky { opacity: 1; }

/* ── Theme toggle ── */
.theme-btn {
  position: fixed; top: 14px; right: 14px; z-index: 20;
  width: 34px; height: 34px; border-radius: 50%;
  background: none; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--muted);
  transition: border-color .15s, color .15s;
}
.theme-btn:hover        { border-color: var(--gold); color: var(--gold); }
.theme-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ── Emblem ── */
.emblem { text-align: center; }
.emblem-ring {
  display: inline-flex; align-items: center; justify-content: center;
  width: 68px; height: 68px; border-radius: 50%;
  border: 1px solid var(--border-hi); position: relative; margin-bottom: 14px;
}
.emblem-ring::after {
  content: ''; position: absolute; inset: -5px; border-radius: 50%;
  border: 1px solid var(--border);
}
.emblem-char { font-family: Georgia, 'Palatino Linotype', serif; font-size: 32px; color: var(--gold); line-height: 1; }
.emblem-name { font-family: Georgia, 'Palatino Linotype', serif; font-size: 22px; letter-spacing: .01em; margin-bottom: 5px; }
.emblem-sub  { font-size: 10.5px; text-transform: uppercase; letter-spacing: .22em; color: var(--gold); opacity: .7; }

/* ── Home page ── */
.page-home {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  width: 100%; max-width: 520px; margin: 0 auto;
  padding: 52px 24px 64px; gap: 28px;
}

/* ── Hero sub ── */
.hero-sub { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.tagline  { font-size: 13.5px; color: var(--muted); text-align: center; line-height: 1.6; max-width: 340px; }

/* ── Server status dot ── */
@keyframes pulse-online {
  0%   { box-shadow: 0 0 0 0 rgba(76,175,130,.5); }
  70%  { box-shadow: 0 0 0 7px rgba(76,175,130,0); }
  100% { box-shadow: 0 0 0 0 rgba(76,175,130,0); }
}
.server-status { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; letter-spacing: .06em; }
.server-status--online  { color: #4caf82; }
.server-status--offline { color: var(--muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot--online  { background: #4caf82; animation: pulse-online 2s ease-out infinite; }
.status-dot--offline { background: #e05c5c; }

/* ── Stats ── */
.stats { display: flex; gap: 1px; width: 100%; background: var(--border); border-radius: 4px; overflow: hidden; }
.stat  { flex: 1; background: var(--surface); padding: 16px 12px; text-align: center; }
.stat-val { font-family: Georgia, 'Palatino Linotype', serif; font-size: 22px; color: var(--gold); font-variant-numeric: tabular-nums; line-height: 1; }
.stat-lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin-top: 5px; }
.stat-status { font-size: 14px; font-weight: 600; letter-spacing: .06em; }
.stat-status--online  { color: #4caf82; }
.stat-status--offline { color: #e05c5c; }

/* ── Buttons ── */
.btn {
  display: block; width: 100%; padding: 13px;
  border: none; border-radius: 3px;
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  text-decoration: none; text-align: center; cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn:hover          { opacity: .88; }
.btn:active         { transform: translateY(1px); }
.btn:focus-visible  { outline: 2px solid var(--gold); outline-offset: 3px; }
.btn-primary        { background: linear-gradient(175deg, var(--gold-lt) 0%, var(--gold) 100%); color: #080e02; }
.btn-secondary      { background: var(--surface2); color: var(--jade); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--border-hi); }

/* ── Actions group ── */
.actions { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.actions-row { display: flex; gap: 10px; }
.actions-row .btn { flex: 1; }

/* ── Separator ── */
.sep { width: 100%; height: 1px; background: var(--border); }

/* ── Footer nav (home) ── */
.foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; }
.foot a { font-size: 11.5px; color: var(--muted); text-decoration: none; transition: color .15s; }
.foot a:hover { color: var(--jade); }

/* ── Register page ── */
.page-reg {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}
.reg-wrap            { width: 100%; max-width: 420px; }
.reg-wrap .emblem    { margin-bottom: 28px; }

/* ── Card ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px; padding: 38px 44px 44px;
  box-shadow: var(--shadow);
  transition: background .3s, border-color .3s, box-shadow .3s;
}
.card .sep { margin: 26px 0; }

/* ── Alerts ── */
.alert { border-radius: 3px; padding: 11px 15px; font-size: 13.5px; line-height: 1.5; margin-bottom: 22px; }
.alert-err { background: var(--err-bg); color: var(--err); border-left: 3px solid var(--err); }
.alert-ok  { background: var(--ok-bg);  color: var(--ok);  border-left: 3px solid var(--ok); }

/* ── Form ── */
.field { margin-bottom: 18px; }
label {
  display: block; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .14em; color: var(--label); margin-bottom: 7px;
}
.in-wrap { position: relative; }

input[type=text],
input[type=email],
input[type=password],
input[type=number] {
  width: 100%;
  background: var(--in-bg); border: 1px solid var(--in-border);
  border-radius: 3px; color: var(--text);
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  font-size: 15px; padding: 10px 14px;
  transition: border-color .15s, box-shadow .15s, background .3s;
  -webkit-appearance: none;
}
input[type=text]:focus,
input[type=email]:focus,
input[type=password]:focus,
input[type=number]:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(196,151,58,.1);
}
input::placeholder { color: var(--muted); opacity: 1; }
input[type=password] { padding-right: 42px; }

/* ── Password eye ── */
.eye {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 4px;
  display: flex; align-items: center;
  transition: color .15s;
}
.eye:hover        { color: var(--jade); }
.eye:focus-visible { outline: 2px solid var(--gold); border-radius: 2px; }

/* ── Hint ── */
.hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

/* ── Field status icons (круглый бейдж справа снаружи поля) ── */
.field-icon {
  position: absolute;
  left: calc(100% + 8px);
  top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid transparent; pointer-events: none;
  display: none; align-items: center; justify-content: center;
}
.field-icon.ok  { display: flex; color: var(--ok);  border-color: var(--ok); }
.field-icon.err { display: flex; color: var(--err); border-color: var(--err); }
.captcha-row .in-wrap { flex: 1; min-width: 0; }

/* ── CAPTCHA ── */
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-q {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 3px; padding: 10px 14px;
  font-family: Georgia, 'Palatino Linotype', serif;
  font-size: 15px; color: var(--gold); white-space: nowrap; flex-shrink: 0;
}
.captcha-row input { flex: 1; min-width: 0; }

/* ── Checkboxes ── */
.check-group { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.check-row   { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check-row input[type=checkbox] {
  width: 16px; height: 16px; margin-top: 2px;
  flex-shrink: 0; accent-color: var(--gold); cursor: pointer;
}
.check-label   { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.check-label a { color: var(--jade); text-decoration: none; }
.check-label a:hover { text-decoration: underline; }

/* ── Code verification step ── */
.code-notice {
  text-align: center; font-size: 13.5px; color: var(--label);
  line-height: 1.65; margin-bottom: 24px;
}
.code-notice strong { color: var(--jade); font-weight: 600; }

.code-input {
  text-align: center !important;
  font-family: Georgia, 'Palatino Linotype', serif !important;
  font-size: 26px !important;
  letter-spacing: .25em;
  padding: 12px 14px !important;
}

.code-actions {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-top: 20px; flex-wrap: wrap;
}
.code-actions-sep { color: var(--border-hi); font-size: 14px; }

.link-btn {
  background: none; border: none; cursor: pointer;
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  font-size: 12px; color: var(--muted); padding: 0;
  transition: color .15s;
}
.link-btn:hover        { color: var(--jade); }
.link-btn:focus-visible { outline: 2px solid var(--gold); border-radius: 2px; outline-offset: 2px; }

/* ── Success state ── */
.ok-body  { text-align: center; padding: 8px 0; }
.ok-ring  {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--ok-bg); border: 1px solid var(--ok);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.ok-title { font-family: Georgia, 'Palatino Linotype', serif; font-size: 19px; margin-bottom: 12px; }
.ok-text  { font-size: 13.5px; color: var(--muted); line-height: 1.65; }
.ok-text b { color: var(--jade); font-weight: 600; }

/* ── Card footer ── */
.card-foot { text-align: center; font-size: 12px; color: var(--muted); line-height: 1.65; }
.card-foot b { color: var(--jade); font-weight: 600; }

/* ── Login page ── */
.login-remember { margin-bottom: 20px; }

.login-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 6px;
}
.login-back-link,
.login-reg-link {
  font-size: 12px; color: var(--muted); text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
  transition: color .15s;
}
.login-back-link:hover,
.login-reg-link:hover { color: var(--jade); }

/* ── Forgot password page ── */
.forgot-intro { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 26px; text-align: center; }
.forgot-icon  {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--notice-bg); border: 1px solid var(--notice-border);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
}
.forgot-intro-text { font-size: 13.5px; color: var(--label); line-height: 1.65; margin: 0; }

/* ── Cabinet tabs ── */
.cabinet-tabs {
  display: flex; gap: 2px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 4px; padding: 3px; width: 100%;
}
.tab-link {
  flex: 1; text-align: center; text-decoration: none;
  font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); padding: 9px 6px; border-radius: 3px;
  transition: color .15s, background .15s;
}
.tab-link:hover             { color: var(--text); }
.tab-link--active           { background: var(--surface); color: var(--gold); }
.tab-link:focus-visible     { outline: 2px solid var(--gold); outline-offset: 2px; }
.tab-panel[hidden]          { display: none; }
.cabinet-row--last          { border-bottom: none; }

/* ── Email verified status ── */
.cabinet-verified {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; color: var(--ok); font-weight: 600;
}
.cabinet-not-verified { font-size: 13px; color: var(--muted); }

/* ── Cabinet page ── */
.page-cabinet {
  position: relative; z-index: 1;
  display: flex; justify-content: center;
  min-height: 100vh; padding: 40px 24px 64px;
}
.cabinet-wrap {
  width: 100%; max-width: 460px;
  display: flex; flex-direction: column; gap: 18px;
}
.cabinet-wrap .emblem { margin-bottom: 10px; }
.cabinet-wrap .alert  { margin-bottom: 0; }

.card-title {
  font-family: Georgia, 'Palatino Linotype', serif;
  font-size: 14.5px; color: var(--gold); letter-spacing: .01em;
  margin-bottom: 20px;
}

.cabinet-info { display: flex; flex-direction: column; gap: 0; }
.cabinet-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.cabinet-row:last-child, .cabinet-row--last { border-bottom: none; }
.cabinet-label {
  font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .14em; color: var(--muted);
}
.cabinet-value {
  font-size: 14px; color: var(--text);
  font-variant-numeric: tabular-nums;
  word-break: break-all; text-align: right; margin-left: 12px;
}
.cabinet-sep { margin: 20px 0; }
.cabinet-server-row {
  display: flex; justify-content: space-between; align-items: center;
}
.cabinet-value-jade {
  font-size: 13px; color: var(--jade);
  font-variant-numeric: tabular-nums;
}
.cabinet-logout { margin-top: 4px; }

/* ── GM tab ── */
.tab-link--gm           { color: var(--gold) !important; }
.tab-link--gm:hover     { color: var(--gold-lt) !important; }
.tab-link--active.tab-link--gm { color: var(--gold); }

.gm-card .card-title    { color: var(--gold); }
.gm-notice {
  font-size: 13px; color: var(--label); line-height: 1.65;
  background: var(--notice-bg); border: 1px solid var(--notice-border);
  border-radius: 3px; padding: 12px 16px; margin-bottom: 20px;
}
.gm-notice strong { color: var(--gold); }
.gm-iweb-btn    { margin-bottom: 0; display: flex; align-items: center; justify-content: center; }
.gm-sep         { margin: 22px 0; }

.gm-info-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 22px; }
.gm-info-item   { background: var(--surface2); padding: 12px 14px; }
.gm-info-label  { font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin-bottom: 4px; }
.gm-info-val    { font-size: 14px; color: var(--jade); font-variant-numeric: tabular-nums; }

.gm-capabilities  { background: var(--surface2); border: 1px solid var(--border); border-radius: 3px; padding: 16px; }
.gm-cap-title     { font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin-bottom: 12px; }
.gm-cap-list      { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.gm-cap-list li   { font-size: 12.5px; color: var(--label); line-height: 1.5; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
