* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #1d1b27;
    background: radial-gradient(circle at top left, #ffe6f2 0%, #ffecf7 30%, #fff2ee 100%);
}

html, body {
    min-height: 100%;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.hidden {
    display: none !important;
}

.page {
    width: min(680px, 100%);
}

.hero, .result-panel, .scratch-section {
    display: grid;
    place-items: center;
    min-height: 100vh;
}

.hero-card, .result-card, .scratch-card {
    width: 100%;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 32px;
    box-shadow: 0 30px 90px rgba(177, 73, 121, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.8);
    padding: 32px;
    backdrop-filter: blur(14px);
}

.hero-badge, .badge {
    display: inline-flex;
    padding: 10px 18px;
    border-radius: 999px;
    background: linear-gradient(135deg, #ff9dd4, #ff5f94);
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-bottom: 18px;
}

.hall-of-fame {
    margin-top: 24px;
}

.hof-table-wrapper {
    overflow-x: auto;
}

.hof-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 18px 42px rgba(177, 73, 121, 0.08);
}

.hof-table th,
.hof-table td {
    padding: 14px 16px;
    text-align: left;
    font-size: 0.95rem;
}

.hof-table thead {
    background: #ffe6f2;
}

.hof-table th {
    color: #7a4362;
    font-weight: 700;
}

.hof-table tbody tr {
    border-bottom: 1px solid #f3d6e4;
}

.hof-table tbody tr:last-child {
    border-bottom: none;
}

.hof-table tbody td {
    color: #53405a;
}

.hof-table tbody tr.highlight {
    animation: highlight-row 1.4s ease forwards;
}

@keyframes highlight-row {
    0% { background: #d8ffe3; }
    50% { background: #f1fff7; }
    100% { background: transparent; }
}

.hero h1 {
    font-size: clamp(2.2rem, 3vw, 3.2rem);
    margin-bottom: 12px;
    letter-spacing: -0.04em;
}

.hero p, .result-card p, .scratch-card p {
    color: #5b485f;
    line-height: 1.65;
    margin-bottom: 24px;
}

.field-group {
    display: grid;
    gap: 18px;
    margin-top: 24px;
}

label {
    display: grid;
    gap: 10px;
    font-size: 0.95rem;
    color: #5b475d;
}

input[type='text'] {
    width: 100%;
    border: 1px solid rgba(179, 85, 127, 0.22);
    border-radius: 18px;
    padding: 16px 18px;
    font-size: 1rem;
    outline: none;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type='text']:focus {
    border-color: #ff7ab8;
    box-shadow: 0 0 0 5px rgba(255, 122, 184, 0.12);
}

.hero-actions, .share-url {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

button {
    cursor: pointer;
    border: none;
    border-radius: 999px;
    padding: 16px 26px;
    font-size: 1rem;
    font-weight: 700;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button.primary, #calculateHeart {
    color: #fff;
    background: linear-gradient(135deg, #ff6da7, #ff2b8f);
}

button.secondary {
    background: #7c5d7c;
    color: #fff;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(181, 70, 121, 0.22);
}

.result-card {
    max-width: 620px;
}

.result-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
}

.result-score {
    font-size: clamp(3rem, 6vw, 5.4rem);
    color: #d92480;
    font-weight: 900;
    letter-spacing: -0.03em;
}

.share-panel {
    margin-top: 24px;
    background: #fff0f7;
    border: 1px solid #ffd4eb;
    border-radius: 22px;
    padding: 20px;
}

.share-panel p {
    margin-bottom: 16px;
}

.share-url {
    width: 100%;
}

.share-url input {
    flex: 1;
    min-width: 0;
    border: 1px solid rgba(179, 85, 127, 0.2);
    border-radius: 18px;
    padding: 14px 16px;
    background: #fff;
}

.share-help {
    margin-top: 12px;
    color: #7f5f74;
    font-size: 0.95rem;
}

.scratch-card {
    position: relative;
    max-width: 640px;
    padding: 32px;
    overflow: hidden;
}

.scratch-header {
    text-align: center;
    margin-bottom: 28px;
}

.pairs {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #3a2438;
    margin-bottom: 10px;
}

.scratch-area {
    position: relative;
    background: linear-gradient(180deg, #ffecf7 0%, #fff2f8 100%);
    border-radius: 28px;
    height: 280px;
    display: grid;
    place-items: center;
    box-shadow: inset 0 12px 32px rgba(220, 141, 178, 0.2);
}

.scratch-overlay {
    position: absolute;
    inset: 24px;
    border-radius: 22px;
    background: linear-gradient(135deg, #e87ebf 0%, #ef4e9c 100%);
    color: white;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 24px;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: transform 0.4s ease, opacity 0.4s ease;
    z-index: 2;
}

.scratch-overlay.revealed {
    transform: translateY(120%);
    opacity: 0;
}

.scratch-result {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    gap: 16px;
    text-align: center;
    padding: 20px;
}

.score {
    font-size: clamp(3.2rem, 7vw, 5rem);
    color: #c21873;
    font-weight: 900;
}

.celebration {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.confetti-piece, .raindrop {
    position: absolute;
    will-change: transform, opacity;
}

.confetti-piece {
    width: 10px;
    height: 18px;
    border-radius: 4px;
    opacity: 0;
}

.raindrop {
    width: 4px;
    height: 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.85);
    opacity: 0;
}

@keyframes confetti-fall {
    0% { opacity: 1; transform: translateY(0) rotate(0deg); }
    100% { opacity: 0; transform: translateY(260px) rotate(720deg); }
}

@keyframes rain-fall {
    0% { opacity: 1; transform: translateY(-20px); }
    100% { opacity: 0; transform: translateY(260px); }
}

.review-copy {
    width: 100%;
}

@media (max-width: 640px) {
    body {
        padding: 16px;
    }

    .hero-card, .result-card, .scratch-card {
        padding: 26px;
    }

    .scratch-area {
        height: 240px;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
