/* Stocks terminal: trade controls beside the chart, account activity below both. */
#game-room[data-game=stocks] .room-title,#game-room[data-game=stocks] .history-bar,#game-room[data-game=stocks] .table-heading,#game-room[data-game=stocks] .game-topline,#game-room[data-game=stocks] #game-outcome,#game-room[data-game=stocks] #game-extras{display:none}
#game-room[data-game=stocks] .room-layout{display:grid;grid-template-columns:250px minmax(0,1fr);gap:0 14px;align-items:stretch}
#game-room[data-game=stocks] .table-panel,#game-room[data-game=stocks] #stage,.stock-terminal{display:contents}
#game-room[data-game=stocks] .control-panel{grid-column:1;grid-row:1/8;display:flex;flex-direction:column;gap:15px;min-width:0;padding:20px 15px;background:#202a35;border:1px solid #8099b025;border-radius:12px;box-shadow:0 10px 30px #0002}
#game-room[data-game=stocks] .control-panel h3{display:none}
#game-room[data-game=stocks] .control-caption,#game-room[data-game=stocks] #amount-hint{font-size:11px;color:#9aafbc;line-height:1.6;margin:0}
#game-room[data-game=stocks] #amount-hint{display:block;margin-top:8px}
#game-room[data-game=stocks] .amount-label{font-size:12px;color:#d4e4ed}
#game-room[data-game=stocks] #stake{background:#121e29;border-color:#8ca7bb35;font-size:21px;min-width:0}
#game-room[data-game=stocks] .amount-presets{display:grid;grid-template-columns:repeat(4,1fr);gap:5px}
#game-room[data-game=stocks] .amount-presets button{padding:9px 4px;border-radius:6px;background:#344252;color:#d4e4ed;font-size:11px}
#game-room[data-game=stocks] #actions{display:grid;grid-template-columns:1fr 1fr;gap:9px}
#game-room[data-game=stocks] #stocks-buy,#game-room[data-game=stocks] #stocks-short{border:1px solid #ffffff24;border-radius:8px;padding:21px 6px;font-size:14px;font-weight:800;white-space:nowrap;cursor:pointer;min-height:64px;box-shadow:0 4px 16px #0002}
#game-room[data-game=stocks] #stocks-buy{background:#4ce8ac;color:#063725}
#game-room[data-game=stocks] #stocks-short{background:#ff708a;color:#400d1a}
#game-room[data-game=stocks] #stocks-buy:hover,#game-room[data-game=stocks] #stocks-short:hover{filter:brightness(1.08)}
#game-room[data-game=stocks] #stocks-buy:disabled,#game-room[data-game=stocks] #stocks-short:disabled{opacity:.45;cursor:wait}
.stock-direction-note,#stocks-retry{grid-column:1/-1}.stock-direction-note{font-size:11px;line-height:1.65;color:#96adbb;margin:3px 0}
#game-room[data-game=stocks] .game-rules{margin-top:auto;font-size:11px;color:#a6bac7;line-height:1.7}
.stock-top{grid-column:2;grid-row:1;display:flex;align-items:center;gap:17px;padding:17px 18px;background:#202d38;border:1px solid #ffffff10;border-bottom:0;border-radius:12px 12px 0 0;color:#deebf2}
.stock-brand{display:flex;gap:9px;align-items:center}.stock-token{display:grid;place-items:center;width:38px;height:38px;border-radius:50%;background:#55edb314;border:1px solid #55edb34d;color:#77f5c8;font-size:28px}
.stock-brand small{display:block;font-size:8px;letter-spacing:1px;color:#93aebb;margin-bottom:3px}.stock-brand strong{font-size:14px}
.stock-price{display:flex;align-items:center;gap:8px;flex:1;white-space:nowrap}.stock-price>strong{font:800 29px ui-monospace,monospace;color:#e9fff5;letter-spacing:-1px}.stock-price>span{font:700 10px ui-monospace,monospace;background:#ffffff09;padding:5px;border-radius:5px}
.positive{color:#5aefb6!important}.negative{color:#ff8396!important}
.stock-count small,.stock-range-stat small{display:block;font-size:7px;color:#90a8b8;letter-spacing:.7px;margin-bottom:4px}.stock-count strong{font:700 19px ui-monospace,monospace}.stock-range-stat b{font:600 11px ui-monospace,monospace}.stock-live{font-size:9px;color:#59eab5;letter-spacing:.6px;white-space:nowrap}
.stock-rounds{grid-column:2;grid-row:2;display:flex;gap:5px;padding:11px 15px;min-height:37px;background:#111e2a;overflow:hidden}.stock-rounds>span{padding:4px 8px;border-radius:4px;background:#ffffff09;font:700 10px ui-monospace,monospace;white-space:nowrap}.stock-rounds small{font-size:11px;color:#809baa}
.stock-quote-bar{grid-column:2;grid-row:3;display:flex;gap:18px;font-size:10px;padding:8px 17px;background:#17242f;color:#8aa4b4}.stock-quote-bar b{color:#d3e9e0}.stock-quote-bar>span:last-child{margin-left:auto;font-size:9px}
.stock-chart-toolbar{grid-column:2;grid-row:4;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:7px 14px;background:#17242f}.stock-chart-tabs{display:flex;gap:3px;padding:3px;background:#0d1823;border:1px solid #ffffff12;border-radius:7px}.stock-chart-tabs button{border:0;border-radius:4px;padding:7px 14px;background:transparent;color:#91aab9;font-size:11px;cursor:pointer}.stock-chart-tabs button[aria-pressed=true]{background:#345063;color:#edfff9}.stock-chart-toolbar>span{color:#85a0af;font:9px ui-monospace,monospace;letter-spacing:.4px}
.stock-chart-wrap{grid-column:2;grid-row:5;height:410px;min-width:0;position:relative;background:#141f29}.stock-chart-wrap canvas{width:100%;height:100%;display:block}.stock-chart-message{position:absolute;left:15px;right:15px;top:35px;padding:9px 12px;background:#302b38ed;border:1px solid #ffd28a44;border-radius:6px;color:#ffe2ab;font-size:11px;pointer-events:none}.stock-chart-message[hidden]{display:none}
.stock-timeline{grid-column:2;grid-row:6;display:flex;justify-content:space-between;background:#141f29;color:#7894a5;font:9px ui-monospace,monospace;padding:8px 90px 13px 15px}.stock-timeline span:first-child{color:#56dca9}.stock-timeline span:last-child{color:#e691a5}
#game-room[data-game=stocks] #result{grid-column:2;grid-row:7;margin:0;padding:12px 17px;min-height:40px;background:#17242f;border-radius:0 0 12px 12px;color:#a0b9c8;font-size:11px;text-align:left}
.stock-lower{grid-column:1/-1;grid-row:8;display:grid;grid-template-columns:1.35fr 1fr;gap:14px;margin-top:14px;color:#d5e6ef;text-align:left}
.stock-position-panel,.stock-trade-panel{min-width:0;background:#1b2834;border:1px solid #ffffff12;border-radius:11px;min-height:290px;overflow:hidden}.stock-panel-title{display:flex;justify-content:space-between;align-items:center;padding:12px 14px;font-size:12px;border-bottom:1px solid #ffffff09;min-height:48px}.stock-panel-title>span{font-size:8px;letter-spacing:1px;color:#8ea8b8}
.stock-position-tabs{display:flex;gap:5px}.stock-position-tabs button{border:0;border-radius:6px;background:transparent;color:#90a9b9;padding:7px 10px;font-size:12px;cursor:pointer}.stock-position-tabs button[aria-pressed=true]{background:#354655;color:#e9f4fa}.stock-position-tabs span{font:600 10px ui-monospace,monospace;margin-left:4px;padding:2px 5px;border-radius:4px;background:#0a17275c}
.stock-position-head,.stock-position{display:grid;grid-template-columns:1.2fr 1.2fr .6fr;gap:8px;padding:12px 14px;align-items:center}.stock-position-head{font-size:10px;color:#829fac}.stock-position{font-size:12px;border-top:1px solid #ffffff08}.stock-position strong,.stock-position small{display:block}.stock-position small{font-size:10px;color:#92abb9;margin-top:5px;line-height:1.4}.stock-position strong>span{font-size:10px;margin-right:3px}
.stock-sell-button{background:#a4c5e118!important;color:#d3e9fa!important;border:1px solid #a4c5e133!important;border-radius:6px;padding:9px!important;font-size:11px!important;min-height:39px;cursor:pointer}.stock-sell-button:hover{background:#a4c5e130!important}.stock-sell-button:disabled{opacity:.4;cursor:wait}.stock-empty{padding:45px 18px;text-align:center;color:#839eae;font-size:12px;line-height:1.6}
.stock-trade{display:grid;grid-template-columns:25px minmax(0,1fr) 44px 65px 53px;gap:7px;align-items:center;padding:9px 12px;border-bottom:1px solid #ffffff07;font-size:11px}.stock-trade.mine{background:#55edb309}.stock-trade strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.stock-trade small{font-size:10px;color:#9bb2c1}.stock-trade b{text-align:right;font:600 11px ui-monospace,monospace}.stock-trade-panel #stock-trades{max-height:340px;overflow:auto}.stock-avatar{display:grid;place-items:center;width:24px;height:24px;background:#344d60;color:#c2d9e6;border-radius:6px;font-size:11px}
.stock-fair{grid-column:1/-1;grid-row:9;padding:15px 18px;margin-top:14px;background:#15232f;border:1px solid #ffffff0b;border-radius:10px;color:#8fa9ba;font-size:11px}.stock-fair summary{cursor:pointer}.stock-fair p{font-size:11px;line-height:1.7}.stock-fair code{display:block;overflow-wrap:anywhere;margin:12px 0;font-size:10px;color:#b7c9d6}.stock-fair button{font-size:10px;padding:7px 10px;margin:4px}.stock-fair #stock-proof-result{color:#bbcfdd}
.stock-chart-tabs button:focus-visible,.stock-position-tabs button:focus-visible,.stock-sell-button:focus-visible,#stocks-buy:focus-visible,#stocks-short:focus-visible{outline:2px solid #d8fff0;outline-offset:3px}
@media(max-width:1100px){#game-room[data-game=stocks] .room-layout{grid-template-columns:220px minmax(0,1fr);gap:0 10px}.stock-top{gap:10px;padding:15px 12px;flex-wrap:wrap}.stock-price>strong{font-size:25px}.stock-range-stat{display:none}.stock-live{margin-left:auto}.stock-lower{gap:10px;grid-template-columns:1.2fr 1fr}.stock-trade{grid-template-columns:23px minmax(0,1fr) 40px 55px 45px;gap:5px;padding:9px;font-size:10px}.stock-trade small,.stock-trade b{font-size:9px}}
@media(max-width:800px){#game-room[data-game=stocks] .room-layout{grid-template-columns:190px minmax(0,1fr)}#game-room[data-game=stocks] .control-panel{padding:15px 10px}#game-room[data-game=stocks] #stocks-buy,#game-room[data-game=stocks] #stocks-short{font-size:12px;padding:19px 4px}.stock-brand small{display:none}.stock-price{justify-content:flex-end}.stock-lower{grid-template-columns:1fr}.stock-position-panel,.stock-trade-panel{min-height:210px}.stock-chart-wrap{height:360px}.stock-quote-bar{gap:10px;font-size:9px}.stock-quote-bar>span:last-child{max-width:90px;font-size:8px;text-align:right}}
@media(max-width:650px){#game-room[data-game=stocks] .room-layout{grid-template-columns:minmax(0,1fr);gap:0}#game-room[data-game=stocks] .control-panel{grid-column:1;grid-row:1;gap:12px;margin-bottom:12px;width:100%;box-sizing:border-box;padding:15px}#game-room[data-game=stocks] .control-caption{display:none}#game-room[data-game=stocks] .game-rules{margin:0}#game-room[data-game=stocks] #stocks-buy,#game-room[data-game=stocks] #stocks-short{font-size:15px;min-height:54px;padding:15px 8px}.stock-top{grid-column:1;grid-row:2}.stock-rounds{grid-column:1;grid-row:3}.stock-quote-bar{grid-column:1;grid-row:4}.stock-chart-toolbar{grid-column:1;grid-row:5}.stock-chart-wrap{grid-column:1;grid-row:6;height:330px}.stock-timeline{grid-column:1;grid-row:7;font-size:8px}#game-room[data-game=stocks] #result{grid-column:1;grid-row:8}.stock-lower{grid-column:1;grid-row:9}.stock-fair{grid-column:1;grid-row:10}.stock-position-head,.stock-position{padding:11px 10px;gap:6px}.stock-position strong{font-size:11px}.stock-position small{font-size:9px}.stock-range-stat{display:block}.stock-top{gap:10px}.stock-chart-toolbar>span{font-size:8px}.stock-trade{grid-template-columns:25px minmax(0,1fr) 45px 62px 52px;font-size:11px}.stock-trade small,.stock-trade b{font-size:10px}}
@media(prefers-reduced-motion:reduce){.stock-terminal *{animation:none!important;transition:none!important}}
/* Match the Stocks direction colors in every state; shared .primary rules load later. */
#game-room[data-game=stocks] #actions button#stocks-buy{background:#22d979;color:#042b17;border-color:#74f7aa;box-shadow:0 4px 0 #0a8145,0 6px 18px #17d67b25}
#game-room[data-game=stocks] #actions button#stocks-short{background:#ef3f50;color:#fff;border-color:#ff8792;box-shadow:0 4px 0 #a81e32,0 6px 18px #ef3f5025}
#game-room[data-game=stocks] #actions button#stocks-buy:hover:not(:disabled){background:#42ed94;border-color:#adffcd;box-shadow:0 4px 0 #0a8145,0 8px 22px #17d67b40}
#game-room[data-game=stocks] #actions button#stocks-short:hover:not(:disabled){background:#ff5968;border-color:#ffadb4;box-shadow:0 4px 0 #a81e32,0 8px 22px #ef3f5040}
#game-room[data-game=stocks] #actions button#stocks-buy:disabled{background:#245d40;color:#a1d6b9;border-color:#377b57;box-shadow:none;opacity:1}
#game-room[data-game=stocks] #actions button#stocks-short:disabled{background:#662d36;color:#f0b7c0;border-color:#934452;box-shadow:none;opacity:1}

.stock-avatar .player-head,.stock-avatar .player-head img{width:24px;height:24px}.stock-avatar{overflow:hidden}
