/* Grundlayout */
.kccg-container {
    max-width: 600px;
    margin: 0 auto;
    font-family: "Comic Sans MS", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    padding: 10px;
    box-sizing: border-box;
    background: linear-gradient(180deg, #f3f9ff 0%, #ffffff 100%);
    border-radius: 16px;
    box-shadow: 0 8px 18px rgba(0,0,0,0.12);
}

/* Obere Infozeile */
.kccg-top-panel {
    display: flex;
    justify-content: center;   /* zentriert */
    column-gap: 200px;         /* 200px Abstand zwischen Zeit und Treffer */
    align-items: center;
    margin-bottom: 8px;
    padding: 6px 10px;
    border-radius: 12px;
    background: #e3f2fd;
    border: 2px solid #90caf9;
}

.kccg-countdown,
.kccg-score {
    font-size: 1.2rem;
    font-weight: 700;
    color: #0d47a1;
}

/* Buttons */
.kccg-btn {
    border: none;
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.18);
}

.kccg-btn:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}

.kccg-btn-start {
    background: #e53935;
    color: #ffffff;
}

.kccg-btn-start:hover {
    background: #ff5252;
}

.kccg-btn-reset {
    background: #43a047;
    color: #ffffff;
}

.kccg-btn-reset:hover {
    background: #66bb6a;
}

.kccg-main-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

/* Spieler-Buttons */
.kccg-player-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 8px;
    margin-bottom: 10px;
}

.kccg-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 30%;
    max-width: 140px;
}

.kccg-player-btn {
    width: 100%;
    background: #42a5f5;
    color: #ffffff;
}

.kccg-player-btn:hover {
    background: #64b5f6;
}

.kccg-player-active {
    background: #ef5350 !important;
    box-shadow: 0 0 0 3px rgba(255, 235, 59, 0.9);
}

.kccg-player-disabled {
    opacity: 0.6;
    cursor: default;
}

.kccg-player-score {
    margin-top: 4px;
    font-size: 0.9rem;
    color: #1a237e;
    min-height: 1.1em;
}

/* Spielfeld (Canvas) – Breite & Höhe */
.kccg-game-area-wrapper {
    margin: 8px 0;
}

.kccg-game-area {
    position: relative;
    width: 95%;
    max-width: none;
    margin: 0 auto;
}

.kccg-game-area::before {
    content: "";
    display: block;
    padding-top: 176%; /* nach Wunsch gekürzt */
}

#kccg-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 18px;
    overflow: hidden;
}

.kccg-cannon-touch-hint {
    position: absolute;
    right: 6%;
    bottom: 8%;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 999px;
    font-size: 0.75rem;
    color: #0d47a1;
    border: 1px dashed #90caf9;
}

/* Untere Einstellungen */
.kccg-bottom-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 12px;
    margin-top: 8px;
}

.kccg-control {
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
    color: #0d47a1;
}

.kccg-control select {
    margin-top: 2px;
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid #90caf9;
    background: #ffffff;
}

/* Popups */
.kccg-popup {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kccg-popup-inner {
    background: #ffffff;
    border-radius: 16px;
    padding: 16px 20px;
    min-width: 260px;
    max-width: 340px;
    text-align: center;
    box-shadow: 0 8px 18px rgba(0,0,0,0.3);
    border: 3px solid #42a5f5;
}

.kccg-popup-inner h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #0d47a1;
}

/* Farb-Bälle im Popup */
.kccg-color-options {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.kccg-color-ball {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid #ffffff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.25);
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.kccg-color-ball:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

/* Gewinner-Popup */
.kccg-winner-score {
    margin-top: 6px;
    margin-bottom: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #2e7d32;
}

/* Visibility Helper */
.kccg-hidden {
    display: none !important;
}

/* Treffer-Flash-Effekt */
.kccg-hit-flash {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle, rgba(255,255,0,0.6) 0%, rgba(255,255,0,0) 60%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease-out;
    z-index: 9998;
}

.kccg-hit-flash.kccg-visible {
    opacity: 1;
}

/* Responsive für großen Touchscreen */
@media (min-width: 768px) {
    .kccg-container {
        max-width: 720px;
        padding: 16px;
    }

    .kccg-game-area {
        width: 95%;
    }

    .kccg-top-panel {
        padding: 8px 14px;
    }

    .kccg-countdown,
    .kccg-score {
        font-size: 1.35rem;
    }
}
