[data-theme="dark"] {
  color-scheme: dark;
  --void: #03070e;
  --void-deep: #020409;
  --panel: #070c14;
  --panel-solid: #070c14;
  --panel-2: #0b1220;
  --edge: rgba(140, 210, 80, 0.12);
  --edge-strong: rgba(160, 230, 90, 0.2);
  --ink: #e9eef8;
  --muted: #8b9bb3;
  --iridium: #9dff2b;
  --gold: #e8c36a;
  --gain: #7ee03a;
  --link-lis: #ff7200;
  --link-tm: #4da3ff;
  --row-hover: rgba(157, 255, 43, 0.06);
}

[data-theme="light"] {
  color-scheme: light;
  --void: #eef3f8;
  --void-deep: #e4ebf3;
  --panel: #ffffff;
  --panel-solid: #ffffff;
  --panel-2: #f4f7fb;
  --edge: rgba(40, 120, 30, 0.12);
  --edge-strong: rgba(40, 120, 30, 0.22);
  --ink: #122033;
  --muted: #5d6f86;
  --iridium: #2f9a14;
  --gold: #9a6b12;
  --gain: #1f8a28;
  --link-lis: #ff7200;
  --link-tm: #1888b8;
  --row-hover: rgba(47, 154, 20, 0.08);
}

:root {
  --display: "Space Grotesk", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 16px;
}

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

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

body {
  font-family: var(--display);
  font-size: 14px;
  background: var(--void-deep);
  color: var(--ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem 1.25rem;
  padding: 0.85rem 3.4rem 0.85rem 1.35rem;
  background: var(--void);
  border-bottom: 1px solid var(--edge);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.mark {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.topbar__title {
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: #fff;
}

.topbar__title span { color: var(--iridium); }

[data-theme="light"] .topbar__title { color: var(--ink); }

.topbar__meta {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sum {
  display: flex;
  align-items: center;
  gap: 0.5rem 0.7rem;
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.sum.is-off { opacity: 0.45; }

.sum__buy { color: var(--link-lis); }
.sum__sell { color: var(--link-tm); }
.sum__arrow { color: var(--muted); font-weight: 500; }
.sum__profit { white-space: nowrap; }
.sum__profit.is-ok { color: var(--gold); }
.sum__profit.is-good { color: var(--gain); }
.sum__profit.is-hot { color: var(--iridium); }

.count {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 0.4rem;
  white-space: nowrap;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.count__value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.count__label {
  color: var(--muted);
  font-weight: 600;
}

.theme-btn {
  position: absolute;
  top: 50%;
  right: 0.85rem;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  border: 1px solid var(--edge);
  border-radius: 50%;
  background: color-mix(in srgb, var(--panel-2) 60%, transparent);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.theme-btn:hover {
  color: var(--ink);
  border-color: var(--edge-strong);
}

.theme-btn__icon { display: none; }
[data-theme="dark"] .theme-btn__icon--sun { display: block; }
[data-theme="light"] .theme-btn__icon--moon { display: block; }

.intro {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.35rem;
  padding: 1.1rem 1.1rem 1.5rem;
  background: #050505;
  overflow: hidden;
}
.intro.hidden,
[data-intro="done"] .intro { display: none; }

html:not([data-intro="done"]) { overflow: hidden; }

html:not([data-intro="done"]) .app {
  transform: scale(0.96);
  filter: blur(10px);
}

.intro.is-out { pointer-events: none; }

.intro.is-out::before {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  height: 140%;
  top: 40%;
  background: linear-gradient(
    to top,
    transparent,
    color-mix(in srgb, var(--iridium) 0%, transparent),
    color-mix(in srgb, var(--iridium) 55%, transparent),
    transparent
  );
  filter: blur(8px);
  animation: introStreak 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  pointer-events: none;
}

.intro.is-out .intro__art {
  animation: introArtOut 0.72s cubic-bezier(0.2, 0.85, 0.25, 1) forwards;
}
.intro.is-out .intro__btn {
  animation: introBtnOut 0.58s cubic-bezier(0.55, 0.05, 0.9, 0.35) forwards;
}
.intro.is-out {
  animation: introFade 0.55s 0.22s ease forwards;
}

.intro.is-out ~ .app {
  animation: appIn 0.72s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.intro__art {
  width: min(440px, 92vw);
  max-height: calc(100dvh - 7.5rem);
  height: auto;
  object-fit: contain;
  will-change: transform, filter, opacity;
}

.intro__btn {
  position: relative;
  z-index: 1;
  font-family: var(--display);
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.82rem 1.7rem;
  border: 0;
  border-radius: 999px;
  background: var(--iridium);
  color: #071000;
  cursor: pointer;
  box-shadow: 0 0 28px color-mix(in srgb, var(--iridium) 50%, transparent);
  animation: introBtnIdle 1.8s ease-in-out infinite;
  will-change: transform, opacity;
}

.intro__btn:hover { filter: brightness(1.08); }

@keyframes introBtnIdle {
  0%, 100% { box-shadow: 0 0 22px color-mix(in srgb, var(--iridium) 42%, transparent); transform: scale(1); }
  50% { box-shadow: 0 0 38px color-mix(in srgb, var(--iridium) 72%, transparent); transform: scale(1.03); }
}

@keyframes introArtOut {
  0% { transform: translateY(0) scale(1); filter: blur(0) brightness(1); opacity: 1; }
  22% { transform: translateY(-2vh) scale(1.06); filter: blur(0) brightness(1.15); }
  100% { transform: translateY(-48vh) scale(0.86); filter: blur(14px) brightness(1.35); opacity: 0; }
}

@keyframes introBtnOut {
  0% { transform: scale(1) translateY(0); opacity: 1; }
  16% { transform: scale(1.12) translateY(0); }
  100% { transform: scale(0.82) translateY(46vh); opacity: 0; }
}

@keyframes introFade {
  to { opacity: 0; visibility: hidden; }
}

@keyframes introStreak {
  0% { transform: translateY(20%); opacity: 0; }
  35% { opacity: 1; }
  100% { transform: translateY(-90%); opacity: 0; }
}

@keyframes appIn {
  from { transform: scale(0.96); filter: blur(10px); }
  to { transform: none; filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  .intro__btn { animation: none; }
  .intro.is-out,
  .intro.is-out .intro__art,
  .intro.is-out .intro__btn,
  .intro.is-out ~ .app { animation: none; }
  html:not([data-intro="done"]) .app { transform: none; filter: none; }
}

.workspace { padding: 0.95rem 1.35rem 1.6rem; }

.table-wrap {
  position: relative;
  overflow: auto;
  max-height: calc(100vh - 110px);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--panel);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-solid);
}

.table th {
  text-align: left;
  padding: 0.7rem 0.85rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--edge);
}

.table th.num,
.table td.num {
  text-align: right;
}

.table td {
  padding: 0.48rem 0.85rem;
  border-bottom: 1px solid color-mix(in srgb, var(--edge) 70%, transparent);
  vertical-align: middle;
  font-size: 0.875rem;
}

.table td.num {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.table tbody tr:hover { background: var(--row-hover); }

.table td.cell-name { position: relative; }

.skin {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.skin__img {
  width: 84px;
  height: 58px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.st {
  position: absolute;
  top: 0;
  left: 0.85rem;
  z-index: 1;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
  padding: calc(0.2rem - 2px) 0.4rem calc(0.34rem - 2px);
  border-radius: 0 0 0.55rem 0.55rem;
  white-space: nowrap;
  pointer-events: none;
  color: #fff;
}

.st--transit { background: #2563eb; }
.st--accepted { background: #16a34a; }
.st--cancelled { background: #dc2626; }

.skin__img.is-empty { visibility: hidden; }

.skin__meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.12rem;
}

.skin__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.skin__when {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.skin-vol { display: none; }

.price-link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.38rem;
  font-weight: 500;
  text-decoration: none;
}

.price-link:hover { text-decoration: underline; }
.price-link--lis { color: var(--link-lis); }
.price-link--tm { color: var(--link-tm); }

.site-logo {
  width: 14px;
  height: 14px;
  object-fit: contain;
  flex-shrink: 0;
  opacity: 0.92;
}

.site-logo--lis {
  width: 16px;
  height: 14px;
}

.profit { font-weight: 600; white-space: nowrap; }
.profit.is-ok { color: var(--gold); }
.profit.is-good { color: var(--gain); }
.profit.is-hot { color: var(--iridium); }

.cell-vol {
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 700;
}

.empty {
  padding: 2.4rem 1rem;
  text-align: center;
}

.empty.hidden { display: none; }

.empty__title { font-weight: 600; margin-bottom: 0.35rem; }
.empty__text { color: var(--muted); font-size: 0.85rem; }

@media (max-width: 900px) {
  .topbar, .workspace { padding-left: 0.8rem; padding-right: 0.8rem; }
  .topbar { gap: 0.5rem 0.7rem; padding-top: 0.7rem; padding-bottom: 0.7rem; padding-right: 3.1rem; }
  .theme-btn { right: 0.7rem; }
  .sum, .count { font-size: 0.92rem; }
  .table-wrap { max-height: calc(100vh - 96px); }
}

@media (max-width: 720px) {
  .topbar__title { font-size: 0.95rem; }
  .mark { width: 32px; height: 32px; }

  .table-wrap {
    overflow-x: hidden;
    max-height: none;
    border-left: 0;
    border-right: 0;
    border-radius: 12px;
  }

  .table thead { display: none; }
  .table,
  .table tbody { display: block; width: 100%; }

  .table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 1fr 1fr 1fr;
    grid-template-areas:
      "name lis"
      "name tm"
      "name profit";
    align-items: stretch;
    column-gap: 0.5rem;
    row-gap: 0;
    padding: 0.7rem 0.65rem;
    border-bottom: 1px solid var(--edge);
  }

  .table tbody tr td {
    border: 0;
    padding: 0;
    width: auto;
    max-width: none;
  }

  .cell-name {
    grid-area: name;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.2rem;
    padding-right: 0.2rem;
  }
  .cell-lis { grid-area: lis; }
  .cell-tm { grid-area: tm; }
  .cell-profit {
    grid-area: profit;
    font-size: 0.925rem;
    white-space: nowrap;
  }
  .cell-vol--table { display: none; }
  .skin-vol {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
  }
  .cell-vol {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
  }

  .cell-vol::before {
    content: attr(data-label);
    display: block;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 600;
    line-height: 1;
    margin-bottom: 0.12rem;
    letter-spacing: 0.04em;
    text-transform: none;
  }

  .cell-lis,
  .cell-tm,
  .cell-profit {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    justify-self: stretch;
    text-align: right;
    margin: 0;
  }

  .cell-lis .price-link,
  .cell-tm .price-link {
    justify-content: flex-end;
    width: 100%;
    min-height: 0;
  }

  .skin { align-items: flex-start; gap: 0.45rem; }
  .skin__img { width: 60px; height: 42px; }
  .st { top: -0.7rem; left: 0; font-size: 0.5rem; padding: calc(0.16rem - 2px) 0.32rem calc(0.28rem - 2px); }
  .skin__name {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 0.78rem;
    line-height: 1.25;
  }
}
