.tt-page { margin: 0; background: #140f33; color: #f4f1ff; font-family: system-ui, "Segoe UI", sans-serif; }
.tt-page * { box-sizing: border-box; }
.tt-nav { max-width: 1320px; margin: auto; padding: 18px 24px; display: flex; align-items: center; justify-content: space-between; }
.tt-nav a { color: #c9c2ff; text-decoration: none; font-size: 13px; font-weight: 650; }
.tt-nav .tt-brand { color: #fff; font-size: 22px; font-weight: 900; letter-spacing: -.8px; display: flex; align-items: center; }
.tt-brand span { color: #ffb02e; }
.tt-brand small { font-size: 9px; letter-spacing: 2px; margin-left: 12px; padding-left: 12px; border-left: 1px solid #ffffff44; }
.tt-main { max-width: 1320px; margin: auto; padding: 4px 24px 24px; }
.tt-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.tt-heading h1 { margin: 0; font-size: clamp(26px, 3.4vw, 40px); font-weight: 900; letter-spacing: -1px; font-style: italic; color: #ffd23f; text-shadow: 3px 3px 0 #ff3d7f; }
.tt-heading h1 span { color: #5ee6ff; text-shadow: 3px 3px 0 #3a2bff; }
.tt-heading p { margin: 0; color: #b9b2e6; font-size: 13px; }

.tt-stage { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: calc(100vh - 40px); border-radius: 18px; overflow: hidden; background: #1d1650; box-shadow: 0 18px 60px #0008; user-select: none; -webkit-user-select: none; }
.tt-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#tt-view { background: linear-gradient(#ff9a6b, #ffd9a0); }
#game-canvas { pointer-events: auto; touch-action: none; outline: none; }
#game-canvas:focus-visible { outline: 3px solid #ffd23f; outline-offset: -3px; }
.tt-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .25s; }
.tt-flash.is-hit { background: radial-gradient(transparent 45%, #ff2b4b88); opacity: 1; transition: none; }
.tt-flash.is-boost { background: radial-gradient(transparent 55%, #ffb02e55), repeating-conic-gradient(from 0deg at 50% 50%, #fff0 0deg 4deg, #ffffff22 4deg 5deg); opacity: 1; }
.tt-flash.is-star { background: radial-gradient(transparent 50%, #ffe14d66); opacity: 1; animation: tt-hue 0.6s linear infinite; }
@keyframes tt-hue { to { filter: hue-rotate(360deg); } }

.tt-hud { position: absolute; inset: 0; pointer-events: none; font-weight: 900; text-shadow: 0 2px 0 #0007, 0 0 12px #0006; }
.tt-hud[hidden] { display: none; }
.tt-hud-left { position: absolute; left: 2.2%; top: 3%; display: grid; gap: 2px; }
.tt-position strong { font-size: clamp(30px, 6vw, 72px); font-style: italic; color: #ffd23f; letter-spacing: -2px; line-height: 1; }
.tt-position span { font-size: clamp(14px, 2vw, 24px); color: #fff; margin-left: 6px; }
.tt-lap { font-size: clamp(13px, 1.6vw, 20px); color: #fff; letter-spacing: 1px; }
.tt-lap strong { color: #5ee6ff; }
.tt-time { font: 800 clamp(13px, 1.5vw, 19px) ui-monospace, monospace; color: #fff; }
.tt-lapsplit { font: 700 clamp(10px, 1.1vw, 13px) ui-monospace, monospace; color: #b8ffcf; min-height: 1em; }
.tt-item { position: absolute; top: 3%; left: 50%; transform: translateX(-50%); width: clamp(64px, 9vw, 104px); aspect-ratio: 1; border-radius: 22%; border: 4px solid #fff; background: radial-gradient(#ffffff40, #1b145080); display: grid; place-items: center; align-content: center; gap: 2px; box-shadow: 0 0 0 3px #3a2bff, 0 8px 22px #0006; }
.tt-item span { font-size: clamp(28px, 4.4vw, 54px); line-height: 1; text-shadow: none; }
.tt-item small { position: absolute; bottom: -22px; white-space: nowrap; font-size: clamp(10px, 1vw, 13px); color: #fff; }
.tt-item.is-rolling span { animation: tt-roll .12s steps(2) infinite; }
.tt-item.is-ready { animation: tt-pop .35s ease-out; }
@keyframes tt-roll { 50% { transform: translateY(-6%) scale(.9); } }
@keyframes tt-pop { 0% { transform: translateX(-50%) scale(1.3); } 100% { transform: translateX(-50%) scale(1); } }
.tt-banner { position: absolute; top: 34%; left: 0; right: 0; text-align: center; font-size: clamp(36px, 9vw, 120px); font-style: italic; letter-spacing: -2px; color: #ffd23f; text-shadow: 5px 5px 0 #ff3d7f, 0 0 30px #0008; opacity: 0; transform: scale(.6); transition: opacity .15s, transform .2s cubic-bezier(.2, 1.6, .5, 1); }
.tt-banner.is-on { opacity: 1; transform: scale(1); }
.tt-banner.is-small { font-size: clamp(22px, 4.5vw, 54px); color: #fff; text-shadow: 3px 3px 0 #3a2bff; }
.tt-banner.is-warn { color: #ff5d5d; text-shadow: 3px 3px 0 #300; }
.tt-legend { position: absolute; left: 2%; bottom: 3%; display: flex; flex-wrap: wrap; gap: 6px; max-width: 46%; font-size: 11px; font-weight: 700; color: #fff; text-shadow: none; }
.tt-legend span { background: #120c35a8; padding: 4px 7px; border-radius: 7px; }
.tt-legend kbd { font: 800 10px ui-monospace, monospace; background: #fff; color: #23195e; border-radius: 4px; padding: 1px 4px; margin: 0 1px; }
.tt-legend[hidden] { display: none; }
.tt-speed { position: absolute; right: 3%; bottom: 4%; width: clamp(90px, 13vw, 170px); text-align: center; font: 900 italic clamp(18px, 2.6vw, 34px) system-ui, sans-serif; color: #fff; }
.tt-speed small { font-size: .45em; font-style: normal; }

.tt-screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 3%; overflow-y: auto; background: linear-gradient(120deg, #1b1250cc, #1b125033 70%); z-index: 3; }
.tt-screen[hidden] { display: none; }
.tt-main-menu { justify-content: flex-start; background: linear-gradient(90deg, #170f47e6 0%, #170f4780 45%, transparent 75%); }
.tt-select-screen { justify-content: flex-end; background: linear-gradient(270deg, #170f47f0 0%, #170f47b0 50%, transparent 78%); }
.tt-select-screen .tt-card { width: min(640px, 100%); margin: auto 0; }
.tt-card { width: min(460px, 100%); padding: clamp(16px, 2.6vw, 30px); border-radius: 20px; background: #221a5ef2; border: 3px solid #ffffff22; box-shadow: 0 20px 60px #0008; margin: auto 0; }
.tt-main-menu .tt-card { margin: auto 0 auto 2%; }
.tt-card.tt-wide { width: min(980px, 100%); }
.tt-card h2 { margin: 0 0 14px; font-size: clamp(20px, 2.6vw, 32px); font-weight: 900; font-style: italic; color: #ffd23f; }
.tt-card h3 { margin: 16px 0 10px; font-size: 16px; color: #5ee6ff; }
.tt-title-card h2 { font-size: clamp(30px, 5vw, 64px); line-height: .95; letter-spacing: -2px; text-shadow: 4px 4px 0 #ff3d7f; }
.tt-title-card h2 span { color: #5ee6ff; text-shadow: 4px 4px 0 #3a2bff; }
.tt-eyebrow { margin: 0 0 10px; font-size: 11px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; color: #ff9ad0; }
.tt-summary { color: #d6d0ff; font-size: 13px; margin: 0 0 16px; }
.tt-note { font-size: 11px; color: #a9a1dc; margin: 12px 0 0; line-height: 1.5; }
.tt-menu-buttons { display: grid; gap: 10px; }
.tt-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.tt-btn { appearance: none; border: 0; border-radius: 12px; padding: 13px 20px; font: 900 15px system-ui, sans-serif; letter-spacing: .3px; color: #fff; background: #3c2f96; box-shadow: 0 4px 0 #18105a; cursor: pointer; transition: transform .08s, background .15s; text-align: left; }
.tt-btn:hover { background: #4d3dc4; }
.tt-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #18105a; }
.tt-btn-primary { background: linear-gradient(#ffcc33, #ff8a1f); color: #2a1300; box-shadow: 0 4px 0 #b4400b; font-size: 18px; }
.tt-btn-primary:hover { background: linear-gradient(#ffe066, #ff9f3d); }
.tt-page button:focus-visible, .tt-page select:focus-visible, .tt-page input:focus-visible, .tt-page a:focus-visible { outline: 3px solid #5ee6ff; outline-offset: 2px; }

.tt-racers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tt-karts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tt-choice { border: 3px solid transparent; border-radius: 14px; background: #ffffff12; color: #fff; padding: 9px; text-align: left; cursor: pointer; font: 700 12px system-ui, sans-serif; display: flex; gap: 9px; align-items: center; min-height: 56px; }
.tt-choice:hover { background: #ffffff22; }
.tt-choice[aria-checked="true"] { border-color: #ffd23f; background: #ffd23f22; }
.tt-choice small { display: block; font-weight: 500; color: #c9c2ff; font-size: 11px; }
.tt-swatch { width: 34px; height: 34px; border-radius: 50%; flex: none; border: 3px solid #fff; box-shadow: inset -5px -5px 0 #0003; }
.tt-select-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 14px; }
.tt-profile { font-size: 13px; color: #e0dbff; line-height: 1.5; }
.tt-profile strong { font-size: 18px; color: #ffd23f; }
.tt-stats { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; margin: 0; font-size: 12px; align-items: center; }
.tt-stats dt { color: #c9c2ff; }
.tt-stats dd { margin: 0; height: 10px; border-radius: 6px; background: #ffffff1c; overflow: hidden; }
.tt-stats dd span { display: block; height: 100%; background: linear-gradient(90deg, #5ee6ff, #ffd23f); border-radius: 6px; }
.tt-tracks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tt-track { flex-direction: column; align-items: stretch; padding: 10px; }
.tt-track canvas { width: 100%; aspect-ratio: 4 / 3; border-radius: 10px; background: #0f0b2e; position: static; }
.tt-track strong { font-size: 15px; }
.tt-settings { display: grid; gap: 12px; }
.tt-settings label { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; font-weight: 700; }
.tt-settings select, .tt-settings input[type="range"] { width: 52%; }
.tt-settings select { padding: 7px; border-radius: 8px; border: 0; font: 700 13px system-ui, sans-serif; }
.tt-settings .tt-check { justify-content: flex-start; }
.tt-results { width: 100%; border-collapse: collapse; font-size: 14px; }
.tt-results th { text-align: left; color: #c9c2ff; font-size: 11px; letter-spacing: 1px; padding: 6px 8px; border-bottom: 2px solid #ffffff22; }
.tt-results td { padding: 7px 8px; border-bottom: 1px solid #ffffff12; font-weight: 700; }
.tt-results td:nth-child(4), .tt-results td:nth-child(5) { font-family: ui-monospace, monospace; }
.tt-results tr.is-player td { background: #ffd23f2e; color: #ffd23f; }

.tt-touch { display: none; position: absolute; left: 0; right: 0; bottom: 0; padding: 10px; justify-content: space-between; align-items: flex-end; pointer-events: none; z-index: 2; }
.tt-touch > * { pointer-events: auto; }
.tt-touch-actions { display: grid; gap: 8px; }
.tt-touch-actions > div { display: flex; gap: 8px; }
.tt-touch button { width: 56px; height: 56px; border-radius: 50%; border: 3px solid #ffffffaa; background: #1b145099; color: #fff; font: 900 13px system-ui, sans-serif; touch-action: none; }
.tt-touch button.is-held { background: #ffd23fcc; color: #2a1300; }
.tt-touch .tt-joystick { position: relative; display: grid; place-items: center; width: clamp(84px, 20vw, 112px); height: auto; aspect-ratio: 1; border-radius: 50%; border: 3px solid #ffffff88; background: radial-gradient(circle, #ffffff35 0 2px, transparent 3px), #1b145099; }
.tt-joystick::after { content: "STEER"; position: absolute; bottom: -20px; color: #ffffffc9; font-size: 9px; font-weight: 900; letter-spacing: 1px; }
.tt-touch .tt-joystick-stick { width: 46%; height: 46%; border: 2px solid #ffffffdd; border-radius: 50%; background: #ffd23fcc; box-shadow: inset -4px -4px 0 #0003, 0 2px 8px #0007; pointer-events: none; transform: translate(var(--stick-x, 0px), var(--stick-y, 0px)); }
.tt-stage.is-racing .tt-touch { display: flex; }
@media (hover: hover) and (pointer: fine) { .tt-stage.is-racing .tt-touch { display: none; } }

.tt-below { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; padding: 26px 0 20px; }
.tt-below h2 { font-size: 18px; margin: 0 0 8px; color: #ffd23f; font-style: italic; }
.tt-below p { margin: 0; font-size: 13px; line-height: 1.75; color: #cfc9f5; }
.tt-footer { border-top: 1px solid #ffffff1f; padding-top: 14px; color: #9890cc; font-size: 11px; }

@media (max-width: 820px) {
  .tt-main { padding: 4px 10px 18px; }
  .tt-nav { padding: 14px 12px; }
  .tt-stage { aspect-ratio: 3 / 4; max-height: none; border-radius: 12px; }
  .tt-main-menu { justify-content: center; background: linear-gradient(#170f47cc, #170f4766); }
  .tt-main-menu .tt-card { margin: auto; }
  .tt-select-screen { justify-content: center; background: linear-gradient(#170f47cc, #170f4799); }
  .tt-racers, .tt-karts { grid-template-columns: repeat(2, 1fr); }
  .tt-tracks { grid-template-columns: 1fr; }
  .tt-select-footer { grid-template-columns: 1fr; }
  .tt-legend { display: none; }
  .tt-below { grid-template-columns: 1fr; gap: 16px; }
  .tt-item small { display: none; }
  .tt-speed { bottom: 84px; }
  .tt-btn { padding: 11px 14px; font-size: 14px; }
  .tt-results { font-size: 12px; }
  .tt-results th:nth-child(3), .tt-results td:nth-child(3) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tt-banner, .tt-item.is-ready, .tt-item.is-rolling span, .tt-flash.is-star { animation: none; transition: none; }
}
