
.rb-sim-bar { display: flex; align-items: center; gap: 12px; margin: 12px 0; padding: 10px 14px; }
.rb-sim-bar-icon { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #0b0f0c; font-size: .8rem; }
/* RB_RACE_SIM_BRAND_V1: Racing Brain branding on the simulator */
.rb-sim-bar { border-left: 3px solid var(--accent); background-image: linear-gradient(90deg, rgba(185,255,53,.07), rgba(0,229,255,.03) 45%, transparent 70%); }
.rb-sim-bar-logo { flex: none; width: 40px; height: 40px; position: relative; }
.rb-sim-bar-logo img { width: 40px; height: 40px; object-fit: contain; display: block; }
.rb-sim-bar-logo i { position: absolute; right: -2px; bottom: 0; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #0b0f0c; font-size: .5rem; font-style: normal; box-shadow: 0 0 0 2px var(--panel, #0f1311); }
.rb-sim-bar-text b em { font-style: normal; color: var(--accent); }
.rb-sim-box { border-top: 3px solid transparent; background-image: linear-gradient(var(--panel, #0f1311), var(--panel, #0f1311)), linear-gradient(90deg, #b9ff35, #00e5ff); background-origin: border-box; background-clip: padding-box, border-box; }
.rb-sim-brand { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rb-sim-brand img { height: 40px; width: auto; display: block; }
.rb-sim-brand h2 { padding-left: 12px; border-left: 1px solid var(--border); color: var(--accent); }
.rb-sim-end-brand { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.rb-sim-end-brand h3 { margin: 0 !important; }
.rb-sim-end-brand img { height: 24px; width: auto; display: block; opacity: .95; }
@media (max-width: 560px) { .rb-sim-brand img { height: 30px; } .rb-sim-brand h2 { font-size: .86rem; padding-left: 9px; } }
.rb-sim-bar-text { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.rb-sim-bar-text b { font-size: .74rem; letter-spacing: .08em; font-weight: 800; }
.rb-sim-bar-text span { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-sim-btn { flex: none; border: 1px solid var(--border); background: var(--panel-soft); color: var(--text); border-radius: 999px; padding: 7px 14px; font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.rb-sim-btn:hover { border-color: var(--accent); }
.rb-sim-btn.is-primary { background: var(--accent); border-color: var(--accent); color: #0b0f0c; }
.rb-sim-btn:focus-visible, .rb-sim-x:focus-visible, .rb-sim-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rb-sim-lock { font-size: .6rem; font-weight: 800; letter-spacing: .06em; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }

.rb-sim { position: fixed; inset: 0; z-index: 100000; background: rgba(3, 5, 4, .82); display: flex; align-items: center; justify-content: center; padding: 18px; }
.rb-sim[hidden] { display: none; }
.rb-sim-box { width: min(1180px, 100%); max-height: 100%; overflow: auto; background: var(--panel, #0f1311); border: 1px solid var(--border, #252c28); border-radius: 16px; color: var(--text, #f4f7f5); box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.rb-sim-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px 10px; }
.rb-sim-title { min-width: 0; flex: 1; }
.rb-sim-title h2 { margin: 0; font-size: 1rem; letter-spacing: .06em; font-weight: 800; }
.rb-sim-title p { margin: 3px 0 0; color: var(--muted); font-size: .8rem; }
.rb-sim-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rb-sim-chip { font-size: .66rem; font-weight: 800; letter-spacing: .05em; padding: 3px 8px; border-radius: 999px; background: var(--panel-soft); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.rb-sim-chip.is-on { color: var(--text); }
.rb-sim-x { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: var(--panel-soft); color: var(--text); font-size: 1.1rem; line-height: 1; cursor: pointer; }
.rb-sim-main { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 12px; padding: 0 16px; }
.rb-sim-stage { position: relative; min-width: 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: #08120c; }
.rb-sim-stage canvas { display: block; width: 100%; height: clamp(240px, 46vh, 430px); }
.rb-sim-call { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 12px; border-top: 1px solid var(--border); background: var(--panel); font-size: .88rem; }
.rb-sim-call b { flex: none; font-size: .64rem; letter-spacing: .07em; color: var(--accent); }
.rb-sim-call span { min-width: 0; }
.rb-sim-end { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); width: min(440px, calc(100% - 24px)); background: rgba(9, 13, 11, .94); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.rb-sim-end[hidden] { display: none; }
.rb-sim-end h3 { margin: 0 0 8px; font-size: .74rem; letter-spacing: .08em; }
.rb-sim-end ol { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.rb-sim-end li { display: flex; align-items: center; gap: 8px; font-size: .86rem; min-width: 0; }
.rb-sim-end li img { width: 22px; height: 28px; object-fit: cover; border-radius: 4px; background: #fff; flex: none; }
.rb-sim-end li .p { flex: none; font-size: .66rem; font-weight: 800; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--panel-soft); }
.rb-sim-end li:first-child .p { background: var(--accent); border-color: var(--accent); color: #0b0f0c; }
.rb-sim-end li .n { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rb-sim-end li .m { margin-left: auto; color: var(--muted); font-size: .76rem; white-space: nowrap; }
.rb-sim-end .rb-sim-end-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rb-sim-side { min-width: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-soft); display: flex; flex-direction: column; overflow: hidden; }
/* the race view sets the height; a long field scrolls inside the list instead of stretching the dialog */
@media (min-width: 861px) { .rb-sim-side { contain: size; min-height: 0; } }
.rb-sim-side h3 { margin: 0; padding: 9px 12px; font-size: .68rem; letter-spacing: .08em; border-bottom: 1px solid var(--border); }
.rb-sim-order { position: relative; flex: 1; overflow-y: auto; min-height: 120px; }
.rb-sim-row { position: absolute; left: 0; right: 0; top: 0; height: 30px; display: flex; align-items: center; gap: 7px; padding: 0 10px; font-size: .8rem; cursor: pointer; transition: transform .45s ease; border-bottom: 1px solid rgba(255,255,255,.04); background: none; border-left: 0; border-right: 0; border-top: 0; color: inherit; font-family: inherit; width: 100%; text-align: left; }
.rb-sim-row.is-sel { background: rgba(185, 255, 53, .1); }
.rb-sim-row .p { flex: none; width: 22px; text-align: center; font-weight: 800; font-size: .7rem; color: var(--muted); }
.rb-sim-row.is-lead .p { color: var(--accent); }
.rb-sim-row img { flex: none; width: 18px; height: 24px; object-fit: cover; border-radius: 3px; background: #fff; }
.rb-sim-row .n { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.rb-sim-row .n small { color: var(--muted); font-weight: 700; margin-right: 4px; }
.rb-sim-row .g { flex: none; color: var(--muted); font-size: .72rem; font-variant-numeric: tabular-nums; }
.rb-sim-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; }
.rb-sim-speed { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.rb-sim-speed button { border: 0; background: var(--panel-soft); color: var(--muted); font: inherit; font-size: .76rem; font-weight: 700; padding: 7px 10px; cursor: pointer; }
.rb-sim-speed button[aria-pressed="true"] { background: var(--accent); color: #0b0f0c; }
.rb-sim-spacer { flex: 1; }
.rb-sim-seed { color: var(--muted); font-size: .72rem; }
.rb-sim-sum { padding: 0 16px 12px; }
.rb-sim-sum[hidden] { display: none; }
.rb-sim-sum p { margin: 0 0 8px; color: var(--muted); font-size: .78rem; }
.rb-sim-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.rb-sim-table th { text-align: left; color: var(--muted); font-size: .64rem; letter-spacing: .06em; font-weight: 800; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.rb-sim-table td { padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,.05); white-space: nowrap; }
.rb-sim-table td.h { white-space: normal; font-weight: 600; }
.rb-sim-table td.h small { color: var(--muted); font-weight: 700; margin-right: 4px; }
.rb-sim-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.rb-sim-winbar { display: inline-block; vertical-align: middle; height: 6px; border-radius: 3px; background: var(--accent); margin-right: 6px; }
.rb-sim-note { margin: 0; padding: 0 16px 14px; color: var(--muted); font-size: .72rem; }
@media (max-width: 860px) {
  .rb-sim { padding: 0; align-items: stretch; }
  .rb-sim-box { border-radius: 0; border: 0; max-height: none; height: 100%; }
  .rb-sim-main { grid-template-columns: minmax(0, 1fr); padding: 0 10px; }
  .rb-sim-head { padding: 12px 12px 8px; }
  .rb-sim-side { max-height: 260px; }
  .rb-sim-order { min-height: 0; height: 220px; }
  .rb-sim-controls { padding: 10px 12px; gap: 6px; }
  .rb-sim-sum { padding: 0 12px 12px; overflow-x: auto; }
  .rb-sim-note { padding: 0 12px 16px; }
  .rb-sim-table .hide-m { display: none; }
}
@media (max-width: 560px) {
  .rb-sim-bar-text span { white-space: normal; }
  .rb-sim-stage canvas { height: 250px; }
}
