/* Final text-flow overrides, loaded after the legacy stylesheet. */
.brand {
  min-width: 196px;
  display: inline-flex !important;
  align-items: center;
  gap: 9px;
  color: var(--text);
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.28));
}

.brand-mark rect {
  fill: #111820;
  stroke: rgba(180, 190, 202, 0.28);
  stroke-width: 1;
}

.brand-mark-k {
  fill: none;
  stroke: #f4f7fa;
  stroke-width: 2.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-mark-candle {
  fill: rgba(252, 213, 53, 0.18);
  stroke: var(--amber);
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-lockup {
  min-width: 0;
  display: grid;
  gap: 2px;
  line-height: 1;
}

.brand-lockup strong {
  color: #f4f7fa;
  font-size: 18px;
  font-weight: 760;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.brand-lockup em {
  color: var(--amber);
  font-style: normal;
}

.brand-lockup small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.14em;
  white-space: nowrap;
}

.result-panel > *,
.leaderboard-card,
.mini-log,
.position-box,
.settlement-card > * {
  min-width: 0;
}

.mini-log {
  min-height: 118px;
  max-height: 240px;
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

.leaderboard-card {
  min-height: 138px;
  max-height: 220px;
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

.mini-log-title {
  min-height: 38px;
  display: flex !important;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 12px !important;
  color: var(--blue-soft);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35 !important;
  white-space: nowrap;
  border-bottom: 1px solid var(--line-soft);
}

#tradeLog {
  min-height: 0;
  margin: 0;
  padding: 6px 12px 10px 30px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#tradeLog li {
  margin: 0 !important;
  padding: 5px 0;
  line-height: 1.45 !important;
  overflow-wrap: anywhere;
}

#leaderboardList li {
  min-height: 22px;
  line-height: 1.35 !important;
}

#leaderboardList {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.settlement-period {
  min-width: 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 12px 0 14px;
  padding: 10px 14px;
  border: 1px solid rgba(83, 177, 255, 0.28);
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(0, 112, 209, 0.12), rgba(30, 35, 41, 0.62));
}

.settlement-period span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.settlement-period strong {
  min-width: 0;
  color: var(--blue-soft);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  overflow-wrap: anywhere;
}

.mission-title,
.mission-progress,
.blind-card small,
.strategy-review p {
  overflow-wrap: anywhere;
}

.risk-line,
.risk-line span {
  min-width: 0;
}

.risk-line {
  align-items: center;
}

@media (min-width: 1121px) {
  .result-panel {
    grid-template-rows: auto auto auto auto auto minmax(138px, max-content) minmax(118px, max-content) !important;
    align-content: start !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  .position-box {
    grid-template-rows: 18px 20px 28px 16px 16px !important;
    gap: 3px !important;
  }

  .position-box .quick-buttons button {
    height: 28px !important;
  }

  .estimate-line,
  .risk-line {
    font-size: 11px !important;
    line-height: 1.2 !important;
    white-space: nowrap;
    overflow: hidden;
  }

  .estimate-line span,
  .risk-line span {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mini-log-title {
    min-height: 34px;
  }
}

@media (min-width: 641px) and (max-width: 1120px) {
  .result-panel {
    grid-template-rows: repeat(7, auto) !important;
    overflow: visible;
  }

  .mini-log {
    min-height: 140px;
  }

  .mini-log-title {
    min-height: 42px;
    font-size: 14px;
  }

  .risk-line {
    flex-wrap: wrap;
    row-gap: 4px;
    line-height: 1.35;
  }
}

@media (max-width: 640px) {
  .brand {
    min-width: 0;
    gap: 6px;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }

  .brand-lockup strong {
    font-size: 14px;
    letter-spacing: 0;
  }

  .brand-lockup small {
    display: none;
  }

  .settlement-period {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .settlement-period strong {
    text-align: left;
  }
}
