@import url('https://fonts.googleapis.com/css2?family=Google+Sans+Flex:wght@100..900&family=Lobster+Two:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  --ink: #24214d;
  --muted: #747393;
  --muted-deep: #5a5875;
  --purple: #5b5bd6;
  --purple-dark: #4747b9;
  --purple-soft: #eeedff;
  --orange: #ff8f50;
  --orange-dark: #df6831;
  --orange-soft: #fff0e6;
  --teal: #52b8a8;
  --teal-soft: #e7f8f3;
  --yellow: #ffd968;
  --line: #ebe9f4;
  --race-accent: #ff8f50;
  --race-accent-dark: #df6831;
  --race-soft: #fff0e6;
  --race-flag: #5b5bd6;
  --shadow: 0 18px 45px rgba(55, 49, 116, 0.08);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; color: var(--ink); background: #f7f6ff; background-image: radial-gradient(circle at 9% 10%, rgba(255,217,104,.17), transparent 19rem), radial-gradient(circle at 96% 22%, rgba(82,184,168,.13), transparent 22rem), linear-gradient(125deg, #f8f7ff 0%, #f9f8ff 44%, #fffaf6 100%); font-family: 'Google Sans Flex', 'Segoe UI', sans-serif; font-size: 15px; line-height: 1.45; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid rgba(91,91,214,.3); outline-offset: 3px; }

.race-shell { position: relative; z-index: 1; width: min(100% - 52px, 1370px); margin: 0 auto; padding: 24px 0 18px; }
.race-topbar, .race-hero, .race-layout, .race-footer { position: relative; z-index: 1; }
.race-topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 58px; height: 50px; color: #fff; background: var(--purple); border: 3px solid #fff; border-radius: 16px 16px 16px 5px; box-shadow: 0 6px 0 #4545ac; font-size: 22px; font-weight: 900; letter-spacing: -.06em; transform: rotate(-3deg); }
.brand-copy { display: flex; flex-direction: column; gap: 0; }.brand-copy strong { font-size: 16px; letter-spacing: .075em; line-height: 1; }.brand-copy small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.topbar-right { display: flex; align-items: center; gap: 9px; }.game-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }.game-nav a { display: inline-flex; align-items: center; gap: 5px; padding: 8px 9px; color: var(--muted-deep); background: rgba(255,255,255,.55); border: 1px solid var(--line); border-radius: 10px; font-size: 11px; font-weight: 800; text-decoration: none; }.game-nav a:hover, .game-nav a[aria-current='page'] { color: var(--purple-dark); background: var(--purple-soft); border-color: #c8c6ef; }.game-nav .nav-icon { font-size: 14px; line-height: 1; }
.sync-status { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; color: var(--muted-deep); background: rgba(255,255,255,.65); border: 1px solid rgba(222,220,243,.9); border-radius: 100px; font-size: 12px; font-weight: 700; }.status-dot { width: 8px; height: 8px; background: var(--yellow); border-radius: 50%; box-shadow: 0 0 0 4px rgba(255,217,104,.2); }.sync-status[data-state='ready'] .status-dot { background: var(--teal); box-shadow: 0 0 0 4px rgba(82,184,168,.16); }.sync-status[data-state='offline'] .status-dot { background: var(--orange); box-shadow: 0 0 0 4px rgba(255,143,80,.16); }.sync-status[data-state='loading'] .status-dot { animation: blink 1s infinite; }@keyframes blink { 50% { opacity: .35; } }
.back-link { display: inline-flex; align-items: center; gap: 6px; padding: 8px 11px; color: var(--purple-dark); background: rgba(255,255,255,.64); border: 1px solid var(--line); border-radius: 11px; font-size: 12px; font-weight: 700; text-decoration: none; transition: background .2s, border-color .2s; }.back-link:hover { background: var(--purple-soft); border-color: #c8c6ef; }.back-link svg, .refresh-button svg, .start-button svg, .race-hint svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }.avatar { display: grid; place-items: center; width: 38px; height: 38px; color: var(--purple-dark); background: var(--yellow); border: 3px solid #fff; border-radius: 50%; font-size: 12px; font-weight: 900; box-shadow: 0 3px 0 #e6bd41; }

.race-hero { display: flex; align-items: center; justify-content: space-between; min-height: 190px; padding: 37px 8% 21px 4%; }.race-hero > div:first-child { max-width: 700px; }.eyebrow, .section-kicker { color: var(--purple); font-size: 11px; font-weight: 900; letter-spacing: .14em; }.eyebrow { display: flex; align-items: center; gap: 8px; }.eyebrow i { display: inline-block; width: 25px; height: 3px; background: var(--race-accent); border-radius: 10px; }.race-hero h1 { margin: 9px 0 0; font-family: 'Lobster Two', Georgia, cursive; font-size: clamp(48px, 5vw, 72px); font-weight: 700; letter-spacing: -.04em; line-height: .95; }.race-hero h1 span { color: var(--race-accent); }.race-hero p { max-width: 590px; margin-top: 13px; color: var(--muted-deep); font-size: 15px; }.hero-sticker { display: grid; place-items: center; width: 132px; height: 100px; color: #fff; background: var(--race-accent); border: 6px solid #fff; border-radius: 38px 38px 38px 9px; box-shadow: 0 9px 0 rgba(72,69,178,.18); font-size: 58px; transform: rotate(5deg); }

.race-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, .75fr); align-items: start; gap: 18px; }.panel-card { background: rgba(255,255,255,.89); border: 1px solid rgba(232,230,244,.95); border-radius: 24px; box-shadow: var(--shadow); }.race-card { min-width: 0; padding: 24px 25px 20px; }.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }.section-heading h2 { margin: 3px 0 0; font-size: 25px; font-weight: 900; letter-spacing: -.03em; line-height: 1.1; }.people-count { display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px; color: var(--muted-deep); background: #faf9ff; border: 1px solid var(--line); border-radius: 99px; font-size: 11px; white-space: nowrap; }.people-count strong { color: var(--purple-dark); font-size: 13px; }
.race-track-wrap { margin-top: 19px; padding: 10px; background: #f4f2ff; border: 1px dashed #d8d6ef; border-radius: 18px; }.track-header { display: flex; align-items: center; justify-content: space-between; padding: 0 10px 8px 43px; color: #a09fbd; font-size: 9px; font-weight: 900; letter-spacing: .1em; }.track-header span:last-child { color: var(--race-accent-dark); }.race-track { display: flex; flex-direction: column; gap: 7px; max-height: 546px; overflow-y: auto; padding: 2px 4px 3px 2px; scrollbar-width: thin; scrollbar-color: #d8d6ef transparent; }.race-lane { display: grid; grid-template-columns: 32px minmax(112px, .65fr) minmax(180px, 1fr); align-items: center; gap: 8px; min-height: 42px; padding: 5px 7px 5px 4px; background: rgba(255,255,255,.8); border: 1px solid #e8e6f3; border-radius: 12px; transition: border-color .2s, background .2s, box-shadow .2s; }.race-lane.is-winner { background: #fff8ee; border-color: #ffd5b3; box-shadow: 0 3px 10px rgba(255,143,80,.12); }.lane-number { display: grid; place-items: center; width: 27px; height: 27px; color: var(--purple-dark); background: var(--purple-soft); border-radius: 8px; font-size: 10px; font-weight: 900; }.lane-info { min-width: 0; }.lane-name { display: block; overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }.lane-status { display: block; margin-top: 1px; color: var(--muted); font-size: 9px; }.race-lane.is-winner .lane-status { color: var(--race-accent-dark); font-weight: 800; }.lane-runway { position: relative; height: 29px; overflow: hidden; background: linear-gradient(180deg, #f8f7ff, #eeedff); border: 1px solid #dfddf2; border-radius: 99px; }.lane-runway::before { position: absolute; top: 50%; right: 5%; left: 4%; height: 2px; content: ''; background: repeating-linear-gradient(90deg, #d0cee9 0 9px, transparent 9px 17px); transform: translateY(-50%); }.lane-runway::after { position: absolute; top: 2px; right: 5%; bottom: 2px; width: 4px; content: ''; background: repeating-linear-gradient(180deg, var(--race-flag) 0 4px, #fff 4px 8px); border-radius: 2px; opacity: .85; }.racer { position: absolute; top: 50%; z-index: 1; left: 7%; display: grid; place-items: center; width: 28px; height: 28px; font-size: 22px; line-height: 1; filter: drop-shadow(0 3px 2px rgba(55,49,116,.18)); transform: translate(-50%, -50%); transition: left .08s linear; }.race-lane.is-winner .racer { filter: drop-shadow(0 3px 2px rgba(223,104,49,.28)); }.track-empty { padding: 30px 15px; color: var(--muted); text-align: center; }.track-empty strong { display: block; margin-bottom: 3px; color: var(--ink); font-size: 15px; }
.race-actions { display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 13px; }.start-button, .refresh-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; border-radius: 14px; font-size: 13px; font-weight: 900; }.start-button { min-width: 185px; padding: 10px 17px; color: #fff; background: var(--race-accent); border: 0; box-shadow: 0 5px 0 var(--race-accent-dark); transition: transform .2s, background .2s, box-shadow .2s; }.start-button:hover:not(:disabled) { background: var(--race-accent-dark); box-shadow: 0 2px 0 var(--race-accent-dark); transform: translateY(3px); }.start-button:disabled, .refresh-button:disabled { cursor: not-allowed; opacity: .58; }.start-button svg { width: 18px; height: 18px; }.refresh-button { padding: 9px 12px; color: var(--purple-dark); background: var(--purple-soft); border: 1px solid #d9d8f5; }.refresh-button:hover:not(:disabled) { background: #e2e1ff; }
.remove-toggle { display: inline-flex; align-items: center; gap: 8px; width: fit-content; max-width: 100%; min-height: 39px; margin: 12px auto 0; padding: 8px 11px; color: var(--purple-dark); background: #faf9ff; border: 1px solid var(--line); border-radius: 12px; font-size: 11px; font-weight: 800; cursor: pointer; user-select: none; }.remove-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }.toggle-track { position: relative; flex: 0 0 34px; width: 34px; height: 20px; background: #d9d7ed; border-radius: 99px; transition: background .2s; }.toggle-track::after { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; content: ''; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(55,49,116,.18); transition: transform .2s; }.remove-toggle input:checked + .toggle-track { background: var(--teal); }.remove-toggle input:checked + .toggle-track::after { transform: translateX(14px); }.remove-toggle input:focus-visible + .toggle-track { outline: 3px solid rgba(91,91,214,.3); outline-offset: 3px; }
.race-hint { display: flex; align-items: center; justify-content: center; gap: 5px; margin: 12px 0 0; color: var(--muted); font-size: 11px; text-align: center; }.race-hint svg { flex: 0 0 14px; width: 14px; height: 14px; }

.side-stack { display: flex; flex-direction: column; gap: 15px; min-width: 0; }.result-card { position: relative; min-height: 204px; padding: 21px 22px; overflow: hidden; color: #fff; background: var(--purple); border-color: var(--purple); box-shadow: 0 12px 0 rgba(72,69,178,.18); }.result-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }.result-topline .section-kicker { color: #d8d8ff; }.result-status { padding: 4px 7px; color: var(--purple-dark); background: var(--yellow); border-radius: 6px; font-size: 9px; font-weight: 900; letter-spacing: .08em; }.result-name { position: relative; z-index: 1; max-width: 86%; min-height: 55px; margin-top: 20px; overflow-wrap: anywhere; font-family: 'Lobster Two', Georgia, cursive; font-size: clamp(35px, 3.3vw, 52px); font-weight: 700; line-height: 1.02; white-space: normal; }.result-card p { position: relative; z-index: 1; max-width: 77%; margin: 9px 0 0; color: #e3e2ff; font-size: 12px; line-height: 1.35; }.result-ribbon { position: absolute; right: -16px; bottom: -23px; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 103px; height: 103px; color: var(--purple-dark); background: var(--yellow); border: 6px solid rgba(255,255,255,.28); border-radius: 50%; transform: rotate(-12deg); }.result-ribbon span { font-size: 39px; font-weight: 900; line-height: .75; }.result-ribbon small { font-size: 13px; font-weight: 900; }.result-card[data-state='winner'] { background: #4f49bd; }.result-card[data-state='winner'] .result-status { color: #207c70; background: var(--teal-soft); }.result-card[data-state='spinning'] .result-name { animation: pulse-name 1s infinite alternate; }.result-card[data-state='spinning'] .result-status { color: #fff; background: var(--race-accent); }.result-card[data-state='spinning'] .result-ribbon { animation: float-ribbon .8s infinite alternate ease-in-out; }@keyframes pulse-name { to { opacity: .55; transform: translateY(-2px); } }@keyframes float-ribbon { to { transform: rotate(-8deg) translateY(-4px); } }
.roster-card { padding: 20px 18px 15px; }.roster-card h2 { margin: 3px 0 0; font-size: 23px; font-weight: 900; }.mini-pill { display: grid; place-items: center; min-width: 29px; height: 27px; padding: 0 9px; color: var(--purple); background: var(--purple-soft); border-radius: 99px; font-size: 13px; font-weight: 900; }.roster-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; max-height: 295px; margin-top: 15px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; scrollbar-color: #d8d6ef transparent; }.roster-person { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 7px; background: #fbfaff; border: 1px solid #efedf6; border-radius: 11px; }.person-dot { display: grid; place-items: center; flex: 0 0 27px; width: 27px; height: 27px; color: var(--purple-dark); background: var(--purple-soft); border-radius: 8px; font-size: 10px; font-weight: 900; }.person-name { min-width: 0; overflow: hidden; color: var(--muted-deep); font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }.roster-person.is-winner { background: #fff8ee; border-color: #ffd5b3; }.roster-person.is-winner .person-dot { color: var(--race-accent-dark); background: #ffe1c6; }.list-loading, .list-empty { grid-column: 1 / -1; padding: 20px 8px; color: var(--muted); text-align: center; font-size: 12px; }.list-empty strong { display: block; margin-bottom: 2px; color: var(--ink); font-size: 14px; }
.race-footer { display: flex; justify-content: space-between; gap: 18px; padding: 17px 5px 0; color: #aaa8bf; font-size: 11px; }.race-doodle { position: fixed; z-index: 0; color: rgba(91,91,214,.12); font-weight: 900; pointer-events: none; user-select: none; }.doodle-sigma { top: 30%; left: 1.5%; font-size: 62px; transform: rotate(-17deg); }.doodle-pi { right: 1.4%; bottom: 9%; color: rgba(255,143,80,.14); font-size: 67px; transform: rotate(15deg); }.doodle-flag { top: 13%; right: 20%; color: rgba(82,184,168,.23); font-size: 36px; transform: rotate(12deg); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: min(360px, calc(100% - 48px)); padding: 12px 17px; color: #fff; background: #2f2b66; border-radius: 13px; box-shadow: 0 12px 35px rgba(45,42,100,.25); font-size: 13px; opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity .22s, transform .22s; }.toast.is-visible { opacity: 1; transform: translateY(0); }.toast[data-type='error'] { background: #be564c; }
@media (max-width: 1080px) { .game-nav { order: 3; width: 100%; margin: 0; justify-content: flex-end; }.race-topbar { flex-wrap: wrap; }.topbar-right { margin-left: auto; }.race-layout { grid-template-columns: 1fr; }.side-stack { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }.tip-card { grid-column: span 2; } }
@media (max-width: 620px) { .race-shell { width: min(100% - 22px, 560px); padding-top: 14px; }.brand-mark { width: 52px; height: 46px; font-size: 20px; }.brand-copy strong { font-size: 14px; }.brand-copy small, .sync-status { display: none; }.topbar-right { gap: 6px; }.back-link { padding: 7px 8px; }.back-link span { display: none; }.game-nav { justify-content: stretch; gap: 4px; }.game-nav a { flex: 1; justify-content: center; padding: 7px 4px; font-size: 10px; }.race-hero { min-height: 205px; padding: 45px 5px 16px; }.race-hero h1 { font-size: 49px; }.race-hero p { max-width: 84%; font-size: 13px; }.hero-sticker { position: absolute; right: 6px; bottom: 14px; width: 100px; height: 66px; border-width: 4px; border-radius: 23px 23px 23px 6px; font-size: 39px; }.race-card { padding: 18px 11px 16px; border-radius: 20px; }.section-heading h2 { font-size: 22px; }.race-track-wrap { padding: 7px; }.race-track { max-height: 480px; }.race-lane { grid-template-columns: 27px minmax(108px, .7fr) minmax(150px, 1fr); gap: 5px; padding-right: 4px; }.lane-number { width: 24px; height: 24px; font-size: 9px; }.lane-name { font-size: 11px; }.lane-status { font-size: 8px; }.racer { font-size: 19px; }.race-actions { flex-direction: column; }.start-button, .refresh-button { width: 100%; }.remove-toggle { width: 100%; justify-content: flex-start; }.race-hint { font-size: 10px; }.side-stack { display: flex; }.result-card { min-height: 185px; }.roster-list { max-height: 250px; }.race-footer { flex-direction: column; gap: 3px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
