@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=VT323&display=swap');

:root {
    --holly-red: #d90429;
    --pine: #0b4f2a;
    --tinsel: #f4e409;
    --snow: #fefdf7;
    --peppermint: #ff6b6b;
    --shadow: rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Fredoka One', 'Comic Sans MS', 'Trebuchet MS', cursive, sans-serif;
    color: var(--snow);
    text-shadow: 0 2px 2px var(--shadow);
    background:
        radial-gradient(circle at 10% 12%, rgba(255, 255, 255, 0.12), transparent 28%),
        radial-gradient(circle at 80% 18%, rgba(255, 255, 255, 0.08), transparent 30%),
        repeating-linear-gradient(45deg, #b30c1d 0 18px, #0b5b3a 18px 36px),
        linear-gradient(#0f2c1c 0%, #0a1910 60%, #0f2c1c 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px 28px;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(2px 2px at 20% 30%, rgba(255, 255, 255, 0.85), transparent),
        radial-gradient(2px 2px at 80% 10%, rgba(255, 255, 255, 0.7), transparent),
        radial-gradient(3px 3px at 50% 50%, rgba(255, 255, 255, 0.9), transparent),
        radial-gradient(2px 2px at 30% 70%, rgba(255, 255, 255, 0.75), transparent),
        radial-gradient(3px 3px at 70% 80%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(4px 4px at 10% 85%, rgba(255, 255, 255, 0.65), transparent),
        radial-gradient(1.5px 1.5px at 90% 60%, rgba(255, 255, 255, 0.9), transparent);
    background-size: 380px 380px, 320px 320px, 440px 440px, 480px 480px, 420px 420px, 520px 520px, 360px 360px;
    animation: snow 14s linear infinite;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(1.5px 1.5px at 5% 15%, rgba(255, 255, 255, 0.9), transparent),
        radial-gradient(2px 2px at 25% 40%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(2px 2px at 60% 5%, rgba(255, 255, 255, 0.85), transparent),
        radial-gradient(3px 3px at 75% 30%, rgba(255, 255, 255, 0.7), transparent),
        radial-gradient(1.8px 1.8px at 45% 65%, rgba(255, 255, 255, 0.95), transparent),
        radial-gradient(2.5px 2.5px at 85% 75%, rgba(255, 255, 255, 0.78), transparent),
        radial-gradient(1.4px 1.4px at 15% 85%, rgba(255, 255, 255, 0.9), transparent),
        radial-gradient(2px 2px at 95% 50%, rgba(255, 255, 255, 0.8), transparent);
    background-size: 260px 260px, 300px 300px, 240px 240px, 280px 280px, 300px 300px, 340px 340px, 260px 260px, 300px 300px;
    animation: snow2 10s linear infinite;
}

header, main, footer {
    width: min(980px, 100%);
}

header {
    margin-bottom: 12px;
    padding: 14px 16px 18px;
    text-align: center;
    border: 4px double var(--tinsel);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.18);
    box-shadow: 0 10px 24px var(--shadow), inset 0 0 18px rgba(255, 255, 255, 0.1);
    position: relative;
}

header::after {
    content: "";
    position: absolute;
    inset: auto 12px -8px 12px;
    height: 10px;
    background: repeating-linear-gradient(
        90deg,
        #fefefe 0 12px,
        #ff2323 12px 24px,
        #0ac46b 24px 36px
    );
    box-shadow: 0 4px 10px var(--shadow);
    border-radius: 0 0 6px 6px;
}

h1 {
    margin: 0;
    font-size: clamp(34px, 6vw, 48px);
    letter-spacing: 2px;
    color: #fff7d1;
    text-transform: uppercase;
    text-shadow:
        0 0 12px rgba(255, 255, 255, 0.35),
        0 0 0 #000,
        0 3px 0 #7d0f1b;
}

main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: min(820px, 100%);
}

#vote-box {
    width: min(780px, 100%);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding: 16px;
    border-radius: 14px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    box-shadow:
        0 10px 30px var(--shadow),
        inset 0 0 0 4px rgba(0, 0, 0, 0.18);
    position: relative;
    overflow: hidden;
}

#vote-box::before {
    content: "🎄 Velg din favoritt! 🎅";
    grid-column: 1 / -1;
    text-align: center;
    font-family: 'VT323', monospace;
    letter-spacing: 1px;
    font-size: clamp(18px, 3vw, 24px);
    margin-bottom: 2px;
    color: var(--tinsel);
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.35), 0 0 6px rgba(255, 255, 255, 0.35);
}

#vote-box::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border: 6px double rgba(255, 255, 255, 0.2);
    mix-blend-mode: screen;
}

#vote-box form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

#vote-box form button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 2 / 3;
    min-height: clamp(320px, 36vw, 520px);
    cursor: pointer;
    border: 4px solid #fff8d6;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.4));
    padding: 10px;
    box-shadow:
        0 10px 20px var(--shadow),
        0 0 0 6px rgba(0, 0, 0, 0.1),
        inset 0 0 12px rgba(255, 255, 255, 0.6);
    transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
    position: relative;
    overflow: hidden;
}

#vote-box form button::after {
    content: "";
    position: absolute;
    inset: -10px;
    border-radius: 16px;
    border: 3px dashed rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
    animation: blink 2.5s linear infinite;
    pointer-events: none;
}

#vote-box img {
    display: block;
    width: 92%;
    height: 92%;
    object-fit: contain;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.78));
    border-radius: 10px;
    padding: 10px;
    filter: drop-shadow(0 8px 12px var(--shadow));
}

#vote-box form button:hover {
    transform: translateY(-6px) rotate(-1deg) scale(1.02);
    box-shadow:
        0 16px 28px rgba(0, 0, 0, 0.4),
        0 0 0 6px rgba(255, 255, 255, 0.14),
        inset 0 0 18px rgba(255, 255, 255, 0.7);
}

#vote-box form button:active {
    transform: translateY(-2px) scale(0.99);
}

.fade-container {
    animation: pop 260ms ease-out;
}

.results-main {
    width: min(980px, 100%);
}

.leaderboard {
    width: 100%;
    padding: 16px;
    border-radius: 14px;
    border: 4px double rgba(255, 255, 255, 0.28);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    box-shadow: 0 12px 28px var(--shadow), inset 0 0 0 4px rgba(0, 0, 0, 0.2);
}

.board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.board-header h2 {
    margin: 0;
    font-size: clamp(24px, 4vw, 30px);
    letter-spacing: 1px;
}

.board-header p {
    margin: 4px 0 0;
    font-family: 'VT323', monospace;
    color: #fff7d1;
    letter-spacing: 0.5px;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    border-radius: 12px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
    box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.2), 0 8px 20px var(--shadow);
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 620px;
}

.leaderboard-table thead th {
    text-align: left;
    padding: 12px 10px;
    font-size: 13px;
    letter-spacing: 0.8px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
    border-bottom: 3px solid rgba(255, 255, 255, 0.2);
}

.leaderboard-table th.rank,
.leaderboard-table td.rank {
    width: 70px;
    text-align: center;
}

.leaderboard-table td {
    padding: 10px 10px;
    vertical-align: middle;
    background: rgba(0, 0, 0, 0.18);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.leaderboard-table tbody.ranked {
    counter-reset: rank;
}

.leaderboard-table tbody.ranked tr {
    counter-increment: rank;
    transition: transform 120ms ease, background 160ms ease;
}

.leaderboard-table tbody.ranked tr:nth-child(even) td {
    background: rgba(0, 0, 0, 0.24);
}

.leaderboard-table tbody.ranked td.rank::before {
    content: "#" counter(rank);
    display: inline-block;
    padding: 6px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.85);
    color: var(--pine);
    font-weight: 800;
    box-shadow: 0 3px 6px var(--shadow);
}

.leaderboard-table tbody tr.top-row td.rank::before {
    background: linear-gradient(135deg, #ffd966, #ffa62b);
}

.leaderboard-table tbody tr.top-row td {
    background: rgba(255, 255, 255, 0.08);
}

.leaderboard-table tbody tr:hover td {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.1);
}

.name-cell .drink-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.thumb-wrap {
    width: 68px;
    height: 68px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.8));
    display: grid;
    place-items: center;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.06), 0 6px 10px var(--shadow);
    overflow: hidden;
}

.thumb-wrap img {
    width: 90%;
    height: 90%;
    object-fit: contain;
}

.drink-meta .drink-name {
    font-size: 18px;
    letter-spacing: 0.5px;
}

.drink-meta .drink-sub {
    font-family: 'VT323', monospace;
    font-size: 16px;
    color: #f9f5dc;
}

.leaderboard-table td.rating,
.leaderboard-table td.matches,
.leaderboard-table td.last {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.leaderboard-table td.wl {
    font-variant-numeric: tabular-nums;
    text-align: center;
    letter-spacing: 0.5px;
}

.leaderboard-table td .win {
    color: #2bd16a;
    font-weight: 700;
}

.leaderboard-table td .loss {
    color: #ff5f6d;
    font-weight: 700;
}

.leaderboard-table td .draw {
    color: #ffe68c;
    font-weight: 700;
}

.leaderboard-table td .dash {
    color: rgba(255, 255, 255, 0.6);
    margin: 0 4px;
}

.leaderboard-table tr.empty td {
    text-align: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.32);
    font-family: 'VT323', monospace;
    letter-spacing: 1px;
}

footer {
    margin-top: 16px;
    text-align: center;
    padding: 12px 14px;
    border-radius: 10px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.2);
    box-shadow: 0 8px 18px var(--shadow);
}

a {
    display: inline-block;
    color: #0b2f1c;
    font-weight: 800;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 12px;
    background: linear-gradient(135deg, #fff7d1 0%, #ffe78a 45%, #ffc741 100%);
    border: 4px double #0b4f2a;
    box-shadow:
        0 6px 12px var(--shadow),
        0 0 0 4px rgba(255, 255, 255, 0.7),
        inset 0 0 0 2px rgba(255, 255, 255, 0.8);
    text-shadow: 0 2px 0 rgba(255, 255, 255, 0.8);
    letter-spacing: 0.5px;
    transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

a:hover {
    transform: translateY(-4px) rotate(-1deg);
    box-shadow:
        0 10px 16px rgba(0, 0, 0, 0.45),
        0 0 0 4px rgba(255, 255, 255, 0.9),
        inset 0 0 0 2px rgba(255, 255, 255, 0.9);
    filter: saturate(1.05);
}

a:focus-visible, #vote-box form button:focus-visible {
    outline: 3px solid var(--tinsel);
    outline-offset: 4px;
}

.hp {
    display: none;
}

/* Metrics page */
.metrics-main {
    width: min(980px, 100%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.metric-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    width: 100%;
}

.metric-card {
    padding: 10px 11px;
    border-radius: 12px;
    border: 3px solid rgba(255, 255, 255, 0.28);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02));
    box-shadow: 0 10px 20px var(--shadow), inset 0 0 0 4px rgba(0, 0, 0, 0.2);
}

.metric-card .label {
    margin: 0 0 4px;
    font-family: 'VT323', monospace;
    color: #fff7d1;
    letter-spacing: 0.5px;
}

.metric-card .value {
    margin: 0;
    font-size: clamp(20px, 3vw, 28px);
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    grid-auto-flow: row dense;
    gap: 10px;
    width: 100%;
}

.metrics-card {
    padding: 12px;
    border-radius: 12px;
    border: 4px double rgba(255, 255, 255, 0.28);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    box-shadow: 0 12px 28px var(--shadow), inset 0 0 0 4px rgba(0, 0, 0, 0.2);
}

.metrics-card h2 {
    margin: 0 0 6px;
}

.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.2);
    font-family: 'VT323', monospace;
}

.pill-code {
    background: rgba(255, 255, 255, 0.12);
    padding: 4px 8px;
    border-radius: 999px;
}

.pill-row.tight {
    gap: 6px;
}

.pill-pct {
    color: var(--tinsel);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.ghost-link {
    color: #fff7d1;
    text-decoration: none;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.5);
}

.bar-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.bar-row {
    display: grid;
    grid-template-columns: 110px 1fr 120px;
    gap: 8px;
    align-items: center;
}

.metrics-main > section {
    width: 100%;
}

.bar-label {
    font-family: 'VT323', monospace;
    color: #fff7d1;
    font-size: 14px;
}

.bar-track {
    height: 12px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4);
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #f4e409, #ff6b6b);
    border-radius: 999px;
    transition: width 180ms ease;
}

.bar-meta {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    font-family: 'VT323', monospace;
}

.bar-list.compact .bar-row {
    grid-template-columns: 90px 1fr 90px;
}

.path-card {
    padding: 12px;
    border-radius: 12px;
    border: 3px solid rgba(255, 255, 255, 0.24);
    background: rgba(0, 0, 0, 0.2);
    box-shadow: 0 8px 18px var(--shadow), inset 0 0 0 3px rgba(0, 0, 0, 0.15);
}

.path-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}

.path-name {
    margin: 2px 0 0;
    font-size: 18px;
}

.path-stats {
    display: flex;
    gap: 10px;
}

.path-stats .value {
    margin: 0;
}

.muted {
    color: rgba(255, 255, 255, 0.7);
    font-family: 'VT323', monospace;
}

@media (max-width: 760px) {
    body {
        padding: 12px 10px 22px;
    }

    h1 {
        font-size: clamp(22px, 5vw, 32px);
    }

    header {
        padding: 10px 12px 12px;
        margin-bottom: 10px;
    }

    main {
        align-items: flex-start;
    }

    #vote-box {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 6px;
    }

    #vote-box::before {
        margin-bottom: 0px;
    }

    #vote-box form button {
        min-height: clamp(220px, 70vw, 320px);
        max-height: 40vh;
        padding: 8px;
    }

    .board-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .leaderboard {
        padding: 12px;
    }

    .thumb-wrap {
        width: 58px;
        height: 58px;
    }

    .drink-meta .drink-name {
        font-size: 16px;
    }
}

@keyframes snow {
    from {
        transform: translateY(-60px);
    }
    to {
        transform: translateY(60px);
    }
}

@keyframes snow2 {
    from {
        transform: translateY(-90px);
    }
    to {
        transform: translateY(90px);
    }
}

@keyframes blink {
    0%, 20% {
        border-color: rgba(255, 255, 255, 0.3);
    }
    30% {
        border-color: rgba(255, 247, 209, 0.9);
    }
    40%, 100% {
        border-color: rgba(255, 255, 255, 0.4);
    }
}

@keyframes pop {
    from {
        opacity: 0;
        transform: scale(0.94);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
