/* Design System & Variables */
:root {
    --bg-primary: #0a0a0c;
    --bg-secondary: #111116;
    --bg-card: rgba(22, 22, 30, 0.75);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(0, 242, 254, 0.15);
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-glow: #e5e7eb;
    
    /* Neon gradients */
    --accent-cyan: #00f2fe;
    --accent-blue: #4facfe;
    --accent-purple: #9b51e0;
    --accent-pink: #f43f5e;
    --accent-orange: #ff5e36;
    
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    --glow-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
    
    --font-sans: 'Outfit', 'Noto Sans JP', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-family: var(--font-sans);
    overflow-hidden: scroll;
    height: 100vh;
}

/* App Container Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Sidebar Styling */
.sidebar {
    width: 320px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: var(--text-main);
}

/* Filter Container in Sidebar */
.filter-container {
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.01);
}

.filter-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.filter-group {
    display: flex;
    gap: 8px;
    width: 70%;
}

.filter-select {
    background-color: var(--bg-primary);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 0.8rem;
    outline: none;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 0;
}

.filter-select:hover, .filter-select:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px rgba(0, 242, 254, 0.15);
}

.badge {
    padding: 4px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 4px;
    text-transform: uppercase;
}

.badge.G3 {
    background: linear-gradient(135deg, var(--accent-orange), var(--accent-pink));
    color: #fff;
    box-shadow: 0 0 8px rgba(254, 94, 54, 0.4);
}

.race-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.race-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.race-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.race-item.active {
    background: rgba(0, 242, 254, 0.08);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.15);
}

.race-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.race-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.race-no-badge {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.race-item.active .race-no-badge {
    background: var(--accent-cyan);
    color: #000;
}

.race-item-body h4 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-main);
}

.race-item-body p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.result-flag {
    font-size: 0.65rem;
    padding: 2px 5px;
    border-radius: 3px;
    margin-left: 6px;
    font-weight: bold;
}
.result-flag.done {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}
.result-flag.predicted {
    background: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background-image: radial-gradient(circle at top right, rgba(127, 0, 255, 0.08), transparent 40%);
}

.main-header {
    padding: 16px 40px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg-primary);
    backdrop-filter: blur(10px);
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 110;
}

.main-header h1 {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.accent-text {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tagline {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.status-indicator-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-admin-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    outline: none;
    line-height: 1;
}

.btn-admin-badge:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-admin-badge.logged-in {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
    color: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.btn-admin-badge.logged-in:hover {
    background: rgba(16, 185, 129, 0.2);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.btn-admin-nav {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s ease;
    padding: 8px 18px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 31px; /* To match other buttons */
    box-sizing: border-box;
    cursor: pointer;
    font-family: var(--font-sans);
}

.btn-admin-nav:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.btn-admin-nav:active {
    transform: translateY(1px);
}

.btn-primary-glow {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    color: #0c0c0e;
    border: none;
    border-radius: 22px;
    padding: 10px 22px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
    font-family: var(--font-sans);
}

.btn-primary-glow:hover {
    transform: translateY(-1px);
    box-shadow: var(--glow-shadow);
    filter: brightness(1.1);
}

.btn-primary-glow:active {
    transform: translateY(1px);
}

.btn-primary-glow:disabled {
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-muted) !important;
    border: 1px solid var(--border-color);
    box-shadow: none !important;
    cursor: not-allowed;
    transform: none !important;
}

.status-indicator {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-cyan);
    border-radius: 50%;
    margin-right: 8px;
    box-shadow: var(--glow-shadow);
    animation: pulse 2s infinite;
}

.status-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Welcome Screen & Loading Screen */
.welcome-screen,
#loading-screen-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

/* Custom Loader Spinner */
.custom-loader {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(0, 242, 254, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-cyan);
    border-bottom-color: var(--accent-blue);
    animation: loader-spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.2);
    display: inline-block;
}

@keyframes loader-spin {
    to {
        transform: rotate(360deg);
    }
}

.welcome-box {
    text-align: center;
    max-width: 480px;
    padding: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: var(--card-shadow);
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 24px;
    display: inline-block;
    animation: float 4s ease-in-out infinite;
}

.welcome-box h2 {
    font-size: 1.4rem;
    margin-bottom: 12px;
    font-weight: 700;
}

.welcome-box p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Dashboard Content Grid */
.race-dashboard {
    padding: 32px 40px;
}

/* Premium Card Components */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(16px);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.card-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Overview Card */
.overview-card {
    padding: 12px 18px;
    background: linear-gradient(135deg, rgba(22, 22, 30, 0.98), rgba(15, 15, 20, 0.98));
    position: sticky;
    top: var(--header-height, 74px);
    z-index: 105;
}

.overview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.race-title-group {
    font-size: 1.15rem;
}

.race-title-group h2 {
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0;
    line-height: 1.2;
}

.race-title-group p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.grade-tag {
    font-size: 0.7rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
}

.grade-tag.GP { background: linear-gradient(45deg, #d4af37, #f39c12); color: #000; }
.grade-tag.G1 { background: linear-gradient(45deg, #e74c3c, #9b59b6); color: #fff; }
.grade-tag.G2 { background: linear-gradient(45deg, #3498db, #2ecc71); color: #fff; }
.grade-tag.G3 { background: linear-gradient(45deg, #e67e22, #f1c40f); color: #000; }

.bank-info-group {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.bank-stat {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
}

.bank-stat .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.bank-stat .label::after {
    content: ":";
}

.bank-stat .val {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-main);
}

.sim-card-header {
    display: none;
    justify-content: flex-end;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-color);
}

/* Simulation Section & Tabs */
.sim-tabs-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-bottom: 1px solid var(--border-color);
}

.sim-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 16px 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    outline: none;
}

.sim-tab:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.01);
}

.sim-tab.active {
    color: var(--accent-cyan);
    border-bottom-color: var(--accent-cyan);
    background: rgba(0, 242, 254, 0.03);
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.3);
}

.sim-tab .stage-num {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 2px;
    opacity: 0.7;
}

.sim-tab .stage-name {
    font-size: 0.9rem;
    font-weight: 700;
}

/* Visual Track board */
.track-board-container {
    background: rgba(0, 0, 0, 0.3);
    padding: 30px 24px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.finish-line-label {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: bold;
}

.bg-lines-label {
    position: absolute;
    left: 20px;
    bottom: 10px;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: bold;
}

.track-board {
    height: 180px;
    position: relative;
    border: 1px dashed rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.01) 0%, transparent 80%);
}

.track-board::before {
    content: '';
    position: absolute;
    right: 60px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: repeating-linear-gradient(
        0deg,
        rgba(255, 255, 255, 0.1),
        rgba(255, 255, 255, 0.1) 10px,
        transparent 10px,
        transparent 20px
    );
    z-index: 1;
}

/* Runner capsule on track */
.runner-capsule {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    cursor: pointer;
    transform: translate(-50%, -50%) scale(var(--runner-scale, 1));
    /* CSS smooth transitions for animations */
    transition: left 0.8s cubic-bezier(0.25, 1, 0.5, 1), 
                top 0.8s cubic-bezier(0.25, 1, 0.5, 1), 
                box-shadow 0.3s ease,
                transform 0.2s ease;
    z-index: 2;
}

.runner-capsule:hover {
    --runner-scale: 1.1;
    z-index: 10;
}

/* Tooltip on capsule hover */
.runner-capsule::after {
    content: attr(data-name);
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: #fff;
    padding: 3px 8px;
    font-size: 0.65rem;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

.runner-capsule:hover::after {
    opacity: 1;
}

/* Standard Keirin Car Colors */
.car-1 { background-color: #ffffff; color: #111111; }
.car-2 { background-color: #222222; color: #ffffff; border: 1px solid rgba(255,255,255,0.3); }
.car-3 { background-color: #e92b2b; color: #ffffff; }
.car-4 { background-color: #1e60eb; color: #ffffff; }
.car-5 { background-color: #f3c400; color: #111111; }
.car-6 { background-color: #1ca250; color: #ffffff; }
.car-7 { background-color: #ff771c; color: #ffffff; }
.car-8 { background-color: #f67bbb; color: #ffffff; }
.car-9 { background-color: #7e22ce; color: #ffffff; }

/* Lines Legend */
.lines-legend {
    padding: 16px 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    background: rgba(255,255,255,0.01);
}

.line-legend-item {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.line-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.bets-card, .digest-card {
    height: 100%;
}

.bets-container {
    padding: 24px;
}

.bet-type-group {
    margin-bottom: 20px;
}

.bet-type-group h4 {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    border-left: 2px solid var(--accent-cyan);
    padding-left: 8px;
}

.sub-tabs-container {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.sub-tab-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 16px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    font-family: var(--font-sans);
}

.sub-tab-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.sub-tab-btn.active {
    background: rgba(0, 242, 254, 0.1);
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px rgba(0, 242, 254, 0.1);
}

.bet-list {
    list-style: none;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 6px;
}

.bet-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.95rem;
    font-weight: 700;
}

.bet-list-item:first-child {
    background: linear-gradient(90deg, rgba(0, 242, 254, 0.06), transparent);
    border-color: rgba(0, 242, 254, 0.25);
}

.bet-prob {
    font-size: 0.8rem;
    color: var(--accent-cyan);
    background: rgba(0, 242, 254, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.digest-content {
    padding: 24px;
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-glow);
}

#prediction-digest-text {
    white-space: pre-line;
}

/* Runners Stats Table Styling */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.runners-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.runners-table th, .runners-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
}

.runners-table th {
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.01);
}

.runners-table th:first-child,
.runners-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 10;
    background-color: var(--bg-secondary);
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.4);
}

.runners-table tbody tr:hover td:first-child {
    background-color: #1e1e24;
}

.runners-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.text-center {
    text-align: center;
}

.car-badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.75rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.runner-name-group {
    display: flex;
    flex-direction: column;
}

.runner-name-group .name {
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
}

.runner-pref-desc {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 2px;
}

.line-info-badge {
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 4px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    display: inline-block;
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 242, 254, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(0, 242, 254, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 242, 254, 0); }
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

/* Loading spinner */
.loading-spinner {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-weight: bold;
}

/* Custom Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    width: 90%;
    max-width: 480px;
    padding: 32px;
    box-shadow: var(--card-shadow), 0 0 30px rgba(0, 242, 254, 0.15);
    animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-card h3 {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--text-main);
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-body {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 24px;
}

.modal-body p {
    margin-bottom: 12px;
}

.warning-text {
    color: var(--accent-orange) !important;
    font-weight: 600;
    font-size: 0.8rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 18px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleUp {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Scrape Modal Styles */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-main);
}

.radio-label input[type="radio"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    outline: none;
    background-color: var(--bg-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.radio-label input[type="radio"]:checked {
    border-color: var(--accent-cyan);
}

.radio-label input[type="radio"]:checked::before {
    content: "";
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    border-radius: 50%;
    display: block;
}

.progress-container {
    width: 100%;
}

.progress-bar-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.scrape-results-summary {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    margin-top: 16px;
    backdrop-filter: blur(4px);
}

/* Running State Button Style */
.btn-secondary.running {
    opacity: 0.6;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.08);
}

/* Drilldown Series Accordion & Race Grid Styles */
.series-accordion {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 0;
}

.series-item {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.series-item:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.15);
}

.series-item.open {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(0, 242, 254, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.series-header {
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.series-header:hover {
    background: rgba(255, 255, 255, 0.02);
}

.series-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.series-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.series-header .grade-tag {
    font-size: 0.6rem;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 3px;
    flex-shrink: 0;
}

.holding-tag {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
    margin-left: 6px;
    flex-shrink: 0;
    display: inline-block;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
    text-shadow: none;
}

.series-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.series-date-range {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.arrow-icon {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.series-item.open .arrow-icon {
    transform: rotate(180deg);
    color: var(--accent-cyan);
}

.series-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: rgba(0, 0, 0, 0.15);
}

.series-item.open .series-content {
    max-height: 1200px; /* high limit to handle up to 4 days */
    border-top: 1px solid var(--border-color);
}

.day-item {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.day-item:last-child {
    border-bottom: none;
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.day-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-glow);
}

.race-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

.race-btn {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 5px 0;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    outline: none;
    font-family: var(--font-sans);
}

.race-btn:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.25);
}

/* Completed races */
.race-btn.done {
    border-color: rgba(16, 185, 129, 0.3);
    color: #10b981;
    background: rgba(16, 185, 129, 0.03);
}

.race-btn.done:hover {
    background: rgba(16, 185, 129, 0.1);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.25);
    border-color: rgba(16, 185, 129, 0.8);
}

/* Upcoming/Predicted races */
.race-btn.predicted {
    border-color: rgba(139, 92, 246, 0.3);
    color: #a78bfa;
    background: rgba(139, 92, 246, 0.03);
}

.race-btn.predicted:hover {
    background: rgba(139, 92, 246, 0.1);
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.25);
    border-color: rgba(139, 92, 246, 0.8);
}

/* Active states */
.race-btn.active.done {
    background: #10b981 !important;
    color: #050507 !important;
    border-color: #10b981 !important;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.45) !important;
}

.race-btn.active.predicted {
    background: #8b5cf6 !important;
    color: #ffffff !important;
    border-color: #8b5cf6 !important;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.45) !important;
}

/* Disabled races */
.race-btn.disabled {
    opacity: 0.15;
    cursor: not-allowed;
    background: transparent;
    border-color: rgba(255, 255, 255, 0.02);
    color: rgba(255, 255, 255, 0.15);
}

/* Specs Modal & Tab Navigation Styles */
.specs-tabs {
    display: flex;
    gap: 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.specs-tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 10px 4px;
    cursor: pointer;
    transition: all 0.25s ease;
    outline: none;
    font-family: var(--font-sans);
}

.specs-tab-btn:hover {
    color: var(--text-main);
}

.specs-tab-btn.active {
    color: var(--accent-cyan);
    border-bottom-color: var(--accent-cyan);
    text-shadow: 0 0 8px rgba(0, 242, 254, 0.25);
}

.specs-tab-content {
    animation: fadeIn 0.3s ease;
}

.stat-card {
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 242, 254, 0.25);
    box-shadow: 0 4px 12px rgba(0, 242, 254, 0.08);
}

    .toggle-group {
        width: 100%;
    }

    .toggle-btn {
        flex: 1;
        text-align: center;
        padding: 5px 0;
    }
}

/* Official Results Card Styling */
.results-summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(16px);
}

.results-summary-content {
    padding: 24px;
}

.podium-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.podium-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.podium-item:hover {
    transform: translateY(-2px);
}

.badge-place {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 2px 10px;
    border-radius: 20px;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.place-1 {
    border-color: rgba(255, 215, 0, 0.3);
    background: linear-gradient(180deg, rgba(255, 215, 0, 0.03), transparent);
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.08);
}
.place-1 .badge-place {
    background: #ffd700;
    color: #000;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

.place-2 {
    border-color: rgba(192, 192, 192, 0.3);
    background: linear-gradient(180deg, rgba(192, 192, 192, 0.03), transparent);
    box-shadow: 0 4px 20px rgba(192, 192, 192, 0.05);
}
.place-2 .badge-place {
    background: #c0c0c0;
    color: #000;
    box-shadow: 0 0 10px rgba(192, 192, 192, 0.3);
}

.place-3 {
    border-color: rgba(205, 127, 50, 0.3);
    background: linear-gradient(180deg, rgba(205, 127, 50, 0.03), transparent);
    box-shadow: 0 4px 20px rgba(205, 127, 50, 0.05);
}
.place-3 .badge-place {
    background: #cd7f32;
    color: #fff;
    box-shadow: 0 0 10px rgba(205, 127, 50, 0.3);
}

.podium-item .car-badge {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    margin-bottom: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

.podium-item .runner-name {
    font-weight: 800;
    font-size: 1rem;
    color: #fff;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kimarite-tag {
    font-size: 0.75rem;
    color: var(--accent-cyan);
    background: rgba(0, 242, 254, 0.08);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(0, 242, 254, 0.15);
}

.results-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.details-section {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
}

.details-section h4 {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
    border-left: 2px solid var(--accent-cyan);
    padding-left: 8px;
}

/* Payout Table */
.payout-table {
    width: 100%;
    border-collapse: collapse;
}

.payout-table th, .payout-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.9rem;
}

.payout-table tr:last-child th, .payout-table tr:last-child td {
    border-bottom: none;
}

.payout-table th {
    color: var(--text-muted);
    font-weight: 600;
    width: 25%;
}

.payout-pattern {
    font-weight: 800;
    color: #fff;
    width: 45%;
}

.payout-amount {
    font-weight: 800;
    color: var(--accent-cyan);
    text-align: right;
}

/* S/H/B list */
.shb-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.shb-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255,255,255,0.02);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.03);
}

.shb-label {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
}

.shb-label.S { background: rgba(0, 242, 254, 0.15); color: var(--accent-cyan); }
.shb-label.H { background: rgba(254, 94, 54, 0.15); color: var(--accent-orange); }
.shb-label.B { background: rgba(244, 63, 94, 0.15); color: var(--accent-pink); }

.shb-val {
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
}

/* Simulation Toggle Button Styles */
.sim-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.sim-mode-toggle-container {
    display: flex;
    align-items: center;
}

.toggle-group {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.05);
    padding: 3px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.toggle-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    border-radius: 18px;
    padding: 6px 16px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    font-family: var(--font-sans);
    white-space: nowrap;
}

.toggle-btn.active {
    background: var(--accent-cyan);
    color: #000 !important;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.3);
}

/* Runners table actual result cell and badge stylings */
.rank-badge {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.75rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.rank-badge.rank-1 { background: #ffd700; color: #000; box-shadow: 0 0 8px rgba(255, 215, 0, 0.4); }
.rank-badge.rank-2 { background: #c0c0c0; color: #000; box-shadow: 0 0 8px rgba(192, 192, 192, 0.3); }
.rank-badge.rank-3 { background: #cd7f32; color: #fff; box-shadow: 0 0 8px rgba(205, 127, 50, 0.3); }
.rank-badge.rank-other { background: rgba(255,255,255,0.08); color: var(--text-muted); border: 1px solid var(--border-color); }
.rank-badge.rank-dnf-10 { background: var(--accent-pink); color: #fff; }
.rank-badge.rank-dnf-11 { background: var(--accent-orange); color: #fff; }

.racer-shb-badges {
    display: inline-flex;
    gap: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

.mini-shb-badge {
    font-size: 0.6rem;
    font-weight: 800;
    width: 15px;
    height: 15px;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mini-shb-badge.S { background: rgba(0, 242, 254, 0.15); color: var(--accent-cyan); border: 1px solid rgba(0, 242, 254, 0.2); }
.mini-shb-badge.H { background: rgba(254, 94, 54, 0.15); color: var(--accent-orange); border: 1px solid rgba(254, 94, 54, 0.2); }
.mini-shb-badge.B { background: rgba(244, 63, 94, 0.15); color: var(--accent-pink); border: 1px solid rgba(244, 63, 94, 0.2); }

.rank-text-val {
    font-size: 0.95rem;
    font-weight: 800;
    color: #fff;
    display: inline-block;
    vertical-align: middle;
}

/* Hit Badges for Payouts */
.hit-badge {
    font-size: 0.7rem;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-block;
    vertical-align: middle;
    white-space: nowrap;
    flex-shrink: 0;
}
.hit-badge.top5 {
    background: rgba(234, 179, 8, 0.15); /* Gold */
    color: #fef08a;
    border: 1px solid rgba(234, 179, 8, 0.3);
}
.hit-badge.top10 {
    background: rgba(59, 130, 246, 0.15); /* Blue */
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}
.hit-badge.other {
    background: rgba(156, 163, 175, 0.15); /* Gray */
    color: #d1d5db;
    border: 1px solid rgba(156, 163, 175, 0.3);
}

/* Dashboard Tab Navigation Style */
.dashboard-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    position: sticky;
    top: calc(var(--header-height, 74px) + var(--overview-height, 160px));
    z-index: 100;
    background: var(--bg-primary);
    padding-top: 10px;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    font-family: var(--font-sans);
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.15);
}

.tab-btn.active {
    background: rgba(0, 242, 254, 0.1);
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 12px rgba(0, 242, 254, 0.15);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Modal styles overrides for Race Selection */
.race-select-modal-card {
    border: 1px solid rgba(0, 242, 254, 0.2);
    box-shadow: 0 0 32px rgba(0, 242, 254, 0.1), var(--card-shadow);
}


/* Responsive Design (Mobile / Tablet) */
@media (max-width: 768px) {
    body {
        height: auto;
        overflow-y: auto;
    }

    .app-container {
        display: grid;
        grid-template-areas:
            "header"
            "sidebar"
            "content"
            "welcome";
        grid-template-rows: auto auto auto auto;
        grid-template-columns: 100%;
        height: auto;
        width: 100%;
        overflow: visible;
    }

    .sidebar {
        grid-area: sidebar;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        height: auto;
        max-height: 50vh; /* リストが長くなりすぎないように制限 */
    }

    .main-content {
        display: contents;
    }

    .main-header {
        grid-area: header;
        padding: 12px 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .main-header.admin-logged-in {
        flex-direction: column;
        align-items: stretch;
    }

    .status-indicator-group {
        width: 100%;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        justify-content: flex-end;
    }

    .main-header.admin-logged-in .status-indicator-group {
        width: 100%;
    }

    .status-indicator-group button {
        flex: 1;
        padding: 6px 4px;
        font-size: 0.68rem;
        white-space: nowrap;
        margin-right: 0 !important;
        text-align: center;
    }

    .status-indicator-group .btn-admin-nav {
        flex: 1;
        padding: 6px 4px;
        font-size: 0.68rem;
        white-space: nowrap;
        margin-right: 0 !important;
        text-align: center;
    }

    .main-header.admin-logged-in .status-indicator-group .btn-admin-nav {
        flex: 1;
        padding: 6px 4px;
    }

    .race-dashboard {
        grid-area: content;
        padding: 16px;
    }

    .welcome-screen,
    #loading-screen-main {
        grid-area: welcome;
        padding: 40px 16px;
    }

    #loading-screen-main .welcome-box {
        padding: 24px 16px;
        width: 100%;
        max-width: 320px;
    }

    #loading-screen-main .welcome-box p {
        font-size: 0.75rem;
        white-space: nowrap;
    }

    .overview-card {
        padding: 10px 12px;
    }

    .overview-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .race-title-group {
        font-size: 1.05rem;
    }

    .race-title-group h2 {
        font-size: 1.05rem;
    }

    .race-title-group p {
        font-size: 0.75rem;
        margin-top: 2px;
    }

    .bank-info-group {
        width: 100%;
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        flex-wrap: nowrap;
        gap: 8px;
    }

    .bank-stat {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 3px;
        flex: 0 1 auto;
    }

    .bank-stat .label {
        font-size: 0.65rem !important;
        white-space: nowrap;
    }

    .bank-stat .val {
        font-size: 0.65rem !important;
        white-space: nowrap;
    }

    .results-grid {
        grid-template-columns: 1fr; /* 2列から1列の縦並びに変更 */
        gap: 16px;
    }

    .sim-tab {
        padding: 12px 4px;
    }

    .sim-tab .stage-name {
        font-size: 0.75rem; /* タブ文字を少し縮小 */
    }
    
    .sim-tab .stage-num {
        font-size: 0.6rem;
    }

    .track-board-container {
        padding: 20px 12px;
        overflow-x: hidden; /* 横スライドしないように非表示へ */
    }

    .track-board {
        min-width: 0; /* スクロール用の最小幅を解除 */
        width: 100%;
        height: 140px; /* 高さを少し低く調整 */
    }

    .runner-capsule {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.8rem !important;
    }

    .runners-table {
        min-width: 800px; /* 横スクロールするように十分な幅を確保 */
    }

    .runners-table th, .runners-table td {
        padding: 5px 6px !important; /* 縦パディングを半分にして高さを低く */
        font-size: 0.72rem;
        white-space: nowrap; /* 折り返さないように設定 */
    }
    
    /* 縦に1画面に収めるための極限余白削減 */
    .main-header {
        padding: 6px 12px !important;
        gap: 4px !important;
    }
    .header-logo h1 {
        font-size: 1.75rem !important;
    }
    .status-indicator-group {
        margin-top: 4px !important;
        gap: 4px !important;
    }
    .status-indicator-group button,
    .status-indicator-group .btn-admin-nav {
        padding: 4px 6px !important;
        font-size: 0.65rem !important;
    }
    #btn-open-race-modal {
        padding: 8px 16px !important;
        font-size: 0.85rem !important;
    }
    .overview-card {
        padding: 6px 10px !important;
        margin-bottom: 6px !important;
    }
    .race-title-group h2 {
        font-size: 0.95rem !important;
    }
    .race-title-group p {
        font-size: 0.68rem !important;
        margin-top: 1px !important;
    }
    .bank-info-group {
        gap: 6px !important;
    }
    .bank-stat .label,
    .bank-stat .val {
        font-size: 0.6rem !important;
    }
    .card {
        margin-top: 6px !important;
        padding: 8px !important;
    }
    .tab-btn {
        padding: 6px 10px !important;
        font-size: 0.72rem !important;
    }
    .runners-card {
        margin-top: 0 !important;
        padding: 4px !important;
    }
    
    .car-badge {
        width: 20px;
        height: 20px;
        font-size: 0.7rem;
    }
    
    .specs-tabs {
        gap: 8px;
        overflow-x: auto;
    }

    /* Results specific responsive styles */
    .podium-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .podium-item {
        flex-direction: row;
        justify-content: flex-start;
        gap: 12px;
        padding: 10px 16px;
    }

    .badge-place {
        margin-bottom: 0;
        width: 50px;
        text-align: center;
    }

    .podium-item .car-badge {
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .podium-item .runner-name {
        margin-bottom: 0;
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        text-align: left;
    }

    .kimarite-tag {
        margin-left: auto;
        flex-shrink: 0;
    }

    .results-details-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .payout-table th, .payout-table td {
        font-size: 0.8rem;
        padding: 8px 6px;
    }

    .payout-amount {
        gap: 4px !important;
        flex-wrap: nowrap !important;
    }

    .sim-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .sim-mode-toggle-container {
        width: 100%;
    }

    .toggle-group {
        width: 100%;
    }

    .toggle-btn {
        flex: 1;
        text-align: center;
        padding: 5px 0;
    }

    /* Tab navigation and modal style overrides for mobile */
    .dashboard-tabs {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
        gap: 6px;
    }
    
    .tab-btn {
        padding: 8px 14px;
        font-size: 0.78rem;
        flex-shrink: 0;
    }

    #btn-open-race-modal {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
}

/* Max Value Highlight */
.max-highlight {
    color: #ff4b4b !important;
    font-weight: 700 !important;
}

/* Accident Probability Stat Glow Effects */
.bank-stat .val.danger-accident {
    color: var(--accent-pink) !important;
    text-shadow: 0 0 8px rgba(244, 63, 94, 0.6) !important;
    font-weight: 800;
    animation: flash-neon-pink 2.0s infinite alternate;
}

.bank-stat .val.warn-accident {
    color: #ffffff !important;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5) !important;
    font-weight: 800;
}

.bank-stat .val.safe-accident {
    color: #10b981 !important;
    text-shadow: 0 0 6px rgba(16, 185, 129, 0.4) !important;
}

@keyframes flash-neon-pink {
    0% {
        opacity: 0.85;
        text-shadow: 0 0 6px rgba(244, 63, 94, 0.5);
    }
    100% {
        opacity: 1;
        text-shadow: 0 0 12px rgba(244, 63, 94, 0.9), 0 0 20px rgba(244, 63, 94, 0.4);
    }
}

/* Digest Timeline Styles */
.digest-timeline {
    position: relative;
    padding-left: 32px;
    margin: 10px 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.digest-timeline::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: rgba(255, 255, 255, 0.1);
}

.timeline-step {
    position: relative;
    animation: fadeInUp 0.4s ease forwards;
    opacity: 0;
}

.timeline-step:nth-child(1) { animation-delay: 0.1s; }
.timeline-step:nth-child(2) { animation-delay: 0.2s; }
.timeline-step:nth-child(3) { animation-delay: 0.3s; }
.timeline-step:nth-child(4) { animation-delay: 0.4s; }

.timeline-step-dot {
    position: absolute;
    left: -32px;
    top: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 3px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

.timeline-step-dot::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Colors for stage dots corresponding to simulator tabs */
.timeline-step.stage-1 .timeline-step-dot {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px rgba(0, 242, 254, 0.4);
}
.timeline-step.stage-1 .timeline-step-dot::after {
    background-color: var(--accent-cyan);
}

.timeline-step.stage-2 .timeline-step-dot {
    border-color: var(--accent-blue);
    box-shadow: 0 0 8px rgba(30, 96, 235, 0.4);
}
.timeline-step.stage-2 .timeline-step-dot::after {
    background-color: var(--accent-blue);
}

.timeline-step.stage-3 .timeline-step-dot {
    border-color: var(--accent-purple);
    box-shadow: 0 0 8px rgba(126, 34, 206, 0.4);
}
.timeline-step.stage-3 .timeline-step-dot::after {
    background-color: var(--accent-purple);
}

.timeline-step.stage-4 .timeline-step-dot {
    border-color: var(--accent-pink);
    box-shadow: 0 0 8px rgba(244, 63, 94, 0.4);
}
.timeline-step.stage-4 .timeline-step-dot::after {
    background-color: var(--accent-pink);
}

.timeline-step-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px 20px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
}

.timeline-step-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateX(4px);
}

.timeline-step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.timeline-step-title {
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.timeline-step.stage-1 .timeline-step-title { color: var(--accent-cyan); }
.timeline-step.stage-2 .timeline-step-title { color: var(--accent-blue); }
.timeline-step.stage-3 .timeline-step-title { color: var(--accent-purple); }
.timeline-step.stage-4 .timeline-step-title { color: var(--accent-pink); }

.timeline-step-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.timeline-step-content {
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--text-main);
}

/* Runner inline tags */
.runner-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-weight: 800;
    font-size: 0.72rem;
    margin: 0 4px;
    vertical-align: middle;
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
    line-height: 1;
}

.runner-name-highlight {
    font-weight: 700;
    color: #fff;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
