* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #0f172a;
    color: #f8fafc;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ---------- TOPPHEADER ---------- */
#top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    background-color: #1e293b;
    border-bottom: 1px solid #334155;
    position: relative;
    height: 50px;
}

.logo {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 1px;
}

.logo span {
    color: #3b82f6;
}

.info {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
}

#current-player {
    color: #38bdf8;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 6px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
    transition: transform 0.3s ease;
}

#rolls-left {
    color: #f1f5f9;
    font-size: 0.95rem;
    font-weight: 600;
    background: #334155;
    padding: 4px 10px;
    border-radius: 6px;
}

@keyframes turnPop {
    0% { transform: scale(1); }
    50% {
        transform: scale(1.2);
        background-color: #38bdf8;
        color: #0f172a;
        box-shadow: 0 0 15px rgba(56, 189, 248, 0.9);
    }
    100% { transform: scale(1); }
}

.turn-animate {
    animation: turnPop 0.6s ease-in-out;
}

/* ---------- HOVEDLAYOUT ---------- */
#main-wrapper {
    display: flex;
    flex: 1;
    height: calc(100vh - 50px);
    overflow: hidden;
}

#left-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

#dice-container {
    flex: 1;
    width: 100%;
    height: 100%;
}

#button-bar {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

#roll-btn {
    background-color: #2563eb;
    color: white;
    border: none;
    padding: 12px 28px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
    transition: all 0.2s ease;
}

#roll-btn:hover {
    background-color: #1d4ed8;
    transform: translateY(-2px);
}

#roll-btn:disabled {
    background-color: #475569;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* ---------- SCOREBOARD ---------- */
#right-container {
    width: 320px;
    background-color: #1e293b;
    border-left: 1px solid #334155;
    display: flex;
    flex-direction: column;
    padding: 8px;
    height: 100%;
    overflow: hidden;
}

#right-container h2 {
    margin-bottom: 4px;
    font-size: 1rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.table-scroll {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    height: auto !important;
}

th, td {
    padding: 1px 2px;
    text-align: center;
    border-bottom: 1px solid #334155;
    vertical-align: middle;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 32px;
}

th {
    background-color: #0f172a;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    height: 24px;
}

td:first-child, th:first-child {
    width: 110px;
    text-align: left;
    padding-left: 6px;
    font-weight: 600;
    color: #cbd5e1;
}

tr.summary-row {
    background-color: rgba(15, 23, 42, 0.6);
}

tr.summary-row td {
    font-weight: 700;
    color: #38bdf8;
}

tr.total-row {
    background-color: rgba(59, 130, 246, 0.2);
}

tr.total-row td {
    font-weight: 800;
    color: #60a5fa;
    font-size: 0.9rem;
}

td.preview {
    color: #ef4444;
    font-weight: 700;
    font-style: italic;
    cursor: pointer;
    font-size: 1rem;
}

td.preview:hover {
    background-color: rgba(239, 68, 68, 0.25);
    color: #f87171;
}

td.filled {
    font-weight: 700;
    color: #ffffff;
}

/* ---------- OVERLAY ---------- */
#setup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal {
    background: #1e293b;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #334155;
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal h2 {
    color: #f8fafc;
}

.modal p {
    color: #cbd5e1;
    font-size: 0.95rem;
    line-height: 1.4;
}

.modal input {
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #475569;
    background: #0f172a;
    color: white;
    font-size: 0.95rem;
}

.modal button {
    padding: 10px;
    border-radius: 6px;
    border: none;
    background: #2563eb;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

.modal button:hover {
    background: #1d4ed8;
}

/* ---------- MOBIL / IPAD ---------- */
@media (max-width: 900px) {

    #main-wrapper {
        flex-direction: column;
    }

    #left-container {
        width: 100%;
        height: 55vh;
    }

    #dice-container {
        width: 100%;
        height: 100%;
    }

    #right-container {
        width: 100%;
        height: 45vh;
        border-left: none;
        border-top: 1px solid #334155;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .table-scroll {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #button-bar {
        bottom: 20px;
    }

    #roll-btn {
        padding: 14px 32px;
        font-size: 1.3rem;
    }

    table {
        font-size: 0.9rem;
    }

    th, td {
        padding: 4px 6px;
    }

    td:first-child, th:first-child {
        width: 140px;
    }

    /* --- VIS STATUSLINJE OG HOVEDMENY --- */
    #top-header {
        flex-direction: column;
        height: auto;
        padding: 10px;
        gap: 6px;
    }

    .info {
        position: static;
        transform: none;
        justify-content: center;
        flex-wrap: wrap;
    }

