/*
 * HorseAI Custom Styles
 * 
 * These styles ADD to Pico CSS (which handles basic typography, 
 * buttons, tables, forms, etc. automatically).
 * 
 * We only need to define:
 * - Layout tweaks (hero, stats grid)
 * - Custom colors and accents
 * - Component-specific styling
 */

/*  CSS VARIABLES (custom theme)  */
:root {
    --brand-color: #4a6fa5;          /* Slate blue */
    --brand-light: #6b8cbe;
    --brand-dark: #2c3e6b;
    --accent-color: #e8926a;         /* Warm coral accent */
    --accent-light: #f2b89c;
    --bg-card: #1e293b;              /* Dark card background */
    --bg-subtle: #1a2332;            /* Slightly darker subtle bg */
    --text-muted: #94a3b8;           /* Muted text for dark theme */
    --border-color: #2d3a4a;         /* Dark border */
    --border-light: #253040;         /* Lighter dark border */
    --table-text-size: 0.78rem;
    --table-header-text-size: 0.78rem;
    --ticket-sort-text-color: #e2e8f0;
    --ticket-race-group-header-color: #e2e8f0;
    --ticket-table-text-color: #e2e8f0;
    --ticket-table-header-bg-color: var(--brand-dark);
    --ticket-creator-text-color: #e2e8f0;
    --ticket-preview-header-bg-color: var(--brand-dark);
    --ticket-preview-header-text-color: rgba(255,255,255,0.55);
    --ticket-preview-row-text-color: #e2e8f0;
    --ticket-preview-bettype-text-color: #e2e8f0;
    --ticket-preview-total-label-color: #e2e8f0;
    --ticket-preview-total-value-color: var(--brand-color);
    --ticket-stat-value-color: #e2e8f0;
    --ticket-overlay-message-color: #e2e8f0;
}

/* Final alignment overrides for compact action controls */
.language-selector .lang-btn,
.language-selector .theme-toggle,
.race-info-bar .race-add-ticket-btn,
.race-predictions-header .race-shortcut-btn {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.language-selector .theme-toggle,
.language-selector .lang-btn {
    height: 32px !important;
    min-height: 32px !important;
}

html[data-theme="light"] {
    --brand-color: #3f6ea6;
    --brand-light: #5f86b8;
    --brand-dark: #284d77;
    --accent-color: #d67f53;
    --accent-light: #e79f7b;
    --bg-card: #f8fafc;
    --bg-subtle: #eef3f8;
    --text-muted: #475569;
    --border-color: #d6e0ea;
    --border-light: #c7d3df;
    --ticket-sort-text-color: #334155;
    --ticket-race-group-header-color: #334155;
    --ticket-table-text-color: #334155;
    --ticket-table-header-bg-color: #d7e5f3;
    --ticket-creator-text-color: #334155;
    --ticket-preview-header-bg-color: #d7e5f3;
    --ticket-preview-header-text-color: #41556f;
    --ticket-preview-row-text-color: #334155;
    --ticket-preview-bettype-text-color: #1f2937;
    --ticket-preview-total-label-color: #334155;
    --ticket-preview-total-value-color: #1d4ed8;
    --ticket-stat-value-color: #334155;
    --ticket-overlay-message-color: #334155;
}

/* Ticket tracker text color controls */
.sort-dropdown,
#sort-select {
    color: var(--ticket-sort-text-color) !important;
}

.sort-dropdown option,
#sort-select option {
    color: var(--ticket-sort-text-color) !important;
}

.race-group-header {
    color: var(--ticket-race-group-header-color) !important;
}

html[data-theme="light"] body {
    background: #f1f4f8;
    color: #1f2937;
}

html[data-theme="light"] h1,
html[data-theme="light"] h2,
html[data-theme="light"] h3,
html[data-theme="light"] h4,
html[data-theme="light"] h5,
html[data-theme="light"] h6,
html[data-theme="light"] th,
html[data-theme="light"] .race-title,
html[data-theme="light"] .news-card-title {
    color: #1f2937;
}

html[data-theme="light"] td,
html[data-theme="light"] label,
html[data-theme="light"] .secondary,
html[data-theme="light"] .muted,
html[data-theme="light"] .table-muted,
html[data-theme="light"] .user-dropdown-trigger {
    color: #334155;
}

html[data-theme="light"] .site-header nav a.secondary,
html[data-theme="light"] .site-header nav .user-dropdown-trigger,
html[data-theme="light"] .site-header nav .brand {
    color: #1f2937;
}

html[data-theme="light"] .site-header nav a.secondary,
html[data-theme="light"] .site-header nav .user-dropdown-trigger {
    color: #334155 !important;
}

html[data-theme="light"] main,
html[data-theme="light"] footer {
    background: transparent;
}

html[data-theme="light"] .site-header {
    background: #f8fafd;
    box-shadow: 0 1px 6px rgba(30, 41, 59, 0.12);
}

html[data-theme="light"] .premium-banner {
    background: linear-gradient(135deg, #35567f 0%, #4f77a8 58%, #6d95c4 100%);
}

html[data-theme="light"] article,
html[data-theme="light"] .stat-card,
html[data-theme="light"] .nav-tile,
html[data-theme="light"] .table-scroll,
html[data-theme="light"] .auth-overlay-card {
    box-shadow: 0 1px 6px rgba(23, 37, 84, 0.08);
}

html[data-theme="light"] .hero {
    border-bottom-color: var(--border-color);
}

html[data-theme="light"] .hero h1,
html[data-theme="light"] .nav-tile h3,
html[data-theme="light"] .quick-links h3 {
    color: #1f2937;
}

html[data-theme="light"] .hero p,
html[data-theme="light"] .nav-tile p,
html[data-theme="light"] .footer-text,
html[data-theme="light"] .empty-state {
    color: var(--text-muted);
}

html[data-theme="light"] .stat-card.stat-win h2 { color: #17824a; }
html[data-theme="light"] .stat-card.stat-win p  { color: #1f6f45; }
html[data-theme="light"] .stat-card.stat-place h2 { color: #1f60bd; }
html[data-theme="light"] .stat-card.stat-place p  { color: #235291; }
html[data-theme="light"] .stat-card.stat-top3 h2 { color: #a66808; }
html[data-theme="light"] .stat-card.stat-top3 p  { color: #8b5606; }

html[data-theme="light"] .nav-tile-predictions h3 { color: #5b3cb9; }
html[data-theme="light"] .nav-tile-predictions p  { color: #4c368f; }
html[data-theme="light"] .nav-tile-horses h3 { color: #14734f; }
html[data-theme="light"] .nav-tile-horses p  { color: #1c5f46; }
html[data-theme="light"] .nav-tile-jockeys h3 { color: #9a4b0f; }
html[data-theme="light"] .nav-tile-jockeys p  { color: #7f420f; }
html[data-theme="light"] .nav-tile-races h3 { color: #0f629e; }
html[data-theme="light"] .nav-tile-races p  { color: #12537f; }

html[data-theme="light"] .stats-hero {
    gap: 0.8rem;
}

html[data-theme="light"] .stats-group {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

html[data-theme="light"] .stats-group-label,
html[data-theme="light"] .stats-group-week .stats-group-label {
    color: #17385d;
}

html[data-theme="light"] .stat-pill {
    background: #dfeaf6;
    color: #17385d;
    border: 1px solid rgba(52, 72, 96, 0.16);
}

html[data-theme="light"] .filter-form label {
    color: #17385d;
}

html[data-theme="light"] .filter-form select {
    background: #e7f0f8;
    color: #17385d;
    border-color: rgba(52, 72, 96, 0.18);
}

html[data-theme="light"] .filter-form select option {
    background: #f8fbff;
    color: #17385d;
}

html[data-theme="light"] .quick-links a.outline {
    color: var(--brand-dark);
    border-color: var(--brand-dark);
}

html[data-theme="light"] .language-selector .lang-btn {
    color: #1f2937;
}

html[data-theme="light"] .language-selector {
    width: 100%;
    justify-content: center;
}

html[data-theme="light"] .theme-toggle {
    margin-left: 0;
    min-width: 68px;
    height: 32px;
    padding: 0.3rem 0.75rem;
    font-size: 0.82rem;
    border-radius: 5px;
    background: #ffffff;
}

html[data-theme="light"] .theme-toggle:hover {
    background: #f8fbff;
    border-color: #c7d3df;
    color: #475569;
}

html[data-theme="light"] .auth-tab.active {
    color: #1f2937;
    border-bottom-color: var(--brand-color);
}

html[data-theme="light"] .auth-tab:hover:not(.active) {
    color: #334155;
}

html[data-theme="light"] .venue-tabs,
html[data-theme="light"] .race-tabs {
    background: #e3ecf6;
}

html[data-theme="light"] .day-tabs {
    background: #e9f0f7;
}

html[data-theme="light"] .venue-separator {
    background: rgba(52, 72, 96, 0.22);
}

html[data-theme="light"] .venue-tab,
html[data-theme="light"] .day-tab,
html[data-theme="light"] .race-tab {
    color: #334155;
    border-color: rgba(52, 72, 96, 0.18);
    background: rgba(255, 255, 255, 0.86);
}

html[data-theme="light"] .race-tab-hit {
    background: rgba(74, 222, 128, 0.18);
    border-color: rgba(47, 126, 88, 0.34);
    color: #1f6a46;
}

html[data-theme="light"] .race-tab-place {
    background: rgba(251, 191, 36, 0.18);
    border-color: rgba(168, 121, 20, 0.34);
    color: #8c6411;
}

html[data-theme="light"] .race-tab-miss {
    background: rgba(148, 163, 184, 0.18);
    border-color: rgba(91, 107, 125, 0.34);
    color: #526273;
}

html[data-theme="light"] .venue-tab:hover,
html[data-theme="light"] .day-tab:hover,
html[data-theme="light"] .race-tab:hover {
    color: #14213a;
    background: #f7fbff;
}

html[data-theme="light"] .venue-tab.active,
html[data-theme="light"] .day-tab.active {
    color: #ffffff;
    background: #2e5f97;
    border-color: #2e5f97;
}

html[data-theme="light"] .race-tab.active {
    color: #17385d;
    background: #eef4fa;
    border-color: rgba(52, 72, 96, 0.22);
}

html[data-theme="light"] .race-tab.active:not(.race-tab-hit):not(.race-tab-place):not(.race-tab-miss) {
    background: #eef4fa !important;
    border-color: rgba(52, 72, 96, 0.22) !important;
    color: #17385d !important;
}

html[data-theme="light"] .race-tab.active.race-tab-hit {
    background: rgba(74, 222, 128, 0.26) !important;
    border-color: rgba(47, 126, 88, 0.55) !important;
    color: #14532d !important;
    box-shadow: inset 0 0 0 1px rgba(47, 126, 88, 0.12);
}

html[data-theme="light"] .race-tab.active.race-tab-hit .badge-sm,
html[data-theme="light"] .race-tab.active.race-tab-hit .race-tab-count {
    background: rgba(47, 126, 88, 0.18);
    color: #14532d;
}

html[data-theme="light"] .race-tab.active.race-tab-place {
    background: rgba(251, 191, 36, 0.26) !important;
    border-color: rgba(168, 121, 20, 0.55) !important;
    color: #7c4d0f !important;
    box-shadow: inset 0 0 0 1px rgba(168, 121, 20, 0.12);
}

html[data-theme="light"] .race-tab.active.race-tab-place .badge-sm,
html[data-theme="light"] .race-tab.active.race-tab-place .race-tab-count {
    background: rgba(168, 121, 20, 0.18);
    color: #7c4d0f;
}

html[data-theme="light"] .race-tab.active.race-tab-miss {
    background: rgba(148, 163, 184, 0.24) !important;
    border-color: rgba(91, 107, 125, 0.52) !important;
    color: #334155 !important;
    box-shadow: inset 0 0 0 1px rgba(91, 107, 125, 0.12);
}

html[data-theme="light"] .race-tab.active.race-tab-miss .badge-sm,
html[data-theme="light"] .race-tab.active.race-tab-miss .race-tab-count {
    background: rgba(91, 107, 125, 0.18);
    color: #334155;
}

html[data-theme="light"] .race-tab.active.race-tab-hit,
html[data-theme="light"] .race-tab.active.race-tab-place,
html[data-theme="light"] .race-tab.active.race-tab-miss {
    color: inherit !important;
}

html[data-theme="light"] .race-tab.active.race-tab-hit:hover,
html[data-theme="light"] .race-tab.active.race-tab-place:hover,
html[data-theme="light"] .race-tab.active.race-tab-miss:hover {
    filter: none;
}

html[data-theme="light"] .race-info-bar a {
    color: #17385d !important;
}

html[data-theme="light"] .race-info-bar a:hover {
    color: #0f2d4c !important;
}

html[data-theme="light"] .filter-bar {
    background: #d5e5f3;
}

html[data-theme="light"] .filter-form label {
    color: #1d4ed8;
}

html[data-theme="light"] .filter-form select {
    background: #ffffff;
    color: #17385d;
    border-color: rgba(29, 78, 216, 0.22);
    box-shadow: 0 1px 2px rgba(23, 56, 93, 0.08);
}

html[data-theme="light"] .filter-form select:focus {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.18);
}

html[data-theme="light"] .filter-form select option {
    background: #ffffff;
    color: #17385d;
}

html[data-theme="light"] .venue-stats-section,
html[data-theme="light"] .venue-stats-table,
html[data-theme="light"] .report-table,
html[data-theme="light"] .pred-table,
html[data-theme="light"] .payback-results-table,
html[data-theme="light"] .sim-table {
    color: #17324f;
}

html[data-theme="light"] .venue-stats-table td,
html[data-theme="light"] .report-table td,
html[data-theme="light"] .sim-table td,
html[data-theme="light"] .pred-table td {
    border-color: rgba(143, 170, 199, 0.22);
}

html[data-theme="light"] .payback-results-table strong {
    color: #17324f;
}

html[data-theme="light"] .vstat-row td,
html[data-theme="light"] .race-detail-header,
html[data-theme="light"] .race-card-footer {
    color: #17324f;
}

html[data-theme="light"] .venue-tab.active .venue-tab-count,
html[data-theme="light"] .day-tab.active .day-tab-count {
    background: rgba(255,255,255,0.2);
    color: #ffffff;
}

html[data-theme="light"] .stats-group-header,
html[data-theme="light"] .stats-group-pills,
html[data-theme="light"] .stat-pill {
    color: #1f2937;
}

html[data-theme="light"] .stats-group {
    background: rgba(255,255,255,0.52);
    border: 1px solid rgba(143, 170, 199, 0.35);
}

html[data-theme="light"] .stats-group-label,
html[data-theme="light"] .stat-pill .stat-label {
    color: #3b4a63;
}

html[data-theme="light"] .stat-pill .stat-value {
    color: #17385d;
}

html[data-theme="light"] .race-info-bar {
    background: #d8e6f4;
    border-bottom-color: rgba(52, 72, 96, 0.16);
}

html[data-theme="light"] .race-info-bar .tag {
    background: rgba(255,255,255,0.72);
    color: #27415f;
    border-color: rgba(52, 72, 96, 0.16);
}

html[data-theme="light"] .race-add-ticket-btn,
html[data-theme="light"] .race-shortcut-btn {
    background: rgba(58, 90, 156, 0.12);
    border-color: rgba(58, 90, 156, 0.32);
    color: #1c3f6e;
}

html[data-theme="light"] .race-add-ticket-btn:hover,
html[data-theme="light"] .race-shortcut-btn:hover {
    background: rgba(58, 90, 156, 0.2);
    border-color: rgba(58, 90, 156, 0.45);
    color: #102c4f;
}

html[data-theme="light"] .race-card-footer {
    background: #d8e6f4;
    color: #17385d;
    border-top-color: rgba(52, 72, 96, 0.16);
}

html[data-theme="light"] .race-card-footer strong {
    color: #17385d;
}

html[data-theme="light"] .pred-table th,
html[data-theme="light"] .payback-results-table th,
html[data-theme="light"] .venue-stats-table thead th,
html[data-theme="light"] .report-table th,
html[data-theme="light"] .sim-table th {
    background: #cfe0f1;
    color: #17385d;
    border-color: rgba(52, 72, 96, 0.14);
}

html[data-theme="light"] .pred-table td,
html[data-theme="light"] .payback-results-table td,
html[data-theme="light"] .venue-stats-table td,
html[data-theme="light"] .report-table td,
html[data-theme="light"] .sim-table td {
    color: #17324f;
    border-color: rgba(143, 170, 199, 0.28);
}

html[data-theme="light"] .payback-results-table strong {
    color: #17324f;
}

html[data-theme="light"] .row-winner,
html[data-theme="light"] .pred-table tbody tr.row-winner td {
    background: rgba(173, 219, 188, 0.22) !important;
}

html[data-theme="light"] .row-second,
html[data-theme="light"] .pred-table tbody tr.row-second td {
    background: rgba(252, 224, 164, 0.24) !important;
}

html[data-theme="light"] .row-third,
html[data-theme="light"] .pred-table tbody tr.row-third td {
    background: rgba(248, 201, 166, 0.24) !important;
}

html[data-theme="light"] .pred-table tbody tr.row-winner td,
html[data-theme="light"] .pred-table tbody tr.row-second td,
html[data-theme="light"] .pred-table tbody tr.row-third td {
    color: #17324f;
}

html[data-theme="light"] .stats-group-week .stats-group-label,
html[data-theme="light"] .stats-group-week .stat-pill .stat-label,
html[data-theme="light"] .stats-group-week .stat-pill .stat-value {
    color: #17324f;
}

/*  NAVIGATION  */
/*  STICKY HEADER  */
.site-header {
    /* Single knob for tiny header breathing space */
    --site-header-y-space: 0.5rem;
    padding-top: var(--site-header-y-space);
    padding-bottom: var(--site-header-y-space);
    margin: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--pico-background-color, #11191f);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.site-header nav {
    padding-top: var(--site-header-y-space);
    padding-bottom: var(--site-header-y-space);
    margin: 0;
}

.site-header nav ul {
    margin-bottom: 0;
}

.site-header nav li {
    padding: 0.2rem 0.6rem;
}

/*  PREMIUM BANNER  */
.premium-banner {
    background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand-color) 60%, var(--brand-light) 100%);
    color: #fff;
    text-align: center;
    padding: 0.15rem 1rem;
    font-size: 0.8rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.premium-banner.hidden {
    display: none;
}

.premium-dismiss {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.2rem;
    margin-left: 0.3rem;
}

.premium-dismiss:hover {
    color: #fff;
}

.premium-banner strong {
    color: var(--accent-light);
}

.premium-banner a.premium-link {
    color: var(--accent-light);
    text-decoration: underline;
}

.premium-btn {
    background: var(--accent-color);
    color: var(--brand-dark) !important;
    padding: 0.2rem 0.8rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.8rem;
}

.premium-btn:hover {
    background: var(--accent-light);
}

nav .brand {
    color: var(--brand-color);
    text-decoration: none;
    font-size: 1.2rem;
}

/*  HERO SECTION  */
.hero {
    text-align: center;
    padding: 2rem 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.hero h1 {
    color: var(--brand-dark);
    margin-bottom: 0.5rem;
    font-size: 2.2rem;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/*  HOME STATS CARDS GRID  */
.home-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.home-stats-grid {
    margin-left: auto;
    margin-right: auto;
}

.stat-card {
    text-align: center;
    padding: 1.5rem 1rem;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    margin: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.stat-card h2 {
    margin: 0;
    font-size: 2.5rem;
}

.stat-card p {
    margin: 0.3rem 0 0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Colored stat cards */
.stat-card.stat-win {
    border-color: rgba(74, 222, 128, 0.3);
    background: rgba(74, 222, 128, 0.06);
}
.stat-card.stat-win h2 { color: #4ade80; }
.stat-card.stat-win p  { color: #86efac; }

.stat-card.stat-place {
    border-color: rgba(96, 165, 250, 0.3);
    background: rgba(96, 165, 250, 0.06);
}
.stat-card.stat-place h2 { color: #60a5fa; }
.stat-card.stat-place p  { color: #93bbfd; }

.stat-card.stat-top3 {
    border-color: rgba(251, 191, 36, 0.3);
    background: rgba(251, 191, 36, 0.06);
}
.stat-card.stat-top3 h2 { color: #fbbf24; }
.stat-card.stat-top3 p  { color: #fcd34d; }

/*  NAV TILES (homepage)  */
.nav-tiles-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

.nav-tile {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
        "icon title"
        "icon desc";
    column-gap: 0.8rem;
    row-gap: 0.15rem;
    align-items: center;
    padding: 1rem 1.2rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.nav-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    text-decoration: none;
}

.nav-tile-icon {
    grid-area: icon;
    font-size: 1.8rem;
    flex-shrink: 0;
}

.nav-tile h3 {
    grid-area: title;
    margin: 0;
    font-size: 1rem;
    line-height: 1.2;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-tile p {
    grid-area: desc;
    margin: 0.1rem 0 0;
    font-size: 0.78rem;
    line-height: 1.2;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Colored nav tiles */
.nav-tile-predictions { border-color: rgba(139, 92, 246, 0.3); background: rgba(139, 92, 246, 0.06); }
.nav-tile-predictions h3 { color: #a78bfa; }
.nav-tile-predictions p  { color: #c4b5fd; }
.nav-tile-predictions:hover { border-color: rgba(139, 92, 246, 0.5); }

.nav-tile-horses { border-color: rgba(52, 211, 153, 0.3); background: rgba(52, 211, 153, 0.06); }
.nav-tile-horses h3 { color: #34d399; }
.nav-tile-horses p  { color: #6ee7b7; }
.nav-tile-horses:hover { border-color: rgba(52, 211, 153, 0.5); }

.nav-tile-jockeys { border-color: rgba(251, 146, 60, 0.3); background: rgba(251, 146, 60, 0.06); }
.nav-tile-jockeys h3 { color: #fb923c; }
.nav-tile-jockeys p  { color: #fdba74; }
.nav-tile-jockeys:hover { border-color: rgba(251, 146, 60, 0.5); }

.nav-tile-races { border-color: rgba(56, 189, 248, 0.3); background: rgba(56, 189, 248, 0.06); }
.nav-tile-races h3 { color: #38bdf8; }
.nav-tile-races p  { color: #7dd3fc; }
.nav-tile-races:hover { border-color: rgba(56, 189, 248, 0.5); }

/*  SECTIONS  */
.empty-state {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 2rem 0;
}

/*  QUICK LINKS  */
.quick-links {
    margin-top: 2rem;
    text-align: center;
}

.quick-links h3 {
    margin-bottom: 1rem;
}

.quick-links a[role="button"] {
    background-color: var(--brand-color);
    border-color: var(--brand-color);
}

.quick-links a[role="button"]:hover {
    background-color: var(--brand-light);
    border-color: var(--brand-light);
}

.quick-links a.outline {
    background: transparent;
    color: var(--brand-color);
}

/*  FOOTER  */
.footer-text {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.site-footer .footer-main-row {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) minmax(320px, auto) minmax(200px, 1fr);
    align-items: center;
    gap: 0.8rem;
    margin-top: 0.55rem;
}

.site-footer .footer-left {
    text-align: left;
}

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

.site-footer .footer-right {
    display: flex;
    justify-content: flex-end;
}

.site-footer .footer-text {
    margin: 0;
}

.footer-traffic {
    margin: 0;
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.footer-legal-links {
    margin: 0;
    display: inline-flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    font-size: 0.78rem;
}

.footer-legal-links a {
    color: var(--text-muted);
    text-decoration: none;
}

.footer-legal-links a:hover {
    text-decoration: underline;
}

.site-footer .language-selector {
    width: auto;
    margin: 1rem 0 0.5rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--border-color);
    justify-content: flex-start;
}

.theme-toggle {
    min-width: 0;
    min-height: 32px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.3rem 0.75rem;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    margin-left: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.2);
}

html[data-theme="light"] .theme-toggle {
    color: #1f2937;
    background: #ffffff;
    border-color: #c7d3df;
}

html[data-theme="light"] .theme-toggle:hover {
    background: #f8fbff;
    color: #111827;
}

/*  RESPONSIVE  */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.6rem;
    }
    .home-stats-grid {
        grid-template-columns: 1fr;
    }
    .nav-tiles-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .site-footer .footer-main-row {
        grid-template-columns: 1fr;
        gap: 0.45rem;
    }

    .site-footer .footer-left,
    .site-footer .footer-center,
    .site-footer .footer-right {
        text-align: center;
        justify-content: center;
    }

    .site-footer .footer-right {
        display: flex;
    }

    .footer-legal-links {
        justify-content: center;
    }

    .footer-traffic {
        white-space: normal;
    }

    .site-footer .language-selector {
        justify-content: center;
    }
}

/*  AUTH OVERLAY  */
.auth-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 500;
    align-items: center;
    justify-content: center;
}

.auth-overlay.open {
    display: flex !important;
}

/* Prevent background scroll when overlay is open */
body.auth-overlay-open {
    overflow: hidden;
}

.auth-overlay-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.auth-overlay-card {
    position: relative;
    z-index: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 2rem 2rem 1.75rem;
    width: min(440px, calc(100vw - 2rem));
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    animation: auth-slide-in 0.18s ease;
}

@keyframes auth-slide-in {
    from { opacity: 0; transform: translateY(-14px) scale(0.97); }
    to   { opacity: 1; transform: none; }
}

.auth-overlay-close {
    position: absolute;
    top: 0.6rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
    transition: color 0.1s, background 0.1s;
}

.auth-overlay-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* Tab bar */
.auth-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
    gap: 0;
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 0.55rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    border-radius: 0;
    transition: color 0.15s, border-color 0.15s;
}

.auth-tab.active {
    color: var(--brand-light);
    border-bottom-color: var(--brand-light);
}

.auth-tab:hover:not(.active) {
    color: #ccc;
}

/* Tab panels */
.auth-tab-panel {
    display: none;
}

.auth-tab-panel.active {
    display: block;
}

/* Message box (error / success) */
.auth-overlay-msg {
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
    font-size: 0.88rem;
    margin-bottom: 1rem;
}

.auth-overlay-msg--error {
    background: #3b1c1f;
    color: #f48c95;
    border: 1px solid #5c2a30;
}

.auth-overlay-msg--success {
    background: #1a3326;
    color: #6fcf97;
    border: 1px solid #2a5040;
}

/* Keep the overlay form inputs/buttons consistent with the dark theme */
.auth-overlay-title {
    margin: 0 0 1.25rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #e2e8f0;
}

.auth-overlay-card label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    display: block;
}

.auth-overlay-card input {
    margin-bottom: 1rem;
}

.auth-overlay-card button[type="submit"] {
    width: 100%;
    margin-top: 0.5rem;
}

/*  AUTH PAGES (login, register)  */
.auth-page {
    display: flex;
    justify-content: center;
    padding: 2rem 0;
}

.auth-card {
    max-width: 420px;
    width: 100%;
    padding: 2rem;
}

.auth-card h2 {
    text-align: center;
    color: var(--brand-dark);
    margin-bottom: 1.5rem;
}

.auth-error {
    background: #fceced;
    color: #944a50;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    border: 1px solid #f0d0d3;
}

.auth-success {
    background: #eaf5ee;
    color: #3a7a52;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    border: 1px solid #c8e3d2;
}

.auth-link {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.auth-link a {
    color: var(--brand-color);
    font-weight: 600;
}

.auth-social-stack {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 0.55rem;
    margin-bottom: 0.85rem;
}

.auth-social-stack-overlay {
    margin-top: 0.2rem;
}

.auth-social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2.65rem;
    height: 2.65rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0;
    text-decoration: none;
    font-size: 0;
    line-height: 0;
    color: transparent;
    background: rgba(255, 255, 255, 0.03);
}

.auth-social-link::before {
    content: "";
    width: 1.45rem;
    height: 1.45rem;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    flex: 0 0 1.45rem;
}

.auth-social-link:hover {
    border-color: var(--brand-color);
    color: #ffffff;
}

.auth-social-google {
    border-color: rgba(66, 133, 244, 0.35);
}

.auth-social-google::before {
    background-image: url('/static/icons/google.svg');
}

.auth-social-x {
    border-color: rgba(29, 161, 242, 0.35);
}

.auth-social-x::before {
    background-image: url('/static/icons/x.svg');
}

.auth-social-line {
    border-color: rgba(6, 199, 85, 0.35);
}

.auth-social-line::before {
    background-image: url('/static/icons/line.svg');
    width: 100%;
    height: 100%;
    flex: 0 0 100%;
    border-radius: 8px;
    background-size: 100% 100%;
}

.auth-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0.65rem 0 1rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1 1 auto;
    border-top: 1px solid var(--border-color);
}

.auth-divider span {
    padding: 0 0.6rem;
}

.oauth-link-list {
    display: grid;
    gap: 0.8rem;
}

.oauth-link-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
}

.oauth-link-status {
    margin-top: 0.25rem;
    font-size: 0.84rem;
}

.oauth-link-status-on {
    color: #4ade80;
}

.oauth-link-status-off {
    color: var(--text-muted);
}

/*  USER DROPDOWN  */
.user-dropdown {
    position: relative;
}

.user-dropdown-trigger {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.user-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    padding: 0.5rem 0;
    margin: 0;
    list-style: none;
    z-index: 100;
}

.user-dropdown-menu.show {
    display: block;
}

.user-dropdown-menu li {
    margin: 0;
    padding: 0;
}

.user-dropdown-menu a {
    display: block;
    padding: 0.65rem 1.25rem;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.95rem;
    transition: background 0.15s;
}

.user-dropdown-menu a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--brand-light);
}

/*  FILTER BAR (predictions date/venue selector)  */
.filter-bar {
    margin-bottom: 2rem;
    padding: 1rem 1.25rem;
    background: var(--brand-dark);
    border-radius: 10px;
    border: none;
}

.filter-form {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 0;
}

.filter-form label {
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.filter-form select {
    margin: 0;
    max-width: 260px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 6px;
    padding: 0.4rem 0.7rem;
    font-size: 0.9rem;
}

.filter-form select:focus {
    border-color: var(--brand-light);
    outline: none;
    box-shadow: 0 0 0 2px rgba(107,140,190,0.3);
}

.filter-form select option {
    background: var(--brand-dark);
    color: #fff;
}

/*  STATS HERO (global stats bar)  */
.stats-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    margin-bottom: 0.8rem;
}

.stats-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stats-group-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted, #888);
    margin-right: 0.25rem;
    white-space: nowrap;
}

.stats-group-week .stats-group-label {
    text-align: right;
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--brand-dark);
    color: #fff;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

.stat-pill .stat-label {
    display: inline-flex;
    align-items: center;
    font-weight: 400;
    opacity: 0.65;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
    margin: 0;
}

.stat-pill .stat-value {
    display: inline-flex;
    align-items: center;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1;
    margin: 0;
}

/* VENUE WEEK STATS TABLE */
.venue-stats-section {
    margin: 0.6rem 0 0.8rem;
    overflow: hidden;
    border-radius: 8px;
    background: var(--bg-card);
}

.venue-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.76rem;
    table-layout: auto;
}

.venue-stats-table thead tr {
    background: var(--brand-dark);
}

.venue-stats-table thead th {
    padding: 0.3rem 0.75rem;
    text-align: left;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.55);
    border: none;
}

.vstat-row td {
    padding: 0.25rem 0.75rem;
    border-bottom: 1px solid var(--border-light);
    border-top: none;
    color: #e2e8f0;
}

.venue-stats-table thead th:first-child,
.vstat-row td:first-child {
    width: auto;
    text-align: left;
}

.venue-stats-table thead th:not(:first-child),
.vstat-row td:not(:first-child) {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}

.vstat-row:last-child td {
    border-bottom: none;
}

.vstat-venue {
    font-weight: 600;
}

.vstat-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
}

/* JRA row: subtle blue tint */
.vstat-row.vstat-jra td {
    background-color: rgba(58, 90, 156, 0.15);
}
.vstat-row.vstat-jra:hover td {
    background-color: rgba(58, 90, 156, 0.26);
}

/* NAR row: subtle green tint */
.vstat-row.vstat-nar td {
    background-color: rgba(45, 130, 90, 0.15);
}
.vstat-row.vstat-nar:hover td {
    background-color: rgba(45, 130, 90, 0.26);
}

/*  VENUE TABS (horizontal row of venue buttons)  */
.venue-tabs {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 0;
    padding: 0.5rem 0.6rem;
    background: var(--brand-dark);
    border-radius: 10px 10px 0 0;
    overflow-x: auto;
    flex-wrap: nowrap;
}

.venue-group {
    display: flex;
    gap: 0.3rem;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.venue-group-jra {
    margin-right: auto;
}

.venue-separator {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.25);
    margin: 0 0.6rem;
    flex-shrink: 0;
}

.predictions-page .venue-tab,
.predictions-page .day-tab,
.predictions-page .race-tab {
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    line-height: 1;
    margin: 0 !important;
    min-height: 0;
    min-width: 0;
    box-shadow: none;
    text-decoration: none !important;
}

.predictions-page .venue-tab {
    padding: 0.3rem 0.65rem;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.65);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.15s, color 0.15s;
}

.venue-tab:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.venue-tab.active {
    background: var(--brand-color);
    color: #fff;
    border-color: var(--brand-color);
}

.venue-tab-count {
    font-size: 0.7rem;
    font-weight: 400;
    background: rgba(255,255,255,0.12);
    padding: 0.08rem 0.4rem;
    border-radius: 10px;
}

.venue-tab.active .venue-tab-count {
    background: rgba(255,255,255,0.22);
}

/* Only show the active venue panel */
.venue-panel { display: none; }
.venue-panel.active { display: block; }

/*  DAY TABS (horizontal day selector)  */
.day-tabs {
    display: flex;
    gap: 0.35rem;
    padding: 0.5rem 0.6rem;
    background: #3b5488;
    overflow-x: auto;
    margin-top: 0;
}

.predictions-page .day-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 0.3rem 0.7rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.day-tab:hover { background: rgba(255,255,255,0.15); color: #fff; }
.day-tab.active { background: var(--accent-color); color: #fff; border-color: transparent; }

.day-tab-count {
    font-size: 0.68rem;
    font-weight: 400;
    opacity: 0.65;
    margin-left: 0.25rem;
}

.day-panel { display: none; }
.day-panel.active { display: block; }

/*  RACE TABS (horizontal race selector)  */
.race-tabs {
    display: flex;
    gap: 0.3rem;
    padding: 0.4rem 0.6rem;
    background: var(--brand-dark);
    overflow-x: auto;
}

.predictions-page .race-tab {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.65);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 5px;
    padding: 0.25rem 0.55rem;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

html[data-theme="light"] .predictions-page .race-tab-hit {
    background: rgba(74, 222, 128, 0.18);
    border-color: rgba(47, 126, 88, 0.34);
    color: #1f6a46;
}

html[data-theme="light"] .predictions-page .race-tab-place {
    background: rgba(251, 191, 36, 0.18);
    border-color: rgba(168, 121, 20, 0.34);
    color: #8c6411;
}

html[data-theme="light"] .predictions-page .race-tab-miss {
    background: rgba(148, 163, 184, 0.18);
    border-color: rgba(91, 107, 125, 0.34);
    color: #526273;
}

html:not([data-theme="light"]) .predictions-page .race-tab-hit {
    background: rgba(74, 222, 128, 0.2);
    border-color: rgba(74, 222, 128, 0.45);
    color: #b8f7d3;
}

html:not([data-theme="light"]) .predictions-page .race-tab-place {
    background: rgba(251, 191, 36, 0.2);
    border-color: rgba(251, 191, 36, 0.45);
    color: #fde9a6;
}

html:not([data-theme="light"]) .predictions-page .race-tab-miss {
    background: rgba(148, 163, 184, 0.2);
    border-color: rgba(148, 163, 184, 0.45);
    color: #d7dee9;
}

.race-tab:hover { background: rgba(255,255,255,0.12); color: #fff; }
.race-tab.active { color: #fff; border-color: rgba(255,255,255,0.25); }
.race-tab.active:not(.race-tab-hit):not(.race-tab-place):not(.race-tab-miss) {
    background: rgba(255,255,255,0.2);
}

.race-tab-hit {
    background: rgba(74, 222, 128, 0.2);
    border-color: rgba(74, 222, 128, 0.45);
    color: #b8f7d3;
}

.race-tab-place {
    background: rgba(251, 191, 36, 0.2);
    border-color: rgba(251, 191, 36, 0.45);
    color: #fde9a6;
}

.race-tab-miss {
    background: rgba(148, 163, 184, 0.2);
    border-color: rgba(148, 163, 184, 0.45);
    color: #d7dee9;
}

.race-tab-hit:hover,
.race-tab-place:hover,
.race-tab-miss:hover {
    filter: brightness(1.08);
}

.race-tab.active.race-tab-hit,
.race-tab.active.race-tab-place,
.race-tab.active.race-tab-miss {
    filter: none;
}

.badge-sm {
    font-size: 0.55rem;
    padding: 0.05rem 0.25rem;
    border-radius: 3px;
}

.race-panel { display: none; }
.race-panel.active { display: block; }

.predictions-page .venue-panel > .race-info-bar {
    margin-bottom: 0.1rem !important;
}

.predictions-page .day-tabs {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

.predictions-page .race-tabs {
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
}

/*  RACE INFO BAR (labels inside the table)  */
.race-info-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.6rem;
    background: #344878;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-wrap: nowrap;
}

.race-info-title {
    text-decoration: none;
    color: inherit;
    font-weight: 600;
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(40vw, 420px);
}

.race-info-tags {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.race-add-ticket-btn,
.race-shortcut-btn {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    padding: 0.32rem 0.7rem;
    min-height: 32px;
    border-radius: 6px;
    border: 1px solid rgba(74, 111, 165, 0.55);
    background: rgba(74, 111, 165, 0.2);
    color: #dbeafe;
    text-decoration: none;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1;
    margin-bottom: 0 !important;
}

.race-info-bar .race-add-ticket-btn,
.race-predictions-header .race-shortcut-btn {
    margin-top: 0;
    margin-bottom: 0;
    align-self: center;
}

.race-add-ticket-btn:hover,
.race-shortcut-btn:hover {
    background: rgba(107, 140, 190, 0.28);
    border-color: rgba(107, 140, 190, 0.75);
    color: #ffffff;
}

.race-predictions-header {
    margin-top: 1.5rem;
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.race-predictions-header h3 {
    margin: 0;
}

.ticket-shortcut-modal {
    position: fixed;
    inset: 0;
    z-index: 3600;
    display: none;
    align-items: center;
    justify-content: center;
}

.ticket-shortcut-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
}

.ticket-shortcut-card {
    position: relative;
    z-index: 1;
    width: min(1050px, 96vw);
    max-height: 92vh;
    overflow: auto;
    border-radius: 10px;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.ticket-shortcut-close {
    position: absolute;
    right: 10px;
    top: 10px;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-subtle);
    color: var(--text-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.ticket-shortcut-header {
    margin-bottom: 0.8rem;
}

.ticket-shortcut-header h3 {
    margin: 0;
}

.ticket-shortcut-race-name {
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.ticket-shortcut-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.7rem;
}

.form-group-full {
    grid-column: 1 / -1;
}

.qs-horses-wrap,
.qs-preview-wrap {
    margin-top: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.7rem;
    background: var(--bg-subtle);
}

.qs-horses-label,
.qs-preview-head {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.45rem;
}

.qs-horses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.35rem;
}

.ts-horse-btn {
    text-align: left;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-color);
    font-size: 0.78rem;
    cursor: pointer;
}

.ts-horse-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.ts-horse-btn.selected {
    background: var(--brand-color);
    color: #fff;
    border-color: var(--brand-light);
}

.qs-preview-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.qs-preview-row {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.35rem 0.45rem;
    border-radius: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    font-size: 0.82rem;
}

.qs-preview-total {
    margin-top: 0.55rem;
    font-size: 0.86rem;
}

.qs-actions {
    margin-top: 0.9rem;
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.55rem;
}

@media (max-width: 760px) {
    .ticket-shortcut-card {
        width: 100vw;
        max-height: 100vh;
        border-radius: 0;
        border: 0;
    }

    .ticket-shortcut-grid {
        grid-template-columns: 1fr;
    }
}

.ticket-shortcut-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3500;
}

.ticket-shortcut-overlay.open {
    display: flex;
}

.ticket-shortcut-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
}

.ticket-shortcut-overlay-card {
    position: relative;
    z-index: 1;
    width: min(1200px, 96vw);
    height: min(92vh, 920px);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: #111827;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
}

.ticket-shortcut-overlay-close {
    position: absolute;
    top: 8px;
    right: 10px;
    z-index: 2;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(15, 23, 42, 0.8);
    color: #e5e7eb;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.ticket-shortcut-overlay-close:hover {
    background: rgba(30, 41, 59, 0.9);
}

.ticket-shortcut-overlay-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: transparent;
}

html.ticket-shortcut-open,
body.ticket-shortcut-open {
    overflow: hidden;
}

@media (max-width: 720px) {
    .ticket-shortcut-overlay-card {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        border: 0;
    }
}

.race-info-bar .tag {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.75);
    border: 1px solid rgba(255,255,255,0.12);
    font-size: 0.72rem;
    padding: 0.12rem 0.45rem;
}

@media (max-width: 980px) {
    .race-info-bar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "title action"
            "tags tags";
        align-items: center;
        row-gap: 0.4rem;
    }

    .race-info-title {
        grid-area: title;
        max-width: 100%;
    }

    .race-info-tags {
        grid-area: tags;
    }

    .race-add-ticket-btn {
        grid-area: action;
        margin-left: 0;
    }

    /* Venue header has no action button, so keep venue + org tag on one line. */
    .predictions-page .venue-panel > .race-info-bar {
        display: flex;
        grid-template-columns: none;
        grid-template-areas: none;
        flex-wrap: nowrap;
        align-items: center;
    }

    .predictions-page .venue-panel > .race-info-bar .race-info-title {
        flex: 1 1 auto;
        min-width: 0;
        max-width: none;
    }

    .predictions-page .venue-panel > .race-info-bar .race-info-tags {
        flex: 0 0 auto;
        min-width: auto;
        flex-wrap: nowrap;
    }
}

.tag {
    display: inline-block;
    padding: 0.12rem 0.4rem;
    font-size: 0.7rem;
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.12);
}

.tag.org-jra { background: rgba(58,90,156,0.35); color: #a8c0e8; border-color: rgba(58,90,156,0.3); }
.tag.org-nar { background: rgba(107,79,160,0.3); color: #c8b5e8; border-color: rgba(107,79,160,0.25); }

.race-dropdown-body {
    overflow-x: auto;
}

/*  PREDICTION TABLE  */
.pred-table {
    margin: 0;
    font-size: 0.8rem;
    width: 100%;
    border-collapse: collapse;
    line-height: 1.3;
}

.pred-table th {
    background: #364a7a;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.25rem 0.4rem;
    color: rgba(255,255,255,0.6);
    font-weight: 600;
}

.pred-table td {
    padding: 0.18rem 0.4rem;
    border-top: 1px solid var(--border-light);
}

.bar-cell { width: 80px; }
.odds-cell { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-secondary, #8a8fa3); }

.locked-winprob-head {
    text-align: center;
}

.locked-winprob-cell {
    position: relative;
    text-align: center;
    min-width: 120px;
    background: rgba(148, 163, 184, 0.08);
}

.locked-winprob-value {
    display: inline-block;
    color: rgba(148, 163, 184, 0.95);
    filter: blur(2px);
    user-select: none;
}

.pred-table-wrap {
    position: relative;
}

.locked-winprob-overlay {
    position: absolute;
    inset: 0;
    z-index: 6;
    pointer-events: none;
}

.locked-winprob-overlay-text {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(90deg);
    transform-origin: center;
    font-size: 0.72rem;
    color: var(--text-secondary, #8a8fa3);
    letter-spacing: 0.03em;
    white-space: nowrap;
    pointer-events: auto;
}

.locked-winprob-overlay-text a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 700;
}

.locked-winprob-overlay-text a:hover {
    color: var(--accent-light);
}

/* PAYBACK RESULTS TABLE */
.payback-results-table {
    margin: 0;
    font-size: 0.85rem;
    width: 100%;
    border-collapse: collapse;
    line-height: 1.4;
}

.payback-results-table th {
    background: #52577a;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.3rem 0.5rem;
    color: rgba(255,255,255,0.7);
    font-weight: 600;
    text-align: left;
}

.payback-results-table td {
    padding: 0.18rem 0.3rem;
    border-top: 1px solid var(--border-light);
    font-variant-numeric: tabular-nums;
    vertical-align: middle;
}

.payback-results-table strong {
    color: rgba(255,255,255,0.85);
    font-weight: 600;
}

/* Unified data-table typography across prediction/trend/jockey/race pages */
.pred-table th,
.trending-table th,
.race-detail-table th,
.payback-results-table th,
.venue-stats-table thead th,
.sim-table th,
.report-table th {
    font-size: var(--table-header-text-size);
}

.pred-table td,
.trending-table td,
.race-detail-table td,
.payback-results-table td,
.venue-stats-table td,
.vstat-row td,
.sim-table td,
.report-table td {
    font-size: var(--table-text-size);
}

/* Probability bar */
.prob-bar {
    width: 70px;
    height: 5px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.prob-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-light), var(--brand-color));
    border-radius: 3px;
    max-width: 100%;
}

/* Result highlights */
.row-winner {
    background: rgba(74, 222, 128, 0.24) !important;
}

.row-second {
    background: rgba(251, 191, 36, 0.26) !important;
}

.row-third {
    background: rgba(251, 146, 60, 0.24) !important;
}

.pred-table tbody tr.row-winner td {
    background: rgba(74, 222, 128, 0.24) !important;
}

.pred-table tbody tr.row-second td {
    background: rgba(251, 191, 36, 0.26) !important;
}

.pred-table tbody tr.row-third td {
    background: rgba(251, 146, 60, 0.24) !important;
}

.row-winner td,
.row-second td,
.row-third td {
    color: #e8eef6;
}

html:not([data-theme="light"]) .race-tab.active.race-tab-hit {
    background: rgba(74, 222, 128, 0.24);
    border-color: rgba(74, 222, 128, 0.52);
    color: #d7ffe7;
    box-shadow: inset 0 0 0 1px rgba(74, 222, 128, 0.18);
}

html:not([data-theme="light"]) .race-tab.active.race-tab-hit .badge-sm,
html:not([data-theme="light"]) .race-tab.active.race-tab-hit .race-tab-count {
    background: rgba(74, 222, 128, 0.22);
    color: #d7ffe7;
}

html:not([data-theme="light"]) .race-tab.active.race-tab-place {
    background: rgba(251, 191, 36, 0.24);
    border-color: rgba(251, 191, 36, 0.52);
    color: #fff0bf;
    box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.18);
}

html:not([data-theme="light"]) .race-tab.active.race-tab-place .badge-sm,
html:not([data-theme="light"]) .race-tab.active.race-tab-place .race-tab-count {
    background: rgba(251, 191, 36, 0.22);
    color: #fff0bf;
}

html:not([data-theme="light"]) .race-tab.active.race-tab-miss {
    background: rgba(148, 163, 184, 0.26);
    border-color: rgba(148, 163, 184, 0.46);
    color: #e2e8f0;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.16);
}

html:not([data-theme="light"]) .race-tab.active.race-tab-miss .badge-sm,
html:not([data-theme="light"]) .race-tab.active.race-tab-miss .race-tab-count {
    background: rgba(148, 163, 184, 0.22);
    color: #e2e8f0;
}

.badge {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 4px;
}

.badge-win  { background: #48956e; color: #fff; }
.badge-2nd  { background: #e8b84a; color: #fff; }
.badge-3rd  { background: #d48a5a; color: #fff; }
.badge-miss { background: #c4747c; color: #fff; }

.race-card-footer {
    padding: 0.35rem 0.6rem;
    background: var(--brand-dark);
    color: #fff;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.78rem;
}

/*  TILE CAROUSEL (homepage)  */
.tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2.5rem 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    min-height: 180px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.tile:hover {
    transform: translateY(-3px);
    border-color: var(--brand-light);
    box-shadow: 0 6px 20px rgba(74,111,165,0.12);
    text-decoration: none;
}

.tile-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.tile h3 {
    margin: 0 0 0.3rem;
    color: var(--brand-dark);
    font-size: 1.2rem;
}

.tile p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-form select {
        max-width: none;
    }
    .tiles-grid {
        grid-template-columns: 1fr 1fr;
    }
    .venue-tabs, .day-tabs, .race-tabs {
        gap: 0.25rem;
        padding: 0.35rem 0.4rem;
    }
    .race-info-bar .tag {
        font-size: 0.65rem;
    }
}

/*  HOME NEWS SECTION  */
.home-news {
    margin-top: 2rem;
}

.home-news h2 {
    margin-bottom: 1rem;
    color: #e2e8f0;
}

.home-news-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem;
    margin-bottom: 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: border-color 0.2s;
}

.home-news-item:hover {
    border-color: rgba(96, 165, 250, 0.4);
}

.home-news-img {
    flex-shrink: 0;
    width: 78px;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    background-color: #1e293b;
}

.home-news-img-placeholder {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

.home-news-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    gap: 0.15rem;
}

.home-news-body h3 {
    margin: 0;
    font-size: 1rem;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.home-news-summary {
    margin: 0;
    color: #94a3b8;
    font-size: 0.82rem;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.home-news-stats {
    display: none;
}

.home-news-stats span {
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: rgba(96, 165, 250, 0.08);
    color: #60a5fa;
}

.home-news-more {
    display: none;
}

@media (max-width: 768px) {
    .home-news-item {
        align-items: center;
    }
    .home-news-img {
        width: 64px;
    }

    .home-stats-grid {
        max-width: none;
    }
}

/*  NEWS LIST PAGE  */
/* Default mobile: single column stack */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.news-card-link {
    text-decoration: none;
    color: inherit;
}

.news-card {
    display: flex;
    gap: 0;
    padding: 0;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.news-card:hover {
    border-color: rgba(96, 165, 250, 0.4);
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
}

.news-card-img {
    flex-shrink: 0;
    width: 110px;
    aspect-ratio: unset;
    align-self: stretch;
    border-radius: 0;
    background-size: cover;
    background-position: center;
    background-color: #1e293b;
}

.news-card-body {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0.7rem 0.85rem;
}

@media (min-width: 841px) {
    .news-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    .news-card-img {
        width: 140px;
    }
}

.news-card-img-placeholder {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

/* Weekly report card image area */
.news-card-img-week {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f2027 0%, #1a3a5c 50%, #203a4c 100%);
}

.news-card-img-results {
    background: linear-gradient(135deg, #0f2a1a 0%, #1a4a2e 60%, #1f5535 100%);
}

.news-card-img-preview {
    background: linear-gradient(135deg, #1a1040 0%, #2d1b69 60%, #3b2080 100%);
}

.week-type-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: rgba(255,255,255,0.55);
    margin-bottom: 0.15rem;
}

.news-tile-hidden {
    display: none;
}

.week-stat-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    text-align: center;
    padding: 0.5rem;
}

.week-stat-big {
    font-size: 2rem;
    font-weight: 800;
    color: #4ade80;
    line-height: 1;
}

.week-stat-sub {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
}

.week-stat-place {
    font-size: 0.7rem;
    color: #60a5fa;
    margin-top: 0.2rem;
}

/* Day links inside the weekly card */
.news-week-actions {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
    margin-top: 0.6rem;
}

.news-week-day-label {
    font-size: 0.72rem;
    color: var(--text-muted, #94a3b8);
    white-space: nowrap;
    margin-right: 0.1rem;
}

.news-card-body h3 {
    margin: 0 0 0.2rem;
    font-size: 1.05rem;
    color: #e2e8f0;
}

.news-card-dates {
    font-size: 0.78rem;
    color: #64748b;
    margin-bottom: 0.3rem;
}

.news-card-body p {
    margin: 0 0 0.4rem;
    font-size: 0.85rem;
    color: #94a3b8;
}

.news-card-stats {
    display: flex;
    gap: 0.7rem;
    font-size: 0.75rem;
}

.news-card-stats span {
    padding: 0.12rem 0.4rem;
    border-radius: 4px;
    background: rgba(96, 165, 250, 0.08);
    color: #60a5fa;
}

@media (max-width: 840px) {
    .news-card-img {
        width: 90px;
    }
}

/*  ARTICLE DETAIL PAGE  */
.article-detail {
    max-width: 900px;
    margin: 0 auto;
}

.article-header h1 {
    margin-bottom: 0.3rem;
    color: #e2e8f0;
}

.article-period {
    color: #60a5fa;
    font-size: 0.9rem;
    margin: 0 0 0.2rem;
}

.article-date {
    color: #64748b;
    font-size: 0.82rem;
    margin: 0 0 1rem;
}

.article-cover {
    margin-bottom: 1.5rem;
}

.article-cover img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 10px;
}

.article-stats-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}

.article-stat {
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    background: rgba(96, 165, 250, 0.08);
    color: #60a5fa;
}

.article-body {
    color: #cbd5e1;
    line-height: 1.7;
    font-size: 0.95rem;
}

/*  NAME CELLS (horse/jockey links in pred table)  */
.name-cell {
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.name-cell a {
    color: var(--brand-light);
    text-decoration: none;
}

.name-cell a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

/*  DETAIL PAGES (horse/jockey)  */
.detail-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.detail-header h2 {
    margin: 0;
}

.detail-id {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.external-link {
    font-size: 0.8rem;
    color: var(--brand-light);
    text-decoration: none;
}

.external-link:hover {
    color: var(--accent-color);
}

/*  Rating Chart  */
.rating-chart-section {
    margin-bottom: 1.5rem;
}
.rating-chart-section h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    color: var(--text-muted);
}
.chart-wrapper {
    position: relative;
    height: 260px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
}
.single-rating {
    color: var(--text-muted);
    font-size: 0.95rem;
}
.single-rating strong {
    color: #6366f1;
    font-size: 1.1rem;
}

/*  BROWSE PAGE LAYOUT  */
.browse-page {
    max-width: 700px;
    margin: 0 auto;
}

/*  SEARCH BAR  */
.search-wrapper {
    position: relative;
    max-width: 480px;
    margin: 0 auto 1.5rem;
}

.search-input {
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    border-radius: 6px;
    background: #cfe0f1 !important;
    color: #2d3748 !important;
    margin-bottom: 0;
}

html:not([data-theme="light"]) .search-input {
    border: 1px solid #4a5568 !important;
    border-radius: 6px;
    background: #2d3748 !important;
    color: #cbd5e0 !important;
}

.search-input::placeholder {
    color: #718096;
}

.search-input:focus {
    border-color: var(--brand-light) !important;
    outline: none;
    box-shadow: 0 0 0 2px rgba(107, 140, 190, 0.3);
}

.search-results {
    display: none;
    position: relative;
    background: #2d3748 !important;
    border: 1px solid #4a5568;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: calc(5 * 2.2rem);
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.search-results.active {
    display: block;
}

.search-item {
    display: block;
    padding: 0.5rem 1rem;
    height: 2.2rem;
    line-height: 1.2rem;
    color: #cbd5e0 !important;
    text-decoration: none;
    font-size: 0.85rem;
    border-bottom: 1px solid #4a5568;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

.search-item:hover {
    background: #3b4a63 !important;
    color: var(--accent-light) !important;
}

.search-item.no-result {
    color: #718096 !important;
    font-style: italic;
    cursor: default;
}

.search-separator {
    height: 2.2rem;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    pointer-events: none;
    user-select: none;
}

.search-separator::before {
    content: '';
    display: block;
    width: 100%;
    height: 2px;
    background: #5a6a82;
    border-radius: 1px;
}

.search-kana {
    color: #718096;
    font-size: 0.78rem;
    margin-left: 0.4rem;
}

/*  NEWS - RACE DAY CARDS (news list page)  */
.section-heading {
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-color);
}

.race-day-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.race-day-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    transition: border-color 0.15s;
}

.race-day-card:hover {
    border-color: var(--brand-light);
}

.race-day-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.race-day-date {
    font-weight: 700;
    font-size: 1rem;
    color: var(--pico-color, #fff);
}

.race-day-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.race-day-venues {
    font-size: 0.85rem;
    color: var(--pico-color, #e0e0e0);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.race-day-stat {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.race-day-stat strong {
    color: #4ade80;
}

.race-day-actions {
    margin-top: 0.3rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.race-day-actions a[role="button"] {
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
    margin: 0;
}

/* News badges */
.news-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.15rem 0.55rem;
    border-radius: 100px;
}
.badge-upcoming { background: #1a4a2e; color: #4ade80; }
.badge-results  { background: #1a3a5c; color: #60a5fa; }
.badge-past     { background: #2a2a2a; color: #94a3b8; }

/*  NEWS - REPORT PAGES (prediction & results)  */

/* Report page header */
.report-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem 0 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.report-header h1 {
    margin: 0.2rem 0 0.3rem;
    font-size: 1.7rem;
}

.report-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

.back-link {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-decoration: none;
}
.back-link:hover { color: var(--brand-light); }

.report-header-nav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Report sections */
.report-section {
    margin-bottom: 2.5rem;
}

.report-section-header {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.report-section-icon {
    font-size: 1.6rem;
    line-height: 1.2;
    flex-shrink: 0;
}

.report-section-header h2 {
    margin: 0 0 0.2rem;
    font-size: 1.15rem;
}

.report-section-header p {
    margin: 0;
    font-size: 0.84rem;
    color: var(--text-muted);
}

/* Report tables */
.table-responsive {
    overflow-x: auto;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--table-text-size);
}

.report-table th {
    background: var(--bg-subtle, #1a2332);
    color: var(--text-muted);
    font-weight: 600;
    font-size: var(--table-header-text-size);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.5rem 0.75rem;
    text-align: left;
    white-space: nowrap;
}

.report-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border-light, #253040);
    vertical-align: middle;
}

.report-table tr:last-child td { border-bottom: none; }
.report-table tr:hover td { background: rgba(255,255,255,0.03); }

.num-col { text-align: right !important; white-space: nowrap; }
.horse-col { font-weight: 600; }
.muted-col { color: var(--text-muted); font-size: inherit; }
.muted { color: var(--text-muted); }

.compact-table th, .compact-table td { padding: 0.4rem 0.65rem; font-size: var(--table-text-size); }

.top-pick-row td { background: rgba(74, 111, 165, 0.08); }

.race-link { color: var(--brand-light); text-decoration: none; }
.race-link:hover { text-decoration: underline; }

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

.table-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    font-style: italic;
}

/* Rank medals */
.rank-medal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.78rem;
}
.rank-1 { background: #c0942a; color: #fff; }
.rank-2 { background: #6b7280; color: #fff; }
.rank-3 { background: #7c5330; color: #fff; }

.rank-other {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

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

.odds-high { color: #f59e0b; font-weight: 700; }
.ev-positive { color: #4ade80; font-weight: 700; }
.ev-negative { color: #f87171; }

/* Result badges */
.result-badge {
    display: inline-block;
    padding: 0.12rem 0.55rem;
    border-radius: 4px;
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.result-win   { background: #14532d; color: #4ade80; }
.result-place { background: #1e3a5f; color: #60a5fa; }
.result-miss  { background: #3a1a1a; color: #f87171; }

/* Premium race blocks */
.premium-race-block {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.premium-race-title {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem 0.9rem;
    background: var(--bg-subtle, #1a2332);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.race-meta-tags {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.race-tag {
    background: rgba(255,255,255,0.08);
    color: var(--text-muted);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.72rem;
}

.race-result-summary {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* Results day stats (top right of header) */
.results-day-stats {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.results-day-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
}

.results-day-stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #4ade80;
}

.results-day-stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* Highlight cards */
.highlight-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.2rem 1.5rem;
    flex-wrap: wrap;
}

.highlight-find { border-color: rgba(245, 158, 11, 0.35); background: rgba(245, 158, 11, 0.05); }

.highlight-race  { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.2rem; }
.highlight-horse { font-size: 1.3rem; font-weight: 700; }
.highlight-jockey { font-size: 0.85rem; color: var(--text-muted); }

.highlight-card-right {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.highlight-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    min-width: 70px;
}

.highlight-stat-value {
    font-size: 1.2rem;
    font-weight: 700;
}

.highlight-stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

/* Simulation card */
.sim-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.sim-race-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 1rem;
    background: var(--bg-subtle, #1a2332);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sim-score {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 400;
}

.sim-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--table-text-size);
}

.sim-table th {
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
    font-size: var(--table-header-text-size);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.4rem 0.9rem;
    font-weight: 600;
    text-align: left;
}

.sim-table td {
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--border-light, #253040);
}

.sim-table tr:last-child td { border-bottom: none; }

.sim-hit  { color: #4ade80; font-weight: 700; font-size: 1.1rem; }
.sim-miss { color: #f87171; font-size: 1rem; }

/* Chart container */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.2rem 1.5rem;
    margin-bottom: 1.5rem;
}

.chart-placeholder {
    width: 100%;
    height: 120px;
    background: repeating-linear-gradient(
        90deg,
        rgba(255,255,255,0.04) 0px,
        rgba(255,255,255,0.04) 2px,
        transparent 2px,
        transparent 40px
    );
    border-radius: 6px;
    position: relative;
}

/* Premium gate */
.premium-gate {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    min-height: 220px;
}

.premium-gate-content {
    filter: blur(6px);
    pointer-events: none;
    user-select: none;
    opacity: 0.5;
}

.premium-gate-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(17, 25, 31, 0.6);
    z-index: 10;
}

.premium-gate-box {
    text-align: center;
    padding: 2rem;
    max-width: 320px;
}

.premium-gate-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.premium-gate-box h3 {
    color: var(--accent-color, #e8926a);
    margin: 0 0 0.4rem;
    font-size: 1.2rem;
}

.premium-gate-box p {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin: 0 0 1rem;
}

.premium-btn-large {
    display: inline-block;
    background: var(--accent-color);
    color: var(--brand-dark) !important;
    padding: 0.55rem 1.5rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.15s;
    border: none;
    cursor: pointer;
}
.premium-btn-large:hover { background: var(--accent-light); }

.premium-gate-sub {
    margin-top: 0.7rem !important;
    font-size: 0.8rem !important;
    color: var(--text-muted) !important;
}
.premium-gate-sub a { color: var(--brand-light); }

@media (max-width: 640px) {
    .report-header { flex-direction: column; }
    .results-day-stats { justify-content: flex-start; }
    .highlight-card { flex-direction: column; }
    .race-day-grid { grid-template-columns: 1fr 1fr; }
}

/*  RACE DETAIL  */
.race-meta-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 1.2rem;
}

.race-meta-line .meta-sep {
    color: #4a5568;
}

.race-result-banner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.8rem 1rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    margin-bottom: 1rem;
}

.result-label {
    font-weight: 600;
    color: #e2e8f0;
    margin-right: 0.3rem;
}

.badge-miss {
    background: #6b7280;
    color: #fff;
    padding: 0.15em 0.5em;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-other {
    background: #475569;
    color: #cbd5e0;
    padding: 0.15em 0.5em;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
}

/*  SORTABLE COLUMNS  */
th[data-sort] {
    cursor: pointer;
    user-select: none;
}

/*  PAGINATION  */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 1.2rem 0 0.5rem;
    padding: 0.6rem 0;
    gap: 1rem;
    flex-wrap: wrap;
}

.pagination-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.pag-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text-body);
    text-decoration: none;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.pag-btn:hover:not(.disabled) {
    background: var(--brand-color);
    border-color: var(--brand-color);
    color: #fff;
}

.pag-btn.disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.pag-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0 0.5rem;
    white-space: nowrap;
}

.pag-size {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.pag-size-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 1.8rem;
    padding: 0 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s;
}

.pag-size-btn:hover:not(.active) {
    background: var(--bg-subtle);
}

.pag-size-btn.active {
    background: var(--brand-color);
    border-color: var(--brand-color);
    color: #fff;
    cursor: default;
    pointer-events: none;
}

/*  TRENDING TABLE  */
.trending-title {
    font-size: 1.1rem;
    margin-bottom: 0.6rem;
}

.trending-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 0.5rem;
}

.trending-table-wrap {
    overflow-x: auto;
    margin-bottom: 2rem;
}

.races-table-wrap {
    overflow-y: hidden;
}

.trending-table {
    width: 100%;
    max-width: 100%;
}

.trending-table a {
    color: var(--brand-light);
    text-decoration: none;
}

.trending-table a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

@media (max-width: 480px) {
    .search-wrapper {
        max-width: 100%;
    }
    .trending-table {
        max-width: 100%;
    }
}

/* ========= Venue accordion (results page) ========= */
.venue-accordion-block {
    margin-bottom: 2rem;
}
.venue-accordion-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.6rem;
    flex-wrap: wrap;
}
.venue-accordion-name {
    font-weight: 700;
    font-size: 1rem;
    color: #1f2937;
}

html:not([data-theme="light"]) .venue-accordion-name {
    color:  #e2e8f0;
}
.venue-accordion-stats {
    font-size: 0.82rem;
    color: var(--text-muted);
}
.race-pills-row {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}
.race-pill {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    color: #1f2937;
    border-radius: 5px;
    padding: 0.22rem 0.5rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1.4;
}

html:not([data-theme="light"]) .race-pill {
    color: #e2e8f0;
}

html:not([data-theme="light"]) .race-pill-win {
    color: #86efac;
    border-color: rgba(134, 239, 172, 0.45);
}

html:not([data-theme="light"]) .race-pill-place {
    color: #93c5fd;
    border-color: rgba(147, 197, 253, 0.45);
}

html:not([data-theme="light"]) .race-pill-miss {
    color: #fca5a5;
    border-color: rgba(252, 165, 165, 0.4);
}

html:not([data-theme="light"]) .race-pill-none {
    color: #94a3b8;
    border-color: rgba(148, 163, 184, 0.3);
}

.race-pill:hover {
    background: rgba(255,255,255,0.1);
}

.race-pill-active {
    background: rgba(74,111,165,0.25) !important;
    border-color: var(--brand-color) !important;
    color: #1f2937;
}

html:not([data-theme="light"]) .race-pill-active {
    color: #fff;
}


.race-pill-win {
    border-color: rgba(74,222,128,0.4);
    color: #4ade80;
}
.race-pill-place {
    border-color: rgba(96,165,250,0.4);
    color: #60a5fa;
}
.race-pill-miss {
    border-color: rgba(248,113,113,0.3);
    color: #f87171;
}
.race-detail-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}
.race-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0.75rem;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.race-detail-winner {
    color: #fbbf24;
    font-size: 0.83rem;
    font-weight: 600;
}
/* Results day stats bar */
.results-day-stats {
    display: flex;
    gap: 1.2rem;
}
.results-day-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.results-day-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.1;
}

html:not([data-theme="light"]) .results-day-stat-value {
    color: #e8eef6;
}

.results-day-stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.report-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
}

.race-pill-none { border-color: rgba(148,163,184,0.25); color: #64748b; }

/*  LANGUAGE SELECTOR  */
.language-selector {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    padding: 0.5rem 0;
    margin: 1rem 0 0.5rem;
    border-top: 1px solid var(--border-color);
}
.language-selector-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.language-selector .lang-btn,
.language-selector .theme-toggle {
    height: 32px;
    min-height: 32px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin: 0 !important;
}

.language-selector .theme-toggle {
    margin-left: auto !important;
}

.language-selector-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-right: 0.3rem;
}

.lang-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.3rem 0.75rem;
    border-radius: 5px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    text-decoration: none;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.2);
}

.lang-btn.active {
    background: var(--brand-color);
    border-color: var(--brand-color);
    color: #fff;
}

/* ===== Requested compact pass (news/predictions/trend/detail/admin) ===== */

/* Utility */
.nowrap {
    white-space: nowrap;
}

/* News list tiles - mobile compact sizes only */

.news-week-row {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: nowrap;
    width: 100%;
}

.news-week-day-label {
    white-space: nowrap;
    min-width: 6.2rem;
}

.news-week-row .btn-sm {
    flex: 1 1 auto;
    text-align: center;
    min-height: 2rem;
}

/* News prediction/results tables: force horse/jockey to one line */
.report-table .horse-col,
.report-table .muted-col {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 12rem;
}

.race-name-small {
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 14rem;
    vertical-align: bottom;
}

.results-day-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
    align-items: stretch;
    white-space: nowrap;
}

/* Predictions top stats: line 1 label row, line 2 pills row */
.stats-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
}

.stats-group-header {
    width: 100%;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.stats-group-pills {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: nowrap;
}

.stats-group-week {
    align-items: flex-end;
}

.stats-group-week .stats-group-header,
.stats-group-week .stats-group-pills {
    justify-content: flex-end;
}

html[data-theme="light"] .stats-group {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

html[data-theme="light"] .stats-group-header,
html[data-theme="light"] .stats-group-pills,
html[data-theme="light"] .stats-group-label {
    background: transparent !important;
}

html[data-theme="light"] .stat-pill .stat-label {
    color: #53657c !important;
}

html[data-theme="light"] .stat-pill .stat-value {
    color: #17385d !important;
}

html[data-theme="light"] .filter-form label {
    color: #17385d !important;
}

html[data-theme="light"] .filter-form select {
    background: #e7eff7 !important;
    color: #17385d !important;
    border: 1px solid rgba(52, 72, 96, 0.18) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .filter-form select:focus {
    border-color: #2e5f97 !important;
    box-shadow: 0 0 0 2px rgba(46, 95, 151, 0.14) !important;
}

.pred-table-compact .name-cell,
.pred-table-compact td:nth-child(2),
.pred-table-compact td:nth-child(3) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pred-table-compact th,
.pred-table-compact td {
    padding: 0.14rem 0.28rem;
    font-size: var(--table-text-size);
}

/* Trend tables compact (horses/jockeys/races pages) */
.trending-table th,
.trending-table td {
    padding: 0.08rem 0.18rem;
    font-size: var(--table-text-size);
    white-space: nowrap;
    line-height: 1.2;
}

.trending-table th:not(:first-child),
.trending-table td:not(:first-child) {
    width: 3rem;
    text-align: center;
}

.trending-table td a {
    white-space: nowrap;
    display: inline-block;
    max-width: 8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}

.trending-table td:first-child,
.trending-table th:first-child {
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Horse/Jockey detail history compact */
.pred-table td.nowrap,
.pred-table th.nowrap {
    white-space: nowrap;
}

/* Race detail page compact */
.race-result-banner {
    gap: 0.32rem;
    padding: 0.45rem 0.55rem;
}

.race-result-banner .badge {
    font-size: 0.66rem;
    padding: 0.06rem 0.32rem;
}

.race-detail-table th,
.race-detail-table td {
    padding: 0.2rem 0.28rem;
    font-size: var(--table-text-size);
    white-space: nowrap;
}

.race-detail-table td:nth-child(2),
.race-detail-table td:nth-child(3) {
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sim-table th,
.sim-table td {
    padding: 0.28rem 0.45rem;
    font-size: var(--table-text-size);
    line-height: 1.2;
}

.payback-results-table th,
.payback-results-table td {
    padding: 0.18rem 0.32rem;
    font-size: var(--table-text-size);
    line-height: 1.2;
}

.line-first td {
    background-color: rgba(74, 222, 128, 0.16) !important;
}

.line-second td {
    background-color: rgba(251, 191, 36, 0.16) !important;
}

.line-third td {
    background-color: rgba(251, 146, 60, 0.16) !important;
}

.ticket-row-win td {
    background-color: rgba(74, 222, 128, 0.13) !important;
}

.ticket-row-loss td {
    background-color: rgba(248, 113, 113, 0.13) !important;
}

@media (max-width: 900px) {
    .news-card-img-week {
        min-height: 110px;
        justify-content: center;
    }

    .stats-hero {
        align-items: stretch;
    }

    .stats-group,
    .stats-group-week {
        align-items: flex-start;
    }

    .stats-group-pills {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .stats-group-week .stats-group-header,
    .stats-group-week .stats-group-pills {
        justify-content: flex-start;
    }

    /* Remove the charging/progress bar column on mobile for prediction tab */
    .pred-table-compact .bar-head,
    .pred-table-compact .bar-cell,
    .pred-table-compact .prob-bar {
        display: none;
    }

    .pred-table-compact th,
    .pred-table-compact td {
        font-size: 0.7rem;
        padding: 0.1rem 0.2rem;
    }

    .pred-table-compact .locked-winprob-head,
    .pred-table-compact .locked-winprob-cell {
        min-width: 74px;
        width: 74px;
    }

    .pred-table-compact .locked-winprob-overlay-text {
        font-size: 0.62rem;
    }

    .pred-table-compact td:nth-child(2),
    .pred-table-compact td:nth-child(3) {
        max-width: 6.5rem;
    }

    .predictions-page .race-tab {
        padding-left: 0.55rem !important;
        padding-right: 0.55rem !important;
        max-width: 4.6rem;
    }

    .report-table .horse-col,
    .report-table .muted-col {
        max-width: 7rem;
    }

    .results-day-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        overflow: visible;
    }

    .race-detail-table td:nth-child(2),
    .race-detail-table td:nth-child(3) {
        max-width: 5.5rem;
    }
}

@media (min-width: 901px) {
    .venue-tabs,
    .day-tabs,
    .race-tabs {
        overflow-x: visible;
        flex-wrap: wrap;
    }

    .table-scroll > table.payback-results-table {
        width: auto;
        min-width: 34rem;
        max-width: 100%;
        table-layout: auto;
    }

    .payback-results-table th:nth-child(1),
    .payback-results-table tbody td:first-child {
        width: 8rem;
    }

    .payback-results-table th:nth-child(2),
    .payback-results-table tbody td:nth-last-child(2) {
        width: auto;
    }

    .payback-results-table th:nth-child(3),
    .payback-results-table tbody td:last-child {
        width: 7rem;
    }
}

@media (max-width: 520px) {
    .premium-banner {
        justify-content: center;
        align-items: center;
        text-align: center;
        width: 100%;
    }

    .news-week-row {
        width: 100%;
        justify-content: space-between;
    }

    .news-card-img-week {
        width: 88px;
        justify-content: center;
    }

    .news-card-img-preview .week-stat-overlay,
    .news-card-img-results .week-stat-overlay {
        align-items: center;
        text-align: center;
    }

    .results-day-stats {
        gap: 0.2rem;
    }

    .results-day-stat-value {
        font-size: 0.85rem;
    }


@media (max-width: 420px) {
    .table-scroll > table.payback-results-table {
        min-width: 100%;
        width: 100%;
        table-layout: fixed;
    }

    .payback-results-table th,
    .payback-results-table td {
        font-size: 0.68rem;
        padding: 0.14rem 0.22rem;
    }

    .payback-results-table tbody td:nth-last-child(2) {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .payback-results-table tbody td:last-child {
        white-space: nowrap;
    }
}
    .results-day-stat-label {
        font-size: 0.52rem;
    }
}

/*  GLOBAL RESPONSIVE FOUNDATION  */
* {
    box-sizing: border-box;
}

img,
video,
canvas,
svg {
    max-width: 100%;
    height: auto;
}

main,
section,
article,
div,
p,
h1,
h2,
h3,
h4,
h5,
h6,
span,
td,
th,
label,
a,
button {
    overflow-wrap: anywhere;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-scroll > table {
    min-width: 640px;
}

.table-scroll > table.payback-results-table {
    min-width: 420px;
}

.payback-results-table th:nth-child(1),
.payback-results-table tbody td:first-child {
    width: 22%;
}

.payback-results-table th:nth-child(2),
.payback-results-table tbody td:nth-last-child(2) {
    width: 48%;
}

.payback-results-table th:nth-child(3),
.payback-results-table tbody td:last-child {
    width: 30%;
    text-align: right;
    white-space: nowrap;
}

.nav-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.35rem;
    width: 2.2rem;
    height: 2.2rem;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.2rem;
}

.nav-toggle-bar {
    display: block;
    width: 1rem;
    height: 2px;
    background: #cbd5e1;
    border-radius: 1px;
}

@media (max-width: 1024px) {
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .hero {
        padding: 1.25rem 0 1rem;
        margin-bottom: 1rem;
    }

    .hero h1 {
        font-size: 1.5rem;
        line-height: 1.2;
    }

    .hero p {
        font-size: 0.95rem;
    }

    .race-day-grid,
    .tiles-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .nav-tiles-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .stats-hero {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .stats-group {
        flex-wrap: wrap;
    }

    .stat-pill {
        flex: 1 1 auto;
        justify-content: space-between;
    }

    .report-header,
    .report-header-right,
    .highlight-card,
    .article-stats-bar,
    .results-day-stats,
    .pagination-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .chart-wrapper {
        height: 220px;
    }


@media (max-width: 640px) {
    .nav-tiles-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .nav-tile h3,
    .nav-tile p {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
}
    .name-cell {
        max-width: 160px;
    }

    .auth-overlay-card {
        width: calc(100vw - 1rem);
        padding: 1rem;
        border-radius: 10px;
    }

    .user-dropdown-menu {
        right: auto;
        left: 0;
        min-width: 200px;
    }

    .premium-banner {
        justify-content: center;
        text-align: center;
        gap: 0.4rem;
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
    }

    .premium-btn {
        padding: 0.15rem 0.6rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 900px) {
    .site-header > nav.container-fluid {
        padding: 0 0.85rem !important;
    }

    .site-header nav {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        row-gap: 0.5rem;
        padding-top: 0;
        padding-bottom: 0;
    }

    .site-header nav > ul:first-child {
        margin: 0;
    }

    .site-header nav > ul:first-child > li {
        padding: 0;
    }

    .site-header nav .brand {
        display: inline-flex;
        align-items: center;
        min-height: 2.2rem;
        padding: 0 0.7rem !important;
        line-height: 1;
    }

    .nav-toggle {
        display: inline-flex;
        margin-left: auto;
        align-self: center;
        margin-top: 0;
        margin-bottom: 0;
    }

    #site-nav-links {
        width: 100%;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0.15rem;
        margin: 0;
        padding: 0.35rem 0 0.15rem;
    }

    #site-nav-links.open {
        display: flex;
    }

    #site-nav-links > li {
        width: 100%;
        padding: 0;
        margin: 0;
    }

    #site-nav-links > li > a {
        display: flex;
        width: 100%;
        padding: 0.6rem 0.7rem;
        border-radius: 6px;
        align-items: center;
        justify-content: center;
        min-height: 2.25rem;
        line-height: 1.2;
        text-align: center;
    }

    .user-dropdown-trigger {
        display: flex;
        width: 100%;
        align-items: center;
        justify-content: center;
        min-height: 2.25rem;
        line-height: 1.2;
    }

    .user-dropdown-menu {
        position: static;
        width: 100%;
        margin-top: 0.35rem;
    }

    .venue-tabs,
    .day-tabs,
    .race-tabs,
    .race-info-bar,
    .pred-table th,
    .pred-table td,
    .report-table th,
    .report-table td,
    .sim-table th,
    .sim-table td,
    .payback-results-table th,
    .payback-results-table td,
    .venue-stats-table th,
    .venue-stats-table td {
        padding: 0.35rem;
    }

    .pred-table,
    .report-table,
    .sim-table,
    .payback-results-table,
    .venue-stats-table {
        font-size: 0.78rem;
    }

    input,
    select,
    textarea,
    button,
    a[role="button"] {
        font-size: 16px;
    }
}

@media (max-width: 640px) {
    h1 { font-size: 1.45rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.1rem; }

    main.container-fluid {
        padding-left: 0.6rem;
        padding-right: 0.6rem;
    }

    .filter-bar,
    .sim-card,
    .premium-race-block,
    .article-detail,
    .auth-card {
        border-radius: 8px;
    }

    /* Predictions header: remove large inner padding and center week dropdown. */
    .filter-bar {
        padding: 0.45rem 0.6rem;
    }

    .filter-form {
        width: 100%;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        gap: 0.4rem;
        text-align: center;
    }

    .filter-form label {
        text-align: center;
    }

    .filter-form select {
        margin-left: auto;
        margin-right: auto;
        max-width: min(320px, 100%);
    }

    .news-card,
    .home-news-item,
    .highlight-card,
    .race-day-card,
    .chart-container,
    .stat-card {
        padding: 0.75rem;
    }

    .news-week-actions,
    .race-day-actions,
    .report-header-nav {
        gap: 0.35rem;
    }

    .language-selector {
        flex-wrap: wrap;
    }

    .table-scroll > table {
        min-width: 560px;
    }

    .table-scroll > table.payback-results-table {
        min-width: min(380px, 100%);
    }
}


/* ==============================
   TICKET TRACKER PAGE STYLES
   Moved from ticket_tracker.html
   ============================== */

.back-btn {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    color: var(--brand-color);
    padding: 6px 12px;
    font-weight: 600;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 35px;
    transition: color 0.2s;
    margin: 0;
}

.back-btn:hover {
    color: var(--brand-light);
}

.bet-controls-row {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
}

.bet-controls-row .form-group {
    margin-bottom: 0;
}

/* Ticket builder controls: Bet Type and Pattern selectors */
#bet_type,
#pattern-type {
    min-height: 36px;
}

.ticket-tracker-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.ticket-tracker-container h1 {
    margin-bottom: 30px;
    color: #e2e8f0;
}

.ticket-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.ticket-tracker-container .stat-card .stat-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 10px;
    line-height: 1.2;
}

.ticket-tracker-container .stat-card .stat-value {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    color: var(--ticket-stat-value-color, #e2e8f0);
    line-height: 1.1;
}

.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.chart-container h2 {
    font-size: 16px;
    margin-bottom: 15px;
    color: #e2e8f0;
}

#pnl-chart {
    width: 100%;
    height: 300px;
    background: transparent;
}

.controls-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.csv-buttons-footer {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.csv-overlay-content {
    max-width: min(90vw, 700px);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.csv-overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 15px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 15px;
}

.csv-overlay-header h3 {
    margin: 0;
    color: #e2e8f0;
    font-size: 16px;
}

.csv-overlay-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.csv-overlay-body > p {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
}

.csv-textarea {
    flex: 1;
    min-height: 250px;
    padding: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-subtle);
    color: #e2e8f0;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    resize: vertical;
}

.csv-textarea:focus {
    outline: none;
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.25);
}

.csv-import-info {
    padding: 10px;
    background: rgba(74, 111, 165, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 12px;
    color: #e2e8f0;
    line-height: 1.5;
}

.csv-overlay-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.sort-dropdown {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: #e2e8f0;
    border-radius: 4px;
    font-size: 14px;
}

.sort-dropdown option {
    background: var(--bg-card);
    color: #e2e8f0;
}

.table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: auto;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.tickets-table {
    width: 100%;
    border-collapse: collapse;
}

.tickets-table th {
    background: var(--ticket-table-header-bg-color, var(--brand-dark));
    padding: 6px 8px;
    text-align: left;
    font-weight: 600;
    color: var(--ticket-table-text-color, #e2e8f0);
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.62rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.tickets-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-color);
    color: var(--ticket-table-text-color, #e2e8f0);
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tickets-table tr:hover {
    background: rgba(58, 90, 156, 0.15);
}

.result-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.result-badge.win {
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
}

.result-badge.loss {
    background: rgba(248, 113, 113, 0.2);
    color: #f87171;
}

.result-badge.pending {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-muted);
}

.pnl-positive {
    color: #4ade80;
    font-weight: 600;
}

.pnl-negative {
    color: #f87171;
    font-weight: 600;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.action-buttons button {
    padding: 4px 9px;
    font-size: 11px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: var(--brand-color);
    color: white;
    transition: background 0.2s;
}

.action-buttons button:hover {
    background: var(--brand-light);
}

.action-buttons button.delete {
    background: #f87171;
}

.action-buttons button.delete:hover {
    background: #ef4444;
}

.action-buttons button.resolve {
    background: var(--accent-color);
    color: white;
}

.action-buttons button.resolve:hover {
    background: var(--accent-light);
    color: white;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

html.no-scroll,
body.no-scroll {
    overflow: hidden;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 8px;
    width: 90%;
    max-width: 900px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    color: var(--ticket-creator-text-color, #e2e8f0);
}

.modal-content.modal-large {
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: var(--ticket-creator-text-color, #e2e8f0);
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-top: 1px solid var(--border-color);
}

.modal-footer-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto;
}

.modal-footer-buttons .btn,
.modal-footer-buttons .back-btn {
    margin: 0;
    height: 35px;
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 20px;
    max-height: calc(90vh - 180px);
    overflow-y: auto;
}

.form-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-step {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 15px;
    background: rgba(58, 90, 156, 0.1);
}

.form-step h3 {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: var(--ticket-creator-text-color, #e2e8f0);
    text-transform: uppercase;
    font-weight: 600;
    border-bottom: 2px solid var(--brand-color);
    padding-bottom: 10px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.form-row .form-group {
    padding: 0;
    border-bottom: none;
}

.form-group {
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.form-group:last-of-type {
    border-bottom: none;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--ticket-creator-text-color, #e2e8f0);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-subtle);
    color: var(--ticket-creator-text-color, #e2e8f0);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.25);
}

.selection-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.selection-section > label {
    font-weight: 600;
    color: var(--ticket-creator-text-color, #e2e8f0);
}

.horse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
}

.horse-grid-full {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    width: 100%;
}

/* Ticket builder controls: Horse selection buttons */

.horse-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-subtle);
    color: var(--ticket-creator-text-color, #e2e8f0);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    gap: 2px;
    height: 44px;
    margin-bottom: 2px;
    width: 100%;
}

.horse-num {
    font-size: 16px;
    font-weight: 700;
    min-width: 30px;
    text-align: center;
}

.horse-info {
    font-size: 12px;
    font-weight: 400;
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.horse-btn:hover {
    border-color: var(--brand-color);
    background: rgba(74, 111, 165, 0.2);
}

.horse-btn.selected {
    background: var(--brand-color);
    color: white;
    border-color: var(--brand-light);
}

.selection-display {
    padding: 10px;
    background: rgba(58, 90, 156, 0.1);
    border-radius: 4px;
    font-size: 13px;
    color: var(--ticket-creator-text-color, #e2e8f0);
    min-height: 25px;
    border: 1px solid var(--border-color);
}

.step-actions-inline {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.step-actions-inline .btn {
    min-width: 120px;
}

.multi-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.multi-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.multi-options label {
    font-weight: 600;
    color: var(--ticket-creator-text-color, #e2e8f0);
    font-size: 13px;
}

.multi-options select {
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-subtle);
    color: var(--ticket-creator-text-color, #e2e8f0);
    border-radius: 4px;
    font-size: 13px;
}

.bet-preview-section {
    border-left: 2px solid var(--brand-color);
    padding: 15px;
    background: rgba(58, 90, 156, 0.1);
}

.preview-toggle-btn {
    display: none;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    
    padding: 8px 10px;
    cursor: pointer;
}

.preview-toggle-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.preview-toggle-icon {
    font-size: 16px;
    line-height: 1;
    min-width: 14px;
    text-align: center;
}

.bet-preview-content {
    display: block;
}

.bet-preview-section h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    text-transform: uppercase;
    font-weight: 600;
}

.preview-table {
    display: flex;
    flex-direction: column;
    gap: 1px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
    background: rgba(58, 90, 156, 0.08);
}

#bet-preview-rows {
    background: rgba(58, 90, 156, 0.08);
}

#bet-preview-rows:empty {
    min-height: 220px;
}

.preview-header {
    display: grid;
    grid-template-columns: 1fr 100px 80px;
    gap: 1px;
    background: var(--ticket-preview-header-bg-color, var(--brand-dark));
    color: var(--ticket-preview-header-text-color, rgba(255,255,255,0.55));
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.preview-col-bet,
.preview-col-amount,
.preview-col-total {
    padding: 8px;
    text-align: center;
}

.preview-col-bet {
    text-align: left;
}

.preview-row {
    display: grid;
    grid-template-columns: 1fr 100px 80px;
    gap: 1px;
    background: var(--bg-card);
}

.preview-row > div {
    padding: 8px;
    font-size: 12px;
}

.preview-row-bet {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    text-align: left;
    font-family: monospace;
}

.preview-row-delete {
    background: transparent;
    border: 1px solid var(--border-color);
    color: #f87171;
    border-radius: 4px;
    padding: 0 6px;
    line-height: 1.2;
    cursor: pointer;
    font-size: 12px;
}

.preview-row-delete:hover {
    background: rgba(248, 113, 113, 0.16);
}

.preview-row-amount,
.preview-row-total {
    text-align: right;
    font-weight: 500;
}

.preview-totals {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    font-size: 13px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.preview-totals strong {
    color: var(--ticket-preview-total-label-color, #e2e8f0);
}

.preview-totals span {
    color: var(--ticket-preview-total-value-color, var(--brand-color));
    font-weight: 600;
}

@media (max-width: 900px) {
    .modal-content.modal-large {
        width: min(96vw, 560px);
        max-height: 95vh;
        overflow: hidden;
    }

    .modal-header {
        padding: 12px 14px;
    }

    .modal-header h2 {
        font-size: 16px;
        line-height: 1.2;
    }

    .close-btn {
        font-size: 20px;
        line-height: 1;
    }

    .modal-footer {
        padding: 10px 12px;
    }

    .modal-footer-buttons {
        justify-content: flex-end;
    }

    .modal-body {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 12px;
        max-height: calc(95vh - 145px);
        overflow: hidden;
    }

    .bet-preview-section {
        order: 1;
        border-left: none;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 8px;
        margin-bottom: 0;
    }

    .preview-toggle-btn {
        display: flex;
    }

    .bet-preview-section h3 {
        display: none;
    }

    .bet-preview-content {
        max-height: 8.5rem;
        overflow: auto;
        margin-top: 6px;
    }

    .form-section {
        order: 2;
        flex: 1 1 auto;
        min-height: 0;
        overflow: auto;
        gap: 10px;
        padding-right: 2px;
    }

    .bet-preview-section.mobile-collapsed .bet-preview-content {
        max-height: 7rem;
    }

    .bet-preview-section.mobile-expanded .bet-preview-content {
        max-height: 34vh;
    }

    .bet-preview-section.mobile-expanded ~ .form-section {
        flex: 0 0 40vh;
    }

    .bet-preview-section.mobile-collapsed ~ .form-section {
        flex: 1 1 auto;
    }

    .form-step {
        overflow: hidden;
    }

    .form-step h3 {
        margin: 0 0 10px 0;
        padding-bottom: 6px;
    }

    .horse-grid-full {
        max-height: 38vh;
        overflow: auto;
        padding-right: 2px;
    }

    .bet-preview-section.mobile-expanded ~ .form-section .horse-grid-full {
        max-height: 24vh;
    }
}

@media (max-width: 420px) {
    .modal-header {
        padding: 10px 12px;
    }

    .modal-header h2 {
        font-size: 15px;
    }

    .modal-footer {
        padding: 8px 10px;
    }

    .modal-body {
        max-height: calc(95vh - 138px);
        padding: 10px;
    }

    .bet-preview-content {
        max-height: 30vh;
    }

    .preview-row > div,
    .preview-header > div {
        font-size: 11px;
        padding: 6px;
    }
}

.race-group-row {
    background: rgba(58, 90, 156, 0.1) !important;
}

.race-group-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    color: #e2e8f0;
}

.race-group-header:hover {
    background: rgba(58, 90, 156, 0.2);
}

.toggle-icon {
    display: inline-block;
    transition: transform 0.2s;
    font-size: 12px;
    color: var(--brand-color);
    min-width: 12px;
}

.race-stats {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: auto;
}

.race-child-row {
    background: var(--bg-card);
    border-left: 3px solid var(--brand-color);
}

.race-child-row:hover {
    background: rgba(58, 90, 156, 0.1);
}

.btn {
    padding: 7px 13px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

@media (max-width: 720px) {
    .ticket-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .stat-card {
        padding: 12px;
    }

    .ticket-tracker-container .stat-card .stat-label {
        font-size: 12px;
    }

    .ticket-tracker-container .stat-card .stat-value {
        font-size: 16px;
    }
}

.btn-primary {
    background: var(--brand-color);
    color: white;
}

.btn-primary:hover {
    background: var(--brand-light);
}

.btn-secondary {
    background: var(--text-muted);
    color: white;
}

.btn-secondary:hover {
    background: rgba(148, 163, 184, 0.8);
}

/* Overlay System Styles */
.overlay-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.overlay-content {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 40px 30px;
    text-align: center;
    max-width: min(90vw, 500px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: overlaySlideUp 0.3s ease-out;
    border: 1px solid var(--border-color);
}

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

.overlay-icon {
    font-size: 48px;
    font-weight: bold;
    color: #4ade80;
    margin-bottom: 15px;
}

.overlay-icon.error-icon {
    color: #f87171;
}

.overlay-icon.warning-icon {
    color: #fbbf24;
}

.overlay-message {
    margin: 20px 0;
}

.overlay-message p {
    font-size: 18px;
    font-weight: 600;
    color: var(--ticket-overlay-message-color, #e2e8f0);
    margin: 0 0 10px 0;
}

.overlay-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin: 10px 0 0 0;
}

.overlay-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 25px;
}

.overlay-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex: 1;
    max-width: 150px;
}

#bet-action-overlay .overlay-btn {
    min-width: 190px;
    max-width: 240px;
}

#bet-action-overlay .overlay-content {
    width: min(94vw, 780px);
    max-width: min(94vw, 780px);
    padding: 28px 22px;
}

#bet-action-overlay .overlay-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: stretch;
}

#bet-action-overlay .overlay-btn {
    width: 100%;
    max-width: none;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 720px) {
    #bet-action-overlay .overlay-buttons {
        grid-template-columns: 1fr;
    }

    #bet-action-overlay .overlay-btn {
        width: 100%;
        max-width: none;
    }
}

.overlay-btn-cancel {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.overlay-btn-cancel:hover {
    background: rgba(148, 163, 184, 0.3);
}

.overlay-btn-confirm {
    background: #f87171;
    color: white;
}

.overlay-btn-confirm:hover {
    background: #ef4444;
}

.edit-ticket-form {
    text-align: left;
    margin-top: 10px;
}

.edit-ticket-form .form-group {
    margin-bottom: 12px;
    border-bottom: none;
    padding: 0;
}

.edit-ticket-form .form-group label {
    font-size: 13px;
}

.error-backdrop {
    background: rgba(248, 113, 113, 0.1);
    z-index: 3000;
}

.error-content {
    border: 2px solid #f87171;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-20px);
    }
}


/* ==============================
   TICKET SHORTCUT MODAL STYLES
   Moved from _ticket_shortcut_modal.html
   ============================== */

.ticket-shortcut-shared {
    --ticket-space: clamp(5px, 1.6vw, 20px);
    --ticket-space-sm: clamp(5px, 1.0vw, 16px);
}

.ticket-shortcut-shared .back-btn {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    color: var(--brand-color);
    padding: 6px 12px;
    font-weight: 600;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 35px;
    margin: 0;
}

.ticket-shortcut-shared .bet-controls-row {
    display: flex;
    gap: 12px;
    margin-bottom: var(--ticket-space-sm);
}

.ticket-shortcut-shared .bet-controls-row .form-group {
    margin-bottom: 0;
    flex: 1 1 0;
    min-width: 0;
}

.ticket-shortcut-shared .modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

html.no-scroll,
body.no-scroll {
    overflow: hidden;
}

.ticket-shortcut-shared .modal-content {
    background: var(--bg-card);
    border-radius: 8px;
    width: 90%;
    max-width: 900px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    color: var(--ticket-creator-text-color, #e2e8f0);
}

.ticket-shortcut-shared .modal-content.modal-large {
    height: min(90vh, 820px);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ticket-shortcut-shared .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--ticket-space);
    border-bottom: 1px solid var(--border-color);
    flex: 0 0 auto;
}

.ticket-shortcut-shared .modal-header h2 {
    margin: 0;
    font-size: 16px;
    line-height: 1;
}

.ticket-shortcut-shared .close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.ticket-shortcut-shared .modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--ticket-space);
    border-top: 1px solid var(--border-color);
    flex: 0 0 auto;
    min-height: 48px;
}

.ticket-shortcut-shared .modal-footer-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto;
}

.ticket-shortcut-shared .modal-footer-buttons .btn,
.ticket-shortcut-shared .modal-footer-buttons .back-btn {
    margin: 0;
    height: 35px;
}

.ticket-shortcut-shared .modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--ticket-space);
    padding: var(--ticket-space);
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.ticket-shortcut-shared .form-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
    min-height: 0;
}

.ticket-shortcut-shared .form-step {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: var(--ticket-space);
    background: rgba(58, 90, 156, 0.1);
}

/* Desktop step-4: fill left column, horse list scrolls */
@media (min-width: 901px) {
    .ticket-shortcut-shared #step-horses {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
    }
    .ticket-shortcut-shared #step-horses .selection-section {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    .ticket-shortcut-shared #step-horses .horse-grid-full {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        overflow-y: auto;
    }
    .ticket-shortcut-shared .bet-preview-section {
        overflow-y: auto;
    }
}

.ticket-shortcut-shared .form-group {
    padding: var(--ticket-space-sm);
    border-bottom: 1px solid var(--border-color);
}

.ticket-shortcut-shared .form-group:last-of-type {
    border-bottom: none;
}

.ticket-shortcut-shared .form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}



.ticket-shortcut-shared .form-group input,
.ticket-shortcut-shared .form-group select,
.ticket-shortcut-shared .form-group textarea {
    width: 100%;
    padding: var(--ticket-space-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-subtle);
    color: var(--ticket-creator-text-color, #e2e8f0);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}

/* Keep native date picker indicator visible/clickable across Chrome/Edge/Safari. */
.ticket-shortcut-shared .form-group input[type="date"],
.ticket-tracker-container .form-group input[type="date"] {
    appearance: auto;
    -webkit-appearance: auto;
    min-height: 38px;
    padding-right: 2.2rem;
}

.ticket-shortcut-shared .form-group input[type="date"]::-webkit-calendar-picker-indicator,
.ticket-tracker-container .form-group input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 1;
    display: block;
    width: 1.05rem;
    height: 1.05rem;
    cursor: pointer;
}

html:not([data-theme="light"]) .ticket-shortcut-shared .form-group input[type="date"]::-webkit-calendar-picker-indicator,
html:not([data-theme="light"]) .ticket-tracker-container .form-group input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.25);
}

html[data-theme="light"] .ticket-shortcut-shared .form-group input[type="date"]::-webkit-calendar-picker-indicator,
html[data-theme="light"] .ticket-tracker-container .form-group input[type="date"]::-webkit-calendar-picker-indicator {
    filter: none;
}

.ticket-shortcut-shared .selection-section {
    display: flex;
    flex-direction: column;
    gap: var(--ticket-space-sm);
}

.ticket-shortcut-shared .horse-grid-full {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
    max-height: 38vh;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding-bottom: 3px;
}

.ticket-shortcut-shared .horse-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 8px 10px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-subtle);
    color: var(--ticket-creator-text-color, #e2e8f0);
    cursor: pointer;
    font-size: 14px;
    gap: 8px;
    height: 44px;
}

.ticket-shortcut-shared .horse-grid-full .horse-btn {
    width: 100%;
}

.ticket-shortcut-shared .horse-btn .horse-num {
    font-size: 16px;
    font-weight: 700;
    min-width: 30px;
    text-align: center;
}

.ticket-shortcut-shared .horse-btn .horse-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    font-weight: 400;
    flex: 1;
    text-align: left;
    white-space: nowrap;
    min-width: 0;
}

.ticket-shortcut-shared .horse-btn .horse-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-shortcut-shared .horse-btn .horse-odds {
    flex: 0 0 auto;
    color: var(--text-muted);
}

.ticket-shortcut-shared .horse-btn.selected {
    background: var(--brand-color);
    color: white;
    border-color: var(--brand-light);
}

.ticket-shortcut-shared .selection-display {
    padding: 7px 9px;
    background: rgba(58, 90, 156, 0.1);
    border-radius: 4px;
    font-size: 13px;
    border: 1px solid var(--border-color);
}

.ticket-shortcut-shared .step-actions-inline {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.ticket-shortcut-shared .bet-preview-section {
    border-left: 2px solid var(--brand-color);
    padding: var(--ticket-space);
    background: rgba(58, 90, 156, 0.1);
}

.ticket-shortcut-shared .bet-preview-content {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ticket-shortcut-shared .preview-table {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: rgba(58, 90, 156, 0.08);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
    flex: 1 1 auto;
    min-height: 0;
}

@media (min-width: 901px) {
    .ticket-shortcut-shared .modal-content.modal-large {
        width: min(90vw, 900px);
    }
}

.ticket-shortcut-shared .preview-header,
.ticket-shortcut-shared .preview-row {
    display: grid;
    grid-template-columns: 1fr 100px 80px;
    gap: 1px;
}

.ticket-shortcut-shared .preview-header {
    background: var(--ticket-preview-header-bg-color, var(--brand-dark));
    color: var(--ticket-preview-header-text-color, rgba(255,255,255,0.55));
    font-weight: 600;
    font-size: 12px;
    align-items: center;
}

.ticket-shortcut-shared .bet-preview-content .preview-header {
    position: sticky;
    top: 0;
    z-index: 2;
}

.ticket-shortcut-shared .preview-row {
    background: var(--bg-card);
    align-items: center;
}

.ticket-shortcut-shared .preview-row > div,
.ticket-shortcut-shared .preview-header > div {
    padding: var(--ticket-space-sm);
    font-size: 12px;
    min-width: 0;
    overflow: hidden;
}

.ticket-shortcut-shared .preview-col-total-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding-right: 6px;
}

.ticket-shortcut-shared .preview-header-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex: 0 0 auto;
    align-self: center;
    margin: 0;
    margin-bottom: 0 !important;
}

.ticket-shortcut-shared .preview-row > div {
    display: flex;
    align-items: center;
}

.ticket-shortcut-shared .preview-row-bet {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-family: monospace;
    min-width: 0;
}

.ticket-shortcut-shared .preview-row-bet > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-shortcut-shared .preview-row-delete {
    background: transparent;
    border: 1px solid var(--border-color);
    color: #f87171;
    border-radius: 4px;
    padding: 0;
    line-height: 1;
    cursor: pointer;
    font-size: 12px;
    align-self: stretch;
    flex: 0 0 auto;
    width: 22px;
    min-width: 22px;
    aspect-ratio: 1 / 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    margin-bottom: 0 !important;
}

.ticket-shortcut-shared #bet-preview-rows {
    overflow-y: auto;
    min-height: 0;
    max-height: 100%;
}

.ticket-shortcut-shared .preview-row-amount,
.ticket-shortcut-shared .preview-row-total {
    text-align: right;
    justify-content: flex-end;
    align-items: center;
}

.ticket-shortcut-shared .preview-totals {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    font-size: 13px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.ticket-shortcut-shared .btn {
    padding: 7px 13px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.ticket-shortcut-shared .btn-primary {
    background: var(--brand-color);
    color: white;
}

.ticket-shortcut-shared .btn-secondary {
    background: var(--text-muted);
    color: white;
}

.ticket-shortcut-shared .overlay-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2100;
}

.ticket-shortcut-shared .overlay-content {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 40px 30px;
    text-align: center;
    max-width: min(90vw, 500px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
}

.ticket-shortcut-shared .overlay-icon {
    font-size: 48px;
    font-weight: bold;
    color: #4ade80;
    margin-bottom: 15px;
}

.ticket-shortcut-shared .overlay-icon.error-icon {
    color: #f87171;
}

.ticket-shortcut-shared .overlay-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 25px;
    flex-wrap: nowrap;
}

.ticket-shortcut-shared .overlay-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex: 0 0 auto;
    max-width: none;
}

.ticket-shortcut-shared #bet-action-overlay .overlay-btn {
    min-width: 210px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ticket-shortcut-shared #bet-action-overlay .overlay-content {
    width: min(94vw, 780px);
    max-width: min(94vw, 780px);
    padding: 28px 22px;
}

.ticket-shortcut-shared #bet-action-overlay .overlay-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: stretch;
}

.ticket-shortcut-shared #bet-action-overlay .overlay-btn {
    width: 100%;
    max-width: none;
    min-width: 0;
}

.ticket-shortcut-shared .overlay-btn-cancel {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.ticket-shortcut-shared .overlay-btn-confirm {
    background: #f87171;
    color: white;
}

.ticket-shortcut-shared .error-backdrop {
    background: rgba(248, 113, 113, 0.1);
    z-index: 3000;
}

.ticket-shortcut-shared .error-content {
    border: 2px solid #f87171;
}

@media (max-width: 900px) {
    .ticket-shortcut-shared .modal-content.modal-large {
        width: min(96vw, 560px);
        height: min(95vh, 760px);
        max-height: 95vh;
        overflow: hidden;
    }

    .ticket-shortcut-shared .modal-header {
        padding: var(--ticket-space);
    }

    .ticket-shortcut-shared .modal-header h2 {
        font-size: 16px;
        line-height: 1.2;
    }

    .ticket-shortcut-shared .close-btn {
        font-size: 20px;
        line-height: 1;
    }

    .ticket-shortcut-shared .modal-body {
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: var(--ticket-space);
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
    }

    .ticket-shortcut-shared .bet-preview-section {
        order: 1;
        border-left: none;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: var(--ticket-space);
        margin-bottom: 0;
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }

    .ticket-shortcut-shared .preview-header-toggle {
        display: inline-flex;
    }

    .ticket-shortcut-shared .preview-col-total-header {
        align-items: center;
    }

    .ticket-shortcut-shared .bet-preview-content {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        overflow: hidden !important;
        margin-top: var(--ticket-space-sm);
    }

    .ticket-shortcut-shared .form-section {
        order: 2;
        flex: 1 1 auto;
        min-height: 0;
        overflow: auto;
        gap: 2px;
        padding-right: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .ticket-shortcut-shared .bet-preview-section {
        width: 100%;
        box-sizing: border-box;
    }

    .ticket-shortcut-shared .form-step#step-horses {
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
        flex: 1 1 auto;
    }

    .ticket-shortcut-shared .form-section.preview-expanded .form-step#step-horses,
    .ticket-shortcut-shared .form-section .form-step#step-horses {
        flex: 1 1 auto;
        min-height: 0;
    }

    .ticket-shortcut-shared #step-horses .selection-section {
        min-height: 0;
        overflow: hidden;
        flex: 1 1 auto;
    }

    .ticket-shortcut-shared #step-horses .horse-grid-full {
        display: block;
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        overflow: auto;
        padding-bottom: 1px;
    }

    .ticket-shortcut-shared #multi-horse-label {
        display: none;
    }

    .ticket-shortcut-shared .selection-display {
        display: none;
    }

    .ticket-shortcut-shared .bet-preview-section.mobile-collapsed {
        flex: 0 0 auto;
    }

    .ticket-shortcut-shared .bet-preview-section.mobile-collapsed .bet-preview-content {
        max-height: 7rem;
    }

    .ticket-shortcut-shared .bet-preview-section.mobile-expanded {
        flex: 0 0 49vh;
    }

    .ticket-shortcut-shared .bet-preview-section.mobile-expanded .bet-preview-content {
        max-height: none;
    }

    .ticket-shortcut-shared .bet-preview-section.mobile-expanded ~ .form-section {
        flex: 1 1 0;
        min-height: 0;
    }

    .ticket-shortcut-shared .bet-preview-section.mobile-collapsed ~ .form-section {
        flex: 1 1 auto;
    }

    .ticket-shortcut-shared .horse-grid-full {
        max-height: 48vh;
        overflow: auto;
        padding-right: 2px;
    }

    .ticket-shortcut-shared .horse-btn {
        height: 43px;
        min-height: 43px;
        padding: 1px 8px;
        gap: 3px;
    }

    .ticket-shortcut-shared .horse-grid-full {
        gap: 1px;
        padding-bottom: 1px;
    }

    .ticket-shortcut-shared .horse-btn .horse-info {
        align-items: center;
        justify-content: space-between;
        gap: 4px;
        white-space: nowrap;
        padding: 4px 0;
        line-height: 1.2;
    }

    .ticket-shortcut-shared .horse-btn .horse-num {
        line-height: 1.2;
    }

    .ticket-shortcut-shared .horse-btn .horse-name,
    .ticket-shortcut-shared .horse-btn .horse-odds {
        white-space: nowrap;
    }

    .ticket-shortcut-shared .selection-section {
        gap: 2px;
    }

    .ticket-shortcut-shared .form-step {
        padding: 3px;
    }

    .ticket-shortcut-shared .bet-controls-row {
        gap: 8px;
        margin-bottom: 3px !important;
    }

    .ticket-shortcut-shared .form-group {
        padding: 2px 0;
    }

    .ticket-shortcut-shared .form-group label {
        margin-bottom: 2px;
    }

    .ticket-shortcut-shared .preview-row-delete {
        width: 18px;
        min-width: 18px;
    }

    .ticket-shortcut-shared .bet-controls-row {
        margin-bottom: 3px !important;
    }

    .ticket-shortcut-shared #bet-action-overlay .overlay-buttons {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .ticket-shortcut-shared #bet-action-overlay .overlay-btn {
        width: 100%;
        min-width: 0;
    }
}

@media (max-height: 700px) and (max-width: 900px) {
    .ticket-shortcut-shared .modal-body {
        max-height: calc(95vh - 96px);
    }

    .ticket-shortcut-shared .bet-preview-section {
        max-height: none;
    }

    .ticket-shortcut-shared .bet-preview-section.mobile-collapsed {
        max-height: 18vh;
    }

    .ticket-shortcut-shared .bet-preview-content {
        max-height: none;
    }

    .ticket-shortcut-shared .bet-preview-section.mobile-collapsed .bet-preview-content {
        max-height: 12vh;
    }
}

@media (max-width: 360px) {
    .ticket-shortcut-shared .horse-btn {
        height: 43px;
        min-height: 43px;
        align-items: center;
    }

    .ticket-shortcut-shared .horse-btn .horse-info {
        flex-direction: row;
        align-items: center;
        white-space: nowrap;
    }

    .ticket-shortcut-shared .horse-btn .horse-name {
        white-space: nowrap;
    }
}

