* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    max-width: 1200px;
    margin: auto;
    padding: 20px;
}

.columns {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.columns > div {
    flex: 1 1 400px;
}

.card {
    background: white;
    border: 2px solid #d8d8d8;
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 12px;
    min-height: 90px;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0,0,0,.15);
    transition: .2s;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,.2);
}

#selectedQuestion {
    transition: all .2s ease;
    min-height: 60px;
    border: 2px solid #ccc;
    padding: 15px;
    margin: 20px 0;
}

#scoreBoard {
    display: flex;
    gap: 20px;
    align-items: center;
    font-size: 22px;
    font-weight: bold;
    padding: 8px 12px;
    margin: 0;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: white;
}

#scoreBoard strong {
    color: #005bbb;
}

#opponentSelect {
    padding: 10px;
    min-width: 200px;
}

#startGameBtn {
    padding: 10px 20px;
}

#topBar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 12px;
    background: #f8f8f8;
    margin-bottom: 5px;
    flex-wrap: wrap;
}

#login {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
}

#meInfo {
    color: #005bbb;
}

#opponentInfo {
    color: #c0392b;
}

.questionCard {
    border-left: 8px solid #2979ff;
    background: #eef5ff;
}

.answerCard {
    border-left: 8px solid #27ae60;
    background: #f1fff4;
}

h1 {
    margin-top: 10px;
    margin-bottom: 10px;
}

h2 {
    margin-top: 5px;
    margin-bottom: 10px;
}

#status {
    margin: 5px 0;
    font-size: 18px;
}

.card.fly-away {
    animation: flyAway 0.3s ease-in forwards;
    pointer-events: none;
}

@keyframes flyAway {

    0% {
        opacity: 1;
        transform:
            translateY(0)
            scale(1)
            rotate(0deg);
    }

    100% {
        opacity: 0;
        transform:
            translateX(300px)
            translateY(-250px)
            scale(0.6)
            rotate(-12deg);
    }
}

/* ===================================== */
/* SPILLMODUS - ALLE SKJERMSTØRRELSER    */
/* ===================================== */

body.game-mode h1,
body.game-mode #topBar,
body.game-mode #status,
body.game-mode h3 {
    display: none;
}

body.game-mode #gameHeader {

    position: sticky;
    top: 0;
    z-index: 1000;

    display: flex;
    align-items: center;
    gap: 12px;

    background: white;

    padding: 10px;

    border: 2px solid #ddd;
    border-radius: 10px;

    margin-bottom: 12px;
}

body.game-mode #selectedQuestion {

    flex: 1;

    min-height: 110px;

    margin: 0;

    padding: 15px;

    font-size: 14px;

    font-weight: bold;

    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    white-space: pre-line;
}

body.game-mode #turnInfo {

    flex: 0;

    min-width: 36px;

    text-align: center;

    font-size: 24px;
}

body.game-mode #scoreBoard {

    flex: 0;

    display: flex;

    flex-direction: row;

    align-items: center;

    gap: 10px;

    font-size: 16px;

    white-space: nowrap;

    border: none;

    background: transparent;

    padding: 0;

    margin: 0;
}

body.game-mode #scoreBoard strong {
    display: none;
}

body.game-mode #meInfo,
body.game-mode #opponentInfo {
    font-size: 16px;
}

body.game-mode .columns {
    gap: 10px;
}

/* ===================================== */
/* MOBIL                                 */
/* ===================================== */

@media (max-width: 768px) {

    body {
        padding: 10px;
    }

    .columns {
        flex-direction: column;
        gap: 15px;
    }

    .columns > div {
        flex: 1 1 auto;
    }

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

    #topBar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    #login {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    #opponentSelect,
    #startGameBtn {
        width: 100%;
        min-width: 0;
    }

    #scoreBoard {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        font-size: 18px;
    }

    #selectedQuestion {
        padding: 12px;
        margin: 15px 0;
    }

    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    #status {
        font-size: 16px;
    }

    /* Spillmodus på mobil */

    body.game-mode {
        padding: 5px;
    }

    body.game-mode #gameHeader {
        gap: 6px;
        padding: 6px;
    }

    body.game-mode #selectedQuestion {
        min-height: 90px;
        font-size: 14px;
        padding: 10px;
        white-space: pre-line;
    }

    body.game-mode #turnInfo {

        font-size: 18px;

        min-width: 24px;
    }

    body.game-mode #scoreBoard {

        font-size: 13px;
    }

    body.game-mode #meInfo,
    body.game-mode #opponentInfo {

        font-size: 13px;
    }

    body.game-mode .card {

        min-height: 70px;

        padding: 12px;

        margin-bottom: 8px;

        font-size: 16px;
    }

    @keyframes flyAway {

        0% {
            opacity: 1;
            transform:
                translateY(0)
                scale(1)
                rotate(0deg);
        }

        100% {
            opacity: 0;
            transform:
                translateX(120px)
                translateY(-120px)
                scale(0.7)
                rotate(-12deg);
        }
    }
}

#selectedQuestion.placeholder {

    font-style: italic;

    color: #777;
}

#selectedQuestion.active-question {

    border-left: 8px solid #2979ff;

    background: #eef5ff;

    color: #000;
    
    font-weight: bold;

    min-height: 60px;
}

.answer-result {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    min-width: 350px;
    padding: 30px;

    text-align: center;
    font-size: 2.5rem;
    font-weight: bold;

    border-radius: 20px;
    z-index: 9999;

    box-shadow: 0 10px 30px rgba(0,0,0,0.3);

    animation: popIn 0.3s ease;
}

.answer-result.correct {
    background: #28a745;
    color: white;
    border: 5px solid #1c7c31;
}

.answer-result.wrong {
    background: #dc3545;
    color: white;
    border: 5px solid #a71d2a;
}

.hidden {
    display: none;
}

@keyframes popIn {
    from {
        transform: translate(-50%, -50%) scale(0.7);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

#game {
    display: none;
}
