:root {
    --bg: #f4f0e8;
    --card: #fffdf8;
    --ink: #14271d;
    --muted: #68736d;
    --green: #087443;
    --yellow: #f4c542;
    --line: #d9ddd7;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(244, 197, 66, .22), transparent 34rem),
        radial-gradient(circle at bottom right, rgba(8, 116, 67, .15), transparent 30rem),
        var(--bg);
}

.page {
    width: min(760px, calc(100% - 32px));
    margin: 0 auto;
    padding: 42px 0 60px;
}

.brand {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 28px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    flex: none;
    border-radius: 18px;
    background: var(--green);
    color: white;
    font-weight: 900;
    letter-spacing: -1px;
    box-shadow: 0 10px 28px rgba(8, 116, 67, .22);
}

h1, h2, h3, p {
    margin-top: 0;
}

h1 {
    margin-bottom: 4px;
    font-size: clamp(1.55rem, 4vw, 2.2rem);
    letter-spacing: -.05em;
}

.brand p {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.45;
}

.match-card,
.torcidometro-card,
.answer-card,
.rules {
    border: 1px solid rgba(20, 39, 29, .09);
    border-radius: 26px;
    background: rgba(255, 253, 248, .9);
    box-shadow: 0 18px 55px rgba(36, 50, 42, .08);
}

.match-card,
.torcidometro-card {
    padding: 24px;
    margin-bottom: 16px;
}

.eyebrow {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 23px;
    color: var(--muted);
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.matchup {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 14px;
    align-items: center;
}

.team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.flag-img {
    width: clamp(70px, 14vw, 100px);
    aspect-ratio: 3 / 2;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(20, 39, 29, 0.12);
    border: 1px solid rgba(20, 39, 29, 0.08);
}

.team strong {
    font-size: clamp(1rem, 4vw, 1.25rem);
}

.versus {
    color: var(--muted);
    font-size: 1.4rem;
    font-weight: 800;
}

.answer-card {
    position: relative;
    overflow: hidden;
    padding: 30px;
    margin-bottom: 16px;
    background: var(--green);
    color: white;
}

.answer-card::after {
    content: "";
    position: absolute;
    width: 230px;
    height: 230px;
    right: -90px;
    top: -95px;
    border-radius: 50%;
    background: var(--yellow);
    opacity: .18;
}

.answer-label {
    position: relative;
    z-index: 1;
    margin-bottom: 5px;
    color: rgba(255, 255, 255, .72);
    font-weight: 700;
}

.answer-country {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 28px;
}

.answer-flag-img {
    width: clamp(80px, 16vw, 120px);
    aspect-ratio: 3 / 2;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    border: 2px solid rgba(255, 255, 255, 0.25);
    flex: none;
}

.answer-country h2 {
    margin: 0;
    font-size: clamp(2.25rem, 9vw, 4.8rem);
    line-height: .95;
    letter-spacing: -.06em;
}

.reasons {
    position: relative;
    z-index: 1;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 18px;
    background: rgba(255, 255, 255, .09);
}

.reasons h3 {
    margin-bottom: 10px;
}

.reasons ul {
    margin: 0;
    padding-left: 20px;
    line-height: 1.55;
}

.share-button {
    position: relative;
    z-index: 1;
    width: 100%;
    margin-top: 18px;
    padding: 15px 18px;
    border: 0;
    border-radius: 14px;
    background: var(--yellow);
    color: #1c2c22;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
}

.share-button:hover {
    filter: brightness(1.04);
    transform: translateY(-1px);
}

.rules {
    padding: 26px;
}

.rules h3 {
    margin-bottom: 16px;
    font-size: 1.3rem;
}

.rules ol {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 28px;
    margin: 0;
    padding-left: 24px;
    line-height: 1.4;
}

.rules-note,
.source {
    color: var(--muted);
    line-height: 1.5;
}

.rules-note {
    margin: 20px 0 0;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.source {
    margin: 16px 5px 0;
    font-size: .82rem;
    text-align: center;
}

.demo-warning {
    margin-top: 14px;
    padding: 13px 15px;
    border: 1px solid #d9b53c;
    border-radius: 12px;
    background: #fff3c9;
    color: #5b4812;
    font-size: .88rem;
    line-height: 1.45;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (max-width: 580px) {
    .page {
        width: min(100% - 22px, 760px);
        padding-top: 24px;
    }

    .brand {
        align-items: flex-start;
    }

    .brand-mark {
        width: 50px;
        height: 50px;
        border-radius: 15px;
    }

    .match-card,
    .torcidometro-card,
    .answer-card,
    .rules {
        border-radius: 21px;
    }

    .match-card,
    .torcidometro-card {
        padding: 21px 15px;
    }

    .answer-card {
        padding: 25px 20px;
    }

    .rules {
        padding: 22px;
    }

    .rules ol {
        grid-template-columns: 1fr;
    }
}

.team-score {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 700;
}

.answer-score {
    font-size: 1.1rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 2px;
}

.score-details {
    list-style: none;
    padding: 0 !important;
    margin: 0 0 20px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.score-details li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    line-height: 1.4;
    text-align: left;
}

.score-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 800;
    text-align: center;
    min-width: 54px;
    flex-shrink: 0;
}

.score-positive {
    background: var(--yellow);
    color: #1c2c22;
}

.score-negative {
    background: #e65c5c;
    color: white;
}

.score-desc {
    color: rgba(255, 255, 255, 0.9);
}

.tabs-container {
    margin-top: 15px;
}

.tab-buttons {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
    padding-bottom: 8px;
    margin-bottom: 15px;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px 12px 0 0;
    color: rgba(255, 255, 255, 0.8);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    outline: none;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: white;
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--yellow);
    border-bottom-color: transparent;
    color: white;
}

.tab-score {
    background: rgba(0, 0, 0, 0.15);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--yellow);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

.final-explanation {
    margin-top: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--yellow);
    line-height: 1.4;
    background: rgba(20, 39, 29, 0.25);
    padding: 10px 14px;
    border-radius: 8px;
    border-left: 3px solid var(--yellow);
    text-align: left;
}

.sim-link-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 12px;
    background: rgba(8, 116, 67, 0.08);
    color: var(--green);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    transition: background 0.2s, transform 0.2s;
    border: 1px solid rgba(8, 116, 67, 0.15);
}

.sim-link-btn:hover {
    background: rgba(8, 116, 67, 0.15);
    transform: translateY(-1px);
}

.rules-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 20px;
    text-align: left;
}

.rules-group h4 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
    padding-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rules-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rules-group li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.88rem;
    color: var(--ink);
}

.points-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 800;
    white-space: nowrap;
}

.points-badge.positive {
    background: #e6f3ed;
    color: var(--green);
}

.points-badge.negative {
    background: #ffe6e6;
    color: #b32d2d;
}

/* Accordion details and summary styling */
.rules details summary {
    list-style: none;
    cursor: pointer;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--ink);
    display: flex;
    justify-content: space-between;
    align-items: center;
    outline: none;
    user-select: none;
}

.rules details summary::-webkit-details-marker {
    display: none;
}

.rules details[open] summary .details-arrow {
    transform: rotate(180deg);
}

.details-arrow {
    font-size: 0.8rem;
    color: var(--muted);
    transition: transform 0.2s;
}

.rules details[open] .rules-container,
.rules details[open] .rules-note {
    animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hover feedback to make clickability obvious */
.rules details summary:hover span {
    color: var(--green);
}


