/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #e8f4fd 0%, #b8d4e3 50%, #8ecae6 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    position: relative;
}

/* ===== CONTAINER ===== */
.container {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 28px;
    padding: 30px 25px;
    max-width: 580px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(70, 130, 180, 0.25);
    animation: fadeIn 0.6s ease;
    position: relative;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(25px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== MUSIC BUTTON ===== */
.music-btn {
    position: fixed;
    top: 18px;
    right: 18px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(70, 130, 180, 0.2);
    transition: all 0.3s ease;
    z-index: 999;
    backdrop-filter: blur(10px);
}

.music-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(70, 130, 180, 0.3);
}

.music-btn:active {
    transform: scale(0.95);
}

/* ===== SECTIONS ===== */
.section {
    display: block;
    animation: fadeIn 0.5s ease;
}

.section.hidden {
    display: none !important;
}

/* ===== LOGO & TITLE ===== */
.logo {
    text-align: center;
    font-size: 3.5rem;
    margin-bottom: 5px;
}

h1 {
    text-align: center;
    color: #1a4b6d;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

h2 {
    text-align: center;
    color: #1a4b6d;
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.subtitle {
    text-align: center;
    color: #4a7a9a;
    margin-bottom: 25px;
    font-size: 0.95rem;
    font-weight: 400;
}

/* ===== RULES BOX ===== */
.rules-box {
    background: rgba(190, 220, 240, 0.25);
    border-radius: 16px;
    padding: 22px 24px;
    margin-bottom: 25px;
    border-left: 4px solid #4a8aaf;
}

.rules-box h3 {
    color: #1a4b6d;
    margin-bottom: 12px;
    font-size: 1.05rem;
}

.rules-box ul {
    list-style: none;
    padding: 0;
}

.rules-box ul li {
    padding: 7px 0;
    color: #2a5a7a;
    border-bottom: 1px solid rgba(74, 138, 175, 0.15);
    font-size: 0.95rem;
    line-height: 1.5;
}

.rules-box ul li:last-child {
    border-bottom: none;
}

.rules-box ul li::before {
    content: "✦ ";
    color: #4a8aaf;
}

.rules-box ul li strong {
    color: #1a4b6d;
}

/* ===== BUTTONS ===== */
.btn-primary {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #4a8aaf, #2a6a8f);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(42, 106, 143, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(42, 106, 143, 0.4);
}

.btn-primary:active {
    transform: translateY(0px);
    box-shadow: 0 2px 10px rgba(42, 106, 143, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-secondary {
    padding: 12px 20px;
    background: rgba(74, 138, 175, 0.15);
    color: #1a4b6d;
    border: 2px solid rgba(74, 138, 175, 0.3);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-secondary:hover {
    background: rgba(74, 138, 175, 0.25);
    border-color: rgba(74, 138, 175, 0.5);
}

.btn-secondary:active {
    transform: scale(0.97);
}

.btn-reset {
    padding: 12px 20px;
    background: rgba(200, 80, 80, 0.1);
    color: #8a4a4a;
    border: 2px solid rgba(200, 80, 80, 0.2);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 10px;
}

.btn-reset:hover {
    background: rgba(200, 80, 80, 0.2);
    border-color: rgba(200, 80, 80, 0.4);
}

.btn-reset:active {
    transform: scale(0.97);
}

.btn-back {
    width: 100%;
    padding: 12px;
    background: transparent;
    color: #4a7a9a;
    border: none;
    font-size: 0.95rem;
    cursor: pointer;
    margin-top: 12px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-back:hover {
    color: #1a4b6d;
    text-decoration: underline;
}

/* ===== INPUT GROUP ===== */
.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.input-group input {
    flex: 1;
    min-width: 150px;
    padding: 12px 16px;
    border: 2px solid rgba(74, 138, 175, 0.25);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.7);
    outline: none;
    color: #1a4b6d;
}

.input-group input:focus {
    border-color: #4a8aaf;
    box-shadow: 0 0 0 4px rgba(74, 138, 175, 0.15);
    background: white;
}

.input-group input::placeholder {
    color: #8aaec9;
}

/* ===== PLAYER LIST ===== */
.player-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 0;
    min-height: 50px;
    margin-bottom: 8px;
}

.player-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(74, 138, 175, 0.12);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.95rem;
    color: #1a4b6d;
    font-weight: 500;
    animation: fadeIn 0.3s ease;
    border: 1px solid rgba(74, 138, 175, 0.15);
}

.player-tag .remove-btn {
    background: none;
    border: none;
    color: #8a4a4a;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 2px;
    transition: all 0.2s;
    line-height: 1;
}

.player-tag .remove-btn:hover {
    transform: scale(1.3);
    color: #cc4444;
}

.player-count {
    text-align: center;
    color: #4a7a9a;
    font-size: 0.9rem;
    margin-bottom: 15px;
    font-weight: 500;
}

/* ===== GAME HEADER ===== */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 4px 18px 4px;
    flex-wrap: wrap;
    gap: 8px;
}

.player-turn {
    font-size: 1.05rem;
    color: #1a4b6d;
    font-weight: 600;
}

.player-turn span {
    color: #2a6a8f;
}

.card-count {
    font-size: 0.95rem;
    color: #4a7a9a;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.5);
    padding: 4px 14px;
    border-radius: 20px;
}

/* ===== CARD ===== */
.card-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10px 0 20px 0;
    min-height: 300px;
}

.card {
    width: 100%;
    min-height: 280px;
    background: linear-gradient(145deg, #ffffff, #f0f8fe);
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(42, 106, 143, 0.15);
    padding: 30px 28px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(255, 255, 255, 0.5);
    position: relative;
}

/* Animasi buang kartu */
.card.throw-left {
    animation: throwLeft 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.card.throw-right {
    animation: throwRight 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes throwLeft {
    0% {
        transform: translateX(0) rotate(0deg) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateX(-120px) rotate(-15deg) scale(0.8);
        opacity: 0;
    }
}

@keyframes throwRight {
    0% {
        transform: translateX(0) rotate(0deg) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateX(120px) rotate(15deg) scale(0.8);
        opacity: 0;
    }
}

/* Animasi kartu baru masuk */
.card.enter-left {
    animation: enterLeft 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.card.enter-right {
    animation: enterRight 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes enterLeft {
    0% {
        transform: translateX(-80px) scale(0.9);
        opacity: 0;
    }

    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes enterRight {
    0% {
        transform: translateX(80px) scale(0.9);
        opacity: 0;
    }

    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

.card-number {
    position: absolute;
    top: 14px;
    left: 20px;
    font-size: 0.75rem;
    color: #8aaec9;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.card-content {
    text-align: center;
    padding: 10px 0;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#questionText {
    font-size: 1.25rem;
    line-height: 1.7;
    color: #1a3b4d;
    font-weight: 500;
    margin: 0;
    word-wrap: break-word;
}

/* ===== GAME ACTIONS ===== */
.game-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

/* ===== END SECTION ===== */
.end-content {
    text-align: center;
    padding: 20px 10px;
}

.end-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.end-content h2 {
    margin-bottom: 10px;
}

.end-content p {
    color: #4a7a9a;
    font-size: 1.05rem;
    margin-bottom: 8px;
}

.end-sub {
    color: #6a9aba !important;
    font-size: 0.95rem !important;
    margin-bottom: 25px !important;
}

/* ===== FOOTER ===== */
.footer {
    margin-top: 30px;
    padding-top: 18px;
    border-top: 1px solid rgba(74, 138, 175, 0.15);
    text-align: center;
}

.footer p {
    color: #6a9aba;
    font-size: 0.8rem;
    line-height: 1.6;
}

.footer a {
    color: #4a8aaf;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.footer a:hover {
    color: #1a4b6d;
    text-decoration: underline;
}

.footer-version {
    font-size: 0.7rem !important;
    color: #8aaec9 !important;
    margin-top: 2px;
}

/* ===== RESPONSIVE ===== */

/* Tablet & HP Landscape */
@media (max-width: 768px) {
    .container {
        padding: 25px 20px;
        border-radius: 24px;
    }

    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.4rem;
    }

    .card {
        min-height: 240px;
        padding: 25px 20px;
    }

    #questionText {
        font-size: 1.1rem;
    }

    .music-btn {
        width: 42px;
        height: 42px;
        font-size: 18px;
        top: 14px;
        right: 14px;
    }
}

/* HP Portrait */
@media (max-width: 480px) {
    body {
        padding: 10px;
        align-items: flex-start;
        padding-top: 20px;
    }

    .container {
        padding: 20px 16px;
        border-radius: 20px;
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.2rem;
    }

    .subtitle {
        font-size: 0.85rem;
        margin-bottom: 18px;
    }

    .logo {
        font-size: 2.8rem;
    }

    .rules-box {
        padding: 16px 18px;
        margin-bottom: 18px;
    }

    .rules-box ul li {
        font-size: 0.85rem;
        padding: 6px 0;
    }

    .btn-primary {
        padding: 12px 16px;
        font-size: 0.95rem;
        border-radius: 12px;
    }

    .btn-secondary {
        padding: 10px 14px;
        font-size: 0.9rem;
    }

    .input-group input {
        padding: 10px 14px;
        font-size: 0.9rem;
        min-width: 120px;
    }

    .player-tag {
        font-size: 0.85rem;
        padding: 6px 12px;
    }

    .card {
        min-height: 200px;
        padding: 20px 16px;
        border-radius: 16px;
    }

    #questionText {
        font-size: 1rem;
        line-height: 1.6;
    }

    .game-header {
        padding: 8px 0 14px 0;
    }

    .player-turn {
        font-size: 0.9rem;
    }

    .card-count {
        font-size: 0.8rem;
        padding: 3px 12px;
    }

    .card-number {
        font-size: 0.65rem;
        top: 10px;
        left: 14px;
    }

    .music-btn {
        width: 38px;
        height: 38px;
        font-size: 16px;
        top: 10px;
        right: 10px;
    }

    .game-actions {
        gap: 8px;
    }

    .btn-reset {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .footer p {
        font-size: 0.7rem;
    }

    .end-icon {
        font-size: 3rem;
    }

    .end-content h2 {
        font-size: 1.3rem;
    }

    .end-content p {
        font-size: 0.95rem;
    }

    @keyframes throwLeft {
        0% {
            transform: translateX(0) rotate(0deg) scale(1);
            opacity: 1;
        }

        100% {
            transform: translateX(-80px) rotate(-12deg) scale(0.8);
            opacity: 0;
        }
    }

    @keyframes throwRight {
        0% {
            transform: translateX(0) rotate(0deg) scale(1);
            opacity: 1;
        }

        100% {
            transform: translateX(80px) rotate(12deg) scale(0.8);
            opacity: 0;
        }
    }

    @keyframes enterLeft {
        0% {
            transform: translateX(-50px) scale(0.9);
            opacity: 0;
        }

        100% {
            transform: translateX(0) scale(1);
            opacity: 1;
        }
    }

    @keyframes enterRight {
        0% {
            transform: translateX(50px) scale(0.9);
            opacity: 0;
        }

        100% {
            transform: translateX(0) scale(1);
            opacity: 1;
        }
    }
}

/* HP sangat kecil */
@media (max-width: 360px) {
    .container {
        padding: 16px 12px;
    }

    h1 {
        font-size: 1.3rem;
    }

    .card {
        min-height: 170px;
        padding: 16px 12px;
    }

    #questionText {
        font-size: 0.9rem;
    }

    .btn-primary {
        font-size: 0.85rem;
        padding: 10px 14px;
    }

    .input-group {
        flex-direction: column;
        gap: 8px;
    }

    .input-group input {
        min-width: unset;
        width: 100%;
    }

    .btn-secondary {
        width: 100%;
    }
}

/* Landscape mode di HP */
@media (max-height: 600px) and (orientation: landscape) {
    body {
        padding: 10px;
        align-items: center;
    }

    .container {
        padding: 18px 20px;
        max-height: 95vh;
        overflow-y: auto;
    }

    .card {
        min-height: 150px;
        padding: 15px 20px;
    }

    #questionText {
        font-size: 0.95rem;
    }

    .game-header {
        padding: 5px 0 10px 0;
    }

    .rules-box {
        padding: 12px 16px;
        margin-bottom: 12px;
    }

    .rules-box ul li {
        padding: 4px 0;
        font-size: 0.8rem;
    }

    .player-list {
        min-height: 30px;
        padding: 6px 0;
    }

    .card-container {
        min-height: 180px;
        margin: 5px 0 10px 0;
    }

    .footer {
        margin-top: 15px;
        padding-top: 12px;
    }
}