:root {
  --bg: #0b0e12;
  --bg-elev: #0f141b;
  --bg-elev-2: #111925;
  --line: #1d2733;
  --line-soft: #263545;
  --text: #e7f0fb;
  --muted: #95a6b8;
  --accent: #27d6e5;
  --accent-2: #6cecc2;
  --buy: #34c7de;
  --sell: #ff6b7f;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Sora", sans-serif;
  overflow-x: hidden;
}

.bg-layer {
  pointer-events: none;
  position: fixed;
  inset: 0;
}

.bg-grid {
  background-image:
    linear-gradient(rgba(72, 100, 128, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(72, 100, 128, 0.1) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 52% 26%, black 30%, transparent 85%);
}

.bg-glow-a {
  width: 420px;
  height: 420px;
  top: -220px;
  left: -180px;
  border-radius: 999px;
  background: rgba(39, 214, 229, 0.16);
  filter: blur(80px);
}

.bg-glow-b {
  width: 420px;
  height: 420px;
  right: -220px;
  bottom: -260px;
  border-radius: 999px;
  background: rgba(108, 236, 194, 0.11);
  filter: blur(90px);
}

.shell {
  position: relative;
  z-index: 2;
  width: min(1240px, 96vw);
  margin: 12px auto 64px;
}

.shell,
.hero-grid,
.workflow-grid,
.hero-card,
.market-card,
.workflow-main,
.workflow-side,
.orderbook,
.table-wrap {
  min-width: 0;
  max-width: 100%;
}

.glass {
  border: 1px solid var(--line);
  background: rgba(14, 20, 28, 0.92);
  border-radius: 8px;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.masthead-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #051015;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  font-family: "Space Mono", monospace;
  font-size: 0.72rem;
}

.brand-text {
  color: #f0f5ff;
  font-family: "Space Mono", monospace;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.masthead-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.masthead-nav a {
  text-decoration: none;
  color: #b6c8da;
  font-size: 0.74rem;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
}

.masthead-nav a:hover {
  color: #f4faff;
  border-color: #30465a;
  background: rgba(16, 25, 36, 0.95);
}

.masthead-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.social-link {
  text-decoration: none;
  color: #9eb2c5;
  border: 1px solid #2a3b4d;
  background: rgba(13, 22, 32, 0.9);
  border-radius: 6px;
  padding: 9px 10px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
}

.social-link:hover {
  color: #ffffff;
  border-color: #3d5770;
}

.btn {
  text-decoration: none;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 9px 12px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Space Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.btn-primary {
  color: #071116;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-ghost {
  color: #b8d7ed;
  border-color: #33506a;
  background: rgba(11, 22, 33, 0.94);
}

.btn-ghost:hover {
  border-color: #4a6d8c;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 10px;
  margin-bottom: 10px;
}

.hero-grid > *,
.workflow-grid > * {
  min-width: 0;
}

.hero-card {
  padding: 16px;
}

.kicker {
  margin: 0;
  color: #84a7c5;
  font-family: "Space Mono", monospace;
  font-size: 0.69rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-username {
  margin: 10px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: clamp(1.7rem, 4.5vw, 2.6rem);
  line-height: 1.02;
  max-width: 100%;
}

.hero-username span,
.hero-username .username-link {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.hero-tg-logo {
  width: clamp(24px, 3.5vw, 32px);
  height: clamp(24px, 3.5vw, 32px);
  color: var(--accent);
}

.tg-logo {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.lead {
  margin: 12px 0 14px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.58;
  max-width: 66ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.fee-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 10px;
}

.fee-item {
  border: 1px solid #2c4357;
  border-radius: 6px;
  background: rgba(8, 18, 28, 0.95);
  padding: 9px 10px;
}

.fee-item h3 {
  margin: 0;
  color: #8ea8be;
  font-family: "Space Mono", monospace;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.fee-item p {
  margin: 7px 0 0;
  color: #eef7ff;
  font-size: 1rem;
  font-weight: 600;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.badge {
  border: 1px solid #2f465a;
  border-radius: 6px;
  padding: 6px 10px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  background: rgba(11, 20, 30, 0.96);
  font-size: 0.7rem;
  color: #bfd5e9;
}

.badge.ok {
  border-color: rgba(108, 236, 194, 0.55);
  color: #99f1d2;
}

.badge.pending {
  border-color: rgba(255, 208, 119, 0.48);
  color: #ffd992;
}

.badge.error {
  border-color: rgba(255, 116, 146, 0.52);
  color: #ffb3c6;
}

.badge-soft {
  color: #8fb3ce;
}

.market-card {
  padding: 14px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

.market-head h2 {
  margin: 0;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.market-head p {
  margin: 6px 0 0;
  color: #8ea6bb;
  font-size: 0.74rem;
}

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

.market-item {
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(10, 17, 26, 0.95);
  padding: 10px;
}

.market-item h3 {
  margin: 0;
  color: #8fa8bd;
  font-size: 0.65rem;
  font-family: "Space Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.market-item p {
  margin: 7px 0 0;
  font-size: 1rem;
  font-weight: 600;
  color: #ecf5ff;
}

.workflow {
  overflow: hidden;
  margin-bottom: 10px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  margin: 0;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mono-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #314f67;
  background: rgba(9, 18, 27, 0.95);
  color: #c5dcf0;
  border-radius: 999px;
  padding: 4px 9px;
  font-family: "Space Mono", monospace;
  font-size: 0.7rem;
}

.workflow-grid {
  display: grid;
  grid-template-columns: 1.26fr 0.74fr;
}

.workflow-main {
  border-right: 1px solid var(--line);
}

.quickstart-card {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 18, 26, 0.94);
}

.quickstart-card h3 {
  margin: 0 0 10px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.quickstart-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.quickstart-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #c8d9ea;
}

.step-no {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(39, 214, 229, 0.55);
  background: rgba(39, 214, 229, 0.13);
  color: #95eefa;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Space Mono", monospace;
  font-size: 0.7rem;
  flex: 0 0 auto;
}

.quickstart-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-mono {
  color: #c8efff;
  font-family: "Space Mono", monospace;
}

.username-link {
  color: inherit;
  text-decoration: none;
}

.username-link:hover {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.command-helper {
  margin: 0;
  padding: 10px 12px 0;
  color: #90a8bc;
  font-size: 0.75rem;
}

.command-list {
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cmd {
  border: 1px solid #35526b;
  border-radius: 999px;
  padding: 6px 10px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 17, 26, 0.95);
  color: #c8ddef;
  font-family: "Space Mono", monospace;
  font-size: 0.69rem;
}

.cmd-btn {
  cursor: pointer;
}

.cmd-btn.active {
  border-color: var(--accent);
  background: rgba(39, 214, 229, 0.18);
  color: #ffffff;
}

.command-detail {
  border-top: 1px solid var(--line);
  padding: 12px;
  background: rgba(8, 14, 21, 0.95);
}

.command-detail h3 {
  margin: 0 0 9px;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.command-detail p {
  margin: 0 0 7px;
  color: #9db5c8;
  font-size: 0.78rem;
  line-height: 1.5;
}

.command-detail strong {
  color: #e3f0fd;
}

.command-detail code {
  color: #d6f3ff;
  border: 1px solid #2f4f67;
  background: rgba(8, 19, 29, 0.95);
  border-radius: 6px;
  padding: 3px 6px;
}

.workflow-side {
  display: grid;
  grid-template-rows: auto auto;
}

.video-card,
.mini-steps {
  padding: 12px;
}

.video-card {
  border-bottom: 1px solid var(--line);
}

.video-card h3,
.mini-steps h3 {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.video-card p,
.mini-steps p {
  margin: 8px 0 0;
  color: #96aec2;
  font-size: 0.77rem;
  line-height: 1.54;
}

.video-embed {
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-top: 10px;
  border: 1px solid #2b465d;
  border-radius: 6px;
  overflow: hidden;
  background: #0a1119;
}

.video-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.video-link {
  display: inline-block;
  margin-top: 9px;
  color: #9cd7e9;
  text-decoration: none;
  font-size: 0.7rem;
  font-family: "Space Mono", monospace;
}

.video-link:hover {
  color: #ffffff;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 20, 29, 0.95);
  padding: 12px;
}

.stat-card h2 {
  margin: 0;
  color: #95acc1;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-family: "Space Mono", monospace;
}

.stat-value {
  margin: 8px 0 0;
  color: #eef6ff;
  font-size: clamp(1.2rem, 2.4vw, 1.7rem);
  line-height: 1.2;
}

.orderbook {
  overflow: hidden;
  margin-bottom: 10px;
}

.tabs {
  display: flex;
  gap: 7px;
}

.tab {
  appearance: none;
  border: 1px solid #36536b;
  border-radius: 999px;
  padding: 6px 11px;
  min-height: 36px;
  background: rgba(10, 20, 30, 0.95);
  color: #bfd5e8;
  font-family: "Space Mono", monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  cursor: pointer;
}

.tab.active {
  color: #061117;
  border-color: var(--accent);
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #1b2a38;
}

th {
  color: #8fa8bf;
  font-family: "Space Mono", monospace;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

td {
  color: #e4effa;
  font-size: 0.75rem;
}

.pill {
  display: inline-block;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 2px 7px;
  font-family: "Space Mono", monospace;
  font-size: 0.64rem;
}

.pill.buy {
  color: var(--buy);
  border-color: rgba(52, 199, 222, 0.42);
  background: rgba(16, 66, 78, 0.32);
}

.pill.sell {
  color: var(--sell);
  border-color: rgba(255, 107, 127, 0.42);
  background: rgba(74, 22, 33, 0.36);
}

.book-divider td {
  background: rgba(9, 16, 24, 0.98);
  color: #91aec5;
  font-family: "Space Mono", monospace;
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.empty {
  text-align: center;
  color: #8ca7bd;
  padding: 22px 10px;
}

.fade-in {
  animation: fadeUp 0.42s ease both;
}

.fade-in-delay {
  animation: fadeUp 0.42s ease 0.08s both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1080px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .workflow-grid {
    grid-template-columns: 1fr;
  }

  .workflow-main {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

@media (max-width: 760px) {
  .shell {
    width: calc(100vw - 12px);
    max-width: 1240px;
    margin-top: 10px;
  }

  .bg-grid {
    opacity: 0.45;
  }

  .bg-glow-a,
  .bg-glow-b {
    opacity: 0.7;
  }

  .masthead {
    flex-direction: column;
    align-items: stretch;
  }

  .masthead-left {
    width: 100%;
    align-items: center;
    justify-content: center;
  }

  .masthead-nav {
    display: none;
  }

  .brand-text {
    font-size: 0.9rem;
    letter-spacing: 0.05em;
  }

  .masthead-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .social-link {
    display: none;
  }

  .social-link,
  .masthead .btn,
  .hero-actions .btn,
  .quickstart-actions .btn {
    width: 100%;
    min-height: 46px;
    text-align: center;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
  }

  .hero-card,
  .market-card,
  .quickstart-card,
  .command-detail,
  .video-card,
  .mini-steps,
  .stat-card {
    padding: 11px;
  }

  .hero-username {
    font-size: clamp(1.6rem, 8.6vw, 2.3rem);
  }

  .lead {
    font-size: 0.95rem;
    line-height: 1.65;
  }

  .section-head h2 {
    font-size: 0.98rem;
  }

  .mono-chip {
    font-size: 0.75rem;
    padding: 6px 10px;
  }

  .market-grid {
    grid-template-columns: 1fr;
  }

  .fee-strip {
    grid-template-columns: 1fr;
  }

  .market-item h3 {
    font-size: 0.72rem;
  }

  .market-item p {
    font-size: 1.14rem;
  }

  .quickstart-list li {
    font-size: 0.95rem;
    line-height: 1.56;
  }

  .step-no {
    width: 22px;
    height: 22px;
    font-size: 0.74rem;
  }

  .command-helper {
    font-size: 0.88rem;
  }

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

  .cmd {
    width: 100%;
    min-height: 42px;
    padding: 8px;
    text-align: center;
    font-size: 0.8rem;
  }

  .tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tab {
    width: 100%;
    min-height: 44px;
    justify-content: center;
    display: inline-flex;
    align-items: center;
    font-size: 0.8rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .command-detail p {
    font-size: 0.9rem;
  }

  .video-card p,
  .mini-steps p {
    font-size: 0.9rem;
  }

  .stat-card h2 {
    font-size: 0.8rem;
  }

  .stat-value {
    font-size: 1.75rem;
  }

  .table-wrap {
    overflow: visible;
    padding: 8px;
  }

  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 8px;
  }

  tbody tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(11, 18, 27, 0.95);
    padding: 9px;
  }

  tbody tr td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    border: 0;
    border-bottom: 1px dashed #25384b;
    padding: 6px 0;
    font-size: 0.95rem;
  }

  tbody tr td:last-child {
    border-bottom: 0;
  }

  tbody tr td::before {
    content: attr(data-label);
    color: #88a6be;
    font-family: "Space Mono", monospace;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    flex: 0 0 auto;
    max-width: 48%;
  }

  tbody tr td[data-label="Order ID"] {
    font-family: "Space Mono", monospace;
    word-break: break-all;
  }

  tbody tr td.empty {
    display: block;
    text-align: center;
    border: 0;
    padding: 12px 6px;
  }

  tbody tr td.empty::before {
    content: none;
  }

  tbody tr.book-divider {
    padding: 8px 9px;
  }

  tbody tr.book-divider td {
    display: block;
    border: 0;
    padding: 0;
    text-align: center;
  }

  tbody tr.book-divider td::before {
    content: none;
  }
}

@media (max-width: 480px) {
  .command-list {
    grid-template-columns: 1fr;
  }

  .kicker {
    font-size: 0.68rem;
  }

  .lead {
    font-size: 0.88rem;
  }
}
