*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --c-bg: #ffffff;
    --c-text: #1a1a1a;
    --c-text2: #6b7280;
    --c-accent: #111111;
    --c-pill: #f5f5f5;
    --c-pill-hover: #eeeeee;
    --c-bar: #e5e7eb;
    --c-bar-fill: #1a1a1a;
    --c-correct: #10b981;
    --c-wrong: #f43f5e;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html, body {
    height: 100%;
    font-family: var(--font);
    background: var(--c-bg);
    color: var(--c-text);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Screens */
.screen {
    display: none;
    min-height: 100vh;
    padding: 48px 24px;
    animation: fadeIn 0.4s ease;
}
.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

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

/* Vote Screen */
.vote-header {
    text-align: center;
    margin-bottom: 48px;
}
.title {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
}
.subtitle {
    margin-top: 8px;
    font-size: 1rem;
    font-weight: 400;
    color: var(--c-text2);
    letter-spacing: -0.01em;
}

/* Characters Layout */
.characters-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 1100px;
    position: relative;
}

.nav-arrow {
    display: none;
    background: none;
    border: none;
    color: var(--c-text2);
    cursor: pointer;
    padding: 12px;
    border-radius: 50%;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
    z-index: 10;
}
.nav-arrow:hover {
    color: var(--c-text);
    background: var(--c-pill);
}

.characters-track {
    flex: 1;
    overflow: hidden;
    position: relative;
}
.characters-track::after {
    display: none;
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 60px; height: 100%;
    background: linear-gradient(to right, transparent, white);
    pointer-events: none;
    z-index: 5;
}
.characters-track::before {
    display: none;
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 60px; height: 100%;
    background: linear-gradient(to left, transparent, white);
    pointer-events: none;
    z-index: 5;
}

.characters-slider {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    transition: none;
}

/* Character Card (no card!) */
.character {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 1;
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.character.fading {
    opacity: 0.15;
    transform: scale(0.95);
    pointer-events: none;
}
.character.rising {
    animation: riseUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes riseUp {
    0%   { transform: translateY(0); opacity: 1; }
    40%  { transform: translateY(-30px); opacity: 1; }
    100% { transform: translateY(-120px); opacity: 0; }
}

.char-image-wrap {
    position: relative;
    width: 100%;
    max-width: 320px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.char-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
    user-select: none;
    -webkit-user-drag: none;
}

/* Select Pill */
.select-pill {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: none;
    border-radius: 40px;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--c-text);
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
    letter-spacing: -0.01em;
    white-space: nowrap;
}
.select-pill:hover {
    background: rgba(255,255,255,0.98);
    box-shadow: 0 4px 24px rgba(0,0,0,0.12);
    transform: translate(-50%, -50%) scale(1.04);
}
.select-pill:active {
    transform: translate(-50%, -50%) scale(0.97);
}

.pill-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--c-accent);
    color: white;
    flex-shrink: 0;
}
.pill-icon svg {
    width: 10px;
    height: 10px;
}

/* Pagination Dots */
.pagination-dots {
    display: none;
    gap: 8px;
    justify-content: center;
    margin-top: 20px;
}
.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--c-bar);
    transition: all 0.3s ease;
}
.dot.active {
    background: var(--c-accent);
    width: 20px;
    border-radius: 3px;
}

/* Waiting Screen */
.wait-content {
    text-align: center;
    max-width: 460px;
}
.wait-check {
    font-size: 2.5rem;
    margin-bottom: 12px;
}
.wait-title {
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}
.wait-text {
    font-size: 0.95rem;
    color: var(--c-text2);
    line-height: 1.6;
    margin-bottom: 40px;
}

.timer-ring-wrap {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto 32px;
}
.timer-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.timer-ring-bg {
    fill: none;
    stroke: var(--c-bar);
    stroke-width: 4;
}
.timer-ring-progress {
    fill: none;
    stroke: var(--c-accent);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 339.292;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}
.timer-text {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.progress-bar-wrap {
    width: 100%;
    height: 4px;
    background: var(--c-bar);
    border-radius: 2px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    width: 100%;
    background: var(--c-accent);
    border-radius: 2px;
    transition: width 1s linear;
}

/* Results Screen */
.results-content {
    max-width: 640px;
    width: 100%;
    text-align: center;
}
.results-title {
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 32px;
}

.personal-result {
    padding: 24px 28px;
    background: var(--c-pill);
    border-radius: 16px;
    margin-bottom: 40px;
    font-size: 1.05rem;
    line-height: 1.6;
    font-weight: 500;
}
.personal-result.correct {
    background: #ecfdf5;
    color: #065f46;
}
.personal-result.wrong {
    background: #fef2f2;
    color: #991b1b;
}

/* Reveal Section */
.reveal-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 48px;
    text-align: left;
}
.reveal-card {
    padding: 20px 24px;
    background: var(--c-pill);
    border-radius: 14px;
    transition: background 0.2s;
}
.reveal-card.correct-reveal {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
}
.reveal-icon {
    font-size: 1.2rem;
    margin-right: 6px;
}
.reveal-label {
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: -0.01em;
}
.reveal-card p {
    margin-top: 8px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--c-text2);
}

/* Stats */
.stats-section {
    text-align: left;
}
.stats-title {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 20px;
}
.stats-bar-group {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}
.stat-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.stat-label {
    font-size: 0.85rem;
    font-weight: 500;
    min-width: 130px;
    white-space: nowrap;
}
.stat-bar-track {
    flex: 1;
    height: 8px;
    background: var(--c-bar);
    border-radius: 4px;
    overflow: hidden;
}
.stat-bar-fill {
    height: 100%;
    background: var(--c-accent);
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.stat-value {
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 44px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.total-votes {
    text-align: center;
    font-size: 0.85rem;
    color: var(--c-text2);
    margin-top: 8px;
}

/* Mobile */
@media (max-width: 768px) {
    .screen {
        padding: 32px 0;
    }
    .vote-header {
        padding: 0 24px;
        margin-bottom: 32px;
    }

    .characters-wrapper {
        gap: 0;
    }

    .nav-arrow {
        display: flex;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 10;
    }
    .nav-arrow-left {
        left: 4px;
    }
    .nav-arrow-right {
        right: 4px;
    }

    .characters-track {
        overflow: visible;
    }
    .characters-track::before,
    .characters-track::after {
        display: block;
    }

    .characters-slider {
        display: flex;
        gap: 16px;
        padding: 0 48px;
        transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
        will-change: transform;
        -webkit-overflow-scrolling: touch;
    }

    .character {
        flex: 0 0 80vw;
        max-width: 320px;
    }

    .pagination-dots {
        display: flex;
    }

    .results-content {
        padding: 0 20px;
    }

    .stat-label {
        min-width: 100px;
        font-size: 0.8rem;
    }

    .reveal-card {
        padding: 16px 18px;
    }
}

/* Swipe hint animation */
@keyframes swipeHint {
    0%   { transform: translateX(0); }
    30%  { transform: translateX(-16px); }
    60%  { transform: translateX(12px); }
    100% { transform: translateX(0); }
}
.characters-slider.hint {
    animation: swipeHint 0.8s ease 1s 1;
}
