:root {
    color-scheme: dark;
    --bg: #18191c;
    --card: rgba(34, 35, 41, 0.78);
    --card-strong: #222329;
    --pink: #ff33cc;
    --pink-2: #ff168c;
    --yellow: #f1c40f;
    --cyan: #38d4ff;
    --green: #36e28a;
    --red: #e74c3c;
    --text: #fff;
    --muted: #b9bbbe;
    --line: rgba(255, 255, 255, 0.1);
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

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

body {
    min-height: 100vh;
    font-family: 'Outfit', system-ui, sans-serif;
    background:
        linear-gradient(135deg, rgba(255, 51, 204, 0.15), transparent 32rem),
        var(--bg);
    color: var(--text);
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-logo {
    width: min(220px, 48vw); max-height: 48px; object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.55));
}

.nav-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: end;
    gap: 10px;
}

.pill-link, .icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 40px; border-radius: 999px; padding: 0 14px;
    border: 1px solid rgba(255,255,255,0.24); background: rgba(0,0,0,0.18);
    color: #fff; font-family: inherit; font-size: inherit; font-weight: 800; white-space: nowrap; text-decoration: none;
    transition: transform 0.2s ease, background 0.2s ease;
}
.pill-link:hover, .icon-btn:hover { transform: translateY(-2px); background: rgba(0,0,0,0.32); }

.nav-logo {
    width: min(220px, 48vw); max-height: 48px; object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.55));
}

/* ===== Topbar ===== */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; min-height: 62px;
    padding: 8px clamp(16px, 4vw, 44px);
    background: linear-gradient(90deg, var(--pink-2), var(--pink));
    box-shadow: 0 8px 30px rgba(255, 51, 204, 0.3);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: end;
    gap: 10px;
}

.pill-link, .icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border-radius: 999px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(0, 0, 0, 0.18);
    color: #fff;
    font-family: inherit;
    font-size: inherit;
    font-weight: 800;
    white-space: nowrap;
    text-decoration: none;
    transition: transform 0.2s ease, background 0.2s ease;
}

.pill-link:hover, .icon-btn:hover {
    transform: translateY(-2px);
    background: rgba(0, 0, 0, 0.32);
}

.nav-logo {
    width: min(220px, 48vw);
    max-height: 48px;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.55));
}

/* Main Container Layout */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.game-title-section {
    text-align: center;
    margin-bottom: 28px;
}

.game-avatar {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: 4px solid var(--pink);
    box-shadow: 0 0 25px rgba(255, 51, 204, 0.45);
    object-fit: cover;
    margin-bottom: 20px;
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    50% { transform: translateY(-8px); }
}

.game-title-section h1 {
    font-size: clamp(2.4rem, 7vw, 6.8rem);
    font-weight: 900;
    text-transform: lowercase;
    line-height: 0.86;
    letter-spacing: 0;
    margin: 0 0 12px;
    text-shadow: 0 10px 36px rgba(0, 0, 0, 0.65);
    color: #fff;
}

.game-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    font-weight: 600;
}

/* Victory Overlay Styling */
.victory-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(15px);
    padding: 24px;
}

.victory-overlay.show {
    display: flex;
}

.victory-content {
    text-align: center;
    padding: 50px 40px;
    border-radius: 32px;
    border: 2px solid rgba(46, 204, 113, 0.35);
    box-shadow: 0 0 50px rgba(46, 204, 113, 0.2);
    max-width: 600px;
    width: 100%;
}

/* Scoreboard HUD */
.hud-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 30px;
}

.hud-group {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line);
    padding: 6px 16px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.hud-label {
    color: var(--muted);
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 1px;
    font-weight: 700;
}

.hud-value {
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
}

.hud-divider {
    color: rgba(255, 255, 255, 0.15);
    font-weight: 300;
    font-size: 1rem;
    user-select: none;
}

#streak {
    color: var(--pink);
    text-shadow: 0 0 10px rgba(255, 51, 204, 0.4);
}

#high-score {
    color: var(--yellow);
}

/* Versus Arena */
.arena {
    display: flex;
    width: 100%;
    max-width: 1100px;
    gap: 32px;
    align-items: stretch;
    justify-content: center;
    position: relative;
    margin-bottom: 32px;
}
.arena.has-lives {
    padding-top: 75px;
}

.card-container {
    flex: 1;
    border-radius: 24px;
    position: relative;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    min-height: 500px;
}

.glass {
    background: rgba(26, 27, 32, 0.95);
    border: none;
    backdrop-filter: blur(20px);
}

.card-button {
    background: transparent;
    border: none;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    text-align: left;
    outline: none;
    padding: 0;
}

.card-header-bar {
    width: 100%;
    padding: 14px 20px;
    background: rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 24px 24px 0 0;
}

.item-tag {
    font-size: 0.75rem;
    font-weight: 900;
    padding: 4px 10px;
    border-radius: 6px;
    letter-spacing: 1px;
}

.item-tag.skin {
    background: rgba(241, 196, 15, 0.2);
    color: var(--yellow);
    border: 1px solid var(--yellow);
}

.item-tag.real {
    background: rgba(56, 212, 255, 0.2);
    color: var(--cyan);
    border: 1px solid var(--cyan);
}

/* Image Showcase */
.image-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    min-height: 280px;
    max-height: 280px;
    margin: 12px;
    border-radius: 16px;
}

.item-img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 12px;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), filter 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    animation: imgFloat 4s ease-in-out infinite;
}

.card-container:hover .item-img {
    animation-play-state: paused !important;
    transform: scale(1.06) !important;
    filter: drop-shadow(0 0 18px rgba(255, 255, 255, 0.7)) drop-shadow(0 0 40px rgba(255, 255, 255, 0.3)) drop-shadow(0 8px 20px rgba(0, 0, 0, 0.4)) !important;
}

@keyframes imgFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.card-container.correct .item-img {
    animation: none;
    transform: scale(1.05);
    filter: drop-shadow(0 0 25px rgba(46, 204, 113, 0.6)) drop-shadow(0 8px 20px rgba(0, 0, 0, 0.5));
}

.card-container.wrong .item-img {
    animation: none;
    transform: scale(0.95);
    filter: drop-shadow(0 0 25px rgba(231, 76, 60, 0.6)) drop-shadow(0 8px 20px rgba(0, 0, 0, 0.5));
}

/* Info Box */
.info-box {
    padding: 24px;
    background: rgba(26, 27, 32, 0.95);
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    border-radius: 0 0 24px 24px;
}

.item-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
}

.item-description {
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.4;
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* Price Box */
.price-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.price-label {
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
}

.price-val {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--yellow);
    line-height: 1;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.price-val.revealed {
    color: var(--green);
    text-shadow: 0 0 20px rgba(46, 204, 113, 0.6), 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* VS Separator */
.vs-divider {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    pointer-events: none;
}

.vs-badge {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--pink-2), var(--pink));
    border: 4px solid var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.6rem;
    box-shadow: 0 8px 24px rgba(255, 51, 204, 0.5);
    color: white;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.vs-badge.success {
    background: var(--green);
    box-shadow: 0 0 30px var(--green), 0 0 60px rgba(46, 204, 113, 0.4);
    transform: scale(1.15) rotate(360deg);
}

.vs-badge.fail {
    background: var(--red);
    box-shadow: 0 0 30px var(--red), 0 0 60px rgba(231, 76, 60, 0.4);
    transform: scale(1.15) rotate(-360deg);
}

/* Card States after Answer */
.card-container.correct {
    border-color: var(--green);
    box-shadow: 0 0 40px rgba(46, 204, 113, 0.35), 0 0 80px rgba(46, 204, 113, 0.15);
    transform: scale(1.02);
}

.card-container.wrong {
    border-color: var(--red);
    box-shadow: 0 0 40px rgba(231, 76, 60, 0.35), 0 0 80px rgba(231, 76, 60, 0.15);
    transform: scale(0.98);
}

.card-container.faded {
    opacity: 0.45;
    filter: grayscale(0.5);
}

/* Action Section */
.controls-area {
    min-height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-next {
    display: none;
    background: linear-gradient(135deg, var(--yellow), var(--pink));
    border: none;
    color: #000;
    font-weight: 900;
    font-size: 1.15rem;
    padding: 14px 44px;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(255, 51, 204, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s ease;
    animation: pulse 1.5s infinite;
}

.btn-next.show {
    display: block;
}

.btn-next:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 28px rgba(255, 51, 204, 0.45);
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.04); }
    100% { transform: scale(1); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .arena {
        flex-direction: column;
        gap: 40px;
    }
    .vs-divider {
        top: 50%;
        transform: translate(-50%, -50%);
    }
    .card-container {
        min-height: 420px;
    }
}

/* Footer */
footer {
    margin-top: 42px;
    padding: 38px 18px 52px;
    background: #111214;
    text-align: center;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 18px;
}

.footer-links a {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    border-radius: 999px;
    background: #1a1b1e;
    border: 1px solid var(--line);
    color: var(--yellow);
    font-weight: 900;
    box-shadow: 0 6px 0 rgba(255, 51, 204, 0.42);
    text-decoration: none;
    transition: transform 0.2s ease, background 0.2s ease;
}

.footer-links a:hover {
    transform: translateY(-2px);
    background: rgba(0, 0, 0, 0.32);
}

footer p {
    margin: 0;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 700;
}

/* ===== Start Screen ===== */
.start-screen {
    position: fixed; inset: 0; z-index: 1000;
    background:
        linear-gradient(135deg, rgba(255, 51, 204, 0.15), transparent 32rem),
        var(--bg);
    display: flex; flex-direction: column; align-items: center;
    overflow-y: auto; gap: 24px;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    padding: 0 24px 40px;
    text-align: center;
}
.start-screen.hide { opacity: 0; visibility: hidden; pointer-events: none; }

.start-screen .topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1001;
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; min-height: 62px;
    padding: 8px clamp(16px, 4vw, 44px);
    background: linear-gradient(90deg, var(--pink-2), var(--pink));
    box-shadow: 0 8px 30px rgba(255, 51, 204, 0.3);
}

.hero-section {
    text-align: center;
    margin-bottom: 50px;
    max-width: 700px;
    padding-top: 80px;
}

.hero-avatar {
    width: 110px; height: 110px; border-radius: 50%;
    border: 4px solid var(--pink); box-shadow: 0 0 25px rgba(255,51,204,0.45);
    object-fit: cover; margin-bottom: 20px; animation: float 4s ease-in-out infinite;
}
@keyframes float { 50% { transform: translateY(-8px); } }

.hero-section h1 {
    font-size: clamp(2.4rem, 7vw, 6.8rem); font-weight: 900;
    line-height: 0.86; letter-spacing: 0; text-transform: lowercase;
    margin: 0 0 12px; text-shadow: 0 10px 36px rgba(0,0,0,0.65);
}
.hero-section p {
    margin: 0; max-width: 700px; color: var(--muted);
    font-size: clamp(1rem, 2.5vw, 1.25rem); font-weight: 600;
}

.mode-cards {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px;
    width: 100%; max-width: 960px; margin-top: 16px; align-items: start;
}

.mode-card {
    border-radius: 24px; border: 1px solid var(--line);
    background: var(--card); overflow: visible;
    backdrop-filter: blur(20px); box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
}
.mode-card:hover { transform: translateY(-6px); box-shadow: 0 30px 60px rgba(255,51,204,0.15); border-color: rgba(255,51,204,0.25); }

.mode-card-toggle {
    display: flex; justify-content: space-between; align-items: center;
    width: 100%; padding: 20px 24px;
    background: rgba(255, 51, 204, 0.08);
    color: #fff; font-size: 1.15rem; font-weight: 900;
    text-align: left; border: none;
    border-bottom: 1px solid var(--line);
    border-radius: 24px; cursor: pointer;
    transition: background 0.2s ease, border-radius 0.2s ease, color 0.2s ease;
}
.mode-card-toggle:hover { background: rgba(255,51,204,0.15); }
.mode-card.open .mode-card-toggle {
    background: linear-gradient(135deg, var(--yellow), var(--pink));
    color: #0d0d10; border-radius: 24px 24px 0 0; border-bottom-color: transparent;
}
.mode-card-chevron { transition: transform 0.25s ease; font-size: 0.7rem; opacity: 0.5; }
.mode-card.open .mode-card-chevron { transform: rotate(180deg); }

.mode-card-panel {
    width: 100%; display: none;
    background: var(--card); border-top: 1px solid var(--line);
    border-radius: 0 0 24px 24px;
}
.mode-card.open .mode-card-panel { display: block; animation: slideDown 0.3s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.mode-panel-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
}

.mode-diff-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    flex-wrap: wrap;
}

.mode-diff-btn {
    font-size: 1.1rem;
    font-weight: 900;
    padding: 14px 32px;
    border-radius: 50px;
    color: #fff;
    background: rgba(255, 51, 204, 0.18);
    border: none;
    position: relative;
    transition: all 0.25s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    outline: none;
}

.mode-diff-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 2px;
    background: rgba(255, 51, 204, 0.5);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    transition: background 0.25s ease;
}

.mode-diff-btn:hover {
    transform: translateY(-2px);
    background: rgba(255, 51, 204, 0.3);
}

.mode-diff-btn:hover::before {
    background: rgba(255, 51, 204, 0.8);
}

.mode-diff-btn.active {
    background: linear-gradient(135deg, var(--yellow), var(--pink));
    color: #0d0d10;
    box-shadow: 0 10px 35px rgba(255, 51, 204, 0.45);
}

.mode-diff-btn.active::before {
    background: transparent;
}

.info-toggle-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--muted);
    font-weight: 700;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: relative;
    z-index: 1;
}

.info-toggle-btn:hover {
    background: rgba(255,51,204,0.12);
    color: #fff;
    border-color: rgba(255,51,204,0.3);
    transform: translateY(-1px);
}

.info-lives-toggle-btn {
    background: rgba(255,255,255,0.06); border: 1px solid var(--line);
    border-radius: 12px; color: var(--muted); font-weight: 700;
    padding: 10px 20px; cursor: pointer; font-size: 0.85rem;
    transition: all 0.2s ease; display: inline-flex; align-items: center; gap: 6px;
    position: relative; z-index: 1;
}
.info-lives-toggle-btn:hover {
    background: rgba(255,51,204,0.12); color: #fff;
    border-color: rgba(255,51,204,0.3); transform: translateY(-1px);
}

.mode-start-btn {
    font-size: 1.3rem;
    font-weight: 900;
    padding: 16px 48px;
    border-radius: 50px;
    color: #0d0d10;
    background: linear-gradient(135deg, var(--yellow), var(--pink));
    box-shadow: 0 10px 35px rgba(255, 51, 204, 0.45);
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    border: none;
}

.mode-start-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 40px rgba(255, 51, 204, 0.65);
}

/* Modal */
.modal { position: fixed; inset: 0; z-index: 1100; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,0.68); backdrop-filter: blur(8px); }
.modal.show { display: flex; }
.letter { width: min(720px,100%); max-height: min(760px,calc(100vh - 40px)); overflow: auto; border-radius: 22px; border: 1px solid rgba(255,255,255,0.16); background: linear-gradient(135deg,rgba(255,51,204,0.12),rgba(241,196,15,0.08)),#18191c; box-shadow: var(--shadow); }
.letter-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; background: linear-gradient(90deg,var(--pink-2),var(--pink)); }
.letter-head strong { font-size: 1.15rem; }
.close-btn { width: 38px; height: 38px; border-radius: 50%; background: rgba(0,0,0,0.26); color: #fff; font-size: 1.3rem; font-weight: 900; border: none; cursor: pointer; }
.letter-body { padding: 22px 22px 6px; color: #f7f2f7; font-size: 1.05rem; line-height: 1.65; }
.letter-body p { margin: 0 0 16px; }

/* Cagado hint */
.price-hint { display: none; text-align: center; color: var(--yellow); font-weight: 700; font-size: 1.1rem; margin-top: 12px; padding: 10px 20px; background: rgba(241,196,15,0.1); border: 1px solid rgba(241,196,15,0.3); border-radius: 12px; }
.price-hint.show { display: block; }

/* Save toast */
.save-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 99999;
    background: linear-gradient(135deg, #1a1b1e, #23242a);
    color: #fff;
    padding: 14px 28px;
    border-radius: 14px;
    border: 1px solid rgba(46, 204, 113, 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
}
.save-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
