/* TradePace Trading Simulator — terminal layout */
#page-replay { animation:none; }
.rp { min-width:0; }
.rp [hidden] { display:none !important; }
.rp-term { display:flex; flex-direction:column; background:var(--bg-card); border:1px solid var(--border-color); border-radius:var(--radius-lg, 12px); overflow:hidden; height:calc(100vh - 150px); min-height:480px; position:relative; }
.rp-max .rp-term { position:fixed; inset:0; z-index:150; height:auto; min-height:0; border:0; border-radius:0; }
.rp-top { display:flex; flex-wrap:wrap; align-items:center; gap:6px 10px; padding:6px 10px; border-bottom:1px solid var(--border-color); background:var(--bg-secondary); flex:0 0 auto; }
.rp-brand { display:flex; flex-direction:column; line-height:1.1; margin-right:4px; }
.rp-brand strong { font-size:13px; color:var(--text-primary); } .rp-brand span { font-size:10px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.06em; }
.rp-tb { display:flex; flex-wrap:wrap; align-items:center; gap:4px; min-width:0; }
.rp-tb-right { margin-left:auto; }
.rp-sep { width:1px; height:20px; background:var(--border-color); margin:0 4px; }
.rp-favs { display:flex; flex-wrap:wrap; gap:4px; }
.rp-tbtn { border:1px solid var(--border-color); background:var(--bg-card); color:var(--text-secondary); padding:5px 10px; font-size:12px; font-weight:600; border-radius:var(--radius-md, 8px); cursor:pointer; white-space:nowrap; min-height:30px; }
.rp-tbtn:hover { background:var(--bg-hover); color:var(--text-primary); }
.rp-tbtn.active, .rp-tbtn.open { background:var(--accent-primary); border-color:var(--accent-primary); color:#fff; }
.rp-tbtn-strong { font-weight:700; }
.rp-fav { border-style:dashed; }
.rp-saved { font-size:11px; color:var(--text-muted); margin-right:4px; } .rp-saved.err { color:var(--accent-danger); }
.rp-stage { position:relative; flex:1 1 auto; min-height:0; overflow:hidden; background:var(--bg-card); }
.rp-canvas-wrap { position:absolute; inset:0; touch-action:none; }
.rp-canvas-wrap canvas { width:100%; height:100%; display:block; cursor:crosshair; touch-action:none; }
.rp-readout { position:absolute; left:8px; top:5px; right:80px; z-index:3; font:12px ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; color:var(--text-secondary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; pointer-events:none; }
.rp-legend { position:absolute; left:8px; top:22px; z-index:4; display:flex; flex-wrap:wrap; gap:2px 12px; max-width:calc(100% - 100px); }
.rp-leg { display:inline-flex; align-items:center; gap:5px; font-size:11px; color:var(--text-secondary); background:color-mix(in srgb, var(--bg-card) 80%, transparent); border-radius:6px; padding:0 4px; }
.rp-leg button { border:0; background:none; color:var(--text-muted); cursor:pointer; padding:2px; display:inline-flex; opacity:.0; transition:opacity .12s; }
.rp-leg:hover button, .rp-leg:focus-within button { opacity:1; } .rp-leg button:hover { color:var(--text-primary); }
@media (hover:none) { .rp-leg button { opacity:1; } }
.rp-dot { width:8px; height:8px; border-radius:50%; display:inline-block; flex:0 0 auto; }
.rp-legval { font-variant-numeric:tabular-nums; color:var(--text-muted); }
.rp-hintbar { position:absolute; left:50%; transform:translateX(-50%); top:40px; z-index:5; background:#334155; color:#fff; font-size:12px; padding:5px 12px; border-radius:20px; max-width:90%; pointer-events:none; }
.rp-ctx { position:absolute; left:50%; transform:translateX(-50%); bottom:58px; z-index:6; display:flex; flex-wrap:wrap; align-items:center; gap:6px 12px; justify-content:center; background:var(--bg-card); border:1px solid var(--border-color); box-shadow:0 8px 24px rgba(0,0,0,.18); border-radius:12px; padding:8px 12px; font-size:12px; max-width:calc(100% - 16px); color:var(--text-secondary); }
.rp-latest { position:absolute; right:84px; bottom:34px; z-index:5; border:0; background:var(--accent-primary); color:#fff; font-size:12px; font-weight:700; padding:6px 12px; border-radius:20px; cursor:pointer; box-shadow:0 4px 12px rgba(0,0,0,.25); }
.rp-emptystate { position:absolute; inset:0; z-index:7; display:flex; align-items:center; justify-content:center; padding:16px; background:var(--bg-card); overflow:auto; }
.rp-emptybox { max-width:620px; }
/* floating panels */
.rp-panel { position:absolute; z-index:20; background:var(--bg-card); border:1px solid var(--border-color); border-radius:12px; box-shadow:0 12px 32px rgba(0,0,0,.22); display:flex; flex-direction:column; overflow:hidden; min-width:220px; max-width:calc(100% - 8px); resize:horizontal; }
.rp-panel.collapsed { resize:none; } .rp-panel.collapsed .rp-pbody { display:none; }
.rp-ph { display:flex; align-items:center; gap:6px; padding:6px 8px 6px 10px; background:var(--bg-secondary); border-bottom:1px solid var(--border-color); cursor:grab; user-select:none; touch-action:none; flex:0 0 auto; }
.rp-ph:active { cursor:grabbing; }
.rp-grip { color:var(--text-muted); letter-spacing:-2px; font-size:12px; }
.rp-pt { font-size:12px; font-weight:700; color:var(--text-primary); flex:1; }
.rp-pb { display:flex; gap:2px; } .rp-pb button { border:0; background:none; color:var(--text-secondary); width:26px; height:26px; border-radius:6px; font-size:16px; cursor:pointer; line-height:1; }
.rp-pb button:hover { background:var(--bg-hover); }
.rp-pbody { padding:10px; overflow:auto; min-height:0; }
.rp-panel[data-panel="replay"] { width:auto !important; resize:none; border-radius:999px; box-shadow:0 8px 24px rgba(0,0,0,.28); }
.rp-panel[data-panel="replay"] .rp-ph { border-bottom:0; background:var(--bg-card); padding:4px 6px; }
.rp-panel[data-panel="replay"] .rp-pt, .rp-panel[data-panel="replay"] .rp-pb button[data-rp="pclose"] { display:none; }
.rp-panel[data-panel="replay"] .rp-pbody { padding:4px 8px 4px 0; overflow:visible; }
.rp-panel[data-panel="replay"] { flex-direction:row; align-items:center; }
.rp-panel[data-panel="replay"] .rp-ph { padding:4px 4px 4px 8px; }
.rp-bar { display:flex; gap:6px; align-items:center; flex-wrap:nowrap; white-space:nowrap; }
.rp-bar-more { display:inline-flex; align-items:center; gap:10px; }
.rp-panel.compact .rp-bar-more { display:none; }
.rp-panel.compact [data-rp="stepbar"] { display:inline-flex; }
.rp-clock { font:11px ui-monospace,Menlo,monospace; color:var(--text-muted); }
.rp-speed { display:flex; align-items:center; gap:6px; font-size:12px; color:var(--text-secondary); }
.rp-speed .form-select { padding:4px 8px; font-size:12px; width:auto; }
.rp-pill { position:absolute; z-index:25; display:inline-flex; align-items:center; gap:8px; border:0; background:var(--accent-primary); color:#fff; border-radius:999px; padding:5px 14px 5px 5px; cursor:grab; font-size:12px; font-weight:700; box-shadow:0 8px 20px rgba(0,0,0,.3); touch-action:none; user-select:none; }
.rp-pill.pos { background:#059669; } .rp-pill.neg { background:#dc2626; }
.rp-plus { width:24px; height:24px; border-radius:50%; background:rgba(255,255,255,.25); display:inline-flex; align-items:center; justify-content:center; font-size:18px; line-height:1; }
.rp-pillinfo { font-variant-numeric:tabular-nums; white-space:nowrap; }
/* menus & dialog */
.rp-menu { position:absolute; z-index:300; min-width:230px; max-height:70vh; overflow:auto; background:var(--bg-card); border:1px solid var(--border-color); border-radius:10px; box-shadow:0 12px 32px rgba(0,0,0,.25); padding:4px; }
.rp-mi { display:flex; align-items:center; border-radius:6px; } .rp-mi:hover { background:var(--bg-hover); }
.rp-mi-sep { border-top:1px solid var(--border-color); margin-top:4px; padding-top:4px; }
.rp-mi-main { flex:1; text-align:left; border:0; background:none; color:var(--text-primary); font-size:13px; padding:7px 8px; cursor:pointer; display:flex; gap:8px; }
.rp-tick { width:14px; color:var(--accent-primary); font-weight:700; }
.rp-star { border:0; background:none; color:var(--text-muted); cursor:pointer; padding:6px 8px; display:inline-flex; } .rp-star.on { color:#f59e0b; } .rp-star:hover { color:#f59e0b; }
.rp-mlabel { display:flex; align-items:center; justify-content:space-between; gap:10px; font-size:13px; padding:4px 8px; width:100%; color:var(--text-primary); }
.rp-dlg { position:absolute; z-index:200; left:50%; top:50%; transform:translate(-50%,-50%); width:min(380px, calc(100% - 16px)); max-height:calc(100% - 16px); display:flex; flex-direction:column; background:var(--bg-card); border:1px solid var(--border-color); border-radius:14px; box-shadow:0 20px 48px rgba(0,0,0,.35); overflow:hidden; }
.rp-dlg-h { display:flex; justify-content:space-between; align-items:center; padding:10px 14px; background:var(--bg-secondary); border-bottom:1px solid var(--border-color); }
.rp-dlg-h button { border:0; background:none; color:var(--text-secondary); cursor:pointer; }
.rp-dlg-b { padding:12px 14px; overflow:auto; }
.rp-dlg-f { display:flex; justify-content:space-between; padding:10px 14px; border-top:1px solid var(--border-color); }
.rp-tabs { display:flex; gap:2px; padding:6px 8px 0; border-bottom:1px solid var(--border-color); }
.rp-tab { border:0; background:none; padding:7px 10px; font-size:12px; font-weight:600; color:var(--text-muted); cursor:pointer; border-bottom:2px solid transparent; }
.rp-tab.active { color:var(--accent-primary); border-bottom-color:var(--accent-primary); }
.rp-tfgrid { display:grid; grid-template-columns:repeat(auto-fill,minmax(80px,1fr)); gap:4px 8px; margin-top:8px; }
.rp-check { display:flex; align-items:center; gap:6px; font-size:13px; color:var(--text-secondary); }
.rp-addgrid { display:flex; flex-wrap:wrap; gap:6px; }
.rp-indrow { display:flex; align-items:center; gap:8px; padding:7px 0; border-bottom:1px solid var(--border-color); } .rp-indrow.dim { opacity:.55; }
.rp-indtxt { flex:1; min-width:0; display:flex; flex-direction:column; font-size:13px; } .rp-indtxt small { color:var(--text-muted); font-size:11px; }
.rp-indbtns { display:flex; } .rp-indbtns button { border:0; background:none; color:var(--text-secondary); cursor:pointer; padding:5px; border-radius:6px; } .rp-indbtns button:hover { background:var(--bg-hover); }
/* shared content */
.rp-btns { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.rp-import { display:flex; flex-direction:column; gap:8px; margin-top:10px; padding:10px; border:1px dashed var(--border-color); border-radius:var(--radius-md,8px); background:var(--bg-tertiary); }
.rp-goto { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.rp-goto .form-input { width:auto; flex:1 1 150px; padding:6px 8px; font-size:12px; }
.rp-grid2 { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 10px; }
.rp-grid2 .form-group { margin:0; } .rp-grid2 .form-label { font-size:11px; }
.rp-trade-btns { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:12px; }
.rp-buy,.rp-sell { color:#fff; font-weight:700; border:0; }
.rp-buy { background:#10b981; } .rp-buy:hover { background:#059669; }
.rp-sell { background:#ef4444; } .rp-sell:hover { background:#dc2626; }
.rp-pos { color:var(--accent-success); } .rp-neg { color:var(--accent-danger); } .rp-muted { color:var(--text-muted); text-align:center; }
.rp-sub { margin:14px 0 6px; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--text-muted); }
.rp-pend { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:6px 0; border-bottom:1px solid var(--border-color); font-size:13px; } .rp-pend small { display:block; color:var(--text-muted); font-size:11px; }
.rp-posinfo { font-size:12px; color:var(--text-secondary); margin-bottom:6px; }
.rp-table-wrap { overflow-x:auto; }
.rp-table { width:100%; border-collapse:collapse; font-size:12px; white-space:nowrap; }
.rp-table th,.rp-table td { padding:6px 8px; text-align:left; border-bottom:1px solid var(--border-color); vertical-align:middle; }
.rp-table th { font-size:10px; text-transform:uppercase; letter-spacing:.04em; color:var(--text-muted); }
.rp-note { min-width:140px; padding:4px 8px; font-size:12px; }
.rp-kpis { display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:8px; }
.rp-kpi { display:flex; flex-direction:column; gap:2px; padding:8px 10px; border:1px solid var(--border-color); border-radius:8px; background:var(--bg-secondary); }
.rp-kpi span { font-size:10px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.04em; } .rp-kpi strong { font-size:14px; font-variant-numeric:tabular-nums; }
.rp-curve { height:110px; border:1px solid var(--border-color); border-radius:8px; } .rp-curve-sm { height:70px; }
.rp-curve canvas { width:100%; height:100%; display:block; }
.rp-bars { display:flex; gap:3px; align-items:stretch; height:110px; }
.rp-bcol { flex:1; display:flex; flex-direction:column; min-width:0; font-size:9px; color:var(--text-muted); text-align:center; }
.rp-bplot { flex:1; display:flex; align-items:flex-end; border-bottom:1px solid var(--border-color); }
.rp-bfill { width:100%; border-radius:2px 2px 0 0; } .rp-bfill.pos { background:#10b981; } .rp-bfill.neg { background:#ef4444; }
.rp-perfbody { padding-top:10px; }
.rp-panel[data-panel="perf"] .rp-pbody { padding-top:0; }
.rp-fullscreen-hide { display:none; }
@media (max-width:760px) {
  .rp-brand span { display:none; }
  .rp-term { height:calc(100vh - 170px); }
  .rp-tb-right { margin-left:0; }
  .rp-panel { max-width:calc(100% - 8px); }
}
@media (max-width:760px) {
  .rp-top { flex-wrap:wrap; gap:6px; padding:6px 8px; }
  .rp-brand, .rp-saved { display:none; }
  .rp-tb { flex:1 1 100%; gap:4px; }
  .rp-tb-right { margin-left:0; justify-content:space-between; }
  .rp-tb .rp-tbtn { flex:1 1 auto; padding:6px 6px; font-size:12px; text-align:center; }
  .rp-sep { display:none; }
  .rp-favs { flex:1 1 100%; flex-wrap:nowrap; overflow-x:auto; scrollbar-width:none; padding-bottom:2px; }
  .rp-favs .rp-tbtn { flex:0 0 auto; }
  .rp-favs:empty { display:none; }
  .rp-tbtn { min-height:34px; }
  .rp-readout { right:8px; font-size:11px; }
  .rp-pill { top:auto; }
}
.rp-short { display:none; }
@media (max-width:760px) { .rp-long { display:none; } .rp-short { display:inline; } }
}
/* v2: docked performance, price-scale controls, drawing properties */
.rp-mhead { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--text-muted); padding:8px 10px 3px; }
.rp-ctx { bottom:calc(58px + var(--dock, 0px)); max-height:44%; overflow:auto; }
.rp-latest { bottom:calc(34px + var(--dock, 0px)); right:92px; }
.rp-auto { position:absolute; right:8px; bottom:calc(30px + var(--dock, 0px)); z-index:5; border:1px solid var(--border-color); background:var(--bg-card); color:var(--text-secondary); font-size:11px; font-weight:700; padding:3px 9px; border-radius:6px; cursor:pointer; }
.rp-auto:hover { background:var(--bg-hover); color:var(--text-primary); }
.rp-ctl { display:inline-flex; align-items:center; gap:5px; font-size:11px; color:var(--text-muted); }
.rp-ctl .form-select { padding:3px 6px; font-size:12px; width:auto; min-height:28px; }
.rp-ctl input[type=color] { width:30px; height:26px; padding:0; border:1px solid var(--border-color); border-radius:6px; background:none; cursor:pointer; }
.rp-panel.docked { left:0; border-radius:0; border-left:0; border-right:0; border-bottom:0; resize:none; max-width:none; box-shadow:0 -6px 18px rgba(0,0,0,.14); z-index:18; }
.rp-panel.docked .rp-ph { cursor:default; }
.rp-panel.docked .rp-pbody { flex:1 1 auto; }
.rp-split { display:none; height:8px; margin-top:-4px; cursor:ns-resize; flex:0 0 auto; position:relative; z-index:2; touch-action:none; }
.rp-split::after { content:''; position:absolute; left:50%; top:3px; width:44px; height:3px; margin-left:-22px; border-radius:2px; background:var(--border-color); }
.rp-panel.docked .rp-split { display:block; }
.rp-panel.docked .rp-kpis { grid-template-columns:repeat(auto-fill,minmax(170px,1fr)); }
.rp-panel.docked .rp-curve { height:130px; }
.rp-panel[data-panel="perf"] { transition:none; }
@media (pointer:coarse) {
  .rp-pb button { width:36px; height:36px; font-size:18px; }
  .rp-tbtn { min-height:38px; padding:6px 12px; }
  .rp-mi-main { padding:11px 10px; } .rp-star { padding:10px 12px; }
  .rp-panel[data-panel="replay"] .btn { min-height:38px; }
  .rp-split { height:18px; margin-top:-9px; } .rp-split::after { top:8px; height:4px; }
  .rp-ctl .form-select, .rp-ctl input[type=color] { min-height:36px; }
  .rp-ctx .btn { min-height:36px; }
}
@media (max-width:760px) {
  .rp-ctx { left:8px; right:8px; transform:none; max-width:none; justify-content:flex-start; }
  .rp-latest { right:84px; }
}

/* emoji buttons + hover words */
.rp-emo { display:inline-flex; line-height:1; margin-right:6px; } .rp-emo svg { width:18px; height:18px; } .rp-emo-only .rp-emo { margin-right:0; } .rp-emo-only .rp-emo svg { width:20px; height:20px; }
.rp-emo-only .rp-lbl { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
.rp-emo-only { display:inline-flex; align-items:center; justify-content:center; min-width:38px; }
.rp-emo-full { display:inline-flex; align-items:center; justify-content:center; gap:0; }
.rp-mi-main .rp-emo { margin:0 8px 0 0; }
.rp-tip { position:fixed; z-index:100000; pointer-events:none; background:#0f172a; color:#fff; font:600 12px/1.3 -apple-system,Segoe UI,Roboto,sans-serif; padding:6px 9px; border-radius:6px; box-shadow:0 4px 14px rgba(0,0,0,.3); max-width:240px; }
@media (hover:none) { .rp-emo-only .rp-lbl { position:static; width:auto; height:auto; clip:auto; margin-left:5px; font-size:12px; } .rp-emo-only .rp-emo { margin-right:0; } .rp-emo-only { min-width:0; } }

/* Trading Simulator practice calendar (simulated records only) */
.rp-dlg-wide { width:min(460px, calc(100% - 20px)); max-height:calc(100% - 20px); display:flex; flex-direction:column; }
.rp-cal-stats { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin-bottom:10px; text-align:center; }
.rp-cal-stats b { display:block; font-size:22px; }
.rp-cal-stats span { font-size:11px; color:var(--text-secondary); }
.rp-cal-nav { display:flex; justify-content:space-between; align-items:center; margin:6px 0; }
.rp-cal { width:100%; border-collapse:collapse; table-layout:fixed; }
.rp-cal th { font-size:11px; font-weight:600; color:var(--text-secondary); padding:4px 0; }
.rp-cal td { height:42px; text-align:center; vertical-align:middle; font-size:12px; border:1px solid var(--border-color); position:relative; }
.rp-cal td small { display:block; font-size:9px; }
.rp-cal td.rp-cal-x { border-color:transparent; }
.rp-cal td.on { background:rgba(34,197,94,.14); font-weight:700; }
.rp-cal td.on i { position:absolute; left:50%; bottom:4px; width:6px; height:6px; margin-left:-3px; border-radius:50%; background:#22c55e; }
.rp-cal td.today { outline:2px solid #3b82f6; outline-offset:-2px; }
.rp-cal td.has { cursor:pointer; }
.rp-cal td.win { background:rgba(34,197,94,.14); color:#16a34a; }
.rp-cal td.loss { background:rgba(239,68,68,.12); color:#dc2626; }
.rp-cal td.sel { outline:2px solid #3b82f6; outline-offset:-2px; }
.rp-cal-detail { margin-top:10px; padding:8px 10px; border:1px solid var(--border-color); border-radius:6px; font-size:12px; }
.rp-cal-detail ul { margin:6px 0 0 16px; padding:0; }
.rp-streakpop { position:absolute; z-index:150; right:12px; bottom:12px; width:min(300px, calc(100% - 24px)); padding:12px 34px 12px 14px; border:1px solid var(--border-color); border-radius:8px; background:var(--bg-secondary); box-shadow:0 6px 20px rgba(0,0,0,.25); }
.rp-streakpop p { margin:6px 0 10px; font-size:12px; line-height:1.45; color:var(--text-secondary); }
.rp-sp-t { font-weight:700; font-size:13px; }
.rp-sp-b { display:flex; gap:8px; }
.rp-sp-x { position:absolute; top:8px; right:8px; border:0; background:none; color:var(--text-secondary); cursor:pointer; }

/* FREE tier: results lock card and rewarded-ad interruption */
.rp-lock { margin-top:12px; padding:12px; border:1px dashed var(--border-color); border-radius:8px; background:var(--bg-secondary); }
.rp-lock p { margin:6px 0 0; line-height:1.5; }
.rp-adgate { position:fixed; inset:0; z-index:400; display:flex; align-items:center; justify-content:center; padding:16px; background:rgba(15,23,42,.55); }
.rp-adbox { max-width:440px; width:100%; padding:20px; border-radius:12px; background:var(--bg-primary,#fff); color:var(--text-primary,#0f172a); border:1px solid var(--border-color); box-shadow:0 20px 50px rgba(0,0,0,.3); }
.rp-adbox h3 { margin:0 0 8px; font-size:18px; } .rp-adbox p { line-height:1.55; margin:0 0 10px; }
.rp-adbox .rp-btns { display:flex; flex-wrap:wrap; gap:8px; }
.form-input.rp-size-locked { background:var(--bg-hover); font-weight:700; cursor:not-allowed; }

/* TradingView-style left drawing panel: plain outline icons, one button per tool group, flyout for the rest */
.rp-canvas-wrap { left:46px; }
.rp-readout, .rp-legend { left:54px; }
.rp-draw { position:absolute; left:0; top:0; bottom:0; width:46px; z-index:6; display:flex; flex-direction:column; align-items:center; gap:2px; padding:6px 0; background:var(--bg-secondary); border-right:1px solid var(--border-color); overflow-y:auto; overflow-x:hidden; scrollbar-width:none; }
.rp-draw::-webkit-scrollbar { display:none; }
.rp-dbtn { position:relative; width:36px; height:34px; flex:0 0 auto; display:inline-flex; align-items:center; justify-content:center; border:0; background:none; color:var(--text-secondary); border-radius:6px; cursor:pointer; padding:0; }
.rp-dbtn svg { width:22px; height:22px; display:block; }
.rp-dbtn:hover { background:var(--bg-hover); color:var(--text-primary); }
.rp-dbtn.active { color:var(--accent-primary); background:color-mix(in srgb, var(--accent-primary) 14%, transparent); }
.rp-dgrp { display:flex; align-items:center; width:46px; justify-content:center; flex:0 0 auto; }
.rp-dgrp .rp-dbtn { width:30px; border-radius:6px 0 0 6px; }
.rp-dfly { width:12px; height:34px; border:0; background:none; color:var(--text-muted); cursor:pointer; padding:0; display:inline-flex; align-items:center; justify-content:center; border-radius:0 6px 6px 0; }
.rp-dfly svg { width:5px; height:8px; fill:none; stroke:currentColor; stroke-width:1.4; stroke-linecap:round; stroke-linejoin:round; }
.rp-dfly:hover, .rp-dfly.open { background:var(--bg-hover); color:var(--text-primary); }
.rp-dsep { width:28px; height:1px; background:var(--border-color); margin:5px 0; flex:0 0 auto; }
.rp-dcolor { cursor:pointer; }
.rp-dcolor input[type=color] { width:20px; height:20px; padding:0; border:1.5px solid var(--text-muted); border-radius:50%; background:none; cursor:pointer; overflow:hidden; }
.rp-dcolor input[type=color]::-webkit-color-swatch-wrapper { padding:0; }
.rp-dcolor input[type=color]::-webkit-color-swatch { border:0; border-radius:50%; }
.rp-dcolor input[type=color]::-moz-color-swatch { border:0; border-radius:50%; }
.rp-fly { position:absolute; z-index:300; min-width:230px; max-height:70%; overflow:auto; background:var(--bg-card); border:1px solid var(--border-color); border-radius:10px; box-shadow:0 12px 32px rgba(0,0,0,.25); padding:4px; }
.rp-fly[hidden] { display:none; }
/* the left panel replaces the old "Draw" dropdown; the top bar goes flat like TradingView's */
.rp-tbtn[data-menu="draw"] { display:none; }
.rp-top .rp-tbtn { border-color:transparent; background:transparent; }
.rp-top .rp-tbtn:hover { background:var(--bg-hover); }
.rp-top .rp-tbtn.active, .rp-top .rp-tbtn.open { background:var(--accent-primary); border-color:var(--accent-primary); }
.rp-top .rp-fav { border-style:solid; }
@media (max-width:760px) {
  .rp-canvas-wrap { left:40px; }
  .rp-readout, .rp-legend { left:46px; }
  .rp-draw { width:40px; }
  .rp-dgrp { width:40px; }
  .rp-dgrp .rp-dbtn { width:26px; }
  .rp-dfly { width:12px; }
  .rp-dbtn { width:32px; }
}
@media (pointer:coarse) { .rp-dbtn, .rp-dfly { height:40px; } }

/* Settings dialog (TradingView-style: section list on the left) + news list */
.rp-no-readout .rp-readout, .rp-no-legend .rp-legend { display:none; }
.rp-dlg-set { width:min(600px, calc(100% - 16px)); }
.rp-dlg-news { width:min(460px, calc(100% - 16px)); }
.rp-sbody { display:flex; min-height:0; flex:1; overflow:hidden; }
.rp-snav { display:flex; flex-direction:column; gap:2px; padding:10px; width:170px; flex:0 0 auto; border-right:1px solid var(--border-color); overflow:auto; }
.rp-snav .rp-tab { display:flex; align-items:center; gap:8px; justify-content:flex-start; text-align:left; width:100%; border-radius:8px; }
.rp-spane { padding:12px 16px; overflow:auto; flex:1; min-width:0; max-height:60vh; }
.rp-shead { font-size:11px; text-transform:uppercase; letter-spacing:.06em; color:var(--text-muted); margin:12px 0 6px; }
.rp-shead:first-child { margin-top:0; }
.rp-srow { display:flex; align-items:center; justify-content:space-between; gap:10px; margin:6px 0; flex-wrap:wrap; }
.rp-sclr { display:inline-flex; gap:8px; }
.rp-sclr input[type=color] { width:34px; height:28px; padding:0; border:1px solid var(--border-color); border-radius:6px; background:none; cursor:pointer; }
.rp-shr em { width:34px; text-align:center; font-style:normal; font-size:11px; color:var(--text-muted); }
.rp-simp { display:inline-flex; gap:12px; flex-wrap:wrap; }
.rp-nrow { display:flex; align-items:flex-start; gap:8px; padding:7px 6px; border-bottom:1px solid var(--border-color); font-size:13px; }
.rp-nrow.here { background:color-mix(in srgb, var(--accent-primary) 10%, transparent); border-radius:6px; }
.rp-ntime { width:46px; flex:0 0 auto; color:var(--text-muted); font-variant-numeric:tabular-nums; }
.rp-ndot { width:10px; height:10px; border-radius:50%; margin-top:4px; flex:0 0 auto; }
.rp-ncur { width:34px; flex:0 0 auto; font-weight:600; }
.rp-ntxt { min-width:0; }
@media (max-width:560px) {
  .rp-sbody { flex-direction:column; }
  .rp-snav { flex-direction:row; width:auto; border-right:0; border-bottom:1px solid var(--border-color); overflow-x:auto; }
  .rp-snav .rp-tab { width:auto; white-space:nowrap; }
}

/* ===== Future look: the simulator shares the app's glass (tokens come from index.html) ===== */
.rp-top { background:var(--glass-bg-strong, var(--bg-secondary)); border-bottom-color:var(--glass-border, var(--border-color)); -webkit-backdrop-filter:var(--glass-blur, none); backdrop-filter:var(--glass-blur, none); }
.rp-tbtn { background:color-mix(in srgb, var(--text-primary) 8%, transparent); border-color:var(--glass-border, var(--border-color)); }
.rp-panel { background:var(--glass-win, var(--bg-card)); border-color:var(--glass-border, var(--border-color)); border-radius:18px; -webkit-backdrop-filter:var(--glass-blur, none); backdrop-filter:var(--glass-blur, none); box-shadow:0 24px 60px rgba(0,0,0,.38), var(--glass-shine, none); }
.rp-ph { background:transparent; border-bottom-color:var(--glass-border, var(--border-color)); }
.rp-menu { background:var(--glass-win, var(--bg-card)); border-color:var(--glass-border, var(--border-color)); -webkit-backdrop-filter:var(--glass-blur, none); backdrop-filter:var(--glass-blur, none); }
.rp-emptystate { background:transparent; }
.rp-stage { background:color-mix(in srgb, var(--bg-card) 40%, transparent); }

/* ===== Phone layout (v3) =====
   One slim top bar, a More sheet for everything else, bottom sheets for panels,
   a docked replay bar, and fixed homes for the floating buttons so nothing overlaps.
   Applies to phones in portrait (narrow) and landscape (short and touch). */
@media (max-width:760px), (max-height:480px) and (pointer:coarse) {
  .rp-term { height:calc(100dvh - 120px); min-height:0; }
  .rp-max .rp-term { height:auto; }

  /* top bar: ONE row that scrolls sideways if it must */
  .rp-top { flex-wrap:nowrap; overflow-x:auto; overflow-y:hidden; gap:4px; padding:4px 6px; scrollbar-width:none; -webkit-overflow-scrolling:touch; -webkit-backdrop-filter:none; backdrop-filter:none; background:var(--bg-secondary); }
  .rp-top::-webkit-scrollbar { display:none; }
  .rp-brand, .rp-saved, .rp-sep, .rp-top [data-menu="draw"] { display:none; }
  .rp-tb, .rp-tb-right { flex:0 0 auto; flex-wrap:nowrap; gap:4px; margin-left:0; }
  .rp-tb .rp-tbtn, .rp-tb-right .rp-tbtn { flex:0 0 auto; min-height:40px; padding:0 12px; font-size:13px; white-space:nowrap; }
  .rp-favs { flex:0 0 auto; flex-wrap:nowrap; overflow:visible; padding:0; }
  .rp-top .rp-more { border-style:solid; font-weight:700; flex:0 0 auto; min-width:76px; white-space:nowrap; position:sticky; right:0; margin-left:auto; z-index:2; background:var(--bg-secondary); box-shadow:-10px 0 8px -2px var(--bg-secondary); }

  /* with the More button present, the rest of the toolbar lives in a bottom sheet */
  .rp-top.rp-has-more .rp-tb-right { display:none; }
  .rp-top.rp-has-more.rp-more-open .rp-tb-right { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:8px; position:absolute; left:0; right:0; bottom:0; z-index:400; margin:0; padding:16px 12px calc(16px + env(safe-area-inset-bottom, 0px)); background:var(--bg-card); border-top:1px solid var(--border-color); border-radius:18px 18px 0 0; box-shadow:0 -14px 40px rgba(0,0,0,.4); }
  .rp-top.rp-more-open .rp-tb-right .rp-tbtn { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; min-height:56px; padding:6px; font-size:12px; border:1px solid var(--border-color); border-radius:12px; background:var(--bg-secondary); }
  .rp-top.rp-more-open .rp-tb-right .rp-tbtn.active, .rp-top.rp-more-open .rp-tb-right .rp-tbtn.open { background:var(--accent-primary); border-color:var(--accent-primary); color:#fff; }
  .rp-top.rp-more-open .rp-tb-right .rp-long { display:inline; }
  .rp-top.rp-more-open .rp-tb-right .rp-short { display:none; }
  .rp-more-scrim { position:absolute; inset:0; z-index:399; background:rgba(0, 0, 0, .5); }

  /* chart text stays small and out of the way */
  .rp-readout { font-size:11px; right:8px; }

  /* replay bar: one full-width bar docked at the bottom, big buttons, no dragging */
  .rp-panel[data-panel="replay"] { position:absolute !important; left:8px !important; right:8px !important; top:auto !important; bottom:calc(8px + env(safe-area-inset-bottom, 0px)) !important; width:auto !important; transform:none !important; border-radius:16px; z-index:30; }
  .rp-panel[data-panel="replay"] .rp-ph { display:none; }
  .rp-panel[data-panel="replay"] .rp-pbody { flex:1; padding:6px; overflow:visible; }
  .rp-panel[data-panel="replay"] .rp-bar { width:100%; gap:6px; }
  .rp-panel[data-panel="replay"] .rp-bar .btn { flex:1 1 0; min-height:44px; justify-content:center; }
  .rp-term:has(.rp-panel[data-panel="replay"]:not([hidden])) { --rp-bottombar:68px; }
  .rp-canvas-wrap { bottom:calc(var(--dock, 0px) + var(--rp-bottombar, 0px)) !important; }
  .rp-draw { bottom:calc(var(--dock, 0px) + var(--rp-bottombar, 0px)); }
  .rp-latest { bottom:calc(var(--rp-bottombar, 0px) + 34px); }
  .rp-auto { bottom:calc(var(--rp-bottombar, 0px) + 30px); }

  /* every other panel opens as a bottom sheet (Orders, Indicators, Performance, Data) */
  .rp-panel:not([data-panel="replay"]) { position:absolute !important; left:0 !important; right:0 !important; top:auto !important; bottom:0 !important; width:auto !important; max-width:none; max-height:72%; transform:none !important; resize:none; border-radius:18px 18px 0 0; z-index:60; }
  .rp-panel:not([data-panel="replay"]) .rp-ph { cursor:default; }

  /* the Order pill: bottom-left above the replay bar, clear of the price scale */
  .rp-pill { top:auto !important; right:auto !important; left:52px !important; bottom:calc(var(--rp-bottombar, 0px) + 10px) !important; }

  /* the practice-calendar nudge: a slim banner at the top, not a card over the chart */
  .rp-streakpop { top:8px; bottom:auto; left:52px; right:8px; width:auto; padding:8px 30px 8px 10px; }
  .rp-streakpop p { margin:2px 0 6px; font-size:11px; }

  /* Ask AI: small, bottom-right above the replay bar; the user can still drag it anywhere */
  /* hide Ask AI while a sheet is open so it never covers a tool */
  body:has(.rp-more-open) .ask-ai-fab, body[data-page="replay"]:has(.rp-term .rp-panel:not([data-panel="replay"]):not([hidden])) .ask-ai-fab { display:none; }
  html body[data-page="replay"] .ask-ai-fab { left:auto; right:10px; bottom:calc(76px + env(safe-area-inset-bottom, 0px)); width:40px; height:40px; padding:0; justify-content:center; opacity:.92; }
}

/* landscape phones: everything shrinks so the chart gets the screen */
@media (max-height:480px) and (pointer:coarse) {
  .rp-top { padding:2px 6px; }
  .rp-streakpop { right:auto; width:min(320px, calc(100% - 64px)); }
  .rp-tb .rp-tbtn, .rp-tb-right .rp-tbtn { min-height:36px; }
  .rp-panel[data-panel="replay"] { left:auto !important; right:8px !important; width:auto !important; max-width:min(540px, calc(100% - 16px)); }
  .rp-panel[data-panel="replay"] .rp-bar .btn { min-height:38px; }
  .rp-term:has(.rp-panel[data-panel="replay"]:not([hidden])) { --rp-bottombar:54px; }
  .rp-panel:not([data-panel="replay"]) { left:auto !important; right:0 !important; top:0 !important; bottom:var(--rp-bottombar, 0px) !important; width:min(420px, 48%) !important; max-height:none !important; border-radius:18px 0 0 18px; }
  .rp-top.rp-has-more.rp-more-open .rp-tb-right { grid-template-columns:repeat(5, minmax(0, 1fr)); padding:10px 10px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .rp-top.rp-more-open .rp-tb-right .rp-tbtn { min-height:46px; }
}

/* ===== Timeframe strip: 1m 3m 5m 15m 30m 1h 4h D W M 12M ===== */
.rp-tfbar { display:inline-flex; align-items:center; gap:2px; padding:2px; border-radius:10px; background:color-mix(in srgb, var(--bg-secondary) 70%, transparent); border:1px solid var(--glass-border, var(--border-color)); flex:0 0 auto; }
.rp-tfbtn { appearance:none; border:0; background:transparent; color:var(--text-secondary); font:600 12.5px/1 inherit; font-family:inherit; min-width:34px; height:28px; padding:0 8px; border-radius:8px; cursor:pointer; white-space:nowrap; transition:background .12s, color .12s; }
.rp-tfbtn:hover { background:var(--bg-tertiary); color:var(--text-primary); }
.rp-tfbtn.active { background:var(--accent-primary); color:#fff; box-shadow:0 1px 6px rgba(0, 0, 0, .25); }
.rp-tfbtn:focus-visible { outline:2px solid var(--accent-primary); outline-offset:1px; }
#rpMenuTf { display:none !important; }
@media (max-width:760px), (max-height:480px) and (pointer:coarse) {
  .rp-tfbar { flex:0 0 auto; }
  .rp-tfbtn { min-width:40px; height:36px; font-size:13px; }
}
