:root {
    --primary-color: #FF9F43;
    /* Orange */
    --secondary-color: #54A0FF;
    /* Blue */
    --accent-color: #FF6B6B;
    /* Red */
    --success-color: #1DD1A1;
    /* Green */
    --bg-color: #87CEEB;
    /* Sky Blue */
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --font-main: 'Fredoka', sans-serif;
    --shadow: 0 6px 0 rgba(0, 0, 0, 0.1);
    --border-radius: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    background-image:
        radial-gradient(white 15%, transparent 16%),
        radial-gradient(white 15%, transparent 16%);
    background-size: 60px 60px;
    background-position: 0 0, 30px 30px;
    color: var(--text-color);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.app-container {
    width: 95%;
    max-width: 600px;
    height: 95%;
    max-height: 850px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 30px;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border: 5px solid #fff;
    overflow: hidden;
}

/* Header */
header {
    padding: 15px;
    text-align: center;
    background: #fff;
    border-bottom: 2px dashed #eee;
    position: relative;
}

.lang-selector {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 5px;
}

.lang-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    padding: 0;
}

.lang-btn.active,
.lang-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

h1 {
    font-size: 2rem;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 2px 2px 0 #eee;
    margin-top: 10px;
}

.btn-icon {
    position: absolute;
    top: 15px;
    left: 15px;
    background: white;
    border: 2px solid #eee;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 0 #ddd;
}

/* Screens */
.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    overflow-y: auto;
}

.screen.hidden {
    display: none;
}

.screen.active {
    display: flex;
}

/* Buttons */
button {
    font-family: var(--font-main);
    border: none;
    cursor: pointer;
    transition: transform 0.1s;
    font-weight: 700;
    outline: none;
}

button:active {
    transform: scale(0.95) translateY(4px) !important;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1) !important;
}

.btn-primary,
.btn-secondary {
    width: 90%;
    padding: 20px;
    margin: 15px 0;
    font-size: 1.5rem;
    border-radius: 50px;
    color: white;
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.btn-primary {
    background: var(--primary-color);
}

.btn-secondary {
    background: var(--secondary-color);
}

.btn-small {
    background: #eee;
    color: #666;
    padding: 8px 16px;
    border-radius: 15px;
    margin-top: 10px;
    box-shadow: 0 4px 0 #ccc;
}

/* Variation Selector */
.variation-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: #f0f9ff;
    padding: 5px;
    border-radius: 50px;
}

.variation-selector input {
    display: none;
}

.var-btn {
    padding: 15px 30px;
    border-radius: 30px;
    cursor: pointer;
    display: block;
    color: #666;
    font-weight: 700;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.variation-selector input:checked+.var-btn {
    background: var(--secondary-color);
    color: white;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.1);
}

/* Game Screen */
.score-board {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px 20px;
    background: #f0f9ff;
    border-radius: 15px;
    margin-bottom: 10px;
}

.score {
    font-size: 2rem;
    color: var(--primary-color);
}

.vs-badge {
    font-weight: bold;
    color: #ccc;
}

.status-bar {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: #555;
    min-height: 1.5em;
    margin: 5px 0;
    transition: all 0.3s;
}

.battle-arena {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 20px;
}

.hand {
    font-size: 5rem;
}

#p1-hand {
    transform: rotate(90deg);
}

#p2-hand {
    transform: rotate(-90deg);
}

.shaking #p1-hand {
    animation: shakeP1 0.5s infinite;
}

.shaking #p2-hand {
    animation: shakeP2 0.5s infinite;
}

@keyframes shakeP1 {
    0% {
        transform: rotate(90deg) translateY(0);
    }

    50% {
        transform: rotate(90deg) translateY(-20px);
    }

    100% {
        transform: rotate(90deg) translateY(0);
    }
}

@keyframes shakeP2 {
    0% {
        transform: rotate(-90deg) translateY(0);
    }

    50% {
        transform: rotate(-90deg) translateY(-20px);
    }

    100% {
        transform: rotate(-90deg) translateY(0);
    }
}

.options {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.option-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: white;
    border: 2px solid #eee;
    font-size: 2rem;
    box-shadow: 0 4px 0 #ddd;
    transition: all 0.2s;
}

.option-btn.hidden {
    display: none;
}

/* Settings */
.settings-group {
    text-align: center;
    margin: 10px 0;
}

.toggle-group {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.toggle-btn {
    padding: 5px 15px;
    background: #eee;
    border-radius: 10px;
    color: #666;
}

.toggle-btn.active {
    background: var(--primary-color);
    color: white;
}

/* Overlay */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.overlay.hidden {
    display: none;
}

.result-card {
    background: white;
    padding: 30px;
    border-radius: 30px;
    text-align: center;
    box-shadow: 0 10px 0 rgba(0, 0, 0, 0.1);
    animation: bounceIn 0.5s;
}

.rules-card {
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.rules-content {
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 20px 0;
    color: #555;
    white-space: pre-line;
    text-align: left;
}

.rules-content hr {
    margin: 15px 0;
    border: 0;
    border-top: 2px dashed #eee;
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

/* Confetti */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: red;
    animation: fall 3s linear forwards;
    z-index: 99;
}

@keyframes fall {
    to {
        transform: translateY(100vh) rotate(360deg);
    }
}