/* ================================
   GENERELT / APP
================================ */
*{box-sizing:border-box;}
html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#000;font-family:Arial,sans-serif;color:#fff;}
button{font-family:inherit;cursor:pointer;}
#app{width:100vw;height:100vh;display:flex;flex-direction:column;}

/* ================================
   TOPBAR
================================ */
#topBar{height:50px;flex-shrink:0;position:relative;display:flex;align-items:center;padding:0 20px;background:#111;border-bottom:1px solid #444;}
.game-title{font-size:22px;font-weight:bold;}
#diceValuesDisplay{position:absolute;left:calc(420px + (100% - 420px)/2);top:50%;transform:translate(-50%,-50%);display:flex;align-items:center;justify-content:center;gap:5px;margin:0;padding:0;}
.mini-die{width:26px;height:26px;display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);padding:3px;background:rgba(255,255,255,.9);border-radius:5px;}
.dot{width:5px;height:5px;justify-self:center;align-self:center;background:#111;border-radius:50%;}

/* ================================
   PC-SKÆRME / MENUER
================================ */
.desktop-screen{display:none;}
.desktop-screen.active{display:flex;}
.desktop-setup-screen{position:fixed;inset:0;z-index:1500;align-items:center;justify-content:center;background:#000;}
.desktop-setup-box{width:420px;padding:28px;display:flex;flex-direction:column;align-items:center;gap:12px;text-align:center;background:rgba(20,20,20,.96);border:1px solid rgba(255,255,255,.12);border-radius:12px;box-shadow:0 8px 25px rgba(0,0,0,.45);}
.desktop-setup-box h1{margin:0 0 14px;}
.desktop-setup-box h3{margin:0 0 4px;}
.desktop-setup-box button,.desktop-home button{width:86%;max-width:300px;min-height:48px;padding:10px 14px;border:1px solid rgba(255,255,255,.12);border-radius:9px;background:linear-gradient(180deg,rgba(80,80,80,.95),rgba(35,35,35,.95));color:#fff;font-size:16px;font-weight:600;letter-spacing:.8px;box-shadow:0 3px 7px rgba(0,0,0,.45),inset 0 1px 0 rgba(255,255,255,.1);}
.desktop-setup-box button:hover,.desktop-home button:hover{filter:brightness(1.12);}
.desktop-setup-box button:active,.desktop-home button:active{transform:translateY(1px);}
.desktop-player-count{width:100%;display:flex;justify-content:center;gap:10px;margin:4px 0 10px;}
.desktop-player-count button{width:55px;min-width:55px;height:45px;}
#desktopPlayerInputs,.desktop-network{width:86%;max-width:300px;display:flex;flex-direction:column;gap:10px;}
.desktop-player-input,.desktop-network input,.desktop-network select{width:100%;height:44px;padding:0 12px;border:1px solid rgba(255,255,255,.16);border-radius:8px;background:#222;color:#fff;font-size:16px;}
.desktop-network button{width:100%;}
#createdGameInfo,#desktopNetworkInfo{width:100%;}

/* ================================
   HOVEDMENU
================================ */
#desktopHomeScreen{position:fixed;inset:0;z-index:1500;align-items:center;justify-content:center;background:#000;}
.desktop-home{width:420px;display:flex;flex-direction:column;align-items:center;text-align:center;}
.desktop-home-title{margin:0 0 18px;font-size:28px;font-weight:bold;letter-spacing:1px;}
.desktop-logo{margin:8px 0 18px;display:flex;align-items:center;justify-content:center;}
.desktop-logo img{display:block;width:90%;max-width:320px;height:auto;}
.desktop-home button{margin:6px auto;display:flex;align-items:center;justify-content:center;}
.desktop-home .desktop-net-button{background:linear-gradient(180deg,#3f5060,#202a33);}

/* ================================
   HIGHSCORE
================================ */
.highscore{width:100%;max-width:360px;margin:8px auto 18px;padding:0;text-align:left;background:transparent;border:0;font-size:17px;line-height:1.7;}
.highscore-row{display:grid;grid-template-columns:42px 1fr auto;align-items:center;min-height:42px;padding:5px 12px;margin-bottom:5px;background:linear-gradient(180deg,rgba(255,255,255,.08),rgba(255,255,255,.03));border:1px solid rgba(255,255,255,.09);border-radius:8px;}
.highscore-rank{font-weight:bold;color:#ffd86a;}
.highscore-name{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}
.highscore-score{padding-left:15px;font-weight:bold;text-align:right;color:#ffd86a;}

/* ================================
   SPILLE-SKÆRM
================================ */
#gameScreen{display:none;flex:1;min-height:0;}
.desktop-game{width:100%;height:100%;display:grid;grid-template-columns:420px minmax(500px,1fr);}
.game-area{min-width:0;min-height:0;position:relative;display:flex;flex-direction:column;background:#000;}
.game-status{height:42px;flex-shrink:0;display:flex;align-items:center;justify-content:space-between;padding:0 18px;background:#181818;font-size:18px;font-weight:bold;}

/* ================================
   SCORETAVLE
================================ */

.score-area{
    min-width:0;
    min-height:0;
    overflow:auto;
    padding:6px;
    background:#151515;
    border-right:2px solid #333;
}

.score-area h2{
    margin:0 0 4px;
    text-align:center;
    font-size:17px;
    line-height:22px;
}

.score-list{
    width:100%;
    padding:0;
    text-align:left;
}

.desktop-score-row{
    display:grid;
    min-height:24px;
    margin:1px 0;
    background:linear-gradient(180deg,rgba(255,255,255,.08),rgba(255,255,255,.03));
    border:1px solid rgba(255,255,255,.08);
    border-radius:4px;
    overflow:hidden;
    font-size:13px;
}

.desktop-score-row > div{
    display:flex;
    align-items:center;
    justify-content:center;
    padding:2px 5px;
    line-height:18px;
    border-right:1px solid rgba(255,255,255,.06);
}

.desktop-score-row > div:last-child{
    border-right:0;
}

.desktop-score-row > div:first-child{
    justify-content:flex-start;
    font-weight:normal;
}

.desktop-score-header{
    min-height:26px;
    background:#181818;
    font-weight:bold;
}

.desktop-score-header > div{
    justify-content:center;
}

.desktop-score-header > div:first-child{
    background:transparent;
}
.desktop-score-row>div:not(:first-child){font-weight:bold;}
.desktop-current-player{color:#ffd86a;}
.desktop-score-choice{cursor:pointer;}
.desktop-score-choice:not(.desktop-score-preview){color:#777;}
.desktop-score-preview{background:rgba(70,140,80,.18);color:#b9e8bf;}
.desktop-score-choice:hover{background:rgba(70,140,80,.30);}
.desktop-score-total{background:rgba(150,110,40,.22);border-color:rgba(220,180,80,.25);}
.desktop-score-total>div:not(:first-child){background:rgba(0,0,0,.20);color:#f0d58a;}
.desktop-score-grand-total{background:rgba(180,130,35,.32);border-color:rgba(255,210,90,.40);font-weight:bold;}
.desktop-score-grand-total>div:first-child{font-weight:bold;}
.desktop-score-grand-total>div:not(:first-child){color:#ffd86a;font-size:14px;font-weight:bold;}

/* ================================
   3D-BORD
================================ */
#threeContainer{flex:1;min-height:0;position:relative;overflow:hidden;background:#000;}
#threeContainer canvas{display:block;width:100%!important;height:100%!important;}

/* ================================
   KAST / BANK
================================ */
.action-buttons{height:70px;flex-shrink:0;display:flex;align-items:center;justify-content:center;gap:14px;padding:8px 20px;background:#111;}
.action-buttons button{width:180px;height:50px;border:1px solid #777;border-radius:8px;background:#292929;color:#fff;font-size:18px;font-weight:bold;}
.action-buttons button:hover:not(:disabled){background:#3a3a3a;}
.action-buttons button:disabled{opacity:.4;cursor:default;}
#bankButton{background:linear-gradient(180deg,#5a4a24,#2c2412);}
.bank-ready{animation:bankPulse 1s infinite alternate;}
#bankButton:active{transform:translateY(1px);box-shadow:0 1px 3px rgba(0,0,0,.5);}
#bankButton.bank-used{background:linear-gradient(180deg,#2f6b3b,#17351d);box-shadow:0 0 10px rgba(80,200,100,.5);color:#d8ffe0;}
@keyframes bankPulse{from{box-shadow:0 0 5px #ffd700;}to{box-shadow:0 0 20px #ffd700,0 0 35px orange;}}

/* ================================
   MODSTANDER STATUS
================================ */
#opponentStatus{position:fixed;left:calc(420px + (100% - 420px)/2);top:35%;transform:translate(-50%,-50%);z-index:9999;pointer-events:none;opacity:0;white-space:nowrap;font-size:32px;font-weight:bold;}
#opponentStatus.show{animation:opponentStatusFly 1.8s ease-out forwards;}
@keyframes opponentStatusFly{0%{opacity:0;transform:translate(-50%,80px) scale(.7);}20%{opacity:1;}70%{opacity:1;}100%{opacity:0;transform:translate(-50%,-120px) scale(1.15);}}

/* ================================
   WAITING ROOM
================================ */
.net-player-number{font-weight:bold;color:#ffd86a;text-align:center;}
.net-player-status{font-size:20px;font-weight:bold;text-align:center;}
.net-player-slots{
    display:grid;
    grid-template-columns:1fr;
    gap:10px;
    margin:14px 0;
}

.net-player-slot{
    min-height:62px;
    display:grid;
    grid-template-columns:30px 28px minmax(0,1fr);
    align-items:center;
    gap:8px;
    padding:8px 12px;
    background:rgba(255,255,255,.06);
    border:1px solid rgba(255,255,255,.10);
    border-radius:8px;
}

.net-player-name{
    min-width:0;
    white-space:normal;
    overflow:visible;
    text-overflow:clip;
    line-height:1.2;
}

/* ================================
   CHAT
================================ */
.chat-button{display:none;position:absolute;top:52px;right:12px;width:42px;height:42px;padding:0;border:1px solid #555;border-radius:50%;background:#333;color:#fff;font-size:22px;z-index:60;}
.chat-button:hover{background:#444;}
.chat-box{display:none;position:absolute;top:100px;right:12px;width:300px;padding:12px;border-radius:12px;background:rgba(20,20,20,.96);box-shadow:0 8px 25px rgba(0,0,0,.55);z-index:70;}
.chat-box.show{display:block;}
.chat-header{margin-bottom:8px;text-align:center;font-weight:bold;}
.chat-messages{min-height:70px;max-height:170px;overflow-y:auto;margin-bottom:10px;padding:6px;background:rgba(255,255,255,.04);border-radius:7px;font-size:14px;}
.chat-emojis{display:grid;grid-template-columns:repeat(6,1fr);gap:5px;margin-bottom:10px;}
.chat-emojis button{width:38px;height:36px;padding:0;border:none;border-radius:7px;font-size:20px;}
.chat-input-row{display:flex;gap:6px;}
.chat-input-row input{flex:1;min-width:0;height:38px;padding:0 9px;border:1px solid #555;border-radius:6px;background:#222;color:#fff;}
.chat-input-row button{width:auto;padding:6px 12px;}

/* ================================
   YATZY / BONUS
================================ */
.yatzy-effect{color:#ffd700;font-size:34px;font-weight:900;animation:yatzyPop .4s ease-out,yatzyPulse .6s infinite alternate;}
@keyframes yatzyPop{0%{transform:scale(0);opacity:0;}70%{transform:scale(1.3);opacity:1;}100%{transform:scale(1);}}
@keyframes yatzyPulse{from{text-shadow:0 0 5px #fff,0 0 10px gold;}to{text-shadow:0 0 15px #fff,0 0 30px gold,0 0 50px orange;}}
.bonus-effect{position:fixed;top:35%;left:50%;transform:translate(-50%,-50%);z-index:10000;color:#ffd700;font-size:30px;font-weight:900;white-space:nowrap;text-shadow:0 0 10px gold,0 0 25px orange;animation:bonusPop .5s ease-out;}
@keyframes bonusPop{0%{transform:translate(-50%,-50%) scale(0);}70%{transform:translate(-50%,-50%) scale(1.2);}100%{transform:translate(-50%,-50%) scale(1);}}

/* ================================
   WINNER / CONFETTI
================================ */
.desktop-winner-screen{display:none;position:fixed;inset:0;z-index:2000;align-items:center;justify-content:center;background:rgba(0,0,0,.88);}
.desktop-winner-screen.active{display:flex;}
.desktop-winner-box{width:min(560px,90vw);padding:30px;text-align:center;background:#181818;border:1px solid rgba(255,255,255,.15);border-radius:12px;}
#finalScores{margin:20px 0;}
.winner-buttons{display:flex;justify-content:center;gap:10px;flex-wrap:wrap;}
.winner-buttons button{padding:12px 18px;border:1px solid #777;border-radius:8px;background:#292929;color:#fff;font-weight:bold;}
.confetti-container{position:fixed;top:0;left:0;width:100%;height:100%;z-index:3000;pointer-events:none;overflow:hidden;}
.confetti{position:absolute;top:-20px;width:10px;height:18px;background:gold;animation:fall 4s ease-out forwards;}
@keyframes fall{to{transform:translateY(110vh) rotate(720deg);}}

/* ================================
   BURGER MENU
================================ */
#headerMenuButton{
    display:none;
    position:absolute;
    right:10px;
    top:50%;
    transform:translateY(-50%);
    margin:0;
    padding:0 6px;
    background:none;
    border:none;
    color:white;
    font-size:24px;
    line-height:1;
    z-index:100;
}

.main-menu{
    display:none;
    position:absolute;
    top:52px;
    right:8px;
    width:170px;
    padding:6px;
    background:#181818;
    border:1px solid #444;
    border-radius:8px;
    box-shadow:0 6px 18px rgba(0,0,0,.55);
    z-index:200;
}

.main-menu.show{display:block;}

.main-menu button{
    display:block;
    width:100%;
    margin:2px 0;
    padding:9px 10px;
    border:none;
    border-radius:5px;
    background:#292929;
    color:white;
    text-align:left;
    font-size:14px;
}

.main-menu button:hover{background:#3a3a3a;}

/* ================================
   EXTRA YATZY POPUP
================================ */

#yatzyPopup{
    position:fixed;
    left:8px;
    top:58px;
    bottom:8px;

    width:404px;

    z-index:5000;

    overflow-y:auto;

    background:transparent;

    pointer-events:none;
}

#yatzyPopup .yatzyPopup{
    width:100%;

    padding:14px;

    text-align:center;

    background:rgba(24,24,24,.98);

    border:1px solid #555;
    border-radius:10px;

    box-shadow:0 8px 30px rgba(0,0,0,.75);

    pointer-events:auto;
}

#yatzyPopup h2{
    margin:0 0 8px;
    color:#ffd700;
}

#yatzyPopup p{
    margin:6px 0 12px;
}

#yatzyPopup button{
    width:100%;
    min-height:40px;

    margin:4px 0;
    padding:8px 10px;

    border:1px solid #555;
    border-radius:7px;

    background:#292929;
    color:white;

    font-size:14px;
    cursor:pointer;
}

#yatzyPopup button:hover{
    background:#3a3a3a;
}

/* ================================
   GLOBAL BURGER + SPROG
================================ */
#headerMenuButton.global-menu-button{
    display:flex !important;
    position:fixed;
    right:10px;
    top:10px;
    transform:none;
    z-index:6000;
}
#desktopMainMenu.global-main-menu{
    position:fixed;
    right:8px;
    top:52px;
    left:auto;
    z-index:6001;
}
.menu-divider{height:1px;margin:5px 4px;background:rgba(255,255,255,.15);}
.language-choices{display:none;padding-top:2px;}
.language-choices.show{display:block;}
.language-choices button{padding-left:18px;}


/* ================================
   GAME OVER - RESULTAT
================================ */
.desktop-result-button{
    display:none;
    position:absolute;
    right:58px;
    top:50%;
    transform:translateY(-50%);
    min-height:32px;
    padding:5px 10px;
    border:1px solid rgba(255,255,255,.18);
    border-radius:7px;
    background:#292929;
    color:#ffd86a;
    font-size:13px;
    font-weight:bold;
    cursor:pointer;
    z-index:90;
}
.desktop-result-button.show{display:block;}
.desktop-result-button:hover{background:#3a3a3a;}


/* ================================
   PRIVAT / OFFENTLIGT NET-PLAY
================================ */
.network-game-type,
.network-join-block{
    width:100%;
    max-width:320px;
    margin:10px auto;
    padding:10px;
    background:rgba(255,255,255,.04);
    border:1px solid rgba(255,255,255,.10);
    border-radius:9px;
}
.network-public-check{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    cursor:pointer;
}
.network-public-check input{
    width:18px;
    height:18px;
}
.network-game-type-info{
    margin-top:5px;
    font-size:13px;
    line-height:1.3;
    opacity:.72;
    text-align:center;
}
.network-join-block h3{
    margin:0 0 4px;
    font-size:15px;
}
.network-or{
    margin:5px 0;
    text-align:center;
    opacity:.45;
}


.lobby-expiry{
    margin-top:10px;
    font-size:13px;
    font-variant-numeric:tabular-nums;
    opacity:.72;
}
