html,
body {
  margin: 0;
  height: 100%;
  min-height: 100vh;
  background: #000;
  color: rgba(255, 255, 255, 0.94);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

.app-toast-stack {
  position: fixed;
  top: 20px;
  left: 50%;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: calc(100vw - 32px);
  pointer-events: none;
  transform: translateX(-50%);
}

.app-toast {
  width: min(420px, calc(100vw - 32px));
  position: relative;
  overflow: hidden;
  padding: 14px 18px 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 8, 8, 0.94);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.42);
  color: rgba(255, 255, 255, 0.94);
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  transform: translateY(0);
  opacity: 1;
  transition: opacity 0.3s ease, transform 0.3s ease;
  backdrop-filter: blur(10px);
}

.app-toast-message {
  display: block;
}

.app-toast-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  background: rgba(255, 255, 255, 0.48);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.18);
  transform-origin: left center;
  animation: app-toast-progress-shrink var(--app-toast-duration, 2000ms) linear forwards;
}

.app-toast-success {
  border-color: rgba(49, 227, 154, 0.3);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(49, 227, 154, 0.12) inset;
}

.app-toast-success .app-toast-progress {
  background: linear-gradient(90deg, rgba(49, 227, 154, 1), rgba(49, 227, 154, 0.62));
  box-shadow: 0 0 12px rgba(49, 227, 154, 0.4);
}

.app-toast-error {
  border-color: rgba(255, 91, 91, 0.28);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(255, 91, 91, 0.12) inset;
}

.app-toast-error .app-toast-progress {
  background: linear-gradient(90deg, rgba(255, 91, 91, 1), rgba(255, 91, 91, 0.62));
  box-shadow: 0 0 12px rgba(255, 91, 91, 0.36);
}

.app-toast-hiding {
  opacity: 0;
  transform: translateY(-10px);
}

@keyframes app-toast-progress-shrink {
  from {
    transform: scaleX(1);
  }

  to {
    transform: scaleX(0);
  }
}

.app-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: clamp(8px, 1.3vw, 12px);
  box-sizing: border-box;
  overflow: hidden;
}

.app-navbar,
.app-content-shell,
.app-main,
.ticker-wrap,
.markets-nav,
.nav-user,
.nav-balance {
  display: flex;
}

.app-navbar {
  align-items: center;
  gap: 14px;
  padding: 0 12px 12px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

.app-brand,
.app-navbar-actions {
  flex: 0 0 auto;
}

.app-brand-title {
  margin: 0;
  color: inherit;
  text-decoration: none;
  font-family: "Times New Roman", serif;
  font-size: clamp(1.45rem, 1.15rem + 0.55vw, 1.9rem);
  letter-spacing: 0.14em;
}

.app-brand-magic {
  color: #c0392b;
}

.app-brand-market {
  color: #fff;
}

.ticker-wrap,
.markets-nav {
  flex: 1 1 auto;
  min-width: 0;
  align-items: center;
  margin: 0 10px;
}

.ticker-wrap {
  overflow: hidden;
}

.ticker {
  color: #5e685e;
  flex: 0 0 auto;
  width: max-content;
  white-space: nowrap;
  padding-left: 100%;
  animation: scroll 20s linear infinite;
}

@keyframes scroll {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-100%);
  }
}

.markets-nav {
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.markets-nav::-webkit-scrollbar {
  display: none;
}

.markets-nav-item,
.login-btn,
.nav-avatar,
.sidebar-link {
  text-decoration: none;
}

.markets-nav-item,
.sidebar-link,
.login-btn,
.nav-avatar,
.nav-balance,
.ticker {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.markets-nav-item {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: rgba(255, 255, 255, 0.34);
  line-height: 1;
  white-space: nowrap;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.markets-nav-item:hover {
  color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}

.markets-nav-item.is-active {
  color: #f5f5f5;
  background: linear-gradient(180deg, rgba(24, 24, 24, 0.98), rgba(17, 17, 17, 0.98));
  border-color: rgba(255, 255, 255, 0.12);
}

.markets-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.markets-dot-open {
  background: #31e39a;
  box-shadow: 0 0 10px rgba(49, 227, 154, 0.35);
  animation: market-open-dot-pulse 1.8s ease-in-out infinite;
}

.markets-dot-closed {
  background: #ff4343;
}

.markets-dot-archive {
  background: rgba(255, 255, 255, 0.3);
}

.markets-label {
  font-size: clamp(0.65rem, 0.6rem + 0.25vw, 0.9rem);
  letter-spacing: 0.04em;
}

.markets-count {
  min-width: 32px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  text-align: center;
  font-size: clamp(0.72rem, 0.68rem + 0.2vw, 0.92rem);
  letter-spacing: 0.03em;
}

.markets-count-open {
  color: #31e39a;
  background: rgba(49, 227, 154, 0.1);
  border-color: rgba(49, 227, 154, 0.08);
}

.markets-count-closed {
  color: #ff5454;
  background: rgba(255, 84, 84, 0.1);
  border-color: rgba(255, 84, 84, 0.08);
}

.markets-count-archive {
  color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.03);
}

.app-navbar-actions {
  margin-left: auto;
}

.login-btn {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  padding: 10px 22px;
  font-size: 14px;
  letter-spacing: 0.08em;
  transition: background 0.2s ease;
}

.login-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.nav-user {
  align-items: center;
  gap: 10px;
}

.nav-balance {
  align-items: baseline;
  gap: 5px;
}

.nav-balance-value {
  color: #ffbe57;
  font-size: clamp(1rem, 0.82rem + 0.35vw, 1.25rem);
  line-height: 1;
  letter-spacing: 0.03em;
}

.nav-balance-unit {
  color: rgba(255, 190, 87, 0.75);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.nav-user-divider {
  width: 1px;
  height: 28px;
  background: rgba(255, 255, 255, 0.14);
}

.nav-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #ff4b4b;
  font-size: 1rem;
  background: rgba(95, 20, 20, 0.45);
  border: 3px solid rgba(140, 35, 35, 0.9);
}

.app-content-shell {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.app-sidebar {
  width: clamp(190px, 21vw, 240px);
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  background: #050505;
  border-right: 2px solid rgba(255, 255, 255, 0.05);
}

.app-sidebar-main {
  display: flex;
  flex-direction: column;
}

.app-sidebar-bottom {
  margin-top: auto;
  padding-top: 16px;
}

.sidebar-item {
  padding: 10px 16px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.5);
}

.sidebar-button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.sidebar-link-logout {
  color: rgba(255, 91, 91, 0.78);
}

.sidebar-divider {
  height: 2px;
  margin: 16px 0;
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-item.active {
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid #c0392b;
}

.sidebar-item:hover .sidebar-link,
.sidebar-item.active .sidebar-link {
  color: #fff;
}

.sidebar-item:hover .sidebar-link-logout {
  color: #ff7b7b;
}

.app-main {
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

@media (max-width: 991px) {
  .ticker-wrap {
    display: none;
  }

  .app-shell {
    padding: 0;
  }

  .app-navbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand actions"
      "center center";
    align-items: center;
    column-gap: 10px;
    row-gap: 8px;
    padding: 12px 12px 10px;
  }

  .app-brand {
    grid-area: brand;
    width: auto;
    min-width: 0;
  }

  .app-brand-title {
    font-size: 1.2rem;
    letter-spacing: 0.08em;
  }

  .ticker-wrap,
  .markets-nav {
    grid-area: center;
    margin: 0;
  }

  .app-navbar-actions {
    grid-area: actions;
    margin-left: 0;
    justify-self: end;
    align-self: center;
  }

  .app-content-shell {
    flex-direction: column;
  }

  .app-sidebar {
    width: 100%;
    padding: 8px 10px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    overflow-x: auto;
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    scrollbar-width: none;
  }

  .app-sidebar::-webkit-scrollbar {
    display: none;
  }

  .app-sidebar-main,
  .app-sidebar-bottom {
    display: flex;
    flex-direction: row;
    gap: 8px;
    flex: 0 0 auto;
  }

  .sidebar-item {
    padding: 0;
    flex: 0 0 auto;
  }

  .sidebar-link {
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    white-space: nowrap;
  }

  .sidebar-item.active {
    border-left: 0;
    background: transparent;
  }

  .sidebar-item.active .sidebar-link {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.05);
  }

  .sidebar-divider {
    display: none;
  }

  .app-sidebar-bottom {
    margin-top: 0;
    padding-top: 0;
  }
}

@media (max-width: 1199px) {
  .ticker-wrap {
    display: none;
  }
}

@media (max-width: 640px) {
  .app-toast-stack {
    top: 12px;
    max-width: calc(100vw - 24px);
  }

  .app-toast {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.88rem;
  }

  .app-navbar {
    column-gap: 8px;
    row-gap: 6px;
    padding: 10px 10px 8px;
  }

  .app-brand-title {
    font-size: 1.05rem;
    letter-spacing: 0.06em;
  }

  .markets-nav {
    gap: 8px;
  }

  .markets-nav-item {
    padding: 5px 9px;
    gap: 6px;
    border-radius: 12px;
  }

  .login-btn {
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.86rem;
  }

  .nav-user {
    gap: 8px;
  }

  .nav-balance {
    gap: 4px;
  }

  .nav-balance-value {
    font-size: 0.88rem;
  }

  .nav-user-divider {
    display: none;
  }

  .nav-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.82rem;
  }

  .sidebar-link {
    min-height: 36px;
    padding: 0 10px;
    gap: 8px;
    font-size: 0.9rem;
  }
}
