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

:root {
    --bg-primary: #0d1329;
    --bg-secondary: #1a2140;
    --bg-card: #252b4a;
    --accent-purple: #9c27b0;
    --accent-purple-dark: #7b1fa2;
    --accent-pink: #e91e63;
    --accent-pink-dark: #c2185b;
    --text-primary: #ffffff;
    --text-secondary: #8892b0;
    --text-placeholder: #5a6380;
    --success: #4ade80;
    --error: #f87171;
    --onboarding-accent: var(--accent-purple);
    --onboarding-accent-dark: var(--accent-purple-dark);
    --onboarding-shadow: rgba(156, 39, 176, 0.3);
    --onboarding-shadow-hover: rgba(156, 39, 176, 0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(180deg, var(--bg-primary) 0%, #0a0f1f 100%);
    min-height: 100vh;
    min-height: var(--app-height, 100dvh);
    color: var(--text-primary);
    overflow-x: hidden;
}

.app {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: var(--app-height, 100dvh);
    position: relative;
}

.screen {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    min-height: var(--app-height, 100dvh);
    padding: 40px 24px;
    padding-top: calc(40px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: flex;
}

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

.title {
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 30px;
}

/* Back Button */
.btn-back {
    position: absolute;
    top: calc(40px + env(safe-area-inset-top, 0px));
    left: 24px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    z-index: 10;
}

/* Game Screen */
.game-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding-top: 20px;
}

.card-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.statement-card {
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-pink) 100%);
    border-radius: 24px;
    padding: 40px 30px;
    width: 100%;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-shadow: 0 8px 40px rgba(156, 39, 176, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

@media (hover: hover) {
    .statement-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 50px rgba(156, 39, 176, 0.5);
    }
}

.statement-card:active {
    transform: translateY(0) scale(0.98);
}

.card-header {
    font-size: 18px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.card-text {
    font-size: 26px;
    font-weight: 700;
    color: white;
    line-height: 1.4;
}

.card-hint {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 20px;
}

/* Punishment Section */
.punishment-section {
    padding: 30px 0;
}

.btn-punishment {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--accent-pink-dark) 100%);
    border: none;
    color: white;
    padding: 20px;
    border-radius: 30px;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(233, 30, 99, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

@media (hover: hover) {
    .btn-punishment:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 25px rgba(233, 30, 99, 0.4);
    }
}

.btn-punishment:active {
    transform: translateY(0);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 24px;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
    border-radius: 24px;
    padding: 40px 30px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    animation: slideUp 0.3s ease;
}

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

.modal-icon {
    font-size: 60px;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-pink);
    margin-bottom: 20px;
}

.modal-text {
    font-size: 20px;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 30px;
}

.btn-close-modal {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-purple-dark) 100%);
    border: none;
    color: white;
    padding: 16px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(156, 39, 176, 0.3);
}

@media (hover: hover) {
    .btn-close-modal:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 25px rgba(156, 39, 176, 0.4);
    }
}

/* Card flip animation */
@keyframes cardFlip {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(90deg); }
    100% { transform: rotateY(0deg); }
}

.statement-card.flip {
    animation: cardFlip 0.4s ease;
}

/* Bottom Section */
.bottom-section {
    padding: 20px 0;
    margin-top: auto;
}

/* Play Button */
.btn-play {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--accent-pink-dark) 100%);
    border: none;
    color: white;
    padding: 18px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(255, 59, 111, 0.3);
}

@media (hover: hover) {
    .btn-play:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 25px rgba(255, 59, 111, 0.4);
    }
}

.btn-play:active {
    transform: translateY(0);
}

.btn-play:disabled {
    background: var(--bg-card);
    box-shadow: none;
    cursor: not-allowed;
}

.play-icon {
    font-size: 20px;
}

/* Pack gallery — square, full-bleed illustrated covers */
#packs-screen {
    width: 100%;
    max-width: 520px;
    height: 100vh;
    height: var(--app-height, 100dvh);
    min-height: 0;
    margin: 0 auto;
    overflow: hidden;
}

#packs-screen .title {
    margin-bottom: 6px;
}

#packs-screen .subtitle {
    margin-bottom: 20px;
    color: var(--text-secondary);
    text-align: center;
    font-size: 14px;
}

#packs-screen .packs-container {
    flex: 1 1 auto;
    min-height: 0;
    padding: 4px 2px 24px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

#packs-screen .packs-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

#packs-screen .pack-card {
    aspect-ratio: 1;
    min-width: 0;
    padding: 0;
    gap: 0;
    overflow: hidden;
    isolation: isolate;
    align-items: stretch;
    border-radius: 22px;
    border-color: rgba(255, 255, 255, 0.1);
    background: #151a31;
    box-shadow: 0 12px 28px rgba(2, 5, 18, 0.32);
    touch-action: manipulation;
}

#packs-screen .pack-card::before,
#packs-screen .pack-card::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
}

#packs-screen .pack-card::before {
    z-index: 1;
    background: linear-gradient(180deg, rgba(6, 9, 25, 0.02) 34%, rgba(6, 9, 25, 0.9) 100%);
}

#packs-screen .pack-card::after {
    z-index: 3;
    opacity: 0;
    background: rgba(7, 10, 27, 0.5);
    transition: opacity 0.25s ease;
}

#packs-screen .pack-card.locked::after {
    opacity: 1;
}

#packs-screen .pack-card.selected {
    border-color: #ff5c8a;
    background: #151a31;
    box-shadow: 0 0 0 2px rgba(255, 92, 138, 0.18), 0 14px 34px rgba(233, 30, 99, 0.28);
}

#packs-screen .pack-card.premium,
#packs-screen .pack-card.premium.selected {
    background: #151a31;
}

#packs-screen .pack-card.premium {
    border-color: rgba(255, 255, 255, 0.1);
}

#packs-screen .pack-card.premium.locked {
    border-color: rgba(255, 210, 92, 0.42);
}

#packs-screen .pack-card.premium.selected:not(.locked) {
    border-color: #ff5c8a;
}

#packs-screen .pack-art {
    position: absolute;
    z-index: 0;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.01);
    transition: transform 0.35s ease, filter 0.25s ease;
}

#packs-screen .pack-card.locked .pack-art {
    filter: saturate(0.65) brightness(0.75);
}

@media (hover: hover) {
    #packs-screen .pack-card:not(.locked):hover .pack-art {
        transform: scale(1.06);
    }
}

@media (prefers-reduced-motion: reduce) {
    #packs-screen .pack-card,
    #packs-screen .pack-art {
        transition: none;
    }

    #packs-screen .pack-card:active {
        transform: none;
    }

    #packs-screen .pack-card:not(.locked):active .pack-art {
        transform: scale(1.01);
    }
}

#packs-screen .pack-name,
#packs-screen .pack-count {
    position: absolute;
    z-index: 2;
    left: 12px;
    right: 12px;
    text-align: left;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

#packs-screen .pack-name {
    bottom: 31px;
    color: #fff;
    font-size: 15px;
    font-weight: 750;
    line-height: 1.12;
}

#packs-screen .pack-count {
    bottom: 11px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 11px;
    font-weight: 600;
}

#packs-screen .premium-badge {
    z-index: 5;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 219, 112, 0.58);
    border-radius: 50%;
    background: rgba(9, 12, 30, 0.78);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.32);
    font-size: 15px;
    backdrop-filter: blur(8px);
}

#packs-screen .pack-card.locked .premium-badge {
    display: none;
}

#packs-screen .pack-lock-image {
    position: absolute;
    z-index: 4;
    top: 12%;
    left: 28%;
    width: 44%;
    height: 44%;
    object-fit: contain;
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.42));
}

#packs-screen .pack-card.locked .pack-name,
#packs-screen .pack-card.locked .pack-count {
    z-index: 4;
}

#packs-screen .bottom-section {
    position: relative;
    z-index: 10;
    flex: 0 0 auto;
    margin-top: 0;
    padding: 14px 0 0;
    background: linear-gradient(180deg, rgba(13, 19, 41, 0) 0, rgba(13, 19, 41, 0.96) 18px, #0d1329 100%);
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .app {
        max-width: 100%;
    }

    .screen {
        padding: 20px 12px;
        padding-top: calc(20px + env(safe-area-inset-top, 0px));
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .btn-back {
        top: 20px;
        left: 12px;
        font-size: 20px;
        padding: 6px;
    }

    .statement-card {
        min-height: 200px;
        padding: 24px 20px;
        margin: 10px;
        border-radius: 20px;
    }

    .card-header {
        font-size: 14px;
        margin-bottom: 12px;
        letter-spacing: 1px;
    }

    .card-text {
        font-size: 18px;
        line-height: 1.3;
    }

    .card-hint {
        font-size: 12px;
        margin-top: 12px;
    }

    .punishment-section {
        padding: 16px 0;
    }

    .btn-punishment {
        padding: 16px;
        border-radius: 24px;
        font-size: 16px;
        gap: 8px;
    }

    .modal-content {
        padding: 30px 24px;
        border-radius: 20px;
    }

    .modal-icon {
        font-size: 48px;
        margin-bottom: 16px;
    }

    .modal-title {
        font-size: 24px;
        margin-bottom: 16px;
    }

    .modal-text {
        font-size: 16px;
        line-height: 1.4;
        margin-bottom: 20px;
    }

    .btn-close-modal {
        padding: 14px;
        border-radius: 24px;
        font-size: 16px;
    }

    #packs-screen .packs-grid {
        gap: 10px;
    }

    #packs-screen .pack-card {
        padding: 0;
        border-radius: 18px;
    }

    #packs-screen .pack-name {
        bottom: 29px;
        font-size: 14px;
    }
}

/* Responsive Height */
@media (max-height: 700px) {
    .screen {
        padding: 20px;
    }

    .statement-card {
        min-height: 220px;
        padding: 30px 24px;
    }

    .card-text {
        font-size: 22px;
    }

    .punishment-section {
        padding: 20px 0;
    }
}

@media (max-height: 600px) {
    .statement-card {
        min-height: 180px;
        padding: 24px 20px;
    }

    .card-header {
        font-size: 14px;
        margin-bottom: 12px;
    }

    .card-text {
        font-size: 20px;
    }
}

@media (max-width: 360px) {
    #packs-screen .pack-lock-image {
        top: 8%;
        left: 32%;
        width: 36%;
        height: 36%;
    }
}

/* Tablet and larger */
@media (min-width: 768px) {
    .app {
        max-width: 100%;
    }

    .screen {
        padding: 50px 40px;
    }

    .statement-card {
        min-height: 320px;
        padding: 50px 40px;
    }

    .card-text {
        font-size: 30px;
    }

    .btn-punishment {
        padding: 24px;
        font-size: 22px;
    }

    .modal-content {
        padding: 50px 40px;
    }

    .modal-title {
        font-size: 32px;
    }

    .modal-text {
        font-size: 22px;
    }
}
