* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, sans-serif; user-select: none; }
body { background-color: #1b5e20; color: #333; height: 100vh; display: flex; justify-content: center; overflow: hidden; }
.hidden { display: none !important; }
.text-center { text-align: center; }
.mb-5 { margin-bottom: 5px; } .mb-10 { margin-bottom: 10px; } .mt-10 { margin-top: 10px; }

/* SEKMELER VE KURULUM EKRANI */
.setup-container { width: 100%; max-width: 600px; height: 100%; padding: 20px; overflow-y: auto; background: #f4f1ea; }
.setup-title { text-align: center; color: #2e7d32; margin-bottom: 15px; text-shadow: 1px 1px 0px #ccc; }
.setup-card { background: #fff; padding: 15px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); margin-bottom: 15px; border: 2px solid #ddd; }

.tabs-container { display: flex; gap: 5px; margin-bottom: 15px; }
.tab-btn { flex: 1; padding: 12px; background: #ccc; border: none; font-weight: bold; color: #555; cursor: pointer; border-radius: 8px 8px 0 0; }
.tab-btn.active { background: #fff; color: #2e7d32; border-bottom: 3px solid #2e7d32; }

.p-input { width: 100%; padding: 10px; font-size: 16px; border: 1px solid #999; border-radius: 4px; font-weight: bold; text-align: center; }
.btn-icon-red { background: #e53935; color: white; border: none; width: 42px; border-radius: 4px; font-size: 16px; cursor: pointer; box-shadow: 0 3px 0 #b71c1c; margin-left: 5px; }
.btn-icon-red:active { transform: translateY(3px); box-shadow: none; }

/* UYGULAMA VE TABLO MİMARİSİ */
.app-container { width: 100%; max-width: 600px; height: 100%; display: flex; flex-direction: column; background-color: #1b5e20; }
.top-navbar { display: flex; justify-content: space-between; align-items: center; padding: 10px; height: 60px; }
.nav-left, .nav-right { display: flex; gap: 8px; align-items: center; }
.round-info { color: white; font-weight: bold; font-size: 16px; margin-right: 5px; }

.icon-btn { background: transparent; border: 1px solid rgba(255, 255, 255, 0.5); color: white; width: 36px; height: 36px; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 16px; cursor: pointer; transition: 0.1s; }
.icon-btn:active { background: rgba(255, 255, 255, 0.2); transform: scale(0.9); }

.scoreboard { flex: 1; display: flex; margin: 0 5px; background: #fff; border: 2px solid #000; border-radius: 4px; overflow-y: auto; position: relative; }
.col-nums { width: 30px; background-color: #e0e0e0; display: flex; flex-direction: column; border-right: 2px solid #4e342e; }
.col-player { flex: 1; display: flex; flex-direction: column; border-right: 1px solid #ccc; background-color: #f4f1ea; }
.col-player:last-child { border-right: none; }

.sticky-top { position: sticky; top: 0; z-index: 5; background: inherit; }
.header-cell { background-color: #4e342e; color: white; font-weight: bold; text-align: center; padding: 8px 0; border-bottom: 2px solid #000; font-size: 14px; }
.ceza-zone { background-color: #fff; text-align: center; display: flex; flex-direction: column; min-height: 55px; border-bottom: 2px dotted #ccc; padding: 4px; }

.ceza-items { flex: 1; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; }
.ceza-badge { display: inline-block; padding: 3px 6px; border-radius: 6px; font-weight: bold; font-size: 12px; box-shadow: 1px 1px 3px rgba(0,0,0,0.15); }
.ceza-tip-1 { background: #e3f2fd; color: #0d47a1; border: 1px solid #90caf9; } 
.ceza-tip-2 { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; } 
.ceza-islek { background: #ffebee; color: #b71c1c; border: 1px solid #ef9a9a; } 
.ceza-odul { background: #e8f5e9; color: #1b5e20; border: 1px solid #a5d6a7; } 

.ceza-total { font-size: 12px; font-weight: bold; color: #d32f2f; padding-top: 4px; border-top: 1px dashed #eee; margin-top: auto; }
.rounds-container { display: flex; flex-direction: column; flex: 1; }
.round-cell { height: 35px; display: flex; justify-content: center; align-items: center; border-bottom: 1px solid #e0e0e0; font-size: 16px; font-weight: bold; color: #333; }
.col-player .round-cell:nth-child(even) { background-color: rgba(0,0,0,0.03); }

.sticky-bottom { position: sticky; bottom: 0; z-index: 5; background: inherit; }
.subtotal-cell { background-color: #e0e0e0; text-align: center; font-weight: bold; font-size: 13px; padding: 5px 0; border-top: 2px solid #4e342e; color: #333; }
.total-cell { background-color: #ffe082; text-align: center; font-weight: bold; font-size: 22px; color: #d32f2f; padding: 8px 0; border-top: 1px solid #000; }
.gizli-metin { background-color: #111 !important; color: #111 !important; text-shadow: none !important; border-radius: 4px; pointer-events: none; }

/* ALT BUTONLAR VE İZLEYİCİ ÇUBUĞU (Üste Taşındı) */
.bottom-actions { display: flex; gap: 10px; padding: 10px; background-color: #fff; border-top: 2px solid #000; }
.action-btn { flex: 1; padding: 15px; font-size: 18px; font-weight: bold; color: white; border: none; border-radius: 8px; cursor: pointer; box-shadow: 0 4px 0 rgba(0,0,0,0.2); }
.action-btn:active { transform: translateY(4px); box-shadow: none; }
.btn-red { background-color: #d32f2f; } .btn-blue { background-color: #1976d2; } .btn-green { background: #388e3c; } .btn-gray { background: #757575; }

/* İzleyici Çubuğu üstte olduğu için border alt kısımda */
#spectator-bar { background: #ff9800; color: #000; padding: 12px; display: flex; justify-content: space-between; align-items: center; font-weight: bold; font-size: 14px; border-bottom: 2px solid #e65100; }
.btn-takeover { background: #d32f2f; color: white; border: none; padding: 8px 15px; border-radius: 5px; font-weight: bold; cursor: pointer; box-shadow: 0 3px 0 #b71c1c; }
.btn-takeover:active { transform: translateY(3px); box-shadow: none; }

.spectator-mode .admin-only { display: none !important; }
.spectator-mode .ceza-zone, .spectator-mode .round-cell { pointer-events: none; cursor: default; }

.game-over-lock .ceza-zone, .game-over-lock .round-cell { pointer-events: none; opacity: 0.8; filter: grayscale(50%); }

.btn-start { width: 100%; padding: 20px; font-size: 24px; background: linear-gradient(135deg, #ff9800, #ff5722); border: 2px solid #e65100; color: white; box-shadow: 0 6px 0 #bf360c; text-shadow: 1px 1px 2px rgba(0,0,0,0.5); border-radius: 10px; cursor:pointer;}
.btn-start:active { transform: translateY(6px); box-shadow: none; }

.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: #fff; padding: 15px; border-radius: 8px; width: 90%; max-width: 380px; box-shadow: 0 10px 25px rgba(0,0,0,0.5); animation: popIn 0.2s ease-out; }
@keyframes popIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-select { width: 100%; padding: 10px; font-size: 18px; font-weight: bold; border: 2px solid #ccc; border-radius: 5px; margin-bottom: 10px; text-align: center; background:#f9f9f9; }
.chk-container { background: #fff3e0; border-radius: 5px; padding: 10px; text-align: center; color: #e65100; font-weight: bold; font-size: 18px; display: flex; justify-content: center; align-items: center; gap: 10px; }

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid-btn { background: #f5f5f5; border: 1px solid #ddd; border-radius: 5px; padding: 12px 0; font-size: 20px; font-weight: bold; color: #333; cursor: pointer; box-shadow: 0 3px 0 #ccc; transition: 0.1s; }
.grid-btn:active { transform: translateY(3px); box-shadow: none; background: #e0e0e0; }
.clear-btn { background: #ffebee; color: #d32f2f; border-color: #ffcdd2; box-shadow: 0 3px 0 #ef9a9a; }
.enter-btn { background: #e8f5e9; color: #2e7d32; border-color: #c8e6c9; box-shadow: 0 3px 0 #a5d6a7; }

.flex-row { display: flex; gap: 8px; }
.btn-islek, .btn-odul, .btn-hizli { flex: 1; padding: 15px; border: none; border-radius: 8px; color: white; font-size: 18px; font-weight: bold; cursor: pointer; box-shadow: 0 4px 0 rgba(0,0,0,0.2); }
.btn-islek:active, .btn-odul:active, .btn-hizli:active { transform: translateY(4px); box-shadow: none; }
.btn-islek { background: #d32f2f; } .btn-odul { background: #2e7d32; }
.btn-hizli.green { background: #4caf50; } .btn-hizli.red { background: #f44336; }

.manuel-input { flex: 1; padding: 10px; font-size: 16px; border: 1px solid #ccc; border-radius: 5px; text-align: center; }
.btn-check { background: #4caf50; color: white; border: none; padding: 0 20px; border-radius: 5px; font-size: 20px; cursor: pointer; box-shadow: 0 3px 0 #388e3c; }
.btn-kapat { width: 100%; padding: 10px; background: #ccc; border: 1px solid #999; font-weight: bold; font-size: 16px; cursor: pointer; border-radius:5px;}

.numpad-display { background: #eee; border: 2px inset #ccc; border-radius: 5px; font-size: 28px; font-weight: bold; text-align: right; padding: 10px; margin-bottom: 10px; color: #333; }
.btn-3d { border: none; border-radius: 8px; color: white; font-weight: bold; cursor: pointer; box-shadow: 0 4px 0 rgba(0,0,0,0.2); transition: 0.1s; padding: 10px; }
.btn-3d:active { transform: translateY(4px); box-shadow: none; }

.team-a-bg { background-color: #e3f2fd !important; border: 2px solid #1976d2 !important; color: #0d47a1 !important; transition: 0.3s; }
.team-b-bg { background-color: #fff3e0 !important; border: 2px solid #e65100 !important; color: #e65100 !important; transition: 0.3s; }