@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --bg-color: #050811;
    --card-bg: rgba(16, 20, 32, 0.6);
    --card-hover: rgba(24, 30, 48, 0.8);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-color: #38bdf8;
    --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #3b82f6 100%);
    --accent-glow: 0 0 20px rgba(56, 189, 248, 0.3);

    --win-gold: #fbbf24;
    --win-gradient: linear-gradient(135deg, #fcd34d 0%, #fbbf24 100%);

    --danger-color: #f43f5e;
    --success-color: #10b981;
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --glass-border-hover: 1px solid rgba(56, 189, 248, 0.3);

    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --font-heading: 'Outfit', var(--font-main);
}

* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    background-image:
        radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.12) 0px, transparent 40%),
        radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.08) 0px, transparent 40%),
        radial-gradient(at 50% 50%, rgba(15, 23, 42, 1) 0px, var(--bg-color) 100%);
    background-attachment: fixed;
}

/* Base Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scoreBarGrow {
    from {
        width: 0;
    }
}

.animate-fade-in {
    animation: fadeInUp 0.5s ease-out forwards;
}

/* Typography */
h1,
h2,
h3 {
    font-family: var(--font-heading);
    margin-top: 0;
    font-weight: 700;
    letter-spacing: -0.01em;
}

h1 {
    font-size: 2.25rem;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Layout */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
header {
    background: rgba(5, 8, 17, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1.25rem 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo::before {
    content: '⚡';
    -webkit-text-fill-color: initial;
}

/* Cards (Glassmorphism) */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    transform: translateY(-4px);
    border-color: rgba(56, 189, 248, 0.2);
    background: var(--card-hover);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.875rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    font-family: var(--font-main);
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 8px 16px -4px rgba(59, 130, 246, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px -4px rgba(59, 130, 246, 0.5);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: scale(0.97);
}

/* Race Grid */
.race-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding: 2rem 0;
}

.race-card {
    display: flex;
    flex-direction: column;
}

.race-title {
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    line-height: 1.25;
}

.race-meta {
    display: flex;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.race-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Detail UI */
.race-header {
    text-align: center;
    padding: 3rem 0;
    animation: fadeInUp 0.6s ease-out;
}

.badge {
    padding: 0.4rem 1rem;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 9999px;
    color: var(--accent-color);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.story-box {
    background: linear-gradient(to right, rgba(56, 189, 248, 0.08), transparent);
    border-left: 4px solid var(--accent-color);
    padding: 1.5rem;
    margin: 1.5rem 0;
    font-size: 1.1rem;
    color: #e2e8f0;
    border-radius: 0 12px 12px 0;
}

/* Analysis Badges */
.analysis-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-right: 0.4rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.analysis-tag.high {
    color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
}

/* Prediction Table */
.prediction-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.prediction-table th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.prediction-table tr {
    transition: all 0.2s;
}

.prediction-table td {
    padding: 1.25rem 1rem;
    background: rgba(255, 255, 255, 0.02);
}

.prediction-table tr:hover td {
    background: rgba(255, 255, 255, 0.04);
}

.prediction-table td:first-child {
    border-radius: 12px 0 0 12px;
}

.prediction-table td:last-child {
    border-radius: 0 12px 12px 0;
}

/* Score Indicator */
.score-indicator {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.score-value {
    font-size: 1.25rem;
    font-weight: 800;
    font-family: var(--font-heading);
}

.score-bar-bg {
    width: 100px;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    background: var(--accent-gradient);
    animation: scoreBarGrow 1.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Horse Rank Badge */
.rank-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 900;
    font-size: 1.1rem;
}

.rank-honorable {
    background: var(--win-gradient);
    color: #000;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
}

/* Responsive Table */
@media (max-width: 768px) {

    .prediction-table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    thead {
        display: none;
    }

    .prediction-table tr {
        margin-bottom: 1.5rem;
        background: var(--card-bg);
        border-radius: 20px;
        padding: 1.5rem;
        border: var(--glass-border);
    }

    .prediction-table td {
        padding: 0.5rem 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: transparent !important;
    }

    .prediction-table td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 0.8rem;
        font-weight: 600;
    }
}