@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@700;900&display=swap');

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

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #f2f0eb;
    background-image: radial-gradient(circle, #ddd8d0 1px, transparent 1px);
    background-size: 24px 24px;
    color: #1a1a1a;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Принудительный горизонтальный режим */
@media (orientation: portrait) {
    body {
        transform: rotate(90deg);
        transform-origin: top left;
        width: 100vh;
        height: 100vw;
        position: absolute;
        top: 0;
        left: 100vw;
    }
}

.screen {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── Setup Screen ─── */

.setup-container {
    text-align: center;
    padding: 20px;
    max-width: 460px;
    width: 100%;
}

.logo-img {
    height: 32px;
    margin-bottom: 6px;
}

.setup-container h1 {
    font-size: 24px;
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.subtitle {
    color: #777;
    font-size: 13px;
    margin-bottom: 18px;
    font-weight: 700;
}

.setting {
    margin-bottom: 12px;
    text-align: left;
}

.setting label {
    display: block;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    color: #999;
    margin-bottom: 4px;
}

.setting input {
    width: 100%;
    padding: 10px 14px;
    border: 3px solid #1a1a1a;
    border-radius: 12px;
    background: #fff;
    color: #1a1a1a;
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 700;
    outline: none;
    transition: border-color 0.2s;
}

.setting input:focus {
    border-color: #ff6b35;
}

.setting input::placeholder {
    color: #ccc;
}

.rounds-selector {
    display: flex;
    gap: 8px;
}

.round-btn {
    flex: 1;
    padding: 10px;
    border: 3px solid #1a1a1a;
    border-radius: 12px;
    background: #fff;
    color: #1a1a1a;
    font-family: 'Nunito', sans-serif;
    font-size: 18px;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.15s;
}

.round-btn.active {
    background: #ffcc02;
    border-color: #1a1a1a;
    transform: rotate(-1deg) scale(1.05);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    border: 3px solid #1a1a1a;
    border-radius: 14px;
    background: #2ecc71;
    color: #1a1a1a;
    font-family: 'Nunito', sans-serif;
    font-size: 20px;
    font-weight: 900;
    text-transform: uppercase;
    cursor: pointer;
    margin-top: 12px;
    transition: transform 0.1s;
    box-shadow: 4px 4px 0 #1a1a1a;
}

.btn-primary:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 #1a1a1a;
}

/* ─── Game Screen ─── */

#screen-game {
    flex-direction: column;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    width: 100%;
}

.player-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 90px;
}

.player-score .player-name {
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    color: #999;
    margin-bottom: 0;
}

.player-score .score {
    font-size: 40px;
    font-weight: 900;
    line-height: 1;
}

.player-score.p1 .score {
    color: #1a1a1a;
    background: #4ecdc4;
    padding: 2px 14px;
    border-radius: 10px;
    border: 3px solid #1a1a1a;
}

.player-score.p2 .score {
    color: #1a1a1a;
    background: #ff6b6b;
    padding: 2px 14px;
    border-radius: 10px;
    border: 3px solid #1a1a1a;
}

.round-info {
    font-size: 14px;
    font-weight: 900;
    color: #bbb;
}

.cards-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex: 1;
}

.card {
    width: 140px;
    height: 160px;
    background: #fff;
    border: 5px solid #1a1a1a;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80px;
    font-weight: 900;
    color: #1a1a1a;
    box-shadow: 6px 6px 0 #1a1a1a;
    animation: cardAppear 0.3s ease-out;
}

.card:first-of-type {
    background: #a8e6cf;
    transform: rotate(-3deg);
}

.card:last-of-type {
    background: #ffd3b6;
    transform: rotate(3deg);
}

@keyframes cardAppear {
    from {
        transform: scale(0.5) rotate(0deg);
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.card-separator {
    font-size: 36px;
    font-weight: 900;
    color: #ccc;
}

.controls {
    display: flex;
    gap: 10px;
    padding: 6px 20px;
}

.btn-control {
    padding: 6px 18px;
    border: 3px solid #1a1a1a;
    border-radius: 10px;
    background: #fff;
    color: #1a1a1a;
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 3px 3px 0 #1a1a1a;
}

.btn-control:disabled {
    opacity: 0.25;
    cursor: default;
    box-shadow: none;
}

.btn-control:not(:disabled):active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 #1a1a1a;
}

.player-buttons {
    display: flex;
    width: 100%;
    height: 20%;
    min-height: 56px;
    gap: 6px;
    padding: 0 6px 6px;
}

.btn-player {
    flex: 1;
    border: 4px solid #1a1a1a;
    border-radius: 16px;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    font-weight: 900;
    text-transform: uppercase;
    color: #1a1a1a;
    transition: all 0.1s;
    box-shadow: 4px 4px 0 #1a1a1a;
}

.btn-player:active {
    transform: translate(3px, 3px);
    box-shadow: 2px 2px 0 #1a1a1a;
}

.btn-player.p1 {
    background: #4ecdc4;
}

.btn-player.p2 {
    background: #ff6b6b;
}

.btn-player.flash {
    animation: flash 0.3s;
}

@keyframes flash {
    0% { filter: brightness(1.5); transform: scale(1.03); }
    100% { filter: brightness(1); transform: scale(1); }
}

/* ─── Result Screen ─── */

.result-container {
    text-align: center;
    padding: 20px;
}

.result-container h1 {
    font-size: 28px;
    font-weight: 900;
    text-transform: uppercase;
    margin: 8px 0 16px;
}

.result-scores {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
}

.result-player {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-name {
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    color: #999;
    margin-bottom: 4px;
}

.result-score {
    font-size: 52px;
    font-weight: 900;
    padding: 0 18px;
    border-radius: 14px;
    border: 4px solid #1a1a1a;
    box-shadow: 4px 4px 0 #1a1a1a;
}

.result-player:first-child .result-score {
    background: #4ecdc4;
    color: #1a1a1a;
}

.result-player:last-child .result-score {
    background: #ff6b6b;
    color: #1a1a1a;
}

.result-vs {
    font-size: 36px;
    font-weight: 900;
    color: #ccc;
}

.promo {
    display: inline-block;
    background: #ffcc02;
    color: #1a1a1a;
    font-size: 14px;
    font-weight: 900;
    padding: 6px 16px;
    border-radius: 8px;
    border: 3px solid #1a1a1a;
    margin-bottom: 12px;
    transform: rotate(-1deg);
}

.store-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 12px;
}

.btn-store {
    display: inline-block;
    padding: 8px 20px;
    border: 3px solid #1a1a1a;
    border-radius: 12px;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 900;
    text-decoration: none;
    text-transform: uppercase;
    color: #fff;
    box-shadow: 3px 3px 0 #1a1a1a;
    transition: all 0.1s;
}

.btn-store:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 #1a1a1a;
}

.btn-store.wb {
    background: #a73afd;
}

.btn-store.ozon {
    background: #005bff;
}

/* Winner highlight */
.winner .result-score {
    animation: winPulse 0.6s ease-in-out infinite alternate;
}

@keyframes winPulse {
    from { transform: scale(1) rotate(-2deg); }
    to { transform: scale(1.08) rotate(2deg); }
}
