:root {
  --bg: #05090c;
  --panel: #0a1116;
  --panel-2: #0d161d;
  --line: #22303a;
  --line-soft: #17232b;
  --text: #f3f7fa;
  --muted: #80909b;
  --muted-2: #a7b1b8;
  --red: #ff4040;
  --red-deep: #b9272b;
  --green: #25c66d;
  --green-deep: #12894c;
  --amber: #f2a81d;
  --blue: #4aa7ff;
  --violet: #a25bff;
  --radius: 8px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(9, 18, 23, 0.98), rgba(3, 7, 10, 1)),
    radial-gradient(circle at 50% -10%, rgba(44, 68, 72, 0.2), transparent 38%);
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: 10px;
  padding: 10px;
}

.topbar,
.account-strip,
.chart-panel,
.result-panel,
.trade-dock {
  min-width: 0;
  border: 1px solid var(--line);
  background: rgba(8, 15, 20, 0.92);
  box-shadow: var(--shadow);
}

.topbar {
  min-height: 54px;
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 8px 12px;
  border-radius: var(--radius);
}

.brand {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.brand-k {
  color: var(--red);
  font-size: 34px;
  font-style: italic;
  margin-right: 2px;
}

.mode-tabs,
.chart-controls,
.quick-buttons,
.step-controls,
.speed-control,
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-tab,
.ghost-button,
.guide-button,
.quick-buttons button,
.secondary-button,
.speed {
  min-height: 34px;
  border: 1px solid var(--line);
  background: #0b1218;
  border-radius: 6px;
  padding: 0 14px;
  color: var(--muted-2);
  cursor: pointer;
}

.mode-tab.active,
.speed.active {
  border-color: rgba(255, 64, 64, 0.8);
  color: #fff;
  background: rgba(255, 64, 64, 0.13);
}

.daily-tab {
  border-color: rgba(242, 168, 29, 0.58);
  color: #ffd479;
}

.run-stats {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 26px;
  color: var(--muted-2);
  white-space: nowrap;
}

.run-stats strong {
  color: var(--amber);
  font-size: 24px;
}

.top-actions {
  justify-self: end;
}

.ghost-button,
.guide-button {
  white-space: nowrap;
}

.guide-button {
  border-color: rgba(74, 167, 255, 0.42);
  color: #d7ebff;
  background: rgba(74, 167, 255, 0.1);
}

.account-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  border-radius: var(--radius);
  overflow: hidden;
}

.account-strip article {
  min-height: 82px;
  padding: 14px 18px;
  border-right: 1px solid var(--line-soft);
}

.account-strip article:last-child {
  border-right: 0;
}

.account-strip span,
.blind-card span,
.score-board span,
.position-meta span,
.estimate-line,
.settlement-top,
.final-grid span {
  color: var(--muted);
  font-size: 13px;
}

.account-strip strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(20px, 2vw, 30px);
  line-height: 1;
}

.account-strip small {
  display: block;
  margin-top: 8px;
  color: var(--muted-2);
}

.workspace {
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 10px;
}

.chart-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-radius: var(--radius);
  overflow: hidden;
}

.chart-toolbar {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line-soft);
}

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

.market-line span {
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-controls {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chart-controls label {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  color: var(--muted-2);
  font-size: 13px;
  white-space: nowrap;
}

.chart-controls input[type="checkbox"] {
  accent-color: var(--amber);
}

.zoom-control input {
  width: 90px;
}

#chartCanvas {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  background: #071014;
}

.result-panel {
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto auto auto auto auto minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius);
}

.panel-title,
.settlement-top,
.position-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title h2 {
  margin: 0;
  font-size: 22px;
}

#revealState {
  color: var(--amber);
  font-weight: 700;
}

.blind-card,
.score-board,
.mission-card,
.leaderboard-card,
.mini-log {
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.018);
  border-radius: var(--radius);
}

.blind-card {
  padding: 14px;
}

.blind-card strong {
  display: block;
  margin-top: 8px;
  font-size: 25px;
}

.blind-card small {
  display: block;
  margin-top: 5px;
  color: var(--muted-2);
}

.score-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.score-board div {
  padding: 12px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.score-board div:nth-child(2n) {
  border-right: 0;
}

.score-board div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.score-board strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.rank-badge {
  min-height: 62px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  border: 1px solid rgba(242, 168, 29, 0.45);
  color: #ffd479;
  background: linear-gradient(135deg, rgba(242, 168, 29, 0.22), rgba(242, 168, 29, 0.04));
  font-size: 22px;
  font-weight: 800;
}

.mission-card,
.leaderboard-card {
  padding: 12px;
}

.mission-head,
.leaderboard-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.mission-head strong,
.leaderboard-head strong {
  color: var(--amber);
}

.mission-title {
  margin-top: 8px;
  color: #fff;
  font-weight: 800;
}

.mission-progress {
  margin-top: 6px;
  color: var(--muted-2);
  font-size: 13px;
  line-height: 1.45;
}

.mission-card.complete {
  border-color: rgba(37, 198, 109, 0.58);
  background: rgba(37, 198, 109, 0.08);
}

#leaderboardList {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

#leaderboardList li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  color: var(--muted-2);
  font-size: 12px;
}

#leaderboardList strong {
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.leaderboard-score {
  color: var(--amber);
  font-weight: 800;
}

.mini-log {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mini-log-title {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted-2);
}

#tradeLog {
  margin: 0;
  padding: 8px 12px 12px 32px;
  overflow: auto;
  color: var(--muted-2);
}

#tradeLog li {
  margin: 6px 0;
  font-size: 13px;
}

.trade-dock {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(280px, 1fr) minmax(150px, 220px) minmax(300px, 520px);
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
}

.icp-footer {
  min-height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.icp-footer a {
  color: inherit;
  text-decoration: none;
}

.icp-footer a:hover {
  color: var(--muted-2);
  text-decoration: underline;
}

.trade-button {
  min-height: 88px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.trade-button span {
  font-size: 18px;
  font-weight: 800;
}

.trade-button strong {
  font-size: 28px;
}

.trade-button small {
  color: rgba(255, 255, 255, 0.75);
}

.sell {
  background: linear-gradient(180deg, rgba(255, 64, 64, 0.9), rgba(133, 23, 29, 0.95));
  border-color: rgba(255, 64, 64, 0.6);
}

.buy {
  background: linear-gradient(180deg, rgba(37, 198, 109, 0.9), rgba(10, 103, 61, 0.95));
  border-color: rgba(37, 198, 109, 0.6);
}

.position-box {
  display: grid;
  gap: 7px;
  padding: 10px 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.position-meta strong {
  color: #fff;
  font-size: 19px;
}

#positionRange {
  width: 100%;
  accent-color: var(--amber);
}

.quick-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.quick-buttons button {
  width: 100%;
  font-weight: 800;
}

.estimate-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.step-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 42px;
  align-items: stretch;
  gap: 8px;
}

.secondary-button,
.next-button {
  min-height: 100%;
  min-width: 108px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.next-button {
  border: 1px solid rgba(242, 168, 29, 0.72);
  border-radius: 6px;
  color: #fff4ce;
  background: linear-gradient(180deg, #a46915, #5f3708);
}

.speed-control {
  grid-column: 1 / -1;
  justify-content: center;
  padding: 0 8px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  white-space: nowrap;
}

.speed-control span {
  color: var(--muted);
}

.positive {
  color: var(--red) !important;
}

.negative {
  color: var(--green) !important;
}

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

.guide-dialog,
.settlement-dialog {
  width: min(840px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  color: var(--text);
  background: #081015;
  box-shadow: var(--shadow);
}

.guide-dialog {
  width: min(760px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  overflow: hidden;
  background: rgba(8, 16, 21, 0.9);
  backdrop-filter: blur(18px);
}

.guide-dialog::backdrop {
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(3px);
}

.settlement-dialog::backdrop {
  background: rgba(0, 0, 0, 0.74);
}

.guide-card,
.settlement-card {
  padding: 22px;
}

.guide-card {
  max-height: calc(100dvh - 28px);
  overflow: auto;
}

.guide-top,
.settlement-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.guide-top {
  color: var(--amber);
  font-weight: 800;
}

.guide-top button,
.settlement-top button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101820;
  cursor: pointer;
}

.guide-card h2 {
  margin: 20px 0 8px;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1;
}

.guide-lead {
  max-width: 640px;
  margin: 0 0 18px;
  color: var(--muted-2);
  line-height: 1.7;
}

.guide-steps {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.guide-steps article {
  min-height: 104px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.guide-steps strong {
  display: block;
  margin-bottom: 8px;
  color: #fff;
}

.guide-steps span,
.guide-tip {
  color: var(--muted-2);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.guide-tip {
  margin: 14px 0 18px;
  padding: 10px 12px;
  border-left: 3px solid var(--amber);
  background: rgba(242, 168, 29, 0.08);
  border-radius: 6px;
}

.guide-card .next-button {
  width: 100%;
  min-height: 48px;
}

.settlement-card h2 {
  margin: 18px 0 8px;
  color: #ffd479;
  font-size: 42px;
}

.settlement-card p {
  margin: 0 0 18px;
  color: var(--muted-2);
  line-height: 1.6;
}

.reveal-stage {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.reveal-stage span {
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.025);
  font-size: 13px;
  font-weight: 800;
  transition:
    border-color 0.24s ease,
    color 0.24s ease,
    background 0.24s ease,
    transform 0.24s ease;
}

.reveal-stage span.is-visible {
  border-color: rgba(242, 168, 29, 0.72);
  color: #ffd479;
  background: rgba(242, 168, 29, 0.12);
  transform: translateY(-1px);
}

.final-grid,
.review-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.review-grid {
  margin-top: -6px;
}

.final-grid div,
.review-grid div,
.strategy-review {
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
}

.final-grid strong,
.review-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.review-grid span,
.strategy-review span {
  color: var(--muted);
  font-size: 13px;
}

.strategy-review {
  margin-bottom: 18px;
}

.strategy-review p {
  margin: 8px 0 0;
}

@media (max-width: 1120px) {
  .app-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
    grid-template-rows: auto auto auto auto;
  }

  .topbar {
    grid-template-columns: 1fr auto;
  }

  .top-actions {
    justify-self: end;
  }

  .mode-tabs,
  .run-stats {
    grid-column: 1 / -1;
    justify-content: flex-start;
    overflow-x: auto;
  }

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

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

  .chart-panel {
    min-height: 620px;
  }

  .result-panel {
    min-height: 420px;
  }

  .trade-dock {
    grid-template-columns: 1fr 1fr;
  }

  .position-box,
  .step-controls {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1121px) and (max-height: 800px) {
  .result-panel {
    gap: 8px;
    padding: 10px;
  }

  .panel-title h2 {
    font-size: 20px;
  }

  .blind-card {
    padding: 10px 12px;
  }

  .blind-card strong {
    margin-top: 5px;
    font-size: 23px;
  }

  .score-board {
    grid-template-columns: repeat(4, 1fr);
  }

  .score-board div,
  .score-board div:nth-child(2n),
  .score-board div:nth-last-child(-n + 2) {
    border-right: 1px solid var(--line-soft);
    border-bottom: 0;
  }

  .score-board div:last-child {
    border-right: 0;
  }

  .score-board div {
    padding: 9px;
  }

  .score-board strong {
    font-size: 18px;
  }

  .rank-badge {
    min-height: 46px;
    font-size: 18px;
  }

  .mini-log {
    display: none;
  }
}

@media (max-width: 640px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
    width: 100vw;
    max-width: 100vw;
  }

  .app-shell {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 6px;
    padding: 6px;
  }

  .topbar,
  .account-strip,
  .workspace,
  .trade-dock {
    width: 100%;
    max-width: 100%;
  }

  .topbar {
    min-height: 42px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 6px;
    padding: 5px 6px;
  }

  .brand {
    font-size: 17px;
  }

  .brand-k {
    font-size: 25px;
  }

  .mode-tabs,
  .top-actions {
    gap: 5px;
    min-width: 0;
  }

  .mode-tabs {
    grid-column: auto;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .mode-tabs::-webkit-scrollbar,
  .account-strip::-webkit-scrollbar {
    display: none;
  }

  .mode-tab,
  .ghost-button,
  .guide-button {
    min-height: 30px;
    padding: 0 9px;
    font-size: 13px;
  }

  .top-actions {
    width: auto;
    justify-self: end;
  }

  .top-actions .ghost-button {
    display: none;
  }

  .run-stats {
    display: none;
  }

  .account-strip,
  .guide-steps,
  .reveal-stage,
  .review-grid,
  .final-grid {
    grid-template-columns: 1fr;
  }

  .account-strip {
    display: grid;
    width: 100%;
    min-width: 0;
    contain: inline-size;
    grid-template-columns: repeat(5, minmax(112px, 1fr));
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }

  .guide-card,
  .settlement-card {
    padding: 18px;
  }

  .account-strip article {
    min-height: 58px;
    padding: 8px 10px;
    border-right: 1px solid var(--line-soft);
  }

  .account-strip span,
  .account-strip small {
    font-size: 11px;
  }

  .account-strip strong {
    margin-top: 4px;
    font-size: 18px;
  }

  .account-strip small {
    margin-top: 4px;
  }

  .workspace {
    min-height: 0;
    overflow: hidden;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 6px;
  }

  .chart-panel {
    min-height: 0;
  }

  .chart-toolbar {
    min-height: 40px;
    align-items: center;
    flex-direction: row;
    gap: 8px;
    padding: 5px 8px;
  }

  .market-line {
    width: auto;
    flex: 1;
    gap: 6px;
    min-width: 0;
  }

  .market-line strong {
    font-size: 14px;
  }

  .market-line span {
    min-width: 0;
    max-width: none;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
  }

  .chart-controls {
    width: auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 5px;
    overflow: hidden;
  }

  .chart-controls label {
    min-height: 24px;
    font-size: 0;
    gap: 0;
  }

  .chart-controls label input[type="checkbox"] {
    width: 14px;
    height: 14px;
  }

  .zoom-control {
    display: none !important;
  }

  #chartCanvas {
    min-height: 0;
  }

  .result-panel {
    min-height: 0;
    max-height: 118px;
    grid-template-rows: auto auto;
    gap: 6px;
    padding: 8px;
    overflow: hidden;
  }

  .result-panel .blind-card,
  .result-panel .score-board,
  .result-panel .leaderboard-card,
  .result-panel .mini-log {
    display: none;
  }

  .panel-title h2 {
    font-size: 16px;
  }

  .rank-badge {
    min-height: 30px;
    font-size: 15px;
  }

  .mission-card {
    padding: 8px;
  }

  .mission-title {
    margin-top: 5px;
    font-size: 13px;
  }

  .mission-progress {
    margin-top: 4px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .trade-dock {
    width: calc(100vw - 12px);
    min-width: 0;
    overflow: hidden;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, calc((100vw - 30px) / 2)));
    grid-template-areas:
      "sell buy"
      "position position"
      "step step";
    gap: 6px;
    padding: 6px;
    box-shadow: 0 -14px 40px rgba(0, 0, 0, 0.42);
  }

  .trade-button {
    min-width: 0;
    min-height: 66px;
    gap: 3px;
  }

  .sell {
    grid-area: sell;
  }

  .buy {
    grid-area: buy;
  }

  .trade-button span {
    font-size: 14px;
  }

  .trade-button strong {
    font-size: 22px;
  }

  .trade-button small {
    font-size: 11px;
  }

  .position-box {
    grid-area: position;
    gap: 5px;
    padding: 7px 9px;
  }

  .position-meta strong {
    font-size: 16px;
  }

  .quick-buttons button {
    min-width: 0;
    min-height: 30px;
    padding: 0 4px;
    font-size: 13px;
  }

  .estimate-line {
    display: none;
  }

  .step-controls {
    grid-area: step;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 50px 34px;
    gap: 6px;
  }

  .secondary-button,
  .next-button {
    min-width: 0;
    font-size: 15px;
  }

  .speed-control {
    grid-column: 1 / -1;
    min-height: 34px;
    justify-content: center;
    gap: 5px;
    padding: 0 5px;
  }

  .speed {
    min-height: 28px;
    padding: 0 9px;
    font-size: 13px;
  }

  .speed-control span {
    font-size: 12px;
  }

  .settlement-dialog {
    max-height: calc(100dvh - 18px);
    overflow: hidden;
  }

  .settlement-card {
    max-height: calc(100dvh - 18px);
    overflow: auto;
  }

  .settlement-card h2 {
    font-size: 32px;
  }

  .final-grid div,
  .review-grid div,
  .strategy-review {
    padding: 10px;
  }

  .final-grid strong,
  .review-grid strong {
    font-size: 19px;
  }
}

@media (max-width: 640px) {
  :root {
    --mobile-pad: 6px;
    --mobile-dock: 194px;
  }

  html,
  body {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
    background: var(--bg);
  }

  body {
    position: fixed;
    inset: 0;
  }

  .app-shell {
    height: 100dvh;
    min-height: 0;
    grid-template-rows: 42px 62px minmax(0, 1fr) var(--mobile-dock) 14px;
    gap: 5px;
    padding: var(--mobile-pad);
    padding-bottom: max(var(--mobile-pad), env(safe-area-inset-bottom));
    background: var(--bg);
  }

  .topbar {
    min-height: 0;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 5px;
    padding: 4px 6px;
    box-shadow: none;
  }

  .brand {
    font-size: 16px;
  }

  .brand-k {
    font-size: 24px;
  }

  .mode-tabs {
    grid-column: auto;
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    overflow: hidden;
  }

  .mode-tab,
  .guide-button {
    min-width: 0;
    min-height: 30px;
    padding: 0 5px;
    font-size: 12px;
    font-weight: 800;
  }

  .top-actions {
    gap: 0;
  }

  .top-actions .ghost-button {
    display: none;
  }

  .run-stats {
    display: none;
  }

  .account-strip {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    overflow: hidden;
    box-shadow: none;
  }

  .account-strip article {
    min-width: 0;
    min-height: 0;
    padding: 7px 8px;
  }

  .account-strip article:nth-child(2),
  .account-strip article:nth-child(4) {
    display: none;
  }

  .account-strip span,
  .account-strip small {
    font-size: 10px;
    line-height: 1.1;
  }

  .account-strip strong {
    margin-top: 4px;
    font-size: clamp(15px, 4.8vw, 20px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .account-strip small {
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .workspace {
    min-height: 0;
    display: block;
    overflow: hidden;
  }

  .chart-panel {
    height: 100%;
    min-height: 0;
    box-shadow: none;
  }

  .chart-toolbar {
    min-height: 34px;
    gap: 6px;
    padding: 4px 7px;
  }

  .market-line {
    gap: 6px;
  }

  .market-line strong {
    display: none;
  }

  .market-line span {
    font-size: 11px;
  }

  .chart-controls {
    flex: 0 0 auto;
    gap: 4px;
  }

  .chart-controls label {
    min-height: 24px;
    padding: 0;
    font-size: 11px;
    font-weight: 800;
  }

  .chart-controls label:nth-child(n + 3) {
    display: none;
  }

  .chart-controls input[type="checkbox"] {
    width: 15px;
    height: 15px;
  }

  .zoom-control {
    display: none !important;
  }

  #chartCanvas {
    height: 100%;
    min-height: 0;
  }

  .result-panel {
    display: none;
  }

  .trade-dock {
    height: var(--mobile-dock);
    min-height: 0;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: 58px 72px 48px;
    grid-template-areas:
      "position position"
      "sell buy"
      "step step";
    gap: 6px;
    padding: 6px;
    box-shadow: none;
  }

  .icp-footer {
    min-height: 14px;
    font-size: 10px;
  }

  .position-box {
    grid-area: position;
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    grid-template-rows: 18px 28px;
    gap: 5px 8px;
    padding: 6px 8px;
  }

  .position-meta {
    grid-row: 1 / -1;
    display: grid;
    align-content: center;
    justify-content: start;
    gap: 4px;
  }

  .position-meta span {
    font-size: 10px;
  }

  .position-meta strong {
    font-size: 17px;
    color: var(--amber);
  }

  #positionRange {
    min-width: 0;
    align-self: center;
  }

  .quick-buttons {
    min-width: 0;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  .quick-buttons button {
    min-height: 27px;
    padding: 0 2px;
    font-size: 12px;
  }

  .estimate-line {
    display: none;
  }

  .trade-button {
    min-height: 0;
    gap: 3px;
    border-radius: 7px;
  }

  .sell {
    grid-area: sell;
  }

  .buy {
    grid-area: buy;
  }

  .trade-button span {
    font-size: 14px;
  }

  .trade-button strong {
    font-size: 23px;
    line-height: 1;
  }

  .trade-button small {
    font-size: 11px;
  }

  .step-controls {
    grid-area: step;
    display: grid;
    grid-template-columns: 0.84fr 1fr auto;
    grid-template-rows: 1fr;
    gap: 6px;
  }

  .secondary-button,
  .next-button {
    min-width: 0;
    min-height: 0;
    font-size: 14px;
  }

  .speed-control {
    grid-column: auto;
    min-width: 120px;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: stretch;
    gap: 3px;
    padding: 4px;
  }

  .speed-control span {
    display: none;
  }

  .speed {
    min-height: 0;
    padding: 0 4px;
    font-size: 11px;
  }

  .guide-dialog,
  .settlement-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  .guide-card,
  .settlement-card {
    padding: 14px;
  }

  .guide-card h2,
  .settlement-card h2 {
    font-size: 28px;
  }

  .guide-lead,
  .guide-tip,
  .strategy-review p {
    font-size: 13px;
    line-height: 1.5;
  }

  .guide-steps,
  .final-grid,
  .review-grid,
  .reveal-stage {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .guide-steps article {
    min-height: 0;
    padding: 10px;
  }
}
