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

:root {
    --racing-green: #00a651;
    --racing-dark-green: #008040;
    --racing-red: #e31e24;
    --racing-gold: #ffd700;
    --racing-orange: #ff8c00;
    --racing-purple: #8b2fc9;
    --racing-blue: #1e90ff;
    --racing-black: #0a0a0a;
    --racing-dark-bg: #1a1a1a;
    --racing-card-bg: #252525;
    --racing-card-hover: #2d2d2d;
    --racing-grey: #888888;
    --racing-light-grey: #444444;
    --racing-text: #e0e0e0;
    --racing-text-muted: #b0b0b0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--racing-black);
    min-height: 100vh;
    color: var(--racing-text);
}

/* Navigation */
.dashboard-nav {
    background: var(--racing-dark-bg);
    border-bottom: 2px solid var(--racing-green);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 22px;
    color: var(--racing-green);
    margin: 0;
    font-weight: 700;
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 8px 14px;
    text-decoration: none;
    color: var(--racing-text-muted);
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--racing-card-bg);
    color: var(--racing-green);
}

.nav-link.active {
    background: var(--racing-green);
    color: var(--racing-black);
}

.nav-toggle {
    display: none;
}

/* Dashboard Container */
.dashboard-container {
    max-width: 1200px;
    margin: 12px auto;
    padding: 0 16px;
}

.dashboard-page {
    display: none;
}

.dashboard-page.active {
    display: block;
}

/* Page Header */
.page-header {
    background: var(--racing-card-bg);
    border: 1px solid var(--racing-light-grey);
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.page-header h2 {
    color: var(--racing-text);
    margin-bottom: 4px;
    font-size: 1.25rem;
}

.page-header p {
    color: var(--racing-text-muted);
    font-size: 0.9rem;
}

/* Controls */
.selections-controls,
.results-controls,
.stats-controls {
    background: var(--racing-card-bg);
    border: 1px solid var(--racing-light-grey);
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.control-group label {
    margin-bottom: 4px;
    font-weight: 600;
    color: var(--racing-text);
    font-size: 13px;
}

.control-group input,
.control-group select {
    padding: 8px 10px;
    border: 1px solid var(--racing-light-grey);
    border-radius: 6px;
    font-size: 14px;
    background: var(--racing-dark-bg);
    color: var(--racing-text);
}

.control-group select[multiple] {
    min-height: 100px;
}

.control-group small {
    margin-top: 4px;
    color: var(--racing-text-muted);
    font-size: 11px;
}

.btn-primary {
    background: var(--racing-green);
    color: var(--racing-black);
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
    align-self: flex-end;
}

.btn-primary:hover {
    background: var(--racing-dark-green);
    color: white;
}

.control-group {
    display: flex;
    flex-direction: column;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.stat-card {
    background: var(--racing-card-bg);
    border: 1px solid var(--racing-light-grey);
    padding: 14px 16px;
    border-radius: 8px;
}

.stat-label {
    color: var(--racing-text-muted);
    font-size: 12px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 26px;
    font-weight: bold;
    color: var(--racing-text);
}

.stat-value.positive {
    color: var(--racing-green);
}

.stat-value.negative {
    color: var(--racing-red);
}

/* Page Content */
.page-content {
    background: var(--racing-card-bg);
    border: 1px solid var(--racing-light-grey);
    padding: 16px 20px;
    border-radius: 8px;
}

/* How it works / Help page – tighter layout */
.help-content {
    max-width: 720px;
    padding: 0;
}
.help-section {
    margin-bottom: 20px;
}
.help-section:last-child {
    margin-bottom: 0;
}
.help-section h3 {
    color: var(--racing-green);
    font-size: 1.1rem;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--racing-green);
}
.help-section p {
    color: var(--racing-text-muted);
    line-height: 1.55;
    margin-bottom: 8px;
    font-size: 0.95rem;
}
.help-section ul,
.help-section ol {
    margin: 6px 0 10px 1.1em;
    color: var(--racing-text-muted);
    line-height: 1.6;
    font-size: 0.95rem;
}
.help-section li {
    margin-bottom: 6px;
}
.help-section li:last-child {
    margin-bottom: 0;
}
.pipeline-steps {
    list-style: none;
    margin-left: 0;
    counter-reset: step;
}
.pipeline-steps li {
    position: relative;
    padding-left: 2em;
    margin-bottom: 10px;
}
.pipeline-steps li::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 1.6em;
    height: 1.6em;
    background: var(--racing-green);
    color: var(--racing-black);
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.6em;
}

/* Tables */
.data-table {
    overflow-x: auto;
}

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

th {
    background: var(--racing-dark-bg);
    color: var(--racing-text);
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--racing-green);
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--racing-light-grey);
    color: var(--racing-text);
}

tr:hover {
    background: var(--racing-card-hover);
}

/* Loading & Error */
.loading {
    text-align: center;
    padding: 32px;
    color: var(--racing-text-muted);
    font-size: 16px;
}

.error {
    background: rgba(227, 30, 36, 0.15);
    color: #ff6b6b;
    padding: 14px;
    border-radius: 6px;
    margin: 16px 0;
    border: 1px solid var(--racing-red);
}

/* Date availability indicator (results) */
.date-indicator {
    margin-top: 6px;
    font-size: 12px;
}
.date-indicator.ok {
    color: var(--racing-green);
}
.date-indicator.missing {
    color: var(--racing-red);
}

/* Selections Display */
.selections-by-course {
    margin-bottom: 30px;
}

.course-header {
    background: linear-gradient(135deg, var(--racing-green) 0%, var(--racing-dark-green) 100%);
    color: white;
    padding: 16px 18px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.course-header h3 {
    margin: 0;
    font-size: 20px;
    color: white;
}

.race-group {
    background: var(--racing-card-bg);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    border: 1px solid var(--racing-light-grey);
}

.race-header {
    background: var(--racing-dark-bg);
    padding: 10px 14px;
    font-weight: 600;
    color: var(--racing-text);
    border-bottom: 2px solid var(--racing-green);
}

.race-horses {
    padding: 10px;
}

.selection-card {
    background: var(--racing-card-bg);
    border: 1px solid var(--racing-light-grey);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.selection-card:hover {
    border-color: var(--racing-green);
    background: var(--racing-card-hover);
}

.selection-card:last-child {
    margin-bottom: 0;
}

.selection-horse {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--racing-text);
}

.selection-details {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    font-size: 14px;
}

.selection-model {
    background: var(--racing-green);
    color: var(--racing-black);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.selection-prob {
    color: var(--racing-green);
    font-weight: 600;
}

.selection-odds {
    color: var(--racing-text-muted);
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-right: 6px;
}

.status-badge.win {
    background: var(--racing-green);
    color: var(--racing-black);
}

.status-badge.place {
    background: #3b82f6;
    color: white;
}

.status-badge.loss {
    background: #ef4444;
    color: white;
}

.status-badge.nr {
    background: #6b7280;
    color: white;
}

/* WordPress-style Selections Display (uses :root vars above) */
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
    font-family: 'Nunito', sans-serif;
}

.yetibets-header {
    background: linear-gradient(135deg, var(--racing-green) 0%, var(--racing-dark-green) 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.yetibets-main-title {
    font-size: 2.5rem;
    margin: 0 0 15px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.yetibets-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 1rem;
}

.yetibets-generated, .yetibets-runners {
    background: rgba(255,255,255,0.2);
    padding: 8px 15px;
    border-radius: 6px;
}

.yetibets-course-wrapper {
    margin: 30px 0;
    border: 2px solid var(--racing-green);
    border-radius: 12px;
    overflow: hidden;
    background: var(--racing-card-bg);
}

.yetibets-course-toggle {
    width: 100%;
    background: linear-gradient(135deg, var(--racing-green) 0%, var(--racing-dark-green) 100%);
    color: white;
    border: none;
    padding: 20px 25px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: background 0.3s ease;
    font-family: inherit;
}

.yetibets-course-toggle:hover {
    background: linear-gradient(135deg, var(--racing-dark-green) 0%, var(--racing-green) 100%);
}

.yetibets-course-icon {
    font-size: 1rem;
    transition: transform 0.3s ease;
    min-width: 20px;
}

.yetibets-course-title {
    font-size: 1.8rem;
    color: white;
    margin: 0;
    font-weight: 700;
    flex: 1;
}

.yetibets-course-content {
    background: var(--racing-dark-bg);
    padding: 25px;
    border-top: 3px solid var(--racing-green);
    display: none;
}

.yetibets-race-section {
    background: var(--racing-card-bg);
    border-radius: 10px;
    margin: 15px 0;
    border: 2px solid var(--racing-light-grey);
    overflow: hidden;
}

.yetibets-race-toggle {
    width: 100%;
    background: var(--racing-dark-bg);
    border: none;
    padding: 18px 20px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    transition: background 0.2s ease;
    font-family: inherit;
}

.yetibets-race-toggle:hover {
    background: var(--racing-card-bg);
}

.yetibets-race-icon {
    font-size: 0.9rem;
    color: var(--racing-green);
    min-width: 16px;
}

.yetibets-race-number {
    background: var(--racing-blue);
    color: white;
    font-weight: bold;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.yetibets-race-header {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.yetibets-race-title {
    font-size: 1.3rem;
    color: var(--racing-text);
    margin: 0;
    font-weight: 700;
}

.yetibets-runners-count {
    color: var(--racing-text-muted);
    font-size: 0.9em;
    font-weight: normal;
    margin-left: 8px;
}

.yetibets-race-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 5px;
    flex-wrap: wrap;
}

.yetibets-race-time {
    color: var(--racing-purple);
    font-weight: 600;
    font-size: 1rem;
}

.yetibets-race-content {
    padding: 20px;
    border-top: 2px solid var(--racing-light-grey);
    background: var(--racing-dark-bg);
    display: none;
}

.yetibets-race-advice {
    background: var(--racing-card-bg);
    padding: 12px 16px;
    border-radius: 6px;
    border-left: 4px solid var(--racing-gold);
    margin: 0 0 15px 0;
    font-style: italic;
    font-size: 0.95rem;
    color: var(--racing-text);
}

.yetibets-runners-badge {
    display: inline-block;
    background: var(--racing-blue);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.yetibets-horses-list {
    display: grid;
    gap: 15px;
    margin-top: 20px;
}

.yetibets-horse-card {
    background: var(--racing-card-bg);
    border-radius: 10px;
    padding: 20px;
    border-left: 5px solid var(--racing-light-grey);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: all 0.2s;
    opacity: 0.8;
}

.yetibets-horse-card.is-tip {
    border-left: 5px solid var(--racing-green);
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
    opacity: 1;
}

.yetibets-horse-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.7);
    transform: translateX(5px);
    background: var(--racing-card-hover);
}

.yetibets-horse-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.yetibets-horse-position {
    background: var(--racing-light-grey);
    color: var(--racing-text);
    font-weight: bold;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.2rem;
}

.yetibets-horse-card.is-tip .yetibets-horse-position {
    background: var(--racing-green);
    color: white;
}

.yetibets-horse-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--racing-text);
    margin: 0;
    flex: 1;
}

.yetibets-horse-probability {
    background: var(--racing-gold);
    color: var(--racing-black);
    font-weight: bold;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 1.1rem;
}

.yetibets-horse-details {
    display: grid;
    gap: 10px;
}

.yetibets-detail-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    padding: 10px 0;
    border-bottom: 1px solid var(--racing-light-grey);
    color: var(--racing-text);
}

.yetibets-detail-row:last-child {
    border-bottom: none;
}

.yetibets-detail-label {
    font-weight: 600;
    color: var(--racing-text-muted);
    margin-right: 5px;
}

.yetibets-ratings {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.yetibets-rating-badge {
    background: var(--racing-dark-bg);
    color: var(--racing-text);
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid var(--racing-light-grey);
}

.yetibets-why {
    background: var(--racing-dark-bg);
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid var(--racing-green);
    margin-top: 10px;
    color: var(--racing-text);
    font-size: 0.95rem;
}

/* Statistics Table */
.stats-table-wrapper {
    overflow-x: auto;
}

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

.stats-table th {
    background: var(--racing-green);
    color: var(--racing-black);
    padding: 12px;
    text-align: center;
}

.stats-table td {
    text-align: center;
    padding: 10px;
    color: var(--racing-text);
}

.stats-table .course-name {
    text-align: left;
    font-weight: 600;
}

.stats-table .positive {
    color: var(--racing-green);
    font-weight: 600;
}

.stats-table .negative {
    color: var(--racing-red);
    font-weight: 600;
}

/* ========== Mobile / responsive ========== */
@media (max-width: 768px) {
    .nav-container {
        padding: 12px 16px;
        flex-wrap: wrap;
    }
    .nav-logo {
        font-size: 20px;
    }
    .nav-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 44px;
        height: 44px;
        padding: 10px;
        background: var(--racing-card-bg);
        border: 1px solid var(--racing-light-grey);
        border-radius: 6px;
        cursor: pointer;
    }
    .nav-toggle span {
        display: block;
        height: 2px;
        background: var(--racing-text);
        border-radius: 1px;
    }
    .nav-toggle[aria-expanded="true"] span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    .nav-toggle[aria-expanded="true"] span:nth-child(2) {
        opacity: 0;
    }
    .nav-toggle[aria-expanded="true"] span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }
    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 0;
        padding-top: 12px;
        border-top: 1px solid var(--racing-light-grey);
        margin-top: 12px;
    }
    .nav-links.is-open {
        display: flex;
    }
    .nav-link {
        padding: 14px 16px;
        min-height: 44px;
        display: flex;
        align-items: center;
        border-radius: 6px;
    }
    .dashboard-container {
        margin: 12px auto;
        padding: 0 12px;
    }
    .page-header {
        padding: 20px 16px;
        margin-bottom: 12px;
    }
    .page-header h2 {
        font-size: 1.35rem;
    }
    .selections-controls,
    .results-controls,
    .stats-controls {
        padding: 16px;
        margin-bottom: 12px;
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .control-group input,
    .control-group select {
        min-height: 44px;
        padding: 12px;
        font-size: 16px; /* prevents zoom on focus on iOS */
    }
    .control-group select[multiple] {
        min-height: 120px;
    }
    .btn-primary {
        min-height: 44px;
        padding: 12px 20px;
        width: 100%;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 12px;
    }
    .stat-card {
        padding: 16px;
    }
    .stat-value {
        font-size: 24px;
    }
    .page-content {
        padding: 16px;
    }
    .data-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -16px;
        padding: 0 16px;
    }
    .data-table table {
        min-width: 600px;
    }
    .data-table th,
    .data-table td {
        padding: 12px 10px;
        font-size: 14px;
    }
    .stats-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -16px;
        padding: 0 16px;
    }
    .stats-table {
        min-width: 560px;
    }
    .stats-table th,
    .stats-table td {
        padding: 10px 8px;
        font-size: 13px;
    }
    .yetibets-selections-content {
        padding: 16px 12px;
    }
    .yetibets-main-title {
        font-size: 1.75rem;
    }
    .yetibets-course-toggle {
        padding: 16px 18px;
    }
    .yetibets-course-title {
        font-size: 1.35rem;
    }
    .yetibets-horse-card {
        padding: 16px;
    }
    .yetibets-horse-name {
        font-size: 1.2rem;
    }
    /* How it works page – mobile */
    .help-content {
        max-width: none;
        padding: 16px 0 8px;
    }
    .help-section {
        margin-bottom: 22px;
    }
    .help-section h3 {
        font-size: 1.1rem;
        margin-bottom: 10px;
        padding-bottom: 6px;
    }
    .help-section p,
    .help-section li {
        font-size: 15px;
        line-height: 1.6;
    }
    .help-section ul,
    .help-section ol {
        margin-left: 0;
        padding-left: 1.25em;
        margin-bottom: 12px;
    }
    .help-section li {
        margin-bottom: 10px;
    }
    .pipeline-steps {
        padding-left: 0;
    }
    .pipeline-steps li {
        padding-left: 2.5em;
        padding-top: 2px;
        margin-bottom: 16px;
        min-height: 2em;
    }
    .pipeline-steps li::before {
        width: 1.5em;
        height: 1.5em;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .help-section h3 {
        font-size: 1.05rem;
    }
    .help-section p,
    .help-section li {
        font-size: 14px;
    }
    .pipeline-steps li {
        padding-left: 2.4em;
        margin-bottom: 14px;
    }
}
