:root {
  --bg-deep: #0d0b0a;
  --bg-sea: #15110f;
  --bg-bronze: #241811;
  --panel: rgba(26, 18, 13, 0.92);
  --panel-soft: rgba(42, 29, 20, 0.82);
  --paper: #ead7b1;
  --paper-soft: #cbb58a;
  --muted: #a69373;
  --line: rgba(209, 174, 113, 0.22);
  --line-strong: rgba(223, 190, 132, 0.36);
  --gold: #e0b96e;
  --gold-deep: #9c6a2b;
  --teal: #6ba5a7;
  --teal-deep: #2e5c61;
  --danger: #b15a4a;
  --shadow: rgba(0, 0, 0, 0.42);
  --radius-l: 34px;
  --radius-m: 24px;
  --radius-s: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--paper);
  background:
    radial-gradient(900px 520px at 14% -6%, rgba(108, 76, 40, 0.24), transparent 58%),
    radial-gradient(1200px 700px at 86% 0%, rgba(52, 92, 99, 0.16), transparent 56%),
    linear-gradient(180deg, #1a120d 0%, #110d0b 38%, #0a0908 100%);
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: 0;
  opacity: 0.28;
  filter: blur(4px);
}

body::before {
  width: 420px;
  height: 420px;
  left: -120px;
  top: 140px;
  background: radial-gradient(circle, rgba(120, 83, 38, 0.34), transparent 68%);
}

body::after {
  width: 540px;
  height: 540px;
  right: -180px;
  top: 80px;
  background: radial-gradient(circle, rgba(55, 99, 105, 0.28), transparent 68%);
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.container,
.auth-page {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
  background: rgba(10, 9, 8, 0.78);
  border-bottom: 1px solid rgba(209, 174, 113, 0.12);
}

.topbar-inner {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #f3e3bd;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(223, 190, 132, 0.28);
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 235, 187, 0.32), transparent 34%),
    linear-gradient(180deg, #8c5d30, #472b1a);
  display: grid;
  place-items: center;
  color: #f8e5bc;
  font-size: 20px;
  box-shadow: inset 0 1px 0 rgba(255, 234, 184, 0.08);
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-kicker,
.eyebrow,
.panel-kicker {
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1.4px;
  font-size: 12px;
  font-weight: 700;
}

.brand-title {
  font-size: 22px;
  line-height: 1;
  font-weight: 700;
}

.topbar-note {
  max-width: 420px;
  color: #bfa37a;
  font-size: 13px;
  line-height: 1.45;
  text-align: right;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.theme-switch {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(158, 178, 205, 0.24);
  background: rgba(15, 22, 32, 0.55);
}

.theme-switch-btn {
  border: 1px solid rgba(158, 178, 205, 0.24);
  border-radius: 9px;
  background: transparent;
  color: #c6d1e2;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 12px;
  line-height: 1;
  padding: 7px 10px;
  cursor: pointer;
}

.theme-switch-btn.active {
  border-color: rgba(164, 184, 210, 0.5);
  background: linear-gradient(180deg, rgba(57, 76, 104, 0.98), rgba(32, 44, 62, 0.98));
  color: #f0f4fb;
}

.auth-page {
  padding: 34px 0 42px;
  display: grid;
  gap: 18px;
}

.hero-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 380px;
  gap: 18px;
}

.hero-card,
.panel {
  border-radius: var(--radius-l);
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 120% at 50% 0%, rgba(224, 185, 110, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(28, 19, 14, 0.96), rgba(12, 10, 9, 0.98));
  box-shadow:
    0 32px 74px var(--shadow),
    inset 0 1px 0 rgba(255, 234, 184, 0.05);
  position: relative;
  overflow: hidden;
}

.hero-card {
  padding: 38px;
  display: grid;
  gap: 22px;
  min-height: 420px;
}

.hero-card::before,
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.06), transparent 34%, rgba(0, 0, 0, 0.18)),
    radial-gradient(1200px 520px at 65% 0%, rgba(62, 103, 110, 0.12), transparent 54%);
  pointer-events: none;
}

.hero-copy,
.panel {
  position: relative;
  z-index: 1;
}

.hero-copy {
  display: grid;
  gap: 14px;
  max-width: 720px;
}

.hero-card h1,
.panel h2 {
  margin: 0;
  color: #f3e5c1;
  font-weight: 700;
}

.hero-card h1 {
  font-size: clamp(34px, 5vw, 62px);
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.hero-text,
.panel-copy,
.topbar-note,
.hint,
.telegram-bind-hint,
.telegram-meta,
.account-meta,
.captain-details,
.status-banner,
.info-item span {
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

.hero-text,
.panel-copy {
  margin: 0;
  max-width: 60ch;
  color: #d7c39e;
  font-size: 17px;
  line-height: 1.65;
}

.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.route-chip {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(223, 190, 132, 0.16);
  background: rgba(255, 255, 255, 0.03);
  color: #d7c298;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1;
}

.status-banner,
.account-meta,
.telegram-bind-hint,
.telegram-meta {
  border-radius: var(--radius-s);
  border: 1px solid rgba(223, 190, 132, 0.16);
  background: rgba(255, 248, 229, 0.03);
  padding: 14px 16px;
  color: #ead8b3;
  line-height: 1.5;
}

.hero-actions,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.action-row-stack {
  align-items: flex-start;
}

.btn {
  border: 1px solid rgba(223, 190, 132, 0.28);
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  color: #f6e7c1;
  background:
    linear-gradient(180deg, rgba(128, 85, 44, 0.98), rgba(78, 50, 28, 0.98));
  cursor: pointer;
  font-weight: 700;
  box-shadow:
    inset 0 1px 0 rgba(255, 234, 184, 0.12),
    inset 0 -2px 0 rgba(0, 0, 0, 0.22);
}

.btn.secondary {
  border-color: rgba(118, 176, 182, 0.28);
  background:
    linear-gradient(180deg, rgba(63, 112, 118, 0.98), rgba(39, 71, 76, 0.98));
}

.btn.alt,
.btn.ghost {
  border-color: rgba(223, 190, 132, 0.18);
  background:
    linear-gradient(180deg, rgba(47, 34, 25, 0.98), rgba(24, 18, 14, 0.98));
  color: #e0cda3;
}

.panel {
  padding: 28px;
  display: grid;
  gap: 16px;
}

.session-panel {
  align-content: start;
}

.dashboard-grid,
.content-grid {
  display: grid;
  gap: 18px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
}

.content-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.content-grid.account-mode {
  grid-template-columns: 1fr;
}

.captain-card {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.captain-avatar-wrap {
  width: 108px;
  height: 108px;
  border-radius: 24px;
  padding: 3px;
  background: linear-gradient(145deg, rgba(224, 185, 110, 0.9), rgba(107, 165, 167, 0.32));
}

.captain-avatar {
  width: 100%;
  height: 100%;
  border-radius: 21px;
  object-fit: cover;
  display: block;
  background: #0c1523;
}

.captain-name {
  font-size: 30px;
  line-height: 1.02;
  color: #f1ddb6;
}

.captain-details {
  color: #c6af88;
  font-size: 15px;
  line-height: 1.6;
}

.info-list {
  display: grid;
  gap: 12px;
}

.info-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  border-radius: var(--radius-s);
  border: 1px solid rgba(223, 190, 132, 0.14);
  background: rgba(255, 248, 229, 0.03);
}

.info-item strong {
  color: var(--gold);
  font-size: 18px;
  line-height: 1;
}

#openWebBtn,
#openOnlineBtn,
#googleLoginBtn,
#openBotBtn,
#logoutBtn {
  display: none;
}

#googleLoginBtn,
#openBotBtn,
#telegramUnlinkBtn {
  min-width: 220px;
}

#tgLoginBox {
  min-height: 4px;
}

#tgLoginBox:empty {
  display: none;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field-grid.single-password {
  grid-template-columns: 1fr;
}

.field-row {
  display: grid;
  gap: 8px;
}

.field-label {
  font: 700 11px/1.2 "Trebuchet MS", "Segoe UI", sans-serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #b89e74;
}

.input {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(223, 190, 132, 0.18);
  background: rgba(6, 11, 20, 0.36);
  color: var(--paper);
  padding: 13px 14px;
  font: 15px/1.2 "Trebuchet MS", "Segoe UI", sans-serif;
  outline: none;
}

.input:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(224, 185, 110, 0.12);
}

.hint {
  min-height: 18px;
  color: #d7c39e;
  font-size: 13px;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

:where(a, button, input, textarea, select):focus-visible {
  outline: 3px solid rgba(224, 185, 110, 0.55);
  outline-offset: 3px;
}

.btn:disabled,
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

body.theme-steel {
  color: #e9e5d8;
  background:
    radial-gradient(900px 520px at 14% -6%, rgba(94, 122, 157, 0.2), transparent 58%),
    radial-gradient(1200px 700px at 86% 0%, rgba(50, 68, 95, 0.2), transparent 56%),
    linear-gradient(180deg, #0f1622 0%, #0a1019 38%, #070b12 100%);
}

body.theme-steel .topbar {
  background: rgba(8, 12, 18, 0.78);
  border-bottom-color: rgba(139, 154, 179, 0.22);
}

body.theme-steel .brand,
body.theme-steel .hero-card h1,
body.theme-steel .panel h2,
body.theme-steel .captain-name {
  color: #eef1f6;
}

body.theme-steel .brand-kicker,
body.theme-steel .eyebrow,
body.theme-steel .panel-kicker,
body.theme-steel .field-label {
  color: #b9c7da;
}

body.theme-steel .brand-mark {
  border-color: rgba(159, 179, 205, 0.35);
  background:
    radial-gradient(circle at 35% 30%, rgba(170, 189, 214, 0.26), transparent 34%),
    linear-gradient(180deg, #2e4058, #141d2b);
}

body.theme-steel .hero-card,
body.theme-steel .panel {
  border-color: rgba(139, 154, 179, 0.26);
  background:
    radial-gradient(120% 120% at 50% 0%, rgba(128, 155, 189, 0.14), transparent 38%),
    linear-gradient(180deg, rgba(14, 20, 31, 0.96), rgba(7, 11, 18, 0.98));
  box-shadow:
    0 28px 68px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(188, 206, 232, 0.08);
}

body.theme-steel .hero-text,
body.theme-steel .panel-copy,
body.theme-steel .captain-details,
body.theme-steel .hint,
body.theme-steel .account-meta,
body.theme-steel .status-banner,
body.theme-steel .info-item span,
body.theme-steel .telegram-bind-hint,
body.theme-steel .telegram-meta {
  color: #9eb0c8;
}

body.theme-steel .route-chip,
body.theme-steel .status-banner,
body.theme-steel .account-meta,
body.theme-steel .telegram-bind-hint,
body.theme-steel .telegram-meta,
body.theme-steel .info-item {
  border-color: rgba(158, 178, 205, 0.22);
  background: rgba(255, 255, 255, 0.04);
}

body.theme-steel .input {
  border-color: rgba(158, 178, 205, 0.24);
  background: rgba(7, 12, 20, 0.44);
  color: #d8e2f2;
}

body.theme-steel .input:focus {
  border-color: rgba(153, 180, 219, 0.45);
  box-shadow: 0 0 0 3px rgba(111, 144, 179, 0.16);
}

body.theme-steel .btn {
  border-color: rgba(168, 189, 214, 0.3);
  color: #eef2f8;
  background: linear-gradient(180deg, rgba(58, 77, 103, 0.98), rgba(34, 46, 64, 0.98));
}

body.theme-steel .btn.secondary {
  border-color: rgba(124, 154, 193, 0.35);
  background: linear-gradient(180deg, rgba(74, 103, 141, 0.98), rgba(42, 63, 91, 0.98));
}

body.theme-steel .btn.alt,
body.theme-steel .btn.ghost,
body.theme-steel .btn.dark {
  border-color: rgba(158, 178, 205, 0.24);
  color: #d5deeb;
  background: linear-gradient(180deg, rgba(30, 41, 57, 0.98), rgba(16, 24, 35, 0.98));
}

body.theme-ivory {
  color: #202737;
  background:
    radial-gradient(900px 520px at 14% -6%, rgba(194, 208, 229, 0.46), transparent 58%),
    radial-gradient(1200px 700px at 86% 0%, rgba(176, 194, 224, 0.42), transparent 56%),
    linear-gradient(180deg, #f0f4fb 0%, #e8eef8 42%, #dfe7f4 100%);
}

body.theme-ivory .topbar {
  background: rgba(232, 238, 248, 0.9);
  border-bottom-color: rgba(120, 142, 177, 0.32);
}

body.theme-ivory .brand,
body.theme-ivory .hero-card h1,
body.theme-ivory .panel h2,
body.theme-ivory .captain-name {
  color: #1f2a3c;
}

body.theme-ivory .brand-mark {
  border-color: rgba(127, 148, 180, 0.34);
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.7), transparent 36%),
    linear-gradient(180deg, #dce6f4, #b8c9e2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 6px 18px rgba(67, 90, 126, 0.12);
}

body.theme-ivory .brand-kicker,
body.theme-ivory .eyebrow,
body.theme-ivory .panel-kicker,
body.theme-ivory .field-label {
  color: #546a8f;
}

body.theme-ivory .hero-card,
body.theme-ivory .panel {
  border-color: rgba(123, 145, 177, 0.3);
  background:
    radial-gradient(120% 120% at 50% 0%, rgba(151, 174, 208, 0.18), transparent 38%),
    linear-gradient(180deg, rgba(246, 249, 253, 0.97), rgba(232, 239, 248, 0.98));
  box-shadow:
    0 22px 50px rgba(28, 42, 66, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

body.theme-ivory .hero-text,
body.theme-ivory .panel-copy,
body.theme-ivory .captain-details,
body.theme-ivory .hint,
body.theme-ivory .account-meta,
body.theme-ivory .status-banner,
body.theme-ivory .info-item span,
body.theme-ivory .telegram-bind-hint,
body.theme-ivory .telegram-meta {
  color: #4a5f83;
}

body.theme-ivory .route-chip,
body.theme-ivory .status-banner,
body.theme-ivory .account-meta,
body.theme-ivory .telegram-bind-hint,
body.theme-ivory .telegram-meta,
body.theme-ivory .info-item {
  border-color: rgba(126, 150, 183, 0.26);
  background: rgba(255, 255, 255, 0.52);
}

body.theme-ivory .input {
  border-color: rgba(126, 150, 183, 0.35);
  background: rgba(244, 249, 255, 0.86);
  color: #2f435f;
}

body.theme-ivory .input:focus {
  border-color: rgba(98, 126, 167, 0.52);
  box-shadow: 0 0 0 3px rgba(89, 117, 154, 0.16);
}

body.theme-ivory .btn {
  border-color: rgba(114, 138, 173, 0.42);
  color: #f5f8fc;
  background: linear-gradient(180deg, rgba(72, 102, 141, 0.98), rgba(51, 73, 102, 0.98));
}

body.theme-ivory .btn.alt,
body.theme-ivory .btn.ghost,
body.theme-ivory .btn.dark {
  border-color: rgba(127, 148, 180, 0.36);
  color: #24344d;
  background: linear-gradient(180deg, rgba(238, 244, 251, 0.98), rgba(220, 230, 244, 0.98));
}

body.theme-ivory .theme-switch {
  border-color: rgba(127, 148, 180, 0.36);
  background: rgba(219, 229, 244, 0.7);
}

body.theme-ivory .theme-switch-btn {
  border-color: rgba(127, 148, 180, 0.32);
  color: #2f4260;
}

body.theme-ivory .theme-switch-btn.active {
  border-color: rgba(98, 126, 167, 0.55);
  background: linear-gradient(180deg, rgba(89, 117, 154, 0.98), rgba(57, 82, 117, 0.98));
  color: #f7f9fd;
}

body.theme-ivory .route-chip {
  color: #6a80a4;
}

body.theme-ivory .info-item strong {
  color: #5b7297;
}

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

@media (max-width: 1100px) {
  .hero-shell,
  .dashboard-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .top-actions {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .container,
  .auth-page {
    width: calc(100% - 16px);
  }

  .topbar-inner {
    min-height: 0;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    flex-direction: column;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .auth-page {
    padding: 14px 0 24px;
  }

  .hero-card,
  .panel {
    padding: 20px;
    border-radius: 26px;
  }

  .hero-card h1 {
    font-size: 36px;
  }

  .captain-card {
    grid-template-columns: 1fr;
  }

  .captain-avatar-wrap {
    width: 92px;
    height: 92px;
  }

  .hero-actions,
  .action-row,
  .field-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .btn,
  #googleLoginBtn,
  #openBotBtn,
  #telegramUnlinkBtn,
  .top-actions .btn {
    width: 100%;
    min-width: 0;
  }
}
