/* ============================================================
   MLB 13 Run Pool — Styles
   Color Palette: Baseball Green & Cream
   ============================================================ */

:root {
    --green-dark: #1B4332;
    --green-mid: #2D6A4F;
    --green-light: #40916C;
    --red-accent: #BC4749;
    --gold-accent: #DDA15E;
    --cream: #FEFAE0;
    --bg: #F5F5F0;
    --bg-alt: #E9F0E6;
    --text: #212529;
    --text-light: #6C757D;
    --white: #FFFFFF;
    --border: #D4D4D4;
    --shadow: rgba(0, 0, 0, 0.1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Montserrat', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--green-dark); text-decoration: none; }
a:hover { color: var(--green-light); }

/* ---- Site Header ---- */
.site-header {
    background: var(--white);
    box-shadow: 0 2px 8px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1.5rem;
    background: var(--green-dark);
    color: var(--cream);
}

.site-title {
    font-size: 1.3rem;
    font-weight: 400;
    letter-spacing: 2px;
    white-space: nowrap;
}

/* ---- Hamburger ---- */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 110;
}

.hamburger span {
    display: block;
    width: 26px;
    height: 3px;
    background: var(--cream);
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}

.hamburger.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ---- Navigation ---- */
.nav {
    background: var(--white);
    border-bottom: 3px solid var(--green-dark);
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0;
    margin: 0;
    padding: 0;
}

.nav-menu > li { position: relative; }

.nav-link {
    display: block;
    padding: 0.65rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
    background: var(--green-dark);
    color: var(--cream);
}

/* Dropdown indicator arrow */
.nav-dropdown > .nav-link::after {
    content: ' \25BE';
    font-size: 0.7em;
    opacity: 0.6;
}

/* ---- Dropdown Menus ---- */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 260px;
    background: var(--white);
    box-shadow: 0 4px 16px var(--shadow);
    border: 1px solid var(--border);
    border-radius: 0 0 6px 6px;
    list-style: none;
    padding: 0.3rem 0;
    z-index: 200;
    max-height: 70vh;
    overflow-y: auto;
}

.nav-dropdown:hover > .dropdown-menu { display: block; }

.dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    transition: background 0.15s;
}

.dropdown-menu a:hover {
    background: var(--bg-alt);
    color: var(--green-dark);
}

.dropdown-divider {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-light);
    padding: 0.5rem 1rem 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    pointer-events: none;
}

/* ---- Banner ---- */
.banner {
    background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-mid) 60%, var(--green-light) 100%);
    padding: 2rem 1.5rem 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Subtle diamond pattern overlay */
.banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 0 L40 20 L20 40 L0 20Z' fill='none' stroke='rgba(255,255,255,0.06)' stroke-width='1'/%3E%3C/svg%3E") repeat;
    pointer-events: none;
}

.banner-text {
    display: block;
    font-size: clamp(1.1rem, 3vw, 1.8rem);
    font-weight: 800;
    color: var(--cream);
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 0.8rem;
    position: relative;
}

.banner-social {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.social-label {
    font-size: clamp(0.6rem, 1.5vw, 0.75rem);
    font-weight: 600;
    color: rgba(254, 250, 224, 0.8);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.social-icons {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.social-icons a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--white);
    border-radius: 50%;
    color: var(--green-dark);
    transition: transform 0.2s, box-shadow 0.2s;
}

.social-icons a:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.social-icons a svg { width: 15px; height: 15px; }

.social-divider {
    width: 1px;
    height: 18px;
    background: rgba(254, 250, 224, 0.4);
}

/* ---- Main Content ---- */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

/* ---- Contest Banner ---- */
.contest-banner {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-light);
    margin: 0 0 0.75rem;
    letter-spacing: 0.3px;
}

/* ---- Contest Tabs (results page contest switcher) ---- */
.contest-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    margin: 0 0 1rem;
}

.contest-tab {
    display: inline-block;
    padding: 0.45rem 1rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--white);
    color: var(--green-dark);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    line-height: 1.2;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.contest-tab:hover {
    background: var(--bg-alt);
    border-color: var(--green-light);
    color: var(--green-dark);
}

.contest-tab.active {
    background: var(--green-dark);
    border-color: var(--green-dark);
    color: var(--cream);
}

.contest-tab.active:hover { color: var(--cream); }

.contest-tab .tab-year {
    font-weight: 500;
    opacity: 0.75;
    margin-left: 0.3rem;
}

.contest-tab.current-live {
    border-style: dashed;
    border-color: var(--gold-accent);
}

/* Tab row sitting at the top of a card, above the green title bar. The card
   itself has no padding (only .rules-body does), so supply it here. */
.rules-section > .contest-tabs {
    margin: 0;
    padding: 0.85rem 1.2rem;
}

/* ---- Pool Table ---- */
.pool-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 auto;
    border-radius: 8px;
    box-shadow: 0 2px 12px var(--shadow);
    background: var(--white);
}

.pool-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 780px;
    font-size: 0.82rem;
}

.pool-table thead th {
    background: var(--green-dark);
    color: var(--cream);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.6rem 0.4rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

.pool-table thead th:first-child {
    text-align: left;
    padding-left: 0.8rem;
    min-width: 110px;
}

.pool-table tbody tr { transition: background 0.15s; }

.pool-table tbody tr:nth-child(even) { background: var(--bg-alt); }
.pool-table tbody tr:nth-child(odd) { background: var(--white); }
.pool-table tbody tr:hover { background: #d6e8d1; }

.pool-table td {
    padding: 0.5rem 0.35rem;
    text-align: center;
    border-bottom: 1px solid #e8e8e8;
    vertical-align: middle;
}

.col-team {
    text-align: left !important;
    padding-left: 0.8rem !important;
    font-weight: 700;
    white-space: nowrap;
}

.col-owner {
    text-align: left !important;
    font-size: 0.78rem;
    color: var(--text-light);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.col-gp, .col-marks {
    font-weight: 700;
    font-size: 0.8rem;
    min-width: 36px;
}

.col-marks { color: var(--green-dark); }

/* ---- Run Cells ---- */
.run-cell {
    min-width: 34px;
    font-weight: 600;
    position: relative;
    cursor: default;
    font-size: 0.8rem;
    color: var(--text-light);
}

.run-cell.achieved {
    background: #d4edda;
}

.run-cell.achieved .run-number {
    color: var(--text);
    font-weight: 400;
    font-size: 0.9rem;
    position: relative;
    z-index: 0;
}

.run-cell .run-x {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--red-accent);
    font-weight: 600;
    font-size: 1.4rem;
    line-height: 1;
    pointer-events: none;
    z-index: 1;
}

/* CSS tooltip for achieved date */
.run-cell[data-date] { cursor: help; }

.run-cell[data-date]:hover::after {
    content: attr(data-date);
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: var(--white);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 50;
    pointer-events: none;
}

.run-cell[data-date]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 0px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--text);
    z-index: 50;
    pointer-events: none;
}

/* Live game indicator */
.run-cell.live {
    background: #FFF3CD;
}

.run-cell.achieved.live {
    background: #d4edda;
}

/* The whole live square links to that game's ESPN Gamecast. The dot lives inside
   the anchor as a real element rather than a ::before, because
   .run-cell[data-date]:hover::before (the date tooltip's arrow) outranks it and
   would replace the dot on hover — which now happens constantly. */
.run-cell .live-link {
    position: absolute;
    inset: 0;
    z-index: 3;
    cursor: pointer;
}

.run-cell .live-link:focus-visible {
    outline: 2px solid var(--green-dark);
    outline-offset: -2px;
}

.run-cell .live-dot {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 7px;
    height: 7px;
    background: var(--red-accent);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

/* Winner rows — place-specific colors */
.pool-table tbody tr.place-1 {
    background: linear-gradient(90deg, #FFD700 0%, #FFF8DC 30%, #FFFBE6 100%) !important;
}
.pool-table tbody tr.place-2 {
    background: linear-gradient(90deg, #C0C0C0 0%, #E8E8E8 30%, #F5F5F5 100%) !important;
}
.pool-table tbody tr.place-3 {
    background: linear-gradient(90deg, #CD7F32 0%, #E8C49A 30%, #FDF0E0 100%) !important;
}

.pool-table tbody tr[class^="place-"] td:first-child::before {
    content: attr(data-place);
    display: inline-block;
    color: var(--text);
    font-size: 0.6rem;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 3px;
    margin-right: 6px;
    vertical-align: middle;
    text-transform: uppercase;
}

/* ---- Footer ---- */
.site-footer {
    text-align: center;
    padding: 1.5rem 1rem;
    font-size: 0.75rem;
    color: var(--text-light);
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

.site-footer .last-updated {
    font-weight: 600;
    color: var(--text);
}

/* ---- Rules Page ---- */
.rules-container {
    max-width: 800px;
    margin: 0 auto;
}

.rules-section {
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 1px 6px var(--shadow);
    margin-bottom: 1.2rem;
    overflow: hidden;
}

.rules-section h2 {
    background: var(--green-dark);
    color: var(--cream);
    padding: 0.7rem 1.2rem;
    font-size: 0.95rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.rules-section .rules-body {
    padding: 1rem 1.2rem;
    font-size: 0.88rem;
    line-height: 1.7;
}

.rules-section .rules-body p { margin-bottom: 0.8rem; }
.rules-section .rules-body p:last-child { margin-bottom: 0; }

.payout-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.8rem 0;
    font-size: 0.85rem;
}

.payout-table th {
    background: var(--bg-alt);
    padding: 0.5rem 0.8rem;
    text-align: left;
    font-weight: 700;
    border-bottom: 2px solid var(--green-dark);
}

.payout-table td {
    padding: 0.5rem 0.8rem;
    border-bottom: 1px solid var(--border);
}

/* ---- Pool Status Banner ---- */
.status-banner {
    text-align: center;
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.status-banner.pending {
    background: #FFF3CD;
    color: #856404;
}

.status-banner.active {
    background: #d4edda;
    color: #155724;
}

.status-banner.complete {
    background: #D1ECF1;
    color: #0C5460;
}

/* ---- Responsive: Tablet (iPad) ---- */
@media (max-width: 1024px) {
    .main-content { padding: 1rem 0.75rem; }
    .pool-table { min-width: 700px; }
    .col-owner { max-width: 90px; font-size: 0.72rem; }
    .run-cell { min-width: 30px; }
    .col-gp, .col-marks { min-width: 30px; }
    .pool-table thead th:first-child { min-width: 90px; }
}

/* ---- Responsive: Mobile ---- */
@media (max-width: 768px) {
    .hamburger { display: flex; }

    .nav {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.35s ease;
        border-bottom: none;
    }

    .nav.open {
        max-height: 100vh;
        border-bottom: 3px solid var(--green-dark);
        overflow-y: auto;
    }

    .nav-menu {
        flex-direction: column;
    }

    .nav-link {
        padding: 0.8rem 1.5rem;
        border-bottom: 1px solid #eee;
        font-size: 0.9rem;
    }

    .dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        border-radius: 0;
        background: var(--bg);
        display: none;
        padding-left: 1rem;
    }

    .nav-dropdown.open > .dropdown-menu { display: block; }

    .dropdown-menu a {
        padding: 0.6rem 1.5rem;
        font-size: 0.82rem;
    }

    /* Sticky first column on mobile */
    .pool-table .col-team {
        position: sticky;
        left: 0;
        z-index: 5;
        background: inherit;
        box-shadow: 2px 0 4px rgba(0,0,0,0.08);
    }

    .pool-table thead th:first-child {
        position: sticky;
        left: 0;
        z-index: 15;
    }

    .pool-table { min-width: 650px; }
    .col-owner { max-width: 80px; font-size: 0.7rem; }
    .run-cell { min-width: 28px; }

    .banner { padding: 1.5rem 1rem 1rem; }
    .banner-text { letter-spacing: 2px; }
    .main-content { padding: 1rem 0.5rem; }
}

@media (max-width: 480px) {
    .site-title { font-size: 1.05rem; }
    .col-owner { display: none; }
    .pool-table thead th.col-owner-hdr { display: none; }
    .pool-table { font-size: 0.75rem; }
    .run-cell { min-width: 28px; font-size: 0.72rem; }
}

/* Rotate hint styles handled inline via JS */
