:root {
  color-scheme: light;
  --ink: #171a1d;
  --muted: #646c72;
  --line: #d7d9d7;
  --paper: #f7f6f1;
  --surface: #ffffff;
  --surface-2: #eef1ef;
  --red: #c84138;
  --red-soft: #fff0ed;
  --green: #14745a;
  --green-soft: #e8f6f0;
  --amber: #b87708;
  --amber-soft: #fff4dc;
  --blue: #315b7d;
  --shadow: 0 12px 30px rgb(23 26 29 / 8%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); }
button, input, select { font: inherit; letter-spacing: 0; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }

.topbar {
  height: 62px;
  padding: 0 clamp(16px, 3vw, 40px);
  background: var(--ink);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid #f0b33a;
}

.brand { color: white; text-decoration: none; display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 14px; }
.brand img { border-radius: 6px; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.quiet-link { color: #e6e8e7; font-size: 13px; text-decoration: none; border-bottom: 1px solid #777; }
.connection { font-size: 12px; color: #b9c0bd; display: inline-flex; align-items: center; gap: 7px; }
.connection i { width: 7px; height: 7px; border-radius: 50%; background: #747b78; }
.connection[data-status="online"] { color: #b8ead8; }
.connection[data-status="online"] i { background: #41c492; }
.connection[data-status="connecting"] i { background: #f0b33a; }

.app-shell { min-height: calc(100vh - 62px); }
.welcome-layout { width: min(1050px, calc(100% - 32px)); margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); gap: clamp(32px, 7vw, 88px); align-items: center; min-height: calc(100vh - 62px); padding: 48px 0; }
.welcome-copy { position: relative; padding-left: 8px; }
.welcome-mark { width: 88px; height: 88px; box-shadow: var(--shadow); border-radius: 8px; }
.eyebrow { margin: 22px 0 8px; color: var(--amber); font-size: 12px; font-weight: 800; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 680px; font-family: Georgia, serif; font-size: clamp(38px, 5vw, 66px); line-height: 1.02; letter-spacing: 0; margin-bottom: 18px; }
.lede { max-width: 620px; color: #4f575b; font-size: 17px; line-height: 1.65; margin-bottom: 0; }
.entry-panel { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--ink); box-shadow: var(--shadow); padding: 24px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); padding: 3px; margin-bottom: 24px; }
.segmented button { border: 0; background: transparent; min-height: 38px; color: var(--muted); font-weight: 700; }
.segmented button.active { background: white; color: var(--ink); box-shadow: 0 1px 4px rgb(0 0 0 / 10%); }
.form-stack { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { color: #4f575b; font-size: 12px; font-weight: 750; }
input, select { width: 100%; height: 42px; border: 1px solid #bfc4c1; border-radius: 4px; background: white; color: var(--ink); padding: 0 11px; outline: none; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgb(49 91 125 / 13%); }
.primary, .secondary, .danger, .ghost, .trade-button, .quote-button { border-radius: 4px; min-height: 40px; padding: 0 15px; font-weight: 750; border: 1px solid transparent; }
.primary { background: var(--ink); color: white; }
.primary:hover:not(:disabled) { background: #30353a; }
.secondary { background: white; color: var(--ink); border-color: #afb5b2; }
.secondary:hover:not(:disabled) { background: var(--surface-2); }
.ghost { background: transparent; color: var(--blue); border-color: transparent; }
.danger { color: var(--red); background: var(--red-soft); border-color: #edc8c4; }
.button-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.button-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

.room-shell { width: min(1440px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 48px; }
.room-head { min-height: 72px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.room-title h1 { font-family: inherit; font-size: 20px; line-height: 1.25; margin: 0 0 5px; }
.room-meta { color: var(--muted); font-size: 12px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.room-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--amber-soft); color: #704700; padding: 3px 7px; border: 1px solid #ead19b; border-radius: 3px; font-weight: 800; }
.metrics { display: flex; gap: 24px; align-items: center; }
.metric { display: grid; gap: 2px; min-width: 78px; }
.metric span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.metric strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.metric.timer strong[data-urgent="true"] { color: var(--red); }

.lobby-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; }
.section-title { font-size: 13px; text-transform: uppercase; color: var(--muted); font-weight: 800; margin: 0 0 12px; }
.seat-list { background: white; border: 1px solid var(--line); }
.seat { min-height: 66px; padding: 11px 15px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.seat:last-child { border-bottom: 0; }
.seat.empty { color: #929895; background: #fafaf8; }
.identity { display: flex; align-items: center; gap: 11px; min-width: 0; }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; background: var(--ink); color: white; border-radius: 4px; font-size: 13px; font-weight: 800; flex: 0 0 auto; }
.avatar.bot { background: var(--blue); }
.identity strong, .identity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity small { color: var(--muted); margin-top: 3px; font-size: 11px; }
.lobby-actions { border-left: 3px solid var(--amber); padding: 4px 0 4px 20px; }
.lobby-actions h2 { font-size: 21px; margin-bottom: 9px; }
.lobby-actions p { color: var(--muted); font-size: 13px; line-height: 1.6; }

.trading-grid { display: grid; grid-template-columns: minmax(600px, 1fr) 310px; gap: 22px; align-items: start; }
.market { background: var(--surface); border: 1px solid var(--line); }
.market-header, .market-row { display: grid; grid-template-columns: minmax(150px, 1.2fr) minmax(106px, .8fr) minmax(106px, .8fr) minmax(220px, 1.3fr); align-items: center; gap: 12px; padding: 0 14px; }
.market-header { min-height: 38px; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.market-row { min-height: 104px; border-bottom: 1px solid var(--line); }
.market-row:last-child { border-bottom: 0; }
.suit-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.suit-symbol { width: 42px; font-family: Georgia, serif; font-size: 35px; line-height: 1; text-align: center; flex: 0 0 auto; }
.red-suit .suit-symbol, .red-suit .suit-name { color: var(--red); }
.suit-name { font-weight: 850; }
.suit-stats { color: var(--muted); font-size: 11px; margin-top: 4px; }
.suit-stats b { color: var(--ink); }
.best-quote { display: grid; gap: 5px; }
.best-quote span { color: var(--muted); font-size: 10px; }
.trade-button { width: 100%; min-height: 38px; padding: 0 8px; }
.trade-button.bid { background: var(--green-soft); color: var(--green); border-color: #adddcb; }
.trade-button.ask { background: var(--red-soft); color: var(--red); border-color: #edc8c4; }
.quote-entry { display: grid; grid-template-columns: minmax(64px, 1fr) auto auto; gap: 6px; }
.quote-entry input { height: 38px; min-width: 0; }
.quote-button { min-height: 38px; padding: 0 9px; background: white; border-color: #bfc4c1; color: var(--ink); }
.quote-button:hover { border-color: var(--ink); }
.no-quote { height: 38px; display: flex; align-items: center; color: #9da29f; font-size: 13px; }
.own-quote { color: var(--blue); font-size: 11px; }

.side-stack { display: grid; gap: 20px; }
.side-section { border-top: 3px solid var(--ink); background: white; border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.side-section h2 { font-size: 12px; text-transform: uppercase; margin: 0; padding: 11px 12px; border-bottom: 1px solid var(--line); }
.player-line, .tape-line, .quote-line { padding: 9px 12px; border-bottom: 1px solid #e7e8e6; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; }
.player-line:last-child, .tape-line:last-child, .quote-line:last-child { border-bottom: 0; }
.player-line.self { background: var(--amber-soft); }
.player-name { font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-data { color: var(--muted); white-space: nowrap; }
.kind-tag { display: inline-block; padding: 2px 5px; border-radius: 3px; color: var(--blue); background: #edf3f7; font-size: 9px; text-transform: uppercase; margin-left: 5px; }
.tape { max-height: 260px; overflow: auto; }
.tape-line { align-items: flex-start; line-height: 1.45; }
.tape-line time { color: var(--muted); font-size: 10px; white-space: nowrap; }
.empty-state { padding: 22px 12px; color: var(--muted); font-size: 12px; text-align: center; }
.depth-price { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 800; }
.depth-price.bid { color: var(--green); }
.depth-price.ask { color: var(--red); }

.settlement-banner { padding: 22px 0 26px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.goal-reveal { display: flex; align-items: center; gap: 16px; }
.goal-reveal .suit-symbol { width: 58px; font-size: 54px; }
.goal-reveal h2 { margin: 0 0 4px; font-size: 24px; }
.goal-reveal p { margin: 0; color: var(--muted); font-size: 12px; }
.results-table { width: 100%; border-collapse: collapse; background: white; border: 1px solid var(--line); font-size: 13px; }
.results-table th, .results-table td { padding: 12px 14px; text-align: right; border-bottom: 1px solid var(--line); }
.results-table th:first-child, .results-table td:first-child { text-align: left; }
.results-table th { color: var(--muted); background: var(--surface-2); text-transform: uppercase; font-size: 10px; }
.results-table tr:last-child td { border-bottom: 0; }
.positive { color: var(--green); font-weight: 800; }

.toast { position: fixed; z-index: 10; bottom: 22px; left: 50%; transform: translate(-50%, 20px); background: var(--ink); color: white; padding: 11px 16px; border-radius: 4px; box-shadow: var(--shadow); font-size: 13px; opacity: 0; pointer-events: none; transition: .18s ease; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #8f2e28; }

.docs-shell { width: min(920px, calc(100% - 32px)); margin: 0 auto; padding: 44px 0 80px; }
.docs-shell h1 { font-size: 42px; }
.docs-shell h2 { margin-top: 36px; font-size: 20px; }
.docs-shell p, .docs-shell li { line-height: 1.65; color: #4f575b; }
pre { overflow: auto; padding: 16px; background: #202428; color: #edf2ef; border-left: 4px solid #f0b33a; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.inline-code { background: #e9ebe8; padding: 2px 5px; border-radius: 3px; color: #2b3438; }

.rules-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 44px 0 72px; }
.rules-head { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 48px; align-items: end; padding-bottom: 34px; }
.rules-head .eyebrow { margin-top: 0; }
.rules-head h1 { max-width: none; margin: 0 0 12px; font-family: inherit; font-size: 42px; line-height: 1.15; }
.rules-head h1 span { color: var(--muted); font-weight: 450; }
.rules-intro { margin: 0; color: var(--muted); line-height: 1.65; }
.language-control > span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.rules-language { margin: 0; }
.rules-language button { min-height: 36px; font-size: 12px; }
.rules-facts { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 4px solid var(--ink); border-bottom: 1px solid var(--line); background: var(--surface); }
.rules-facts div { min-height: 104px; padding: 18px 22px; display: grid; align-content: center; gap: 6px; border-right: 1px solid var(--line); }
.rules-facts div:last-child { border-right: 0; }
.rules-facts strong { font-size: 28px; font-variant-numeric: tabular-nums; }
.rules-facts span { color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; }
.rules-section { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 48px; padding: 48px 0; border-bottom: 1px solid var(--line); }
.rules-label { display: flex; align-items: baseline; gap: 14px; }
.rules-label > span { color: var(--amber); font: 800 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.rules-label h2 { margin: 0; font-size: 18px; line-height: 1.35; }
.rules-copy { min-width: 0; }
.rules-copy > p { margin-bottom: 20px; color: #444c50; font-size: 15px; line-height: 1.75; }
.rules-copy > p:last-child { margin-bottom: 0; }
.rule-callout { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 18px; margin-top: 24px; padding: 18px 20px; border-left: 3px solid var(--blue); background: #edf3f7; }
.rule-callout strong { color: var(--blue); font-size: 12px; }
.rule-callout p { margin: 0; color: #46555f; font-size: 13px; line-height: 1.65; }
.deck-counts { display: grid; grid-template-columns: repeat(4, 1fr); margin: 24px 0; border: 1px solid var(--line); background: var(--surface); }
.deck-counts div { min-height: 112px; display: grid; grid-template-columns: auto 1fr; grid-template-rows: 1fr 1fr; align-items: center; column-gap: 10px; padding: 15px 18px; border-right: 1px solid var(--line); }
.deck-counts div:last-child { border-right: 0; }
.deck-counts b { grid-row: 1 / -1; font-family: Georgia, serif; font-size: 42px; line-height: 1; }
.deck-counts span { align-self: end; color: var(--muted); font-size: 11px; }
.deck-counts strong { align-self: start; font-size: 21px; }
.red-suit-text { color: var(--red); }
.rule-example { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 16px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.rule-example span { color: var(--amber); font-size: 10px; font-weight: 850; text-transform: uppercase; }
.rule-example p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.rule-steps { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.rule-steps li { min-height: 98px; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.rule-steps li > span { width: 24px; height: 24px; display: grid; place-items: center; background: var(--ink); color: white; font-size: 10px; font-weight: 800; }
.rule-steps p { margin: 1px 0 0; color: #444c50; font-size: 13px; line-height: 1.6; }
.rules-table-wrap { width: 100%; margin: 24px 0; overflow-x: auto; }
.rules-table { width: 100%; min-width: 620px; border-collapse: collapse; background: var(--surface); font-size: 12px; }
.rules-table th, .rules-table td { padding: 13px 15px; text-align: left; border: 1px solid var(--line); line-height: 1.5; }
.rules-table th { color: var(--muted); background: var(--surface-2); font-size: 10px; text-transform: uppercase; }
.rules-table td:first-child { font-weight: 750; }
.market-tag { display: inline-block; min-width: 88px; padding: 5px 7px; border: 1px solid; text-align: center; font-size: 10px; font-weight: 850; text-transform: uppercase; }
.bid-tag { color: var(--green); border-color: #adddcb; background: var(--green-soft); }
.ask-tag { color: var(--red); border-color: #edc8c4; background: var(--red-soft); }
.rule-list { margin: 0; padding-left: 20px; color: #444c50; font-size: 13px; line-height: 1.7; }
.rule-list li { padding: 4px 0 4px 5px; }
.payout-formula { display: grid; grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr); align-items: stretch; margin: 24px 0; }
.payout-formula div { min-height: 96px; display: grid; align-content: center; gap: 7px; padding: 17px 20px; border: 1px solid var(--line); background: var(--surface); }
.payout-formula strong { font-size: 15px; }
.payout-formula span { color: var(--muted); font-size: 11px; line-height: 1.45; }
.payout-formula i { display: grid; place-items: center; color: var(--amber); font-style: normal; font-size: 21px; font-weight: 800; }
.payout-table { min-width: 460px; }
.strategy-band { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 48px; margin-top: 48px; padding: 32px; background: var(--ink); color: white; }
.strategy-band .eyebrow { margin: 0 0 8px; }
.strategy-band h2 { margin: 0; font-size: 22px; }
.strategy-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.strategy-grid p { margin: 0; }
.strategy-grid strong, .strategy-grid span { display: block; }
.strategy-grid strong { margin-bottom: 8px; color: #f0b33a; font-size: 12px; }
.strategy-grid span { color: #c8cecb; font-size: 12px; line-height: 1.6; }
.rules-footer { display: flex; align-items: center; gap: 10px; padding-top: 32px; }
.rules-footer .button-link { min-height: 42px; padding: 0 18px; }

.runner-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 38px 0 70px; }
.runner-head { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; align-items: end; padding-bottom: 30px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.runner-head .eyebrow { margin-top: 0; }
.runner-head h1 { font-family: inherit; font-size: 34px; line-height: 1.1; margin-bottom: 10px; }
.runner-head p { max-width: 720px; color: var(--muted); line-height: 1.6; margin-bottom: 0; }
.security-note { border-left: 3px solid var(--green); padding: 4px 0 4px 16px; display: grid; gap: 6px; }
.security-note strong { font-size: 13px; }
.security-note span { color: var(--muted); font-size: 12px; line-height: 1.5; }
.runner-grid { display: grid; grid-template-columns: 410px minmax(0, 1fr); gap: 24px; align-items: start; }
.config-panel, .runner-status { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--ink); }
.config-panel { padding: 22px; }
.config-panel h2 { font-size: 16px; margin-bottom: 20px; }
.profile-picker { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.profile-picker .danger { min-height: 42px; }
.disabled-field { opacity: .5; }
.form-error { color: var(--red); font-size: 12px; min-height: 16px; line-height: 1.4; }
.test-result { min-height: 38px; padding: 10px 11px; border-left: 3px solid var(--blue); background: #edf3f7; color: var(--blue); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.test-result:empty { display: none; }
.test-result.success { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.test-result.failure { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.test-result.testing { border-color: var(--amber); background: var(--amber-soft); color: #704700; }
.config-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.config-actions .primary { grid-column: 1 / -1; }
.config-actions button { min-width: 0; }
.runner-status { min-height: 540px; }
.agents-toolbar { min-height: 52px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.agents-toolbar h2 { margin: 0; font-size: 13px; text-transform: uppercase; }
.agents-toolbar span { color: var(--muted); font-size: 11px; }
.agent-instance { border-bottom: 4px solid var(--paper); }
.agent-instance:last-child { border-bottom: 0; }
.runner-empty { min-height: 535px; display: grid; place-content: center; justify-items: center; text-align: center; padding: 30px; }
.runner-empty > span { width: 58px; height: 58px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); font-weight: 900; margin-bottom: 15px; }
.runner-empty h2 { font-size: 17px; margin-bottom: 6px; }
.runner-empty p, .muted-copy { color: var(--muted); font-size: 12px; }
.status-head { min-height: 106px; padding: 18px 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.status-head h2 { margin: 10px 0 4px; font-size: 19px; }
.status-head p { color: var(--muted); margin: 0; font-size: 11px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; text-transform: uppercase; font-size: 9px; font-weight: 850; color: var(--blue); }
.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }
.status-pill[data-state="active"] { color: var(--green); }
.status-pill[data-state="active"] i { background: var(--green); }
.status-pill[data-state="thinking"] { color: var(--amber); }
.status-pill[data-state="thinking"] i { background: var(--amber); }
.status-pill[data-state="error"] { color: var(--red); }
.status-pill[data-state="error"] i { background: var(--red); }
.status-pill[data-state="stopped"] { color: var(--muted); }
.status-pill[data-state="stopped"] i { background: var(--muted); }
.agent-metrics { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.agent-metrics > div { min-height: 72px; padding: 13px 16px; border-right: 1px solid var(--line); display: grid; align-content: center; gap: 4px; }
.agent-metrics > div:last-child { border-right: 0; }
.agent-metrics span { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.agent-metrics strong { font-size: 18px; text-transform: capitalize; }
.agent-error { margin: 16px 20px 0; background: var(--red-soft); border-left: 3px solid var(--red); padding: 10px 12px; display: grid; gap: 4px; font-size: 11px; }
.agent-error strong { color: var(--red); }
.decision-block { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.decision-block h3, .agent-log h3 { margin: 0 0 12px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.decision-line { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.decision-line strong { color: var(--green); }
.decision-block > p { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.agent-log { padding: 18px 20px; }
.agent-log summary { color: var(--muted); cursor: pointer; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.agent-log[open] summary { margin-bottom: 10px; }
.agent-log-history { max-height: 420px; overflow-y: auto; overscroll-behavior: contain; }
.agent-log-line { display: grid; grid-template-columns: 54px 32px 52px minmax(0, 1fr); gap: 8px; padding: 10px 0; border-bottom: 1px solid #e8e9e7; font-size: 11px; line-height: 1.4; }
.agent-log-line time { color: var(--muted); }
.agent-log-line em { color: var(--muted); font-style: normal; font-variant-numeric: tabular-nums; }
.agent-log-line b { text-transform: uppercase; color: var(--blue); }
.agent-log-line small { grid-column: 4; color: var(--muted); display: flex; gap: 7px; }
.agent-log-line small strong { color: var(--ink); font-size: 9px; text-transform: uppercase; }
.agent-log-line .decision-duration { grid-column: 4; justify-self: end; }
.runner-log-empty { color: var(--muted); font-size: 12px; padding: 18px 0; }

@media (max-width: 960px) {
  .trading-grid { grid-template-columns: 1fr; }
  .side-stack { grid-template-columns: 1fr 1fr; }
  .side-section:last-child { grid-column: 1 / -1; }
  .runner-grid { grid-template-columns: 350px minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .topbar { padding: 0 14px; }
  .quiet-link { display: none; }
  .quiet-link.always-link { display: inline; }
  .welcome-layout { grid-template-columns: 1fr; min-height: auto; padding: 34px 0 50px; gap: 32px; }
  .welcome-mark { width: 64px; height: 64px; }
  h1 { font-size: 42px; }
  .room-shell { width: min(100% - 20px, 1440px); padding-top: 10px; }
  .room-head { align-items: flex-start; flex-direction: column; padding: 12px 0 16px; }
  .metrics { width: 100%; justify-content: space-between; gap: 10px; }
  .lobby-grid { grid-template-columns: 1fr; }
  .lobby-actions { border-left: 0; border-top: 3px solid var(--amber); padding: 18px 0 0; }
  .market { border-left: 0; border-right: 0; }
  .market-header { display: none; }
  .market-row { grid-template-columns: 1fr 1fr; min-height: 0; padding: 14px 10px; gap: 12px; }
  .suit-cell { grid-column: 1 / -1; }
  .quote-entry { grid-column: 1 / -1; }
  .side-stack { grid-template-columns: 1fr; }
  .side-section:last-child { grid-column: auto; }
  .settlement-banner { align-items: flex-start; flex-direction: column; }
  .results-wrap { overflow-x: auto; }
  .results-table { min-width: 620px; }
  .runner-head { grid-template-columns: 1fr; gap: 20px; }
  .runner-grid { grid-template-columns: 1fr; }
  .runner-status { min-height: 420px; }
  .runner-empty { min-height: 415px; }
  .rules-shell { width: min(100% - 24px, 1120px); padding-top: 28px; }
  .rules-head { grid-template-columns: 1fr; gap: 24px; }
  .rules-head h1 { font-size: 34px; }
  .language-control { width: min(100%, 280px); }
  .rules-facts { grid-template-columns: 1fr 1fr; }
  .rules-facts div:nth-child(2) { border-right: 0; }
  .rules-facts div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .rules-section { grid-template-columns: 1fr; gap: 22px; padding: 36px 0; }
  .deck-counts { grid-template-columns: 1fr 1fr; }
  .deck-counts div:nth-child(2) { border-right: 0; }
  .deck-counts div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .strategy-band { grid-template-columns: 1fr; gap: 28px; padding: 26px 22px; }
  .strategy-grid { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 440px) {
  .brand span { display: none; }
  .field-row { grid-template-columns: 1fr; }
  .entry-panel { padding: 18px; }
  .market-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .quote-entry { grid-template-columns: minmax(60px, 1fr) auto auto; }
  .metric strong { font-size: 19px; }
  .agent-metrics { grid-template-columns: 1fr 1fr; }
  .agent-metrics > div:nth-child(2) { border-right: 0; }
  .agent-metrics > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .status-head { flex-direction: column; }
  .config-actions { grid-template-columns: 1fr; }
  .config-actions .primary { grid-column: auto; }
  .topbar-actions { gap: 11px; }
  .always-link { font-size: 11px; }
  .rules-head h1 span { display: block; margin-top: 5px; font-size: 22px; }
  .rules-facts div { min-height: 86px; padding: 14px 16px; }
  .rules-facts strong { font-size: 23px; }
  .rule-callout, .rule-example { grid-template-columns: 1fr; gap: 8px; }
  .deck-counts div { min-height: 96px; padding: 12px; }
  .deck-counts b { font-size: 35px; }
  .rule-steps { grid-template-columns: 1fr; }
  .payout-formula { grid-template-columns: 1fr; }
  .payout-formula i { min-height: 32px; }
  .rules-footer { align-items: stretch; flex-direction: column; }
}
