* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow-x: hidden;
    overscroll-behavior: none;
}

body {
    background-color: black;
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    -webkit-user-select: none; /* Förhindrar textmarkering i hela appen */
    user-select: none;
}

header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 14px 0;
    background-color: black;
    border-bottom: 1px solid #333;
    max-width: 720px;

}
header img {
    position: absolute;
    left: 10px;
    width: 48px;
    height: 48px;
}
header h1 {
    font-size: 1.4rem;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #ccc;
}

main {
    margin: 0;
    padding: env(safe-area-inset-top, 10px) 10px env(safe-area-inset-bottom, 10px) 10px;
    width: 100%;
    max-width: 720px;
    display: flex;
    flex-direction: column;
}

@media (max-width: 767px) {
    main {
        padding: env(safe-area-inset-top, 10px) 10px env(safe-area-inset-bottom, 10px) 10px;
        width: 100%;
        max-width: none;
        font-size: 16px;
        margin: 0;
    }
}

@media (max-width: 339px) {
    main {
        font-size: 16px;
    }
}

 .setup-container, .game-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    height: 100%;
}

.menu-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    height: 100%;
    background: url('../icons/logo.svg') no-repeat center 60%;
    background-size: 300px auto;
}

.menu-container .btn {
    background-color: rgba(51, 51, 51, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px); /* För bättre stöd i Safari/iOS */
}

h2 {
    font-size: 1.1rem;
    color: #888;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 16px;
}

.btn {
    padding: 15px;
    font-size: 1.2rem;
    border: none;
    border-radius: 8px;
    background: #333;
    color: white;
    cursor: pointer;
}

.btn-primary { background: #28a745; }
.btn-danger { background: #dc3545; }

.player-input-group {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
}

.player-input-group .btn {
    padding: 8px 15px;
    font-size: 1rem;
}

input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    border-radius: 5px;
    border: 1px solid #444;
    background: #222;
    color: white;
}

.scoreboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    background: #111;
    padding: 10px;
    border-radius: 10px;
}

.player-card {
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    background: #222;
    border: 2px solid transparent;
}

.player-card.active {
    border-color: #ffcc00;
    background: #333;
}

.score-display {
    font-size: 2rem;
    font-weight: bold;
}

.dart-board-input {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    padding-bottom: 10px;
}

.dart-btn {
    padding: 10px 0;
    border-radius: 5px;
    background: #333;
    color: white;
    border: none;
    font-size: 1.1rem;
}

.multiplier-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin-bottom: 10px;
}

.btn-double { background: #2980b9 !important; }
.btn-triple { background: #c0392b !important; }
.btn-bull   { background: #27ae60 !important; }
.btn-miss   { background: #7f8c8d !important; }

.settings-container {
    background: #111;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-around;
    margin-bottom: 10px;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.active-multiplier {
    background: #ffcc00 !important;
    color: black !important;
}

.history-log {
    font-size: 0.8rem;
    color: #888;
    max-height: 50px;
    overflow-y: auto;
}

.current-turn-display {
    text-align: center;
    font-size: 1.5rem;
    min-height: 2rem;
    margin: 5px 0;
    color: #ffcc00;
    font-weight: bold;
}

.win-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #ffcc00;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    z-index: 100;
    width: 85%;
    box-shadow: 0 0 30px rgba(255, 204, 0, 0.3);
}

.winner-name {
    font-size: 2rem;
    margin: 20px 0;
    color: #ffcc00;
    font-weight: bold;
}

.player-card.winner {
    border-color: #ffcc00;
    background: rgba(255, 204, 0, 0.15);
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.4);
    animation: winnerPulse 2s infinite;
}

.bust-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(139, 0, 0, 0.95);
    border: 2px solid #dc3545;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    z-index: 101;
    width: 80%;
}

/* Cricket table styles */
.cricket-table {
    display: grid;
    grid-template-columns: 2fr repeat(7, 1fr);
    gap: 2px;
    background: #111;
    padding: 8px;
    border-radius: 10px;
    margin-top: 5px;
    font-size: 0.75rem;
    align-items: center;
}
.cricket-header {
    text-align: center;
    color: #888;
    font-weight: bold;
    padding-bottom: 5px;
}
.cricket-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 5px;
}
.cricket-marker {
    text-align: center;
    font-size: 1.1rem;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mark-0 { color: #333; }
.mark-1 { color: #ffffff; }
.mark-2 { color: #ffcc00; }
.mark-3 { color: #27ae60; text-shadow: 0 0 8px rgba(39, 174, 96, 0.4); font-weight: bold; font-size: 1.3rem; }

@keyframes winnerPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

.hidden {
    display: none !important;
}