:root {
  color-scheme: dark;
  --bg: #090d15;
  --bg-elevated: #0d121c;
  --surface: #111823;
  --surface-2: #151e2b;
  --surface-3: #1a2534;
  --surface-hover: #1b2635;
  --line: #263244;
  --line-soft: rgba(124, 145, 174, 0.16);
  --text: #f4f7fb;
  --text-2: #c6cfdb;
  --muted: #8491a3;
  --faint: #5d697a;
  --accent: #d8a94b;
  --accent-bright: #f0c66f;
  --accent-soft: rgba(216, 169, 75, 0.13);
  --long: #ff5d72;
  --long-soft: rgba(255, 93, 114, 0.12);
  --short: #4f9fff;
  --short-soft: rgba(79, 159, 255, 0.12);
  --good: #38d3a1;
  --good-soft: rgba(56, 211, 161, 0.12);
  --warning: #f2bf5a;
  --warning-soft: rgba(242, 191, 90, 0.12);
  --danger: #ff6577;
  --danger-soft: rgba(255, 101, 119, 0.12);
  --violet: #9d8cff;
  --cyan: #52c9dc;
  --radius: 20px;
  --radius-sm: 13px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  --font: Inter, Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans KR", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 50% -180px, rgba(58, 83, 125, 0.17), transparent 420px),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

::selection {
  background: rgba(216, 169, 75, 0.28);
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: #324055;
  background-clip: padding-box;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 2000;
  top: -60px;
  left: 18px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  padding: 10px 14px;
  font-weight: 800;
  text-decoration: none;
}

.skip-link:focus {
  top: 14px;
}

.site-header {
  position: sticky;
  z-index: 200;
  top: 0;
  height: 72px;
  border-bottom: 1px solid rgba(120, 142, 173, 0.14);
  background: rgba(9, 13, 21, 0.88);
  backdrop-filter: blur(22px);
}

.header-inner {
  width: min(1560px, 100%);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  min-width: max-content;
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}

.brand-mark {
  width: 41px;
  height: 41px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(235, 197, 120, 0.25);
  border-radius: 13px;
  background: #f5f3ed;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.brand-mark img {
  width: 35px;
  height: 35px;
  object-fit: contain;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.08;
}

.brand-copy strong {
  font-size: 17px;
  letter-spacing: -0.45px;
}

.brand-copy span {
  margin-top: 5px;
  color: var(--accent-bright);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.desktop-nav {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-button,
.nav-link {
  height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.16s, background 0.16s;
}

.nav-button svg {
  width: 17px;
  height: 17px;
}

.nav-link svg {
  width: 14px;
  height: 14px;
}

.nav-button:hover,
.nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-2);
}

.nav-button.active {
  background: var(--accent-soft);
  color: var(--accent-bright);
}

.header-market {
  min-width: max-content;
  margin-left: auto;
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 10px;
  align-items: center;
  padding-right: 4px;
}

.header-market > span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.header-market strong {
  margin-top: 1px;
  font-size: 14px;
}

.header-market em {
  margin-top: 1px;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.auth-area {
  min-width: max-content;
}

.login-button {
  height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(240, 198, 111, 0.25);
  border-radius: 12px;
  background: var(--accent);
  color: #17120a;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
  transition: transform 0.15s, filter 0.15s;
}

.login-button svg {
  width: 17px;
  height: 17px;
  stroke-width: 2.1;
}

.login-button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.user-button {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--surface);
  padding: 5px 10px 5px 6px;
  cursor: pointer;
}

.user-button > svg {
  width: 15px;
  height: 15px;
  color: var(--muted);
}

.user-avatar,
.account-avatar {
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  background: linear-gradient(145deg, #5368a8, #2d3b66);
  color: #fff;
  font-weight: 900;
}

.user-avatar {
  width: 36px;
  height: 36px;
  font-size: 13px;
}

.user-avatar img,
.account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 120px;
  text-align: left;
  line-height: 1.2;
}

.user-copy strong,
.user-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-copy strong {
  font-size: 12px;
}

.user-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.ticker-strip {
  height: 39px;
  overflow: hidden;
  border-bottom: 1px solid rgba(120, 142, 173, 0.12);
  background: #0b1019;
}

.ticker-inner {
  width: min(1560px, 100%);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
  color: var(--text-2);
  font-size: 11px;
  white-space: nowrap;
}

.ticker-status,
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ticker-status i,
.quote-live i,
.chart-source i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
}

.ticker-status.live i,
.quote-live.live i,
.chart-source i {
  background: var(--good);
  box-shadow: 0 0 0 4px rgba(56, 211, 161, 0.08);
}

.ticker-item::before {
  content: "";
  width: 1px;
  height: 13px;
  margin-right: 18px;
  background: var(--line);
}

.ticker-item strong {
  font-size: 11px;
}

.ticker-item em {
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.ticker-placeholder {
  width: 160px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #18202d, #222d3d, #18202d);
  background-size: 220% 100%;
  animation: skeleton 1.5s infinite linear;
}

.ticker-placeholder.short {
  width: 120px;
}

.page {
  width: min(1560px, 100%);
  margin: 0 auto;
  padding: 18px 24px 52px;
}

.service-notice {
  min-height: 58px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 13px;
  border: 1px solid rgba(242, 191, 90, 0.2);
  border-radius: 16px;
  background: var(--warning-soft);
  padding: 10px 14px;
}

.service-notice.error {
  border-color: rgba(255, 101, 119, 0.2);
  background: var(--danger-soft);
}

.notice-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(242, 191, 90, 0.13);
  color: var(--warning);
}

.service-notice.error .notice-icon {
  background: rgba(255, 101, 119, 0.12);
  color: var(--danger);
}

.notice-icon svg {
  width: 18px;
  height: 18px;
}

.service-notice > div {
  min-width: 0;
  flex: 1;
}

.service-notice strong {
  display: block;
  font-size: 12px;
}

.service-notice p {
  margin: 2px 0 0;
  color: var(--text-2);
  font-size: 11px;
}

.service-notice > button {
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  padding: 8px 11px;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.view {
  display: none;
  animation: view-in 0.2s ease-out;
}

.view.active {
  display: block;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

.trading-layout {
  display: grid;
  grid-template-columns: 252px minmax(520px, 1fr) 350px;
  gap: 14px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(17, 24, 35, 0.96);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.watchlist-panel,
.order-panel {
  position: sticky;
  top: 128px;
}

.watchlist-panel {
  overflow: hidden;
}

.panel-heading,
.order-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 18px 14px;
}

.eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--accent-bright);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.panel-heading h2,
.order-heading h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.45px;
}

.market-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 8px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  white-space: nowrap;
}

.market-state i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
}

.market-state.open {
  background: var(--good-soft);
  color: var(--good);
}

.market-state.open i {
  background: var(--good);
  box-shadow: 0 0 0 4px rgba(56, 211, 161, 0.08);
}

.market-state.closed {
  background: var(--danger-soft);
  color: var(--danger);
}

.market-state.closed i {
  background: var(--danger);
}

.index-card {
  width: calc(100% - 24px);
  margin: 0 12px 13px;
  display: block;
  border: 1px solid rgba(235, 193, 107, 0.14);
  border-radius: 16px;
  background:
    radial-gradient(circle at 85% 0, rgba(216, 169, 75, 0.14), transparent 62%),
    #171d28;
  padding: 14px;
  color: inherit;
  text-align: left;
  cursor: default;
}

.index-card-top,
.index-card-value {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.index-card-top small {
  display: block;
  color: var(--accent);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.index-card-top strong {
  display: block;
  margin-top: 3px;
  font-size: 11px;
}

.index-symbol {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent-bright);
}

.index-symbol svg {
  width: 17px;
  height: 17px;
}

.index-card-value {
  margin-top: 14px;
  align-items: flex-end;
}

.index-card-value strong {
  font-size: 21px;
  letter-spacing: -0.5px;
}

.index-card-value em {
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
}

.watchlist-label {
  display: flex;
  justify-content: space-between;
  padding: 0 17px 7px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 750;
}

.instrument-list {
  padding: 0 8px 8px;
}

.instrument-row {
  width: 100%;
  min-height: 67px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  padding: 8px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.instrument-row:hover {
  background: rgba(255, 255, 255, 0.035);
}

.instrument-row.active {
  border-color: rgba(216, 169, 75, 0.16);
  background: var(--accent-soft);
}

.commodity-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: 800;
}

.commodity-icon.gold {
  background: rgba(216, 169, 75, 0.13);
  color: #f2c96f;
}

.commodity-icon.oil {
  background: rgba(88, 114, 146, 0.16);
  color: #a9bfd9;
}

.instrument-name,
.instrument-values {
  min-width: 0;
}

.instrument-name strong,
.instrument-name small,
.instrument-values strong,
.instrument-values em {
  display: block;
}

.instrument-name strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.instrument-name small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.instrument-values {
  text-align: right;
}

.instrument-values strong {
  font-size: 11px;
}

.instrument-values em {
  margin-top: 3px;
  font-size: 9px;
  font-style: normal;
  font-weight: 850;
}

.instrument-values .sparkline {
  width: 55px;
  height: 22px;
  display: block;
  margin: 4px 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}

.instrument-skeleton {
  height: 62px;
  margin: 4px;
  border-radius: 14px;
  background: linear-gradient(90deg, #141c28, #1b2635, #141c28);
  background-size: 220% 100%;
  animation: skeleton 1.5s infinite linear;
}

@keyframes skeleton {
  to {
    background-position: -220% 0;
  }
}

.market-rule-note {
  margin: 5px 12px 13px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-top: 1px solid var(--line-soft);
  padding: 13px 4px 0;
  color: var(--muted);
}

.market-rule-note svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.market-rule-note p {
  margin: 0;
  font-size: 9px;
  line-height: 1.55;
}

.market-workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chart-panel {
  min-width: 0;
  overflow: hidden;
}

.quote-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 23px 24px 0;
}

.quote-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 13px;
}

.quote-identity .commodity-icon {
  width: 49px;
  height: 49px;
  border-radius: 16px;
  font-size: 15px;
}

.quote-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quote-title-row h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.6px;
}

.symbol-chip,
.paused-chip {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.symbol-chip {
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
}

.paused-chip {
  background: var(--warning-soft);
  color: var(--warning);
}

.quote-identity p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.quote-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.quote-price-row {
  min-height: 84px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 24px 9px;
}

.quote-price {
  display: block;
  font-size: clamp(28px, 3vw, 37px);
  line-height: 1.1;
  letter-spacing: -1.2px;
}

.quote-change {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 850;
}

.bid-ask {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 5px;
}

.bid-ask > i {
  width: 1px;
  height: 27px;
  background: var(--line);
}

.bid-ask span {
  min-width: 80px;
  text-align: right;
}

.bid-ask small,
.bid-ask strong {
  display: block;
}

.bid-ask small {
  color: var(--muted);
  font-size: 8px;
}

.bid-ask strong {
  margin-top: 3px;
  font-size: 11px;
}

.chart-toolbar {
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line-soft);
  padding: 0 24px;
}

.range-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
}

.range-tabs button {
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  padding: 0 10px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}

.range-tabs button:hover {
  color: var(--text-2);
}

.range-tabs button.active {
  background: var(--surface-3);
  color: var(--text);
}

.chart-source {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 8px;
}

.chart-wrap {
  position: relative;
  height: 400px;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.007), rgba(255, 255, 255, 0));
}

#marketChart {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: pan-y;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  min-width: 112px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  background: rgba(20, 28, 40, 0.94);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  padding: 8px 10px;
  backdrop-filter: blur(12px);
}

.chart-tooltip time,
.chart-tooltip strong {
  display: block;
}

.chart-tooltip time {
  color: var(--muted);
  font-size: 8px;
}

.chart-tooltip strong {
  margin-top: 3px;
  font-size: 11px;
}

.chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: rgba(17, 24, 35, 0.62);
}

.chart-loading span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: chart-dot 1s infinite ease-in-out;
}

.chart-loading span:nth-child(2) {
  animation-delay: 0.13s;
}

.chart-loading span:nth-child(3) {
  animation-delay: 0.26s;
}

@keyframes chart-dot {
  0%,
  70%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  35% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-align: center;
}

.chart-empty svg {
  width: 32px;
  height: 32px;
  margin-bottom: 10px;
  color: var(--faint);
}

.chart-empty strong {
  color: var(--text-2);
  font-size: 12px;
}

.chart-empty p {
  margin: 4px 0 0;
  font-size: 9px;
}

.chart-stats {
  min-height: 52px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line-soft);
  padding: 0 24px;
}

.chart-stats span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.chart-stats span + span {
  border-left: 1px solid var(--line-soft);
}

.chart-stats small {
  color: var(--muted);
  font-size: 8px;
}

.chart-stats strong {
  font-size: 10px;
}

.position-strip {
  min-height: 88px;
  overflow: hidden;
}

.position-strip-empty {
  min-height: 88px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 18px;
}

.position-empty-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--muted);
}

.position-empty-icon svg {
  width: 18px;
  height: 18px;
}

.position-strip-empty > div {
  min-width: 0;
  flex: 1;
}

.position-strip-empty strong {
  display: block;
  font-size: 11px;
}

.position-strip-empty p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.position-strip-empty button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  padding: 7px 10px;
  color: var(--text-2);
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}

.active-position-strip {
  min-height: 88px;
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) repeat(4, minmax(80px, 0.7fr));
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
}

.strip-position-name {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.strip-position-name em {
  border-radius: 8px;
  padding: 4px 7px;
  font-size: 8px;
  font-style: normal;
  font-weight: 900;
}

.strip-position-name em.long {
  background: var(--long-soft);
  color: var(--long);
}

.strip-position-name em.short {
  background: var(--short-soft);
  color: var(--short);
}

.strip-position-name strong,
.strip-position-name small,
.active-position-strip > span small,
.active-position-strip > span strong {
  display: block;
}

.strip-position-name strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strip-position-name small,
.active-position-strip > span small {
  color: var(--muted);
  font-size: 8px;
}

.active-position-strip > span strong {
  margin-top: 4px;
  font-size: 10px;
}

.market-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.info-card {
  min-width: 0;
  min-height: 70px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: rgba(17, 24, 35, 0.72);
  padding: 12px;
}

.info-icon {
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
}

.info-icon svg {
  width: 17px;
  height: 17px;
}

.info-icon.amber {
  background: var(--accent-soft);
  color: var(--accent-bright);
}

.info-icon.violet {
  background: rgba(157, 140, 255, 0.12);
  color: var(--violet);
}

.info-icon.cyan {
  background: rgba(82, 201, 220, 0.12);
  color: var(--cyan);
}

.info-card div {
  min-width: 0;
}

.info-card small,
.info-card strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-card small {
  color: var(--muted);
  font-size: 8px;
}

.info-card strong {
  margin-top: 3px;
  font-size: 10px;
}

.order-panel {
  overflow: hidden;
}

.order-heading {
  padding-bottom: 12px;
}

.order-market-chip {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  padding: 5px 8px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 850;
}

.order-market-chip.open {
  background: var(--good-soft);
  color: var(--good);
}

.order-market-chip.closed {
  background: var(--danger-soft);
  color: var(--danger);
}

.order-quote {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: 11px 18px;
}

.order-quote span:last-child {
  text-align: right;
}

.order-quote small,
.order-quote strong {
  display: block;
}

.order-quote small {
  color: var(--muted);
  font-size: 8px;
}

.order-quote strong {
  margin-top: 3px;
  font-size: 11px;
}

#openOrderForm {
  padding: 17px 18px 0;
}

.field-group + .field-group {
  margin-top: 17px;
}

.field-group > label,
.field-label-row label {
  color: var(--text-2);
  font-size: 10px;
  font-weight: 800;
}

.field-label-row {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.field-label-row small {
  color: var(--faint);
  font-size: 8px;
}

.side-toggle {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.side-toggle button {
  min-height: 57px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.side-toggle button svg {
  width: 18px;
  height: 18px;
}

.side-toggle button span {
  text-align: left;
}

.side-toggle button strong,
.side-toggle button small {
  display: block;
}

.side-toggle button strong {
  font-size: 11px;
}

.side-toggle button small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 8px;
}

.side-toggle .long.active {
  border-color: rgba(255, 93, 114, 0.34);
  background: var(--long-soft);
  color: var(--long);
}

.side-toggle .short.active {
  border-color: rgba(79, 159, 255, 0.34);
  background: var(--short-soft);
  color: var(--short);
}

.stepper {
  height: 45px;
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.stepper button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}

.stepper button:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.stepper > div {
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.stepper input {
  width: 62px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
  appearance: textfield;
}

.stepper input::-webkit-inner-spin-button,
.stepper input::-webkit-outer-spin-button {
  appearance: none;
}

.stepper span {
  margin-left: 5px;
  color: var(--muted);
  font-size: 9px;
}

.leverage-options {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.leverage-options button {
  height: 35px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  cursor: pointer;
}

.leverage-options button:hover {
  color: var(--text-2);
}

.leverage-options button.active {
  border-color: rgba(216, 169, 75, 0.3);
  background: var(--accent-soft);
  color: var(--accent-bright);
}

.leverage-warning {
  height: 3px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.leverage-warning span {
  width: 20%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--good);
  transition: width 0.2s, background 0.2s;
}

.order-preview {
  margin-top: 17px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: rgba(8, 13, 21, 0.36);
  padding: 7px 11px;
}

.order-preview > div {
  min-height: 29px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.order-preview > div + div {
  border-top: 1px solid rgba(124, 145, 174, 0.08);
}

.order-preview span {
  color: var(--muted);
  font-size: 8px;
}

.order-preview strong {
  font-size: 9px;
}

.order-preview .liquidation-row strong {
  color: var(--danger);
}

.order-status {
  min-height: 30px;
  margin: 10px 2px 7px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.5;
}

.order-status.error {
  color: var(--danger);
}

.order-status.success {
  color: var(--good);
}

.order-submit {
  width: 100%;
  height: 47px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.15s, filter 0.15s, opacity 0.15s;
}

.order-submit.long {
  background: var(--long);
}

.order-submit.short {
  background: var(--short);
}

.order-submit:hover:not(:disabled) {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.order-submit:disabled,
.close-position-box button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.close-position-box {
  margin: 17px 18px 0;
  border: 1px solid rgba(216, 169, 75, 0.18);
  border-radius: 15px;
  background: var(--accent-soft);
  padding: 13px;
}

.close-box-title,
.close-position-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.close-box-title > span {
  color: var(--text-2);
  font-size: 9px;
  font-weight: 800;
}

.close-box-title em {
  border-radius: 7px;
  padding: 3px 6px;
  font-size: 8px;
  font-style: normal;
  font-weight: 900;
}

.close-position-main {
  margin-top: 10px;
}

.close-position-main > strong {
  font-size: 15px;
}

.close-position-main > span {
  font-size: 11px;
  font-weight: 900;
}

.close-position-grid {
  margin-top: 11px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.close-position-grid span {
  border-radius: 9px;
  background: rgba(8, 13, 21, 0.26);
  padding: 7px 8px;
}

.close-position-grid small,
.close-position-grid strong {
  display: block;
}

.close-position-grid small {
  color: var(--muted);
  font-size: 7px;
}

.close-position-grid strong {
  margin-top: 2px;
  font-size: 9px;
}

.close-position-box > button {
  width: 100%;
  height: 39px;
  margin-top: 11px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 11px;
  background: var(--text);
  color: var(--bg);
  font-size: 9px;
  font-weight: 900;
  cursor: pointer;
}

.order-risk {
  margin: 14px 18px 17px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--faint);
}

.order-risk svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.order-risk p {
  margin: 0;
  font-size: 8px;
  line-height: 1.55;
}

.up {
  color: var(--long) !important;
}

.down {
  color: var(--short) !important;
}

.flat {
  color: var(--muted) !important;
}

.page-title {
  min-height: 94px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 5px 4px 17px;
}

.page-title h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.8px;
}

.page-title p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.secondary-button,
.primary-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 11px;
  padding: 0 13px;
  font-size: 10px;
  font-weight: 850;
  cursor: pointer;
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
}

.primary-button {
  border: 0;
  background: var(--accent);
  color: #181208;
}

.secondary-button svg {
  width: 15px;
  height: 15px;
}

.guest-state {
  min-height: 390px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
}

.guest-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 21px;
  background: var(--accent-soft);
  color: var(--accent-bright);
}

.guest-icon svg {
  width: 28px;
  height: 28px;
}

.guest-state h2 {
  margin: 17px 0 0;
  font-size: 17px;
}

.guest-state p {
  margin: 6px 0 17px;
  color: var(--muted);
  font-size: 10px;
}

.guest-state button {
  height: 40px;
  border: 0;
  border-radius: 11px;
  background: var(--accent);
  color: #17120a;
  padding: 0 18px;
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.summary-card {
  min-height: 125px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: var(--surface);
  padding: 19px;
}

.summary-card.primary {
  border-color: rgba(216, 169, 75, 0.2);
  background:
    radial-gradient(circle at 95% -20%, rgba(216, 169, 75, 0.18), transparent 60%),
    var(--surface);
}

.summary-card small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
}

.summary-card strong {
  margin-top: 8px;
  font-size: 21px;
  letter-spacing: -0.6px;
}

.summary-card > span {
  margin-top: 7px;
  color: var(--faint);
  font-size: 8px;
}

.portfolio-panel {
  margin-top: 14px;
  overflow: hidden;
}

.panel-section-heading {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
  padding: 15px 20px;
}

.panel-section-heading h2 {
  margin: 0;
  font-size: 15px;
}

.panel-section-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 9px;
}

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

.portfolio-position-card {
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: var(--surface-2);
  padding: 15px;
}

.portfolio-position-head,
.portfolio-position-pnl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.portfolio-position-head > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.portfolio-position-head h3 {
  margin: 0;
  font-size: 12px;
}

.portfolio-position-head small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
}

.position-side-chip {
  border-radius: 8px;
  padding: 4px 7px;
  font-size: 8px;
  font-weight: 900;
}

.position-side-chip.long {
  background: var(--long-soft);
  color: var(--long);
}

.position-side-chip.short {
  background: var(--short-soft);
  color: var(--short);
}

.portfolio-position-pnl {
  margin-top: 17px;
  align-items: flex-end;
}

.portfolio-position-pnl small,
.portfolio-position-pnl strong {
  display: block;
}

.portfolio-position-pnl small {
  color: var(--muted);
  font-size: 8px;
}

.portfolio-position-pnl strong {
  margin-top: 3px;
  font-size: 20px;
}

.portfolio-position-pnl em {
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.position-detail-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.position-detail-grid span {
  border-radius: 10px;
  background: rgba(7, 11, 18, 0.25);
  padding: 8px;
}

.position-detail-grid small,
.position-detail-grid strong {
  display: block;
}

.position-detail-grid small {
  color: var(--muted);
  font-size: 7px;
}

.position-detail-grid strong {
  margin-top: 3px;
  font-size: 9px;
}

.portfolio-empty {
  grid-column: 1 / -1;
  padding: 58px 20px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.history-panel {
  overflow: hidden;
}

.history-summary {
  min-height: 78px;
  display: flex;
  align-items: center;
  gap: 42px;
  border-bottom: 1px solid var(--line-soft);
  padding: 13px 20px;
}

.history-summary small,
.history-summary strong {
  display: block;
}

.history-summary small {
  color: var(--muted);
  font-size: 8px;
}

.history-summary strong {
  margin-top: 4px;
  font-size: 15px;
}

.table-scroll {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th,
td {
  border-bottom: 1px solid rgba(124, 145, 174, 0.09);
  padding: 13px 16px;
  font-size: 9px;
  text-align: right;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2) {
  text-align: left;
}

th {
  background: rgba(8, 13, 21, 0.3);
  color: var(--muted);
  font-weight: 800;
}

td {
  color: var(--text-2);
}

td strong,
td small {
  display: block;
}

td small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 7px;
}

.trade-action {
  display: inline-flex;
  border-radius: 7px;
  padding: 3px 6px;
  font-size: 7px;
  font-weight: 900;
}

.trade-action.open {
  background: var(--accent-soft);
  color: var(--accent-bright);
}

.trade-action.close {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-2);
}

.trade-action.liquidate {
  background: var(--danger-soft);
  color: var(--danger);
}

.table-empty {
  padding: 62px 20px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.site-footer {
  min-height: 100px;
  margin-top: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line-soft);
  padding: 24px 3px 0;
  color: var(--faint);
}

.site-footer strong {
  color: var(--muted);
  font-size: 10px;
}

.site-footer p {
  max-width: 680px;
  margin: 5px 0 0;
  font-size: 8px;
}

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-links a {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--text-2);
}

.mobile-nav {
  display: none;
}

dialog.modal {
  width: calc(100% - 28px);
  max-width: 440px;
  max-height: calc(100vh - 36px);
  overflow: visible;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: var(--text);
  padding: 0;
}

dialog.modal::backdrop {
  background: rgba(3, 6, 11, 0.76);
  backdrop-filter: blur(7px);
}

dialog.modal[open] {
  animation: modal-in 0.18s ease-out;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
}

.modal-shell {
  position: relative;
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid rgba(145, 162, 186, 0.2);
  border-radius: 22px;
  background: #121924;
  box-shadow: var(--shadow);
  padding: 25px;
}

.modal-close {
  position: absolute;
  z-index: 2;
  top: 15px;
  right: 15px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text);
}

.modal-close svg {
  width: 17px;
  height: 17px;
}

.modal-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-brand > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: #f5f3ed;
}

.modal-brand img {
  width: 33px;
  height: 33px;
  object-fit: contain;
}

.modal-brand strong,
.modal-brand small {
  display: block;
}

.modal-brand strong {
  font-size: 11px;
}

.modal-brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
}

.auth-modal .modal-shell > h2 {
  margin: 24px 0 0;
  font-size: 21px;
  letter-spacing: -0.65px;
}

.modal-lead {
  margin: 5px 0 20px;
  color: var(--muted);
  font-size: 10px;
}

.auth-tabs {
  height: 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  border-radius: 12px;
  background: var(--bg-elevated);
  padding: 3px;
}

.auth-tabs button {
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  cursor: pointer;
}

.auth-tabs button.active {
  background: var(--surface-3);
  color: var(--text);
}

.auth-pane {
  display: none;
  padding-top: 15px;
}

.auth-pane.active {
  display: block;
}

.discord-login {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 13px;
  background: #5865f2;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  text-decoration: none;
}

.discord-login:hover {
  filter: brightness(1.06);
}

.discord-login svg {
  width: 20px;
  height: 20px;
}

.auth-benefits {
  margin-top: 14px;
  display: grid;
  gap: 8px;
  border-radius: 13px;
  background: rgba(8, 13, 21, 0.35);
  padding: 12px;
}

.auth-benefits span {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-2);
  font-size: 9px;
}

.auth-benefits i {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-bright);
  font-size: 8px;
  font-style: normal;
  font-weight: 900;
}

.email-form label {
  display: block;
  margin-bottom: 7px;
  color: var(--text-2);
  font-size: 9px;
  font-weight: 800;
}

.input-with-icon {
  position: relative;
}

.input-with-icon svg {
  position: absolute;
  top: 13px;
  left: 13px;
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}

.email-form input,
.compact-form input {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
  background: var(--bg-elevated);
  color: var(--text);
  padding: 0 12px;
}

.input-with-icon input {
  width: 100%;
  padding-left: 40px;
}

.email-form input:focus,
.compact-form input:focus {
  border-color: rgba(216, 169, 75, 0.55);
  box-shadow: 0 0 0 3px rgba(216, 169, 75, 0.09);
}

.email-form > button:not(.text-button) {
  width: 100%;
  height: 44px;
  margin-top: 9px;
  border: 0;
  border-radius: 11px;
  background: var(--accent);
  color: #17120a;
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
}

.email-form button:disabled,
.compact-form button:disabled {
  cursor: wait;
  opacity: 0.5;
}

.verify-form > p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 9px;
}

.email-form .code-input {
  width: 100%;
  font-size: 20px;
  font-weight: 850;
  letter-spacing: 0.35em;
  text-align: center;
}

.text-button {
  width: 100%;
  margin-top: 9px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  cursor: pointer;
}

.form-status {
  min-height: 17px;
  margin: 8px 1px 0;
  color: var(--muted);
  font-size: 8px;
}

.form-status.error {
  color: var(--danger);
}

.form-status.success {
  color: var(--good);
}

.auth-footnote {
  margin: 10px 2px 0;
  color: var(--faint);
  font-size: 8px;
  line-height: 1.55;
}

.account-profile {
  display: flex;
  align-items: center;
  gap: 13px;
  padding-right: 42px;
}

.account-avatar {
  width: 51px;
  height: 51px;
  border-radius: 16px;
  font-size: 17px;
}

.account-profile h2 {
  margin: 0;
  font-size: 17px;
}

.account-profile p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.account-link-card,
.account-email-card {
  margin-top: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--bg-elevated);
  padding: 13px;
}

.account-link-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.account-link-card small,
.account-link-card strong,
.account-section-title small,
.account-section-title strong {
  display: block;
}

.account-link-card small,
.account-section-title small {
  color: var(--muted);
  font-size: 8px;
}

.account-link-card strong,
.account-section-title strong {
  margin-top: 3px;
  font-size: 10px;
}

.account-link-card a {
  border-radius: 9px;
  background: var(--surface-3);
  padding: 7px 9px;
  color: var(--text-2);
  font-size: 8px;
  font-weight: 850;
  text-decoration: none;
}

.account-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.account-section-title em {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  padding: 4px 7px;
  color: var(--muted);
  font-size: 7px;
  font-style: normal;
  font-weight: 900;
}

.account-section-title em.registered {
  background: var(--good-soft);
  color: var(--good);
}

#emailEnrollment > p {
  margin: 11px 0 9px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.55;
}

.compact-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
}

.compact-form input {
  min-width: 0;
  height: 39px;
  font-size: 9px;
}

.compact-form button {
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #17120a;
  padding: 0 11px;
  font-size: 8px;
  font-weight: 900;
  cursor: pointer;
}

.logout-button {
  width: 100%;
  height: 42px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 101, 119, 0.2);
  border-radius: 11px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 9px;
  font-weight: 900;
  cursor: pointer;
}

.logout-button svg {
  width: 16px;
  height: 16px;
}

.confirm-modal {
  max-width: 420px !important;
}

.confirm-icon {
  width: 45px;
  height: 45px;
  margin-bottom: 14px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--long-soft);
  color: var(--long);
}

.confirm-icon.short {
  background: var(--short-soft);
  color: var(--short);
}

.confirm-icon.close {
  background: var(--accent-soft);
  color: var(--accent-bright);
}

.confirm-icon svg {
  width: 21px;
  height: 21px;
}

.confirm-modal h2 {
  margin: 4px 36px 0 0;
  font-size: 18px;
  letter-spacing: -0.55px;
}

.confirm-modal #confirmDescription {
  margin: 6px 0 15px;
  color: var(--muted);
  font-size: 9px;
}

.confirm-details {
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: var(--bg-elevated);
  padding: 7px 11px;
}

.confirm-details > div {
  min-height: 31px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.confirm-details > div + div {
  border-top: 1px solid rgba(124, 145, 174, 0.09);
}

.confirm-details span {
  color: var(--muted);
  font-size: 8px;
}

.confirm-details strong {
  font-size: 9px;
}

.confirm-risk {
  margin-top: 11px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border-radius: 11px;
  background: var(--warning-soft);
  padding: 9px;
  color: var(--warning);
}

.confirm-risk svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.confirm-risk span {
  font-size: 8px;
  line-height: 1.5;
}

.confirm-actions {
  margin-top: 15px;
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 8px;
}

.confirm-actions button {
  width: 100%;
}

.toast-region {
  position: fixed;
  z-index: 3000;
  right: 20px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  width: min(350px, calc(100vw - 28px));
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid rgba(145, 162, 186, 0.2);
  border-radius: 14px;
  background: #1b2533;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
  padding: 12px 13px;
  animation: toast-in 0.2s ease-out;
}

.toast::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.toast.success::before {
  background: var(--good);
}

.toast.error::before {
  background: var(--danger);
}

.toast strong,
.toast p {
  display: block;
}

.toast strong {
  font-size: 10px;
}

.toast p {
  margin: 2px 0 0;
  color: var(--text-2);
  font-size: 8px;
  line-height: 1.5;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (max-width: 1320px) {
  .trading-layout {
    grid-template-columns: 220px minmax(480px, 1fr) 320px;
  }

  .header-market {
    display: none;
  }

  .header-inner {
    gap: 18px;
  }

  .desktop-nav {
    margin-left: auto;
  }

  .chart-wrap {
    height: 370px;
  }

  .active-position-strip {
    grid-template-columns: minmax(130px, 1.1fr) repeat(4, minmax(65px, 0.7fr));
  }
}

@media (max-width: 1080px) {
  .trading-layout {
    grid-template-columns: minmax(0, 1fr) 330px;
  }

  .watchlist-panel {
    position: relative;
    top: auto;
    grid-column: 1 / -1;
  }

  .watchlist-panel .panel-heading {
    padding-bottom: 9px;
  }

  .watchlist-panel .index-card {
    width: 220px;
    min-width: 220px;
    margin: 0 0 10px 12px;
    display: inline-block;
    vertical-align: top;
  }

  .watchlist-label,
  .market-rule-note {
    display: none;
  }

  .instrument-list {
    width: calc(100% - 244px);
    display: inline-grid;
    grid-template-columns: repeat(2, minmax(210px, 1fr));
    gap: 4px;
    vertical-align: top;
    padding: 0 8px 10px;
  }

  .instrument-skeleton {
    margin: 0;
  }

  .order-panel {
    top: 88px;
  }

  .portfolio-positions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  body {
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
  }

  .site-header {
    height: 62px;
  }

  .header-inner {
    padding: 0 14px;
  }

  .brand-mark {
    width: 37px;
    height: 37px;
    border-radius: 12px;
  }

  .brand-mark img {
    width: 31px;
    height: 31px;
  }

  .brand-copy strong {
    font-size: 15px;
  }

  .brand-copy span {
    font-size: 8px;
  }

  .desktop-nav {
    display: none;
  }

  .auth-area {
    margin-left: auto;
  }

  .login-button {
    height: 38px;
    padding: 0 12px;
  }

  .login-button svg {
    display: none;
  }

  .user-button {
    height: 42px;
    border: 0;
    background: transparent;
    padding: 3px;
  }

  .user-avatar {
    width: 35px;
    height: 35px;
  }

  .user-copy,
  .user-button > svg {
    display: none;
  }

  .ticker-strip {
    height: 34px;
  }

  .ticker-inner {
    gap: 15px;
    overflow-x: auto;
    padding: 0 14px;
    scrollbar-width: none;
  }

  .ticker-inner::-webkit-scrollbar {
    display: none;
  }

  .ticker-item::before {
    margin-right: 7px;
  }

  .page {
    padding: 12px 12px 30px;
  }

  .trading-layout {
    display: flex;
    flex-direction: column;
  }

  .watchlist-panel,
  .market-workspace,
  .order-panel {
    width: 100%;
  }

  .watchlist-panel .index-card {
    width: calc(45% - 12px);
    min-width: 185px;
  }

  .instrument-list {
    width: calc(55% - 6px);
    grid-template-columns: minmax(190px, 1fr);
  }

  .instrument-row {
    min-height: 62px;
  }

  .order-panel {
    position: relative;
    top: auto;
  }

  .chart-wrap {
    height: 350px;
  }

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

  .mobile-nav {
    position: fixed;
    z-index: 190;
    right: 0;
    bottom: 0;
    left: 0;
    height: calc(62px + env(safe-area-inset-bottom));
    display: flex;
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: rgba(12, 17, 26, 0.94);
    backdrop-filter: blur(18px);
  }

  .mobile-nav button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 8px;
    font-weight: 800;
  }

  .mobile-nav button svg {
    width: 19px;
    height: 19px;
  }

  .mobile-nav button.active {
    color: var(--accent-bright);
  }

  .toast-region {
    right: 14px;
    bottom: calc(76px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 560px) {
  :root {
    --radius: 16px;
  }

  .service-notice {
    align-items: flex-start;
  }

  .notice-icon {
    width: 31px;
    height: 31px;
  }

  .service-notice > button {
    display: none;
  }

  .panel-heading {
    padding: 16px 14px 11px;
  }

  .watchlist-panel .index-card {
    width: calc(100% - 24px);
    min-width: 0;
    margin: 0 12px 8px;
  }

  .instrument-list {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 8px 9px;
  }

  .instrument-row {
    min-height: 78px;
    grid-template-columns: 35px minmax(0, 1fr);
    gap: 8px;
  }

  .instrument-row .commodity-icon {
    width: 35px;
    height: 35px;
    border-radius: 11px;
    font-size: 11px;
  }

  .instrument-values {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2px;
    text-align: left;
  }

  .instrument-values em {
    margin-top: 0;
  }

  .instrument-values .sparkline {
    display: none;
  }

  .quote-header {
    align-items: flex-start;
    padding: 18px 15px 0;
  }

  .quote-identity {
    gap: 10px;
  }

  .quote-identity .commodity-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }

  .quote-title-row {
    flex-wrap: wrap;
    gap: 5px;
  }

  .quote-title-row h1 {
    font-size: 17px;
  }

  .quote-live {
    max-width: 92px;
    text-align: right;
    white-space: normal;
  }

  .quote-price-row {
    min-height: 102px;
    align-items: flex-start;
    flex-direction: column;
    padding: 13px 15px 10px;
  }

  .quote-price {
    font-size: 29px;
  }

  .bid-ask {
    width: 100%;
    justify-content: flex-end;
    padding-bottom: 0;
  }

  .chart-toolbar {
    height: 44px;
    padding: 0 11px;
  }

  .range-tabs button {
    padding: 0 8px;
  }

  .chart-source {
    display: none;
  }

  .chart-wrap {
    height: 300px;
  }

  .chart-stats {
    min-height: 76px;
    grid-template-columns: repeat(2, 1fr);
    padding: 0 10px;
  }

  .chart-stats span {
    justify-content: flex-start;
    padding-left: 10px;
  }

  .chart-stats span + span {
    border-left: 0;
  }

  .chart-stats span:nth-child(even) {
    border-left: 1px solid var(--line-soft);
  }

  .chart-stats span:nth-child(n + 3) {
    border-top: 1px solid var(--line-soft);
  }

  .position-strip-empty {
    padding: 12px;
  }

  .position-strip-empty button {
    display: none;
  }

  .active-position-strip {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 13px;
  }

  .strip-position-name {
    grid-column: 1 / -1;
  }

  .market-info-grid {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .info-card {
    min-height: 58px;
  }

  .order-heading {
    padding: 17px 15px 12px;
  }

  .order-quote {
    padding: 11px 15px;
  }

  #openOrderForm {
    padding: 15px 15px 0;
  }

  .close-position-box,
  .order-risk {
    margin-right: 15px;
    margin-left: 15px;
  }

  .page-title {
    min-height: 84px;
    padding: 2px 3px 13px;
  }

  .page-title h1 {
    font-size: 22px;
  }

  .page-title .secondary-button {
    width: 40px;
    min-width: 40px;
    padding: 0;
    font-size: 0;
  }

  .summary-grid {
    gap: 8px;
  }

  .summary-card {
    min-height: 112px;
    padding: 14px;
  }

  .summary-card strong {
    font-size: 17px;
  }

  .portfolio-positions {
    padding: 10px;
  }

  .position-detail-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .history-summary {
    gap: 25px;
  }

  .site-footer {
    flex-direction: column;
  }

  dialog.modal {
    width: calc(100% - 18px);
  }

  .modal-shell {
    border-radius: 18px;
    padding: 21px 18px;
  }
}

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