@import url('https://fonts.googleapis.com/css2?family=Patrick+Hand&display=swap');

body {
    background-color: #1b5e20;
    font-family: 'Patrick Hand', cursive;
    margin: 0;
    padding: 0;
    color: #333;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
}

#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1500;
}

.container {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 5px;
    box-sizing: border-box;
}

#setup-screen {
    height: 100%;
    overflow-y: auto;
    padding-bottom: 50px;
    -webkit-overflow-scrolling: touch;
}

#game-screen {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Renkler & UI */
.team-a-bg {
    background-color: #e3f2fd !important;
    border: 2px solid #2196f3 !important;
}

.team-b-bg {
    background-color: #fffde7 !important;
    border: 2px solid #fbc02d !important;
}

.card {
    background: #f4f1ea;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
    box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.2);
}

input,
select {
    font-family: 'Patrick Hand', cursive;
    font-size: 18px;
    padding: 8px;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #999;
    border-radius: 4px;
    margin-bottom: 5px;
    background: #fff;
}

.rule-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    border-bottom: 1px dashed #ccc;
    padding-bottom: 5px;
    align-items: center;
}

.rule-row input {
    width: 70px;
    text-align: center;
    color: #d32f2f;
    font-weight: bold;
    margin: 0;
}

/* 3D BUTONLAR */
.btn-3d {
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    font-family: 'Patrick Hand', cursive;
    transition: all 0.1s;
    position: relative;
    top: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-3d:active {
    top: 3px;
    box-shadow: none !important;
}

.btn-gold {
    background: #ffca28;
    color: #000;
    box-shadow: 0 4px 0 #bfa004;
    border: 2px solid #000;
    width: 100%;
    font-size: 22px;
}

.btn-red {
    background: #d32f2f;
    color: white;
    box-shadow: 0 4px 0 #b71c1c;
}

.btn-green {
    background: #388e3c;
    color: white;
    box-shadow: 0 4px 0 #1b5e20;
}

.btn-blue {
    background: #2196f3;
    color: white;
    box-shadow: 0 4px 0 #0d47a1;
}

.btn-gray {
    background: #9e9e9e;
    color: white;
    box-shadow: 0 4px 0 #616161;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 14px;
    box-shadow: 0 2px 0 #1b5e20;
}

.flex-1 {
    flex: 1;
}

.btn-icon {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: white;
    cursor: pointer;
    padding: 8px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-icon:active {
    background: rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
}

/* TABELA */
.scoreboard {
    flex: 1;
    display: flex;
    gap: 0;
    background: #000;
    padding: 2px;
    border: 2px solid #fff;
    overflow: hidden;
    margin-bottom: 5px;
}

.num-column {
    width: 35px;
    background: #e0e0e0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid #999;
}

.num-column .hand-scores-list {
    background: #e0e0e0;
    color: #555;
    font-size: 14px;
}

.player-column {
    flex: 1;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid #ccc;
    transition: all 0.5s ease;
}

.p-name {
    background: #3e2723;
    color: #fff;
    padding: 5px 0;
    text-align: center;
    font-weight: bold;
    border-bottom: 2px solid #000;
    font-size: 14px;
    white-space: nowrap;
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.penalty-zone {
    background: #fff;
    border-bottom: 1px solid #999;
    padding: 4px;
    text-align: center;
    font-size: 13px;
    color: #333;
    flex-shrink: 0;
    min-height: 60px;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    transition: height 0.2s ease;
}

.penalty-chips-wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 3px;
}

.penalty-sum-label {
    font-weight: bold;
    font-size: 13px;
    color: #c62828;
    margin-top: auto;
    border-top: 1px dashed #ccc;
    width: 100%;
}

.hand-scores-list {
    flex: 1;
    overflow-y: auto;
    background: #f4f1ea;
    padding: 0;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    -webkit-overflow-scrolling: touch;
}

.score-item {
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px dotted #e0e0e0;
}

.score-item:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.03);
}

.score-green {
    color: #2e7d32;
}

.score-red {
    color: #d32f2f;
}

.sub-total-area {
    background: #e0e0e0;
    color: #333;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    padding: 4px 0;
    border-top: 2px solid #555;
    flex-shrink: 0;
}

.grand-total-area {
    background: #ffecb3;
    color: #d32f2f;
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    padding: 8px 0;
    border-top: 1px solid #000;
    flex-shrink: 0;
}

.pen-chip {
    padding: 2px 5px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 12px;
    box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
}

.pen-odd {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.pen-even {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
}

.pen-green {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.pen-red {
    background: #d32f2f;
    color: #fff;
    border: 1px solid #b71c1c;
}

.buzlu {
    color: transparent !important;
    background-color: #333 !important;
    position: relative;
    user-select: none;
}

.buzlu::after {
    content: "???";
    color: #fff;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    font-weight: bold;
}

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    min-height: 40px;
    padding: 0 5px;
    flex-shrink: 0;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.modal-content {
    background: #fff;
    padding: 15px;
    border: 3px solid #000;
    width: 90%;
    max-width: 350px;
    overflow-y: auto;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.score-input-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    background: #eee;
    padding: 5px;
    border-radius: 4px;
}

.yanci-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 2px solid #000;
    padding: 10px;
    width: 85%;
    text-align: center;
    z-index: 1000;
    font-weight: bold;
    box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.5);
}

/* GİZLEME SINIFI (Çok Önemli) */
.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

/* GAME OVER STYLES */
.game-over-content {
    background: #1a1a1a;
    color: #fff;
    border: 4px solid #ffd700;
    text-align: center;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.5);
    max-width: 90%;
}

.game-over-title {
    font-size: 40px;
    color: #fff;
    text-shadow: 4px 4px #d32f2f;
    margin: 0 0 20px 0;
    letter-spacing: 5px;
}

.winner-section {
    background: linear-gradient(45deg, #ff6f00, #ffca28);
    padding: 15px;
    border-radius: 10px;
    color: #000;
    position: relative;
    overflow: hidden;
}

.winner-badge {
    background: #000;
    color: #ffca28;
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 5px;
}

.loser-section {
    background: #424242;
    padding: 15px;
    border-radius: 10px;
    color: #ccc;
    position: relative;
    border: 2px dashed #999;
    margin-top: 15px;
}

.loser-badge {
    background: #d32f2f;
    color: #fff;
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 12px;
}

.go-score {
    font-size: 36px;
    font-weight: bold;
    margin: 5px 0;
}

.crown-anim {
    font-size: 50px;
    color: #fff;
    margin-bottom: 10px;
    display: block;
    animation: tacParlamasi 1.5s infinite alternate;
}

.glove-anim {
    font-size: 50px;
    color: #f06292;
    margin-bottom: 10px;
    display: block;
    animation: titreme 0.1s infinite;
}

@keyframes tacParlamasi {
    0% {
        transform: scale(1) rotate(-10deg);
        text-shadow: 0 0 10px #fff;
    }

    100% {
        transform: scale(1.2) rotate(10deg);
        text-shadow: 0 0 30px #fff;
    }
}

@keyframes titreme {
    0% {
        transform: translate(1px, 1px) rotate(0deg);
    }

    25% {
        transform: translate(-1px, -2px) rotate(-5deg);
    }

    50% {
        transform: translate(-3px, 0px) rotate(5deg);
    }

    75% {
        transform: translate(3px, 2px) rotate(0deg);
    }

    100% {
        transform: translate(1px, -1px) rotate(-5deg);
    }
}

.modal-content {
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.fade-out-left {
    animation: slideOutLeft 0.5s forwards;
}

.fade-in-right {
    animation: slideInRight 0.5s forwards;
}

@keyframes slideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.shuffling {
    color: #d32f2f !important;
    background-color: #fff8e1 !important;
    font-style: italic;
    transition: all 0.1s;
}

.new-score-row {
    animation: highlightRow 1s ease-out;
}

@keyframes highlightRow {
    0% {
        background-color: #ffeb3b;
        transform: scale(1.05);
    }

    100% {
        background-color: transparent;
        transform: scale(1);
    }
}

.setup-header-container {
    position: relative;
    text-align: center;
    margin-bottom: 20px;
    padding-top: 10px;
}

.okey-tile-header {
    display: inline-flex;
    width: 40px;
    height: 52px;
    background-color: #f8f9fa;
    border-radius: 6px;
    color: #d32f2f;
    font-family: sans-serif;
    font-weight: 900;
    font-size: 18px;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 3px 0 #ccc, 3px 3px 6px rgba(0, 0, 0, 0.3);
    border: 1px solid #e0e0e0;
    transform: rotate(-10deg);
    margin-right: 8px;
    vertical-align: middle;
}

.subtitle {
    text-align: center;
    color: #fff;
    font-size: 18px;
    margin-top: 5px;
    margin-bottom: 20px;
    opacity: 0.9;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* SARI BAŞLIK RENGİ BURADA */
.setup-header-container h1 {
    font-size: 32px;
    margin: 0;
    display: inline-block;
    text-shadow: 2px 2px #000;
    color: #ffd700;
}

.dinliyor {
    animation: pulseRed 1.5s infinite;
    background-color: #ff0000 !important;
    border: 2px solid #fff !important;
}

@keyframes pulseRed {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
        transform: scale(1);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(255, 0, 0, 0);
        transform: scale(1.1);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0);
        transform: scale(1);
    }
}

.hizli-tus-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.hizli-tus-grid button {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px 0;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    transition: background 0.2s;
}

.hizli-tus-grid button:active {
    background: #2196f3;
    color: white;
}

.btn-ozel-ceza {
    flex: 1;
    padding: 15px;
    font-weight: bold;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
}

.btn-ozel-ceza span {
    font-size: 12px;
    font-weight: normal;
    opacity: 0.9;
}

/* SALLANMA VE PARLAMA EFEKTLERİ */
.winner-column {
    border: 4px solid #ffd700 !important;
    box-shadow: 0 0 20px #ffd700;
    z-index: 10;
    animation: winnerPulse 2s infinite;
}

@keyframes winnerPulse {

    0%,
    100% {
        box-shadow: 0 0 10px #ffd700;
    }

    50% {
        box-shadow: 0 0 25px #ffd700;
    }
}

.loser-column {
    background-color: #bdbdbd !important;
    filter: grayscale(80%) contrast(120%);
    border: 2px solid #555 !important;
    animation: loserShake 0.5s infinite;
}

@keyframes loserShake {
    0% {
        transform: translate(1px, 1px);
    }

    25% {
        transform: translate(-1px, -2px);
    }

    50% {
        transform: translate(-3px, 0px);
    }

    75% {
        transform: translate(3px, 2px);
    }
}

/* --- MODERN EL BİTİRME EKRANI STİLLERİ --- */
/* Seçim Izgarası (Yan Yana Kutular) */
.selection-grid {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

/* Seçim Butonları (Pasif Hal) */
.btn-choice {
    flex: 1;
    padding: 12px 5px;
    border: 2px solid #ccc;
    background: #f5f5f5;
    border-radius: 8px;
    font-weight: bold;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Aktif (Seçili) Hal - Kazanan İçin */
.btn-choice.active-winner {
    background: #e8f5e9;
    border-color: #2e7d32;
    color: #2e7d32;
    box-shadow: 0 0 10px rgba(46, 125, 50, 0.3);
    transform: scale(1.05);
}

/* Aktif (Seçili) Hal - Bitiş Türü İçin */
.btn-choice.active-type {
    background: #e3f2fd;
    border-color: #1976d2;
    color: #1565c0;
    font-weight: 900;
}

/* Açmadı Butonu */
.btn-acmadi-toggle {
    background: #eee;
    border: 1px solid #ccc;
    color: #999;
    padding: 8px 12px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    width: 80px;
    transition: all 0.2s;
}

/* Açmadı Butonu (Aktif/Kırmızı) */
.btn-acmadi-toggle.active-red {
    background: #ffebee;
    border-color: #d32f2f;
    color: #d32f2f;
}

/* Satır Düzeni */
.loser-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid #eee;
    background: #fff;
}

/* --- İZLEYİCİ MODU (GÜVENLİK KİLİDİ) --- */
/* --- İZLEYİCİ MODU (GÜNCEL) --- */
/* Sadece Ses Butonu (#btn-sound-toggle) açık kalsın, Göz butonu dahil hepsi gitsin */
/* Ses Butonu (#btn-sound-toggle) VE Kurallar Butonu (#btn-rules) açık kalsın */
body.izleyici-modu .header-bar .btn-icon:not(#btn-sound-toggle):not(#btn-rules) {
    display: none !important;
}

/* Diğer gizlemeler aynen kalıyor */
body.izleyici-modu #setup-screen,
body.izleyici-modu #action-buttons-container,
body.izleyici-modu #game-ended-controls,
body.izleyici-modu #btn-undo {
    display: none !important;
}

/* İsimlere ve ceza alanlarına tıklamayı kapat */
body.izleyici-modu .p-name,
body.izleyici-modu .penalty-zone {
    pointer-events: none !important;
}

/* --- EL BİTİRME PENCERESİ BUTONLARI --- */

.btn-choice {
    /* Temel Ayarlar */
    cursor: pointer;
    /* 1. Parmak İşareti Çıksın */
    transition: all 0.2s ease;
    /* 2. Animasyonlu Geçiş */
    user-select: none;
    /* Yazı seçilmesin */

    /* Güzelleştirme (Eğer eksikse) */
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    font-weight: bold;
    color: #333;
    margin: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Üzerine Gelince (Hover) */
.btn-choice:hover {
    background: #e3f2fd;
    /* Hafif mavi olsun */
    border-color: #2196f3;
    transform: translateY(-2px);
    /* Hafif yukarı kalksın */
}

/* Tıklama Anı (Active) - BASMA HİSSİ BURADA */
.btn-choice:active {
    transform: scale(0.95);
    /* %5 Küçülsün */
    background: #bbdefb;
}

/* Seçili Olduğunda (Mavi Kalsın) */
.active-type {
    background-color: #2196f3 !important;
    color: white !important;
    border-color: #1976d2 !important;
    box-shadow: 0 0 10px rgba(33, 150, 243, 0.4);
    transform: scale(1.05);
    /* Seçili olan biraz büyük dursun */
}

/* --- ANA EKRAN BUTONLARI (El Bitir & Geri Al) --- */

/* Butonların genel kapsayıcısı içindeki tüm butonlar */
#action-buttons-container button,
#btn-undo {
    cursor: pointer !important;
    /* 1. Üstüne gelince PARMAK çıksın */
    transition: all 0.1s ease;
    /* 2. Hareket yumuşak olsun */

    /* Eğer butonun gölgesi yoksa hafif gölge ekleyelim, daha "buton" gibi durur */
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
    position: relative;
    /* Hareket için gerekli */
}

/* Üzerine gelince (Hover) */
#action-buttons-container button:hover,
#btn-undo:hover {
    filter: brightness(1.1);
    /* Rengi %10 parlat */
    transform: translateY(-2px);
    /* Çok hafif yukarı kalksın */
}

/* TIKLAMA ANI (Active) - İşte aradığın hareket bu! */
#action-buttons-container button:active,
#btn-undo:active {
    transform: translateY(2px);
    /* Aşağı doğru (içe) göçsün */
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
    /* Gölgeyi küçült (basılmış hissi) */
    opacity: 0.9;
}

/* --- İKON BUTONLAR CANLANDIRMA (Ayarlar, Paylaş, Ses, Göz, Geri Al) --- */

/* Hepsini kapsayan ortak ayar */
.header-bar .btn-icon,
/* Üst menüdekiler */
.btn-close,
/* Pencere kapatma butonları */
#btn-undo {
    /* Geri al butonu */
    cursor: pointer !important;
    /* Parmak işareti */
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Yaylanma efekti (Bouncy) */
    user-select: none;
    /* Üzerine çift tıklayınca mavi seçilmesin */
}

/* ÜZERİNE GELİNCE (Hover): Hafif Büyüme */
.header-bar .btn-icon:hover,
#btn-undo:hover {
    transform: scale(1.15);
    /* %15 Büyüsün */
    filter: brightness(1.2);
    /* Biraz parlasın */
}

/* KAPAT BUTONLARI İÇİN ÖZEL HOVER (Kırmızılaşsın) */
.btn-close:hover {
    background-color: #e53935 !important;
    color: white !important;
    transform: scale(1.02);
}

/* TIKLAMA ANI (Active): İçeri Göçme / Küçülme */
.header-bar .btn-icon:active,
.btn-close:active,
#btn-undo:active {
    transform: scale(0.85);
    /* %15 Küçülsün (Pıt diye basma hissi) */
    filter: brightness(0.9);
}

/* ==========================================
   📱 MOBİL İÇİN AKILLI SIKIŞTIRMA (Header)
   ========================================== */
@media (max-width: 420px) {

    /* 1. Üst barın kenar boşluklarını sıfırla */
    .header-bar {
        padding: 0 2px;
        gap: 2px !important;
        /* Elemanlar arası boşluğu azalt */
    }

    /* 2. Butonları biraz küçült (Normalde 40px) */
    .header-bar .btn-icon {
        width: 32px;
        /* 32px idealdir */
        height: 32px;
        padding: 0;
        /* İç boşluğu kaldır */
        font-size: 14px;
        /* İkonu biraz küçült */
    }

    /* 3. Kırmızı Mikrofonu orantılı küçült (Normalde 50px) */
    #btn-mic {
        width: 42px !important;
        height: 42px !important;
        font-size: 18px !important;
    }

    /* 4. Aradaki tur yazısını küçült ve sıkıştır */
    .tur-bilgisi {
        font-size: 11px;
        margin: 0 2px;
        white-space: nowrap;
        /* Yazı alt satıra kaymasın */
    }

    /* 5. Gruplar arasındaki boşlukları daralt */
    .header-bar>div {
        gap: 2px !important;
    }
}