﻿body {
    background: #222;
}
.toTilFemten {
    /* Fjerner blå/grå boks ved tap på mobil */
    -webkit-tap-highlight-color: transparent;
    /* Hindrer at tekst blir markert når man trykker fort flere ganger */
    user-select: none;
    /* Viser at elementet er klikkbart */
    cursor: pointer;
    touch-action: manipulation;
}
.mySmallBtn {
    touch-action: manipulation; /* Disables double-tap-to-zoom lag */
    user-select: none; /* Prevents text highlighting while tapping rapidly */
    -webkit-user-select: none;
}
/* Custom Extra Large Button */
.btn-xl {
    padding: .2rem 1.5rem;
    font-size: 1.5rem;
    border-radius: 0.5rem;
}

.btn-xl .bi {
    /* ENDRING: Gjør ikonet mindre (juster etter behov) */
    font-size: 1rem;
    /* Litt luft mellom ikon og tekst */
    margin:0px,4px,3px,4px;

}

/* Styling av TEKSTEN inni .btn-xl */
.btn-xl .ballsLeftFont {
    /* Sørg for at teksten er sentrert */
    text-align: center;
    /* Gjør teksten mindre slik at den passer (juster etter behov) */
    font-size: 0.9rem;
    line-height: 1; /* Forhindrer stor avstand mellom linjer hvis teksten brekker */
    font-weight:bolder;
    font-size: 2.5rem;
    margin-bottom: 3px;

}

.btn-xl:hover {
    transform: scale(1.1);
}
/* Target all buttons and links globally */
button,
a,
input[type="button"],
input[type="submit"],
.btn {
    touch-action: manipulation;
}
    /* Når body har klassen .is-fullscreen, skjul navbaren */
    body.is-fullscreen .navbar {
        display: none !important;
    }

    /* Eventuelt fjerne padding som layouten legger til på toppen */
    body.is-fullscreen {
        padding-top: 10 !important;
        margin-top: 0 !important;
    }

.billiard-grid {
    display: grid;
    grid-template-rows: 40vh 60vh; /* Topp 40%, Bunn 60% */
    height: 100vh;
}

.h4 {
    font-size: calc(1rem + 1vh);
    margin-bottom: 0;
}

.hf4 {
    color: orangered;
}

.hr4 {
    color: aquamarine;
}

button:disabled {
    opacity: 0.2;
    cursor: not-allowed;
    border-style: dashed !important;
}

.distance-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 10px 20px;
    text-align: center;
    min-width: 100px;
    display: inline-block;
    backdrop-filter: blur(5px);
    margin: 10px auto;
}

.distance-label {
    color: #6c757d; /* Dempet grå */
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: -5px;
}

.distance-value {
    color: #0dcaf0; /* Cyan/Lys blå farge */
    font-size: 2rem;
    font-weight: 800;
    font-family: 'Segoe UI', Roboto, sans-serif;
}

.mode-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 5px 10px;
    text-align: center;
    min-width: 50px;
    display: inline-block;
    backdrop-filter: blur(3px);
    margin: 5px auto;
}

.mode-label {
    color: #6c757d; /* Dempet grå */
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: -5px;
}

.mode-value {
    color: #0dcaf0; /* Cyan/Lys blå farge */
    font-size: 1rem;
    font-weight: 800;
    font-family: 'Segoe UI', Roboto, sans-serif;
}

.input-section {
    background: #222;
    color: white;
    padding: 20px;
}

.player-card.active {
    border-color: #ffc107; /* Gull-ramme for aktiv spiller */
    background-color: rgba(255, 193, 7, 0.1);
}

/* Øk høyden på spiller-seksjonen */
.player-card {
    border: 2px solid transparent;
    transition: 0.3s;
    padding: 30px 15px !important;
    min-height: 150px;
    border-right: 1px solid #444; /* Skille mellom spillerne */
}

    /* Navnet: Dobbelt så stort */
    .player-card small {
        font-size: 2.2rem !important;
        letter-spacing: 2px;
        text-transform: uppercase;
        opacity: 0.9;
    }

    /* Poengsummen: Gigantisk */
    .player-card .display-2 {
        font-size: 10rem !important; /* Dette er ca 160px på en vanlig skjerm */
        font-weight: 800 !important;
        margin: 10px 0 !important;
        line-height: 0.9;
    }


/* Statistikk i hjørnene (HI, Ø, F, HC) */
.stat-box {
    position: absolute;
    font-size: 1.4rem !important;
    font-family: 'Courier New', Courier, monospace; /* Gir et "tavle"-preg */
    font-weight: bold;
}

.hi-runs {
    bottom: 40px;
    left: 10px;
}

.avg {
    top: 5px;
    right: 10px;
}

.fouls {
    bottom: 5px;
    left: 10px;
}

.hc {
    bottom: 5px;
    right: 10px;
}

/* Highlight for aktiv spiller */
.player-card.active {
    background: linear-gradient(180deg, #1a1a1a 0%, #2c3e50 100%);
    box-shadow: inset 0 0 50px rgba(255, 193, 7, 0.2);
}
@media (max-width: 992px) {
    .player-card .display-2 {
        font-size: 6rem !important;
    }

    .player-card small {
        font-size: 1.5rem !important;
    }

    .stat-box {
        font-size: 1.1rem !important;
    }
}

/* Standardoppsett for kortet */
.player-card {
    padding: 10px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

@media(max-height: 650px) {
    .player-card {
        padding: 5px;
        min-height: 40px;
    }
    .player-card .display-2 {
        font-size: 4rem !important;
    }
    .player-card small {
        font-size: 1.2rem !important;
    }
    .stat-box {
        font-size: 0.9rem !important;
    }
}

/* Spesifikke justeringer for smale skjermer (iPhone stående) */
@media (max-width: 610px) {

    .billiard-grid {
        display: grid;
        grid-template-rows: 25vh 75vh; /* Topp 40%, Bunn 60% */
        height: 100vh;
    }

    .player-info {
        text-align: center;
        flex: 1;
    }

    .player-score-container {
        text-align: center;
        flex: 1;
    }

    .player-card h3 {
        font-size: 1.1rem; /* Mindre navn */
        margin: 0;
    }

    .player-card .display-4 {
        font-size: 1.8rem !important; /* Mindre poengtall */
        margin: 0;
    }

    /* Skjul HI-run eller gjør den veldig liten på mobil for å spare plass */
    .hi-runs {
        font-size: 0.7rem;
        opacity: 0.7;
    }

    .h4 {
        font-size: 1.2rem;
    }

    .mySmallBtn {
        padding: 0.25rem 0.5rem;
        font-size: 1.2rem;
        touch-action: manipulation; /* Disables double-tap-to-zoom lag */
        user-select: none; /* Prevents text highlighting while tapping rapidly */
        -webkit-user-select: none;
    }
}

.btn-ining-action-common {
    font-weight: bold;
    min-width: 100px;
    height: 80px;
    font-size: 1.5rem;
    border: 2px solid rgba(255,255,255,0.2);
    color: white;
}
    .btn-ining-action-common:active {
        background-color: #e8590c;
        transform: scale(0.98);
    }
 .btn-rack {
    background-color: #fd7e14; /* Oransje - skiller seg ut fra rød/grønn */
}

.btn-GO {
    background-color: forestgreen; /* Oransje - skiller seg ut fra rød/grønn */
}

.btn-fault {
    background-color: red; /* Oransje - skiller seg ut fra rød/grønn */
}

/* Styling for opplyst knapp */
.btn-outline-light.active-ball {
    background-color: #ffc107 !important; /* Gull/Gul */
    color: #000 !important;
    box-shadow: 0 0 15px #ffc107;
    border-color: #fff;
}

/* Skjul angreknapper som standard */
.undo-controls {
    display: none; /* Skjules helt */
    transition: opacity 0.3s ease;
}

/* En enkel animasjon for når de dukker opp */
.show-undo {
    display: flex !important;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Fjern den irriterende standard-rammen til nettleseren når knapper trykkes */
button:focus,
.btn:focus,
[id^="btn-ball-"]:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Sørg for at den aktive knappen BLIR bunnsolid gul og holder seg sånn */
.active-ball {
    background-color: #ffc107 !important; /* Kraftig gul */
    color: #000000 !important; /* Svart tall inni */
    border-color: #ffffff !important; /* Hvit ramme rundt */
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.8) !important; /* God glød */
    font-weight: bold !important;
    transform: scale(1.05); /* Gjør den ørlite grann større */
}
.preview-score {
    position: absolute;
    top: -10px;
    right: -40px;
    font-size: 2.5rem; /* Mindre enn hovedtallet, men tydelig */
    font-weight: bold;
    opacity: 0; /* Skjult til vanlig */
    transition: all 0.2s ease-in-out;
}

    .preview-score.show {
        opacity: 1;
        transform: translateY(-5px);
    }

.display-2 span {
    transition: all 0.3s ease;
    display: inline-block;
}

.score-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8); /* Mørk bakgrunn */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.score-modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    min-width: 300px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}
.made-by-sidebar {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%) rotate(180deg); /* Sentrerer vertikalt og snur teksten */
    writing-mode: vertical-lr; /* Gjør teksten vertikal */
    text-align: center;
    font-size: 0.8rem;
    color: #6c757d; /* Diskret gråfarge */
    text-transform: uppercase;
    letter-spacing: 2px;
    z-index: 1000;
    pointer-events: none; /* Gjør at man kan trykke "gjennom" teksten hvis nødvendig */
    padding-left: 5px;
    opacity: 0.6;
}

/* Skjul merkingen i mørk modus eller endre farge */
body.dark-mode .made-by-sidebar {
    color: #adb5bd;
}

/* Bakgrunnen som dekker alt */
.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5); /* Gjennomsiktig sort */
}

/* Selve modal-boksen */
.modal-content {
    background-color: black;
    margin: 2% auto; /* Plassering fra toppen */
    padding: 20px;
    border-radius: 10px;
    width: 90%; /* Dekker nesten hele bredden */
    height: 85%; /* Dekker nesten hele høyden */
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Grid for tallknappene */
.button-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    overflow-y: auto; /* Scroll hvis det blir for trangt */
    padding: 20px;
}

.num-btn {
    padding: 15px 25px;
    font-size: 1.2rem;
    cursor: pointer;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 5px;
    min-width: 60px;
}

    .num-btn:hover {
        background-color: #ddd;
    }

/* Skjul-knappen nederst */
.close-btn {
    padding: 15px 30px;
    background-color: #ff4444;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
}
.zoomBtn {
    height: 20vh;
    width: 20vh;
    font-size: 2.5rem;
    font-weight: bold;
}
.padding {
    padding: 0 30px 0 30px ;
}

/* Spesifikke justeringer for smale skjermer (iPhone stående) */
@media (max-width: 610px) {
    .zoomBtn {
        height: 25vw;
        width: 25vw;
        font-size: 1rem;
        font-weight: bold;
    }

    .padding {
        padding: 0 10px 0 10px;
    }

}

/* Modal / Popup */
.edScoreModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.edScoreModal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 320px;
    text-align: center;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Stepper (+ / - knapper) */
.stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 25px 0;
}

.step-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: #f0f0f0;
    font-size: 1.5rem;
    cursor: pointer;
}

.score-input {
    width: 80px;
    border: none;
    font-size: 2rem;
    text-align: center;
    font-weight: bold;
    color: var(--dark);
}

/* Knapper nederst */
.edScoreModal-actions {
    display: flex;
    gap: 10px;
}

.edScore_btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
}

.edScore_btn.btn-save {
    background: var(--primary);
    color: white;
}

.edScore_btn.btn-cancel {
    background: #eee;
    color: #666;
}
