:root {
  --orange: #FF7B25; --orange-light: #FF9B52; --orange-deep: #F05A0A;
  --cream: #FFEDE2; --paper: #FFF8F3; --yellow: #FCD77B;
  --dark: #2E2626; --muted: #7A6E6A; --line: #EADBD1; --red: #C0392B;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Open Sans", system-ui, sans-serif; color: var(--dark); background: var(--paper); }
h1, h2, h3, .brandmark, .tabs button { font-family: "Teko", sans-serif; text-transform: uppercase; letter-spacing: .5px; }
h1 { font-size: 40px; margin: 0 0 8px; line-height: 1; }
h2 { font-size: 30px; margin: 0 0 6px; line-height: 1; }
h3 { font-size: 24px; margin: 0; line-height: 1; }
code { background: var(--cream); padding: 1px 5px; border-radius: 4px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--red); min-height: 1.2em; }

.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 24px;
  background: linear-gradient(135deg, var(--orange-light), var(--orange), var(--orange-deep)); color: #fff; }
.brandmark { font-size: 34px; display: flex; align-items: center; gap: 12px; line-height: 1; }
.brandmark img { height: 26px; width: auto; display: block; }
.brandmark span { opacity: .8; padding-top: 5px; }
.who { font-size: 14px; display: flex; gap: 12px; align-items: center; }
.who button { background: rgba(255,255,255,.2); color: #fff; border: 1px solid #fff; }

.panel { background: #fff; border-radius: 16px; padding: 24px; margin: 32px auto; box-shadow: 0 6px 24px rgba(255,123,37,.08); }
.narrow { max-width: 420px; }
label { display: block; font-weight: 600; font-size: 14px; margin: 12px 0; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=date], input[type=time], input[type=search], textarea, select {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-weight: 400; background: #fff; }
textarea { min-height: 70px; resize: vertical; }
button { font: inherit; font-weight: 700; border: 1px solid var(--line); background: #fff; color: var(--dark);
  padding: 9px 16px; border-radius: 10px; cursor: pointer; }
button.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
button.danger { color: var(--red); border-color: #f1c4bf; }
button:disabled { opacity: .5; cursor: default; }

main { max-width: 1100px; margin: 0 auto; padding: 16px 24px 60px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 2px solid var(--line); }
.tabs button { font-size: 24px; border: none; background: none; padding: 6px 14px; border-bottom: 3px solid transparent;
  margin-bottom: -2px; border-radius: 0; color: var(--muted); }
.tabs button.active { color: var(--orange); border-bottom-color: var(--orange); }
.brandbar { margin: 14px 0 20px; display: flex; gap: 10px; align-items: center; font-weight: 600; }
.brandbar select { width: auto; margin: 0; }

.card { background: #fff; border-radius: 14px; padding: 18px; margin-bottom: 16px; box-shadow: 0 4px 16px rgba(255,123,37,.07); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 860px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.note { background: var(--cream); padding: 10px 12px; border-radius: 10px; font-size: 14px; }

/* iPhone preview */
.phone { width: 200px; height: 410px; border-radius: 30px; border: 8px solid var(--dark); overflow: hidden; position: relative;
  margin: 10px auto; background: linear-gradient(135deg, var(--orange-light), var(--orange), var(--orange-deep));
  background-size: cover; background-position: center; color: #fff; }
.phone .scrim { position: absolute; inset: 0; background: linear-gradient(rgba(0,0,0,.45), rgba(0,0,0,.15), rgba(0,0,0,.55)); }
.phone .content { position: absolute; inset: 0; padding: 26px 14px; display: flex; flex-direction: column; gap: 4px; }
.phone .big { font-family: Teko, sans-serif; font-size: 54px; line-height: .9; }
.phone .label { font-family: Teko, sans-serif; font-size: 18px; text-transform: uppercase; opacity: .9; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: none; border-radius: 0; font-weight: 600; }
.seg button.on { background: var(--orange); color: #fff; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
th { font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .5px; }
td select { margin: 0; }
audio { height: 32px; max-width: 220px; }

.prize-preview { border: 2px solid var(--yellow); border-radius: 14px; padding: 12px; max-width: 300px; background: #fff; }
.prize-preview img { width: 100%; height: 120px; object-fit: cover; border-radius: 10px; display: block; margin-bottom: 8px; }
.prize-preview .claim { margin-top: 8px; background: var(--orange); color: #fff; text-align: center; padding: 8px; border-radius: 10px; font-weight: 700; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--dark); color: #fff;
  padding: 10px 18px; border-radius: 12px; font-weight: 600; z-index: 9; }
.toast.err { background: var(--red); }

/* Bot Racers */
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; display: inline-flex; align-items: center;
  justify-content: center; background: var(--orange); color: #fff; font-family: Teko, sans-serif; font-size: 18px; flex: none; }
.avatar.lg { width: 96px; height: 96px; font-size: 44px; }
.switch { position: relative; width: 44px; height: 26px; display: inline-block; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; margin: 0; }
.switch span { position: absolute; inset: 0; background: #d9cfc8; border-radius: 26px; transition: .15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; border-radius: 50%;
  background: #fff; transition: .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--orange); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:disabled + span { opacity: .5; cursor: default; }
.bots td:first-child, .bots th:first-child { width: 28px; }
.bots tr.off td { color: var(--muted); }
.bots tr.off .avatar { filter: grayscale(1); opacity: .6; }
.pace { display: flex; gap: 6px; align-items: center; }
.pace input { width: 80px; margin: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; border-radius: 999px;
  background: rgba(255,255,255,.22); color: #fff; font-size: 14px; }
.chip .avatar { width: 24px; height: 24px; font-size: 12px; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--orange); }
th.sortable.active { color: var(--orange); }
th.sortable .arrow { font-size: 10px; opacity: .7; }

/* Live Audio schedule (build 18) */
.daystrip { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 10px; align-items: center; }
.daystrip button { white-space: nowrap; flex: 0 0 auto; }
.daystrip button.active { background: var(--orange); border-color: var(--orange); color: #fff; }
.daystrip input[type=date] { flex: 0 0 auto; width: auto; }
.schedlist { display: flex; flex-direction: column; gap: 8px; }
.schedrow { display: grid; grid-template-columns: 80px 1fr auto auto auto; gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: 12px; background: var(--cream); }
.schedrow.live { background: #fde8e8; }
.schedrow .when { font-weight: 700; font-size: 18px; }
.small { font-size: 13px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; background: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; }
.badge.live { background: #d33; color: #fff; }
.badge.big { font-size: 15px; padding: 5px 14px; }
.card.onair { border: 2px solid #d33; }
.meter { height: 14px; background: #eee; border-radius: 6px; overflow: hidden; margin: 10px 0; }
.meterfill { height: 100%; width: 0; border-radius: 6px; transition: width .05s; }
@media (max-width: 700px) { .schedrow { grid-template-columns: 64px 1fr; } }
.daystrip input[type=date] { margin-top: 0; padding: 7px 10px; }
.row input[type=search] { margin-top: 0; }
.schedhead { margin: 22px 0 14px; }

/* Schedule a host: race picker (SCRUM-31) */
.pickfilters { display: grid; grid-template-columns: 200px 1fr; gap: 12px; }
@media (max-width: 700px) { .pickfilters { grid-template-columns: 1fr; } }
.pickfilters label { margin: 0; }
.pickhead { font-size: 20px; margin: 18px 0 8px; }
.pickscroll { max-height: 320px; overflow-y: auto; padding: 2px; }
button.pickrow { width: 100%; text-align: left; font-weight: 400; border: 2px solid transparent; grid-template-columns: 80px 1fr auto auto; }
button.pickrow:hover, .slot:hover { border-color: var(--orange-light); }
button.pickrow.picked, .slot.picked { border-color: var(--orange); background: #fff; }
.slotgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; max-height: 210px; overflow-y: auto; padding: 2px; }
.slot { padding: 7px 6px; font-weight: 600; white-space: nowrap; border: 2px solid var(--line); }
.slot.hosted { background: var(--cream); }
.slot .dot { color: var(--orange); font-size: 10px; margin-left: 4px; vertical-align: middle; }
.picksummary { margin: 18px 0 4px; padding: 12px 14px; border: 2px solid var(--orange); border-radius: 12px; background: var(--paper);
  display: flex; flex-direction: column; gap: 4px; }

/* SCRUM-30: styled file picker (a clear call to action instead of the bare browser control). */
.filepick { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 14px 16px; cursor: pointer;
  border: 2px dashed var(--orange); border-radius: 12px; background: var(--cream); color: var(--dark); font-weight: 600; }
.filepick:hover { background: #ffe2cf; }
.filepick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.filepick .icon { width: 36px; height: 36px; border-radius: 50%; background: var(--orange); color: #fff; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 20px; line-height: 1; }
.filepick .name { font-weight: 400; color: var(--muted); font-size: 13px; }
.fieldhint { display: block; font-weight: 400; color: var(--muted); font-size: 13px; margin-top: 4px; }

/* SCRUM-30: in-app previews of a race card, drawn at the app's real point sizes (iPhone 18 Pro, 402 pt). */
.previews { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 14px; }
.pv { width: 402px; max-width: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 16px 20px 20px; }
.pv .pvlabel { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }
.pv .sechead { display: flex; align-items: center; gap: 10px; font-family: Teko, sans-serif; font-size: 26px; text-transform: uppercase; color: var(--dark); margin-bottom: 8px; }
.pv .sechead::before { content: ""; width: 4px; height: 22px; border-radius: 2px; background: var(--orange); }
.pvcard { position: relative; display: flex; align-items: center; gap: 14px; min-height: 104px; padding: 16px; border-radius: 14px;
  overflow: hidden; background: #fff; color: var(--dark); }
.pvcard.img, .pvhero { background: linear-gradient(135deg, var(--orange-light), var(--orange), var(--orange-deep)); color: #fff; }
.pvbg { position: absolute; inset: 0; background-size: cover; background-position: center; }
.pvcard .pvscrim { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.55), rgba(0,0,0,.25), rgba(0,0,0,.55)); }
.pvhero .pvscrim { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.55), rgba(0,0,0,.25), rgba(0,0,0,.55)); }
.pvcard .txt, .pvhero .txt { position: relative; flex: 1; min-width: 0; }
.pvcard .nm { font-family: Teko, sans-serif; font-weight: 600; font-size: 24px; line-height: 1.05; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pvcard .nm .star { color: var(--orange); font-size: 12px; margin-right: 6px; vertical-align: 3px; }
.pvcard .wh { font-size: 14px; font-weight: 600; }
.pvcard .sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pvcard.img .sub { color: rgba(255,255,255,.9); }
.pvtag { position: relative; font-family: Teko, sans-serif; font-weight: 600; font-size: 18px; padding: 0 10px; border-radius: 999px; background: var(--cream); color: var(--orange); flex: none; }
.pvhero { position: relative; border-radius: 18px; padding: 20px; overflow: hidden; }
.pvhero .row1 { display: flex; align-items: center; justify-content: space-between; }
.pvhero .kind { font-family: Teko, sans-serif; font-weight: 600; font-size: 18px; padding: 0 10px; border-radius: 999px; background: rgba(255,255,255,.25); }
.pvhero .big { font-family: Teko, sans-serif; font-weight: 600; font-size: 44px; line-height: 1; text-transform: uppercase; margin-top: 8px; }
.pvhero .wh { font-size: 16px; font-weight: 600; margin-top: 2px; }
.pvhero .host { display: inline-block; margin-top: 8px; font-family: Teko, sans-serif; font-weight: 500; font-size: 18px; padding: 0 12px; border-radius: 999px; background: #fff; color: var(--orange); }
.pvhero .starts { font-family: Teko, sans-serif; font-weight: 500; font-size: 20px; opacity: .85; margin-top: 10px; }
.pvhero .cd { font-family: Teko, sans-serif; font-weight: 600; font-size: 44px; line-height: .9; }

/* SCRUM-24: race-screen previews with the app's real UI captured on top. */
.vtools { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 6px 0 14px; }
.vtools select { width: auto; display: inline-block; margin: 0 0 0 6px; }
.vtools label { margin: 0; display: flex; align-items: center; gap: 6px; font-weight: 600; }
.uibadge { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--cream); padding: 3px 8px; border-radius: 999px; }
.phone2 { position: relative; overflow: hidden; border: 7px solid var(--dark); background: linear-gradient(135deg, var(--orange-light), var(--orange), var(--orange-deep)); margin: 8px auto; }
.phone2 .bg { position: absolute; inset: 0; background-size: cover; background-position: center; }
.phone2 .scrim { position: absolute; inset: 0; background: linear-gradient(rgba(0,0,0,.45), rgba(0,0,0,.15), rgba(0,0,0,.55)); }
.phone2 .ui { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.phone2 .noui { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-family: Teko, sans-serif; font-size: 22px; text-align: center; padding: 20px; }
.segsmall { display: flex; gap: 4px; justify-content: center; margin-top: 4px; }
.segsmall button { padding: 3px 10px; font-size: 12px; }
.segsmall button.on { background: var(--dark); color: #fff; border-color: var(--dark); }

/* Visuals cards: centered, aligned across the row (titles, toggles, phones and controls line up). */
.vcard { display: flex; flex-direction: column; align-items: center; text-align: center; }
.vcard h3 { margin-bottom: 14px; }
.vcard .vtoggle { min-height: 30px; display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.vcard .phone2 { margin: 6px auto 14px; }
.vcard .seg { justify-content: center; }
.vcard .filepick { width: 100%; text-align: left; }
.vcard .vactions { margin-top: auto; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 4px; }
.vcard .vactions .note { margin: 0; }

/* SCRUM-24 part 2: drag / zoom framing. */
.phone2.framable { cursor: grab; touch-action: none; user-select: none; }
.phone2.framable.dragging { cursor: grabbing; }
.phone2 img.bgimg { position: absolute; max-width: none; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.phone2 .safe { position: absolute; border: 2px dashed rgba(255,255,255,.95); box-shadow: 0 0 0 1px rgba(0,0,0,.45); pointer-events: none; }
.framebar { display: flex; align-items: center; gap: 8px; justify-content: center; width: 100%; font-size: 13px; color: var(--muted); }
.framebar input[type=range] { width: 120px; }
.framebar button { padding: 4px 10px; font-size: 12px; }
.warnbadge { font-size: 12px; font-weight: 700; color: #7a4a00; background: var(--yellow); padding: 3px 8px; border-radius: 999px; }

/* Races tab rows: the card image leads (same shape as the app's race card), tiny × controls. */
.racerow { position: relative; display: grid; grid-template-columns: 240px 1fr auto; gap: 16px; align-items: center;
  padding: 12px 40px 12px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
.racetile { position: relative; width: 240px; height: 70px; border-radius: 10px; overflow: hidden; cursor: pointer;
  background: #fff center / cover no-repeat; border: 1px solid var(--line); }
.racetile.empty { background: repeating-linear-gradient(135deg, #fff 0 10px, #faf3ee 10px 20px); }
.racetile .hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 700; color: #fff; background: rgba(46,38,38,.55); opacity: 0; transition: opacity .15s; }
.racetile.empty .hint { color: var(--muted); background: none; }
.racetile:hover .hint, .racetile.empty:hover .hint { opacity: 1; }
.xbtn { position: absolute; width: 22px; height: 22px; padding: 0; border-radius: 50%; border: none; line-height: 22px;
  font-size: 12px; font-weight: 700; text-align: center; cursor: pointer; }
.racetile .xbtn { top: 5px; right: 5px; background: rgba(0,0,0,.6); color: #fff; z-index: 1; }
.racetile .xbtn:hover { background: rgba(0,0,0,.85); }
.racerow > .xbtn.del { top: 8px; right: 8px; background: transparent; color: var(--muted); }
.racerow > .xbtn.del:hover { background: #f6e1dc; color: var(--red); }
.racerow .what b { font-size: 16px; }
.racerow .meta { display: flex; align-items: center; gap: 8px; }
@media (max-width: 760px) { .racerow { grid-template-columns: 1fr; } .racetile { width: 100%; height: 90px; } }
