:root {
    --bg-color: #FAF8F1;       
    --bg-card: #FFFFFF;        
    --bg-keyboard: #EFEBE4;    
    
    --c-text: #3E2723;         /* Ana Koyu Renk */
    --c-sub: #6D4C41;          
    --c-accent: #8D6E63;       
    
    --c-correct: #4CAF50;      
    --c-present: #FBC02D;      
    --c-absent: #9E9E9E;       
    --c-fail: #D32F2F;         

    --shadow: 0 4px 12px rgba(62, 39, 35, 0.08);
    --radius: 16px;
    --font-ui: system-ui, -apple-system, sans-serif;
    
    --word-len: 5; 
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; }

body {
    margin: 0; padding: 0;
    height: 100vh;          
    height: 100dvh;         
    overflow: hidden;       
    background-color: var(--bg-color);
    color: var(--c-text);
    font-family: var(--font-ui);
    display: flex; flex-direction: column;
}

.screen { width: 100%; height: 100%; display: flex; flex-direction: column; }
.hide { display: none !important; }
.centered { align-items: center; justify-content: center; text-align: center; }

/* LOADING */
#loading-screen{
  position: fixed;
  inset: 0;
  background: var(--bg-color);
  z-index: 2147483646; /* fly-coin 2147483647, onun 1 altı */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  opacity: 1;
  pointer-events: all;
  transition: opacity .55s ease-out;
}

#loading-screen.fade-out{
  opacity: 0;
  pointer-events: none;
}

#loading-screen.is-hidden{
  display: none !important;
}
#floating-letters { font-size: 2rem; font-weight: 900; color: var(--c-text); letter-spacing: 3px; margin-bottom: 20px; }
.loader-container { width: 150px; height: 6px; background: #E0E0E0; border-radius: 4px; overflow: hidden; }
.loading-bar-fill { height: 100%; width: 0%; background: var(--c-correct); transition: width 0.1s; }
.loading-percent { margin-top: 10px; font-weight: bold; font-size: 0.9rem; color: var(--c-sub); }

/* HEADER */
.main-header {
    height: 60px; 
    
    /* DEĞİŞİKLİK BURADA: */
    padding-left: 0;      /* Sol taraf: DUBA GİBİ SIFIR (En sola yapışır) */
    padding-right: 20px;  /* Sağ taraf: 20px içeride (Profil simgesi kesilmez) */
    
    flex-shrink: 0;
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    background: var(--bg-card); 
    box-shadow: var(--shadow); 
    z-index: 50; 
    position: relative;
}

.header-left, .header-right { display: flex; align-items: center; }
.header-left { cursor: pointer; justify-content: center; pointer-events: auto; z-index: 1001; }
.header-right { gap: 8px; flex-wrap: nowrap; }

.home-logo { height: 42px; width: auto; object-fit: contain; display: block; }
.app-logo { height: 40px; width: auto; object-fit: contain; display: block; }

.icon-btn {
    padding: 8px; cursor: pointer; color: var(--c-text);
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; transition: background 0.1s;
    z-index: 100; position: relative;
}
.icon-btn:active { background: #eee; }
.icon-btn svg, button svg { pointer-events: none; }

.stat-pill {
    background: #F5F5F5; padding: 5px 10px; border-radius: 20px;
    font-size: 0.85rem; font-weight: bold; color: var(--c-sub);
    white-space: nowrap; display: flex; align-items: center;
}

/* ANA SAYFA */
.home-center {
    flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center;
    padding: 20px; gap: 15px; overflow-y: auto;
}
.menu-grid { display: grid; grid-template-columns: 1fr; gap: 12px; width: 100%; max-width: 360px; }
.mode-card {
    background: var(--bg-card); padding: 12px 15px; border-radius: var(--radius);
    box-shadow: var(--shadow); display: flex; align-items: center; gap: 15px;
    cursor: pointer; transition: transform 0.1s; border: 1px solid transparent;
}
.mode-card:active { transform: scale(0.97); background: #FDFDFD; }
.daily-card { background: #FFF8E1; } /* Çerçeve kaldırıldı, zemin sarı */

.icon-circle {
    width: 44px; height: 44px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; flex-shrink: 0;
}
.classic-bg { background: #E8F5E9; }
.marathon-bg { background: #E3F2FD; }
.daily-bg { background: #FFF8E1; }
.free-bg { background: #EFEBE9; }

.card-info { text-align: left; }
.card-title { font-weight: 800; font-size: 1.1rem; color: var(--c-text); }
.card-sub { font-size: 0.85rem; color: var(--c-sub); margin-top: 2px; }

.stats-row { display: flex; gap: 10px; width: 100%; max-width: 360px; }
.stats-btn {
    flex: 1; background: var(--bg-card); border: none; padding: 12px;
    border-radius: var(--radius); box-shadow: var(--shadow);
    font-weight: bold; color: var(--c-accent); cursor: pointer;
    pointer-events: auto; z-index: 10;
}
.text-btn { background: none; border: none; text-decoration: underline; color: var(--c-sub); font-size: 0.9rem; cursor: pointer; }

/* OYUN EKRANI */
.game-header {
    height: 50px; display: flex; justify-content: space-between; align-items: center;
    padding: 0 15px; background: var(--bg-color); flex-shrink: 0;
    z-index: 50; position: relative;
}
.game-header-left { display: flex; align-items: center; gap: 10px; }
.game-logo-icon { color: var(--c-accent); display: flex; align-items: center; justify-content: center; }
.game-logo-img { height: 32px; width: auto; object-fit: contain; }

.game-stats { display: flex; gap: 8px; align-items: center; }
.g-stat {
    background: #ECE6D8; padding: 4px 10px; border-radius: 12px;
    font-size: 0.85rem; font-weight: bold; color: var(--c-text);
    display: flex; gap: 5px; align-items: center;
    font-variant-numeric: tabular-nums; /* Rakamlar oynama yapmaz */
    min-width: 80px; /* Sabit genişlik */
    justify-content: center;
}
.g-stat.score { min-width: auto; } /* Skor kutusu esnek kalsın */
.g-stat.ratios { min-width: auto; }
.g-stat.ratios { background: #ECE6D8; padding: 4px 12px; font-size: 0.95rem; gap: 12px; }
.ok { color: var(--c-correct); } .fail { color: var(--c-fail); }

.exit-btn {
    background: none; border: none; cursor: pointer; padding: 8px;
    display: flex; align-items: center; justify-content: center;
    pointer-events: auto; z-index: 100; position: relative;
}
/* SVG tıklamayı yutmasın */
.exit-btn svg { pointer-events: none; }

.progress-track { width: 100%; height: 4px; background: #E0E0E0; flex-shrink: 0; }
.progress-fill { width: 100%; height: 100%; background: var(--c-accent); transition: width 0.2s linear; }

/* JOKER BAR */
.joker-container {
    display: flex; justify-content: center; align-items: center; gap: 15px;
    padding: 10px 0; flex-shrink: 0;
}
.joker-wallet {
    background: rgba(0,0,0,0.05); padding: 5px 12px; border-radius: 20px;
    font-weight: bold; font-size: 0.9rem; color: #8D6E63; border: 1px solid #D7CCC8;
}
.joker-item {
    position: relative; width: 48px; height: 48px;
    border-radius: 14px; border: 2px solid #D7CCC8;
    background: white; color: var(--c-text);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.joker-item:active { transform: scale(0.95); }
.joker-item:disabled { opacity: 0.5; filter: grayscale(1); }
.joker-badge {
    position: absolute; top: -8px; right: -8px;
    background: var(--c-text); color: white;
    font-size: 0.65rem; padding: 2px 6px; border-radius: 10px;
    border: 2px solid white; font-weight: bold; pointer-events: none;
}
.joker-badge::after {
    content:''; position: absolute; bottom:-4px; left:4px;
    border-width: 4px 4px 0; border-style: solid;
    border-color: var(--c-text) transparent;
}

/* GRID ALANI */
/* --- GRID SİSTEMİ REVİZYONU (Solution 1: Elastic Grid) --- */

/* Grid Kapsayıcısı: Asla taşmaz, kaydırma çubuğu çıkmaz */
.grid-wrapper {
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    width: 100%; 
    overflow: hidden; /* Scroll yasak */
    padding: 10px 0; /* Üstten alttan az boşluk */
    /* Klavye ile Header arasındaki alanı doldurur */
}

/* Oyun Tahtası: Sabit oranlarda durur */
.game-grid {
    display: flex;           /* Grid yerine Flex kullanıyoruz (Dikey) */
    flex-direction: column;  /* Satırlar alt alta */
    gap: 5px;                /* Satır arası boşluk */
    
    width: 100%;
    height: 100%;            /* Wrapper'ın tamamını kullan */
    max-width: 350px;        /* Çok genişlemesin */
    
    /* Yükseklik Sınırı: Ekranın %50'sini geçmesin ki klavyeye yer kalsın */
    max-height: 55vh;        
    
    padding: 5px;
    box-sizing: border-box;
}

/* Satır: Esnek yapıda */
.row { 
    display: flex;           /* Harfler yan yana */
    flex: 1;                 /* Mevcut yüksekliği eşit paylaşın */
    gap: 5px;                /* Harf arası boşluk */
    justify-content: center; /* Ortala */
    
    /* reveal satırı kapalıyken yer kaplamasın */
    min-height: 0;           
}

/* Gizli Satır (Reveal) */
/* Gizli Satır Ayarı - REZERVE ALAN MANTIĞI */
.row.reveal { 
    display: flex !important; /* Her zaman flex olsun, yer kaplasın */
    visibility: hidden;       /* Ama görünmesin */
    opacity: 0;
}

/* Cevap açıldığında görünür olsun */
.row.reveal.show { 
    visibility: visible !important;
    opacity: 1;
}

/* Kutu (Tile): Büyüklüğü otomatik ayarlanır */
.tile {
    /* Sabit width/height SİLİNDİ. */
    width: auto;       /* Genişlik otomatik */
    height: 100%;      /* Satırın yüksekliği kadar ol */
    aspect-ratio: 1/1; /* Her zaman kare kal */
    
    /* Geri kalan stiller aynı */
    background: #fff; 
    border: 2px solid #D7CCC8; 
    border-radius: 6px;
    display: flex; 
    align-items: center; 
    justify-content: center;
    font-size: 1.5rem; /* Fontu biraz responsive yapmak gerekebilir ama şimdilik kalsın */
    font-weight: 800; 
    color: var(--c-text);
    user-select: none;
}

/* Küçük ekranlarda (iPhone SE vb) harfler taşmasın diye fontu kısalım */
@media (max-height: 600px) {
    .tile { font-size: 1.2rem; }
    .game-grid { max-height: 50vh; }
}
.tile.correct { background: var(--c-correct); color: white; border-color: var(--c-correct); }
.tile.present { background: var(--c-present); color: white; border-color: var(--c-present); }
.tile.absent { background: var(--c-absent); color: white; border-color: var(--c-absent); }
.tile.fail { background: #FFEBEE; border-color: var(--c-fail); }
.tile.hint { color: rgba(0,0,0,0.25); }
.tile.pop { animation: pop 0.1s; border-color: var(--c-text); }
.tile.dance { animation: pop 0.4s ease-in-out; }

/* KONTROLLER */
.controls-area {
    background: var(--bg-keyboard);
    padding: 10px 5px calc(10px + env(safe-area-inset-bottom)) 5px; 
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
    flex-shrink: 0; z-index: 100;
}
.action-row { display: flex; justify-content: center; gap: 15px; margin-bottom: 10px; }
.action-btn {
    border: none; padding: 8px 16px; border-radius: 20px;
    font-weight: bold; font-size: 0.9rem; cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); display: flex; align-items: center; gap: 5px;
}
.action-btn.pass { background: white; color: var(--c-accent); border: 2px solid var(--c-accent); }
.action-btn.enter { background: var(--c-text); color: white; border: 2px solid var(--c-text); }
.action-btn:active { transform: translateY(1px); }

/* Fiyat görünümlü PAS butonu için */
.btn-pass.premium-gold {
    background: #FFF9C4 !important; border-color: #FBC02D !important;
    color: #F57F17 !important;
}

.keyboard-box {
    display: flex; flex-direction: column; gap: 6px;
    width: 100%; max-width: 500px; margin: 0 auto;
}
.vk-row { display: flex; justify-content: center; gap: 4px; }
.vk-key {
    flex: 1; height: 46px; border-radius: 6px; border: none;
    background: #FFF; color: var(--c-text);
    font-size: 1.2rem; font-weight: bold;
    cursor: pointer; box-shadow: 0 2px 0 #D7CCC8;
    display: flex; align-items: center; justify-content: center;
}
.vk-key:active { background: #E0E0E0; transform: translateY(2px); box-shadow: none; }
.vk-key.action-key { flex: 1.5; background: #D7CCC8; }
.vk-key.correct { background: var(--c-correct); color: white; box-shadow: 0 2px 0 #388E3C; }
.vk-key.present { background: var(--c-present); color: white; box-shadow: 0 2px 0 #F9A825; }
.vk-key.absent { background: var(--c-absent); color: white; opacity: 0.6; box-shadow: 0 2px 0 #616161; }

/* MODAL / OYUN SONU */
.modal-backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 2000;
    display: flex; align-items: center; justify-content: center;
}
.modal-content {
    background: var(--bg-card); padding: 25px; border-radius: var(--radius);
    width: 85%; max-width: 320px; text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.modal-content.wide { max-width: 500px; }
.modal-opt {
    width: 100%; padding: 12px; margin-top: 10px;
    background: #F5F5F5; border: none; border-radius: 8px;
    font-weight: bold; color: var(--c-text); cursor: pointer;
}
.modal-opt.primary { background: var(--c-correct); color: white; }
.modal-opt.danger { background: var(--c-fail); color: white; }
.modal-close { background: #000000; border: 1px solid #000000; color: #ffffff; margin-top: 15px; padding: 8px 20px; border-radius: 20px; cursor: pointer; }

#endInfo {
    font-weight: 800; font-size: 1.2rem; margin: 15px 0;
    text-shadow: none !important; opacity: 1 !important;
}
/* Oyun Sonu Mesaj Renkleri - Temaya Göre Değişir */
.end-msg-win { 
    color: #2E7D32 !important; /* Gündüz: Koyu Yeşil */
    font-weight: 800;
}
.end-msg-fail { 
    color: #D32F2F !important; /* Gündüz: Koyu Kırmızı */
    font-weight: 800;
}

/* Gece Modu (Dark Mode) İçin Renkler */
[data-theme="dark"] .end-msg-win { 
    color: #81C784 !important; /* Gece: Açık Parlak Yeşil */
}
[data-theme="dark"] .end-msg-fail { 
    color: #E57373 !important; /* Gece: Açık Parlak Kırmızı */
}
#msg { height: 24px; color: var(--c-fail); font-weight: bold; font-size: 0.95rem; margin-top: 5px; text-align: center; }
#toast {
    position: fixed; bottom: 140px; left: 50%; transform: translateX(-50%);
    background: rgba(40,40,40,0.95); color: white;
    padding: 12px 24px; border-radius: 30px; z-index: 9999;
    opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
#toast.show { opacity: 1; }

/* SKOR TABLOSU PANELİ */
.score-panel {
    background: #FAF8F1; padding: 0; border-radius: 24px; overflow: hidden;
    width: 90%; max-width: 400px; height: 70vh; display: flex; flex-direction: column;
}
.panel-header {
    background: #fff; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #eee; flex-shrink: 0;
}
.panel-header h3 { margin: 0; color: #3E2723; font-size: 1.2rem; }
.icon-close { background: none; border: none; font-size: 1.5rem; color: #888; cursor: pointer; }
.tab-row { padding: 10px; display: flex; gap: 5px; justify-content: center; background: #fff; flex-shrink: 0; }
.tab-btn {
    flex: 1; padding: 8px; border: none; background: transparent; color: #8D6E63;
    font-weight: 600; border-bottom: 3px solid transparent; cursor: pointer; transition: all 0.2s;
}
.tab-btn.active { color: #3E2723; border-bottom-color: #3E2723; }

.sub-tabs { display: flex; justify-content: center; gap: 8px; padding-bottom: 10px; background: #fff; }
.chip-btn {
    padding: 4px 12px; border-radius: 12px; border: 1px solid #ddd;
    background: #fff; color: #666; font-size: 0.8rem; cursor: pointer;
}
.chip-btn.active { background: #3E2723; color: #fff; border-color: #3E2723; }

.table-container { flex: 1; overflow-y: auto; padding: 10px; background: #FAF8F1; }
.fancy-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
.fancy-table tbody tr { background: #FFFFFF; box-shadow: 0 2px 5px rgba(0,0,0,0.03); transition: transform 0.1s; }
.fancy-table tbody tr td { padding: 12px 10px; font-size: 0.95rem; color: #3E2723; font-weight: 600; }
.fancy-table tbody tr td:first-child { border-top-left-radius: 10px; border-bottom-left-radius: 10px; }
.fancy-table tbody tr td:last-child { border-top-right-radius: 10px; border-bottom-right-radius: 10px; }

.rank-badge {
    display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center;
    border-radius: 50%; font-size: 0.8rem; font-weight: bold; color: #555; background: #eee;
}
.rank-1 { background: #FFD700; color: #fff; box-shadow: 0 2px 5px rgba(255, 215, 0, 0.4); }
.rank-2 { background: #C0C0C0; color: #fff; }
.rank-3 { background: #CD7F32; color: #fff; }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; color: #aaa; text-align: center; }
.empty-state span { font-size: 1rem; margin-bottom: 1px; display: block; }
.spinner { width: 20px; height: 20px; border: 3px solid #ddd; border-top-color: #3E2723; border-radius: 50%; animation: spin 1s linear infinite; display: inline-block; margin-right: 5px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* PROFİL SAYFASI */
#screen-profile { justify-content: flex-start !important; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.profile-header-bar {
    flex-shrink: 0; width: 100%; z-index: 50; position: relative; padding: 15px;
    background: var(--bg-card); border-bottom: 1px solid rgba(0,0,0,0.1);
    color: var(--c-text); display: flex; justify-content: space-between; align-items: center;
}
.profile-header-bar h3 { margin: 0; color: var(--c-text); font-size: 1.2rem; }
.profile-content { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 20px; align-items: center; padding-bottom: 80px; width: 100%; }

.profile-card {
    background: #fff; width: 100%; max-width: 400px; border-radius: 20px; padding: 20px;
    box-shadow: 0 4px 15px rgba(62, 39, 35, 0.06); text-align: center;
}
.profile-card.hero { background: linear-gradient(135deg, #fff 0%, #FFF8E1 100%); border: 1px solid #FFE082; }

.avatar-container { width: 100px; height: 100px; margin: 0 auto 15px; position: relative; cursor: pointer; }
.avatar-container img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 4px solid #fff; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.edit-badge {
    position: absolute; bottom: 0; right: 0; background: #3E2723; color: #fff;
    width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 14px; border: 2px solid #fff;
}

.nick-row { display: flex; gap: 8px; justify-content: center; align-items: center; margin-bottom: 15px; }
#p-nick-edit { border: none; background: transparent; font-size: 1.2rem; font-weight: 800; color: #3E2723; text-align: center; width: 150px; }
#p-nick-edit:focus { outline: none; border-bottom: 2px solid #3E2723; }
.small-btn { font-size: 0.75rem; padding: 4px 10px; border-radius: 12px; border: 1px solid #ccc; background: #fff; cursor: pointer; }
.small-btn.primary { background: #4CAF50; color: #fff; border-color: #4CAF50; }

.rank-display { margin-top: 10px; width: 100%; }
#p-rank-name { font-weight: bold; color: #FF8F00; display: block; margin-bottom: 5px; }
.xp-bar-track { width: 100%; height: 8px; background: #eee; border-radius: 4px; overflow: hidden; margin-bottom: 5px; }
.xp-bar-fill { height: 100%; background: #FFB300; transition: width 0.3s; }
.xp-details { display: flex; justify-content: space-between; width: 100%; margin-top: 6px; font-size: 0.85rem; font-weight: 600; color: var(--c-sub); }
.xp-details b { font-weight: 800; color: var(--c-text); }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; max-width: 400px; }
.stat-box {
    background: #fff; padding: 15px; border-radius: 16px; display: flex; flex-direction: column; align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.stat-icon { font-size: 1.5rem; margin-bottom: 5px; }
.stat-val { font-size: 1.2rem; font-weight: 800; color: #3E2723; }
.stat-label { font-size: 0.8rem; color: #888; }

.badges-list-container { flex: 1; overflow-y: auto; padding: 15px; background: #FAF8F1; }
.badge-item {
    display: flex; align-items: center; gap: 15px; background: #fff; padding: 12px; margin-bottom: 10px;
    border-radius: 12px; box-shadow: 0 2px 5px rgba(0,0,0,0.03); opacity: 0.6; filter: grayscale(1); transition: all 0.3s;
}
.badge-item.unlocked { opacity: 1; filter: grayscale(0); border-left: 4px solid #4CAF50; }
.badge-icon { font-size: 2rem; }
.badge-info h4 { margin: 0 0 4px 0; color: #3E2723; font-size: 1rem; }
.badge-info p { margin: 0; color: #666; font-size: 0.8rem; line-height: 1.2; }

.avatar-selection-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-height: 300px; overflow-y: auto; padding: 10px; }
.avatar-selection-grid img { width: 100%; border-radius: 50%; cursor: pointer; border: 3px solid transparent; padding: 2px; }
.avatar-selection-grid img.active-selection { border-color: #4CAF50; background: #E8F5E9; transform: scale(1.05); }
.modal-actions { display: flex; gap: 10px; padding-top: 15px; border-top: 1px solid #eee; width: 100%; }

.panic-visual { background-color: #FFEBEE !important; color: #D32F2F !important; border: 1px solid #D32F2F !important; animation: pulse 1s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.7; } 100% { opacity: 1; } }

/* Bu kısmı CSS dosyanda güncelle */
.fly-coin {
    position: fixed;
    width: 30px;
    height: 30px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='14' fill='%23FFD700' stroke='%23DAA520' stroke-width='2'/%3E%3Ctext x='50%25' y='50%25' text-anchor='middle' dy='.3em' font-size='18' font-weight='bold' fill='%23B8860B'%3E%24%3C/text%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 2147483647; /* En yüksek katman */
    opacity: 0; 
}
.fly-coin::after { content: '$'; color: #F57F17; font-weight: 900; font-family: sans-serif; }
.wallet-pulse { animation: wallet-bump 0.3s ease-in-out; }
@keyframes wallet-bump { 0% { transform: scale(1); } 50% { transform: scale(1.3); color: #FFD700; } 100% { transform: scale(1); } }

/* ================= GECE MODU (TEK BLOK HALİNDE) ================= */
[data-theme="dark"] {
    --bg-color: #121212; --bg-card: #1E1E1E; --bg-keyboard: #2C2C2C;
    --c-text: #E0E0E0; --c-sub: #B0BEC5; --c-accent: #90CAF9;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
    --c-fail: #EF5350; --c-present: #FDD835; --c-correct: #66BB6A;
}

[data-theme="dark"] .mode-card, 
[data-theme="dark"] .profile-card, 
[data-theme="dark"] .score-panel, 
[data-theme="dark"] .panel-header, 
[data-theme="dark"] .sub-tabs, 
[data-theme="dark"] .chip-btn, 
[data-theme="dark"] .modal-content,
[data-theme="dark"] .profile-header-bar {
    background: var(--bg-card) !important; color: var(--c-text); border-color: #333;
}

[data-theme="dark"] .vk-key { background: #424242; color: #fff; box-shadow: 0 2px 0 #212121; }
[data-theme="dark"] .vk-key:active { background: #616161; }
[data-theme="dark"] .joker-item, [data-theme="dark"] .main-header, [data-theme="dark"] .game-header { background: #1E1E1E; border-color: #555; color: #fff; }

[data-theme="dark"] .fancy-table tbody tr { background: #252525; color: #E0E0E0; }
[data-theme="dark"] .fancy-table tbody tr td { color: #E0E0E0; }

[data-theme="dark"] h3, [data-theme="dark"] h2, [data-theme="dark"] .card-title { color: #E0E0E0 !important; }
[data-theme="dark"] .icon-btn { color: #E0E0E0; }

[data-theme="dark"] .modal-opt { background-color: #313030 !important; color: #FFFFFF !important; border: 1px solid #ffffff !important; }
[data-theme="dark"] .modal-opt.primary { background-color: var(--c-correct) !important; }
[data-theme="dark"].modal-close { background: transparent; border: 1px solid #000000; color: #ffffff; margin-top: 15px; padding: 8px 20px; border-radius: 20px; cursor: pointer; }

/* Oyun Izgarası Dark */
[data-theme="dark"] .tile { background-color: #252525 !important; border-color: #3e3e3e !important; color: #ffffff !important; }
[data-theme="dark"] .tile.correct { background-color: var(--c-correct) !important; border-color: var(--c-correct) !important; }
[data-theme="dark"] .tile.present { background-color: var(--c-present) !important; border-color: var(--c-present) !important; color: #3E2723 !important; }
[data-theme="dark"] .tile.absent { background-color: var(--c-absent) !important; border-color: var(--c-absent) !important; }
[data-theme="dark"] .tile.fail { background-color: #4a1818 !important; border-color: var(--c-fail) !important; }

[data-theme="dark"] .g-stat, [data-theme="dark"] .stat-pill { background-color: #2C2C2C !important; color: #E0E0E0 !important; }
[data-theme="dark"] .stat-box { background-color: #1E1E1E !important; box-shadow: 0 2px 8px rgba(0,0,0,0.5); }
[data-theme="dark"] .stat-label, [data-theme="dark"] .xp-details { color: #aaa !important; }
[data-theme="dark"] .stat-val, [data-theme="dark"] .xp-details b { color: #FFFFFF !important; text-shadow: 0 0 10px rgba(255, 255, 255, 0.15); }
[data-theme="dark"] input { color: #fff !important; }

[data-theme="dark"] .action-btn {
    background-color: #2C2C2C !important; color: #E0E0E0 !important;
    border: 2px solid #555 !important; box-shadow: 0 4px 0 #151515 !important;
}
[data-theme="dark"] .action-btn.enter { background-color: #1B5E20 !important; border-color: #2E7D32 !important; color: #FFF !important; }
[data-theme="dark"] .joker-badge { background-color: #FF5252 !important; color: #FFFFFF !important; font-weight: 700 !important; }

/* KESİN GÖRÜNÜRLÜK (HTML'den bağımsız) */
#btnAddTime { display: flex !important; opacity: 1 !important; visibility: visible !important; }
#progressWrap { display: none !important; }
/* ================================================= */
/* GECE MODU: ROZETLER VE LİSTE DÜZELTMESİ */
/* ================================================= */

/* Listenin arka planını koyulaştır */
[data-theme="dark"] .badges-list-container {
    background-color: #121212 !important; /* Ana koyu zemin */
}

/* Her bir rozet kartını koyulaştır */
[data-theme="dark"] .badge-item {
    background-color: #1E1E1E !important; /* Kart zemini */
    border: 1px solid #333 !important;    /* Hafif çerçeve */
    box-shadow: 0 2px 5px rgba(0,0,0,0.5) !important;
}

/* Kartın içindeki Başlık (Örn: İlk Adım) */
[data-theme="dark"] .badge-info h4 {
    color: #FFFFFF !important;
}

/* Kartın içindeki Açıklama metni */
[data-theme="dark"] .badge-info p {
    color: #B0BEC5 !important; /* Okunabilir gri */
}

/* Eğer henüz kazanılmamışsa (kilitliyse) daha soluk yap */
[data-theme="dark"] .badge-item:not(.unlocked) {
    background-color: #1a1a1a !important;
    opacity: 0.5 !important;
}
/* EKLENECEK CSS KODLARI - STYLE.CSS EN ALTI */

/* 1. Loading ekranını en üste garanti alalım */
#loading-screen {
    z-index: 2147483647 !important; /* Maksimum değer */
}

/* 2. Puanlar Tablosu Gece Modu Düzeltmesi */
[data-theme="dark"] .table-container,
[data-theme="dark"] .score-panel, 
[data-theme="dark"] .panel-header, 
[data-theme="dark"] .tab-row, 
[data-theme="dark"] .sub-tabs {
    background-color: #1E1E1E !important; /* Koyu gri */
    border-color: #333 !important;
    color: #E0E0E0 !important;
}

/* Tablo satırları gece modu */
[data-theme="dark"] .fancy-table tbody tr {
    background-color: #2C2C2C !important;
    color: #FFF !important;
}

/* Tab butonları gece modu */
[data-theme="dark"] .tab-btn {
    color: #888 !important;
}
[data-theme="dark"] .tab-btn.active {
    color: #FFF !important;
    border-bottom-color: #FFF !important;
}
[data-theme="dark"] .main-title {
    background: linear-gradient(45deg, #FFF, #CCC) !important;
    -webkit-background-clip: text !important;
     background-clip: text !important; /* <-- BU EKLENDİ */
    -webkit-text-fill-color: transparent !important;
}
/* --- KLAVYE DÜZELTMELERİ (HİSSİYAT VE RENK) --- */
.vk-key {
    transition: transform 0.1s, background-color 0.2s; /* Yumuşak geçiş */
    box-shadow: 0 4px 0 rgba(0,0,0,0.2); /* Tuşun altındaki gölge (3D hissi) */
    position: relative;
    top: 0;
}

/* Tıklanınca tuşun içeri göçmesi */
.vk-key:active {
    transform: translateY(4px) !important; /* Aşağı it */
    box-shadow: 0 0 0 rgba(0,0,0,0) !important; /* Gölgeyi yok et */
}

/* Klavye Renkleri - Gece Modunu EZECEK Şekilde */
.vk-key.correct { 
    background-color: #4CAF50 !important; 
    color: white !important; 
    border-color: #4CAF50 !important;
    box-shadow: 0 4px 0 #2E7D32 !important; /* Yeşil gölge */
}
.vk-key.present { 
    background-color: #FBC02D !important; 
    color: black !important; /* Sarı üstüne siyah yazı daha okunur */
    border-color: #FBC02D !important;
    box-shadow: 0 4px 0 #F57F17 !important;
}
.vk-key.absent { 
    background-color: #3e3e3e !important; 
    color: #888 !important; 
    opacity: 0.6 !important;
    box-shadow: none !important;
}

/* --- LOADING EKRANI DÜZELTMESİ --- */
#loading-screen {
    z-index: 99999 !important;
    opacity: 1;
    transition: opacity 0.5s ease-out; /* Kaybolurken yavaşça sön */
}
#loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}
/* ================= GHOST İLK HARF STİLİ ================= */

/* Genel ghost görünümü (üst grid + alt satır) */
.tile.ghost {
    opacity: 0.45;                            /* Silik dursun */
    font-weight: 600;                         /* Normalden biraz daha hafif */
    color: var(--c-text);                     /* Aynı yazı rengi */
    background: #FFFFFF;                      /* Normal kutu gibi */
    border-color: #D7CCC8;                    /* Normal kutu çerçevesi */
    box-shadow: none;                         /* Parlama olmasın */
    transform: none !important;
    text-shadow: none !important;
}

/* Yeri bilinen ve doğru yerde olan ghost (aşağıdaki satırda) */
.tile.ghost.correct {
    background: rgba(76, 175, 80, 0.14);      /* Çok hafif yeşil zemin */
    border-color: var(--c-correct);           /* Yeşil çerçeve */
    color: #2E7D32;                           /* Koyu yeşil yazı */
}

/* Dark mode için ghost */
[data-theme="dark"] .tile.ghost {
    background: #252525 !important;
    border-color: #3e3e3e !important;
    color: #E0E0E0 !important;
    opacity: 0.5 !important;
}

[data-theme="dark"] .tile.ghost.correct {
    background: rgba(102, 187, 106, 0.2) !important;
    border-color: var(--c-correct) !important;
    color: #C8E6C9 !important;
}

/* POP efekti: kullanıcı gerçekten bir harf girdiğinde */
.tile.pop {
    animation: pop 0.1s;
    border-color: var(--c-text);
    opacity: 1 !important;
    font-weight: 800 !important;  /* Artık gerçek giriş gibi kalın */
}
/* Coin Animasyonu İçin - Bunu CSS'in En Altına Koy */
.fly-coin {
    position: fixed;
    width: 30px;
    height: 30px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='14' fill='%23FFD700' stroke='%23DAA520' stroke-width='2'/%3E%3Ctext x='50%25' y='50%25' text-anchor='middle' dy='.3em' font-size='18' font-weight='bold' fill='%23B8860B'%3E%24%3C/text%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 2147483647 !important; /* Her şeyin üstünde olsun */
    opacity: 0;
}
.header-container {
    padding-right: 20px; /* Sağ taraftan 20px boşluk bırakır */
    /* Eğer width: 100% kullanıyorsan taşmayı önlemek için şunu da ekle: */
    box-sizing: border-box; 
}
/* ============================
   NASIL OYNANIR EKRANI
   ============================ */

.rules-wrapper {
  max-width: 380px;
  margin: 12px auto;
  padding: 18px 16px 20px;
  background: var(--bg-card, #ffffff);         /* 🔹 Light/Dark temaya göre değişecek */
  color: var(--c-text, #222222);               /* 🔹 Temaya göre metin rengi */
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.12);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-sizing: border-box;
}
.btn-rules-back-top {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.4);
  background: rgba(0,0,0,0.06);
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
}

.btn-rules-back-top:hover {
  background: rgba(0,0,0,0.12);
}

/* Dark mode’da tersini yapalım: daha açık */
body[data-theme="dark"] .btn-rules-back-top {
  border-color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.08);
}

body[data-theme="dark"] .btn-rules-back-top:hover {
  background: rgba(255,255,255,0.14);
}

.rules-wrapper::-webkit-scrollbar {
  width: 6px;
}

.rules-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.rules-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
}


.rules-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.rules-sub {
  font-size: 0.9rem;
  opacity: 0.8;
  line-height: 1.4;
  margin-bottom: 16px;
}

/* Renk açıklamaları */
.rules-legend {
  margin-bottom: 16px;
  border-radius: 14px;
  padding: 10px 10px 6px;
  background: rgba(0,0,0,0.02);
  border: 1px solid rgba(0,0,0,0.06);
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.legend-tile {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  background: rgba(255,255,255,0.03);
}

.tile-correct {
  background: var(--c-correct, #4CAF50);
  border-color: rgba(0,0,0,0.4);
  color: #fff;
}

.tile-present {
  background: var(--c-present, #FBC02D);
  border-color: rgba(0,0,0,0.4);
  color: #3a2b00;
}

.tile-absent {
  background: var(--c-absent, #9E9E9E);
  border-color: rgba(0,0,0,0.4);
  color: #111;
}

.legend-text {
  font-size: 0.9rem;
  line-height: 1.3;
}

/* Örnek satır */
.rules-example {
  margin-bottom: 18px;
}

.example-label {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-bottom: 6px;
}

.example-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.rules-example-text {
  font-size: 0.8rem;
  opacity: 0.8;
  line-height: 1.3;
}

/* Adım adım */
.rules-steps {
  margin-bottom: 18px;
}

.rules-steps h3 {
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.rules-steps ol {
  padding-left: 18px;
  margin: 0;
}

.rules-steps li {
  font-size: 0.85rem;
  line-height: 1.4;
  margin-bottom: 4px;
}

/* Geri dön butonu */
.btn-rules-back {
  width: 100%;
  margin-top: 8px;
  padding: 10px 0;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.65);
  background: #111111;              /* 🔹 LIGHT MODE: koyu buton */
  color: #fdfaf4;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease,
              transform 0.1s ease, box-shadow 0.15s ease;
}

.btn-rules-back:hover {
  background: #000000;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
}

.btn-rules-back:active {
  transform: scale(0.97);
}

/* DARK MODE: arka plan siyahken buton açık renk */
body[data-theme="dark"] .btn-rules-back {
  background: #f5f2e9;
  color: #3E2723;
  border-color: rgba(255,255,255,0.55);
}

body[data-theme="dark"] .btn-rules-back:hover {
  background: #fffaf0;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.25);
}


.btn-rules-back:hover {
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.12);
}

.btn-rules-back:active {
  transform: scale(0.97);
}
/* Ek bilgi bölümleri (Jokerler & Modlar) */
.rules-section {
  margin-bottom: 18px;
}

.rules-section h3 {
  font-size: 0.95rem;
  margin-bottom: 8px;
}

/* Joker satırları */
.rules-chip-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rules-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(0,0,0,0.02);
  border: 1px solid rgba(0,0,0,0.06);
}

.chip-emoji {
  font-size: 1.2rem;
  width: 26px;
  text-align: center;
}

.chip-text {
  display: flex;
  flex-direction: column;
  font-size: 0.82rem;
  line-height: 1.3;
}

.chip-text strong {
  font-size: 0.86rem;
}

/* Mod kartları */
.rules-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.rules-card {
  padding: 10px 10px 9px;
  border-radius: 14px;
  background: rgba(0,0,0,0.02);
  border: 1px solid rgba(0,0,0,0.06);
  font-size: 0.82rem;
  line-height: 1.35;
}

.rules-card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.rules-card-title span {
  font-size: 1.1rem;
}

.rules-card-title strong {
  font-size: 0.9rem;
}

/* Biraz daha geniş ekranlarda kartları yan yana yapalım */
@media (min-width: 480px) {
  .rules-card-grid {
    grid-template-columns: 1fr 1fr;
  }
}
body[data-theme="dark"] .rules-wrapper {
  background: var(--bg-dark, #151515);
  color: var(--txt, #f5f5f5);
  box-shadow: 0 18px 40px rgba(0,0,0,0.55);
}

body[data-theme="dark"] .rules-legend,
body[data-theme="dark"] .rules-chip,
body[data-theme="dark"] .rules-card {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.10);
}
/* Oyun Sonu Açıklama Yazısı (Ah be... yazısı) */
.reason-text {
    font-size: 1.1rem;
    margin-top: 12px;
    font-weight: 800;
    color: #D32F2F !important; /* Gündüz: Koyu Kırmızı (Okunur) */
    opacity: 1;
}

/* Gece Modunda Açık Renk Olsun */
[data-theme="dark"] .reason-text {
    color: #E57373 !important; /* Gece: Açık Kırmızı */
}
/* --- YENİ OYUN DÜZENİ (Referans Görsel Tarzı) --- */

/* 1. Header Düzenlemesi */
.game-header {
    justify-content: space-between;
    padding: 0 10px;
    height: 50px;
}
.game-stats-center {
    display: flex;
    gap: 10px;
    align-items: center;
    flex: 1;
    justify-content: center;
}

/* 2. Grid (6 Satırlık Yer Tutucu) */
.game-grid {
    /* 6 satıra göre hesapla ama esnek olsun */
    max-height: 50vh; 
    /* Kutular arası boşluk */
    gap: 6px; 
}
/* Satırlar her zaman eşit yükseklikte */
.row { flex: 1; }

/* 3. Klavye (Biraz yukarı çekelim) */
.keyboard-box {
    margin-bottom: 10px;
    padding: 0 5px;
}

/* 4. BOTTOM ACTION BAR (En Önemli Kısım) */
.bottom-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    gap: 10px;
    background: transparent;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

/* Yuvarlak Butonlar (Jokerler ve Pas) */
.round-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 0 rgba(0,0,0,0.2);
    transition: transform 0.1s;
    position: relative;
}
.round-btn:active {
    transform: translateY(4px);
    box-shadow: none;
}

/* Sol Taraftaki Joker Grubu */
.left-actions {
    display: flex;
    gap: 8px;
}
.joker-btn {
    background-color: #FFB74D; /* Turuncu tonu */
    color: white;
}
.joker-btn .price-badge {
    position: absolute;
    bottom: -6px;
    right: -6px;
    background: #3E2723;
    color: #fff;
    font-size: 9px;
    padding: 2px 4px;
    border-radius: 6px;
    font-weight: bold;
}

/* Orta Büyük Submit Butonu */
.big-submit-btn {
    flex: 1; /* Kalan boşluğu doldur */
    height: 50px;
    background-color: #64B5F6; /* Mavi tonu */
    color: white;
    border: none;
    border-radius: 25px; /* Tam oval */
    font-size: 1.1rem;
    font-weight: 900;
    box-shadow: 0 5px 0 #1976D2;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.big-submit-btn:active {
    transform: translateY(5px);
    box-shadow: none;
}

/* Sağdaki Pas Butonu */
.pass-btn {
    background-color: #4DB6AC; /* Teal tonu */
    color: white;
}

/* 5. REKLAM ALANI */
.ad-banner {
    height: 50px; /* Standart banner yüksekliği */
    width: 100%;
    background-color: #333;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    flex-shrink: 0; /* Asla küçülmesin */
    margin-top: auto; /* En alta it */
}

/* Küçük ekran düzeltmesi */
@media (max-height: 650px) {
    .game-grid { max-height: 40vh; }
    .round-btn { width: 40px; height: 40px; font-size: 1rem; }
    .big-submit-btn { height: 42px; font-size: 1rem; }
    .ad-banner { height: 40px; }
}
/* --- DÜZELTMELER: JOKER BOYUTU VE MESAJ GİZLEME --- */

/* 1. Mesaj Alanını Tamamen Yok Et */
#msg {
    display: none !important; /* Görünmez yapar ve yer kaplamaz */
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
}

/* 2. Joker Butonlarını Küçült ve Kibarlaştır */
.bottom-action-bar {
    padding: 5px 15px; /* Üst/alt boşluğu biraz kıstık */
    gap: 8px;
}

.left-actions {
    gap: 6px; /* Jokerler arası boşluk */
}

.round-btn {
    width: 40px !important;  /* Çapı 48px'ten 40px'e düşürdük */
    height: 40px !important;
    font-size: 1.1rem !important; /* İkonu da hafif küçülttük */
    border-radius: 50%;
    flex-shrink: 0; /* Asla sıkışmasınlar */
}

/* Jokerlerdeki Fiyat Etiketini Ayarla */
.joker-btn .price-badge {
    font-size: 8px !important;
    padding: 1px 3px !important;
    bottom: -4px !important;
    right: -4px !important;
    border-radius: 4px !important;
}

/* Gönder Butonu Ayarı (Daha orantılı olsun) */
.big-submit-btn {
    height: 44px !important; /* Jokerlerle uyumlu yükseklik */
    font-size: 1rem !important;
    border-radius: 22px !important;
}

/* Pas Butonu (Kapsül şeklinde kalsın istiyorsan) */
.pass-btn {
    width: auto !important; /* Yuvarlak değil geniş olsun */
    padding: 0 15px !important;
    height: 40px !important;
    border-radius: 20px !important; /* Kapsül şekli */
    font-size: 0.9rem !important;
    font-weight: bold;
    display: flex;
    gap: 5px;
}
/* --- KÜÇÜK EKRANLAR İÇİN ACTION BAR DÜZENLEMESİ --- */

.bottom-action-bar {
    display: flex;
    flex-wrap: nowrap; /* Asla alt satıra inme */
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 5px 8px; /* Kenar boşluklarını azalttık */
    gap: 0; /* Elemanlar arası boşluğu manuel yöneteceğiz */
    box-sizing: border-box;
}

/* 1. SOL GRUP (Jokerler) */
.left-actions {
    display: flex;
    gap: 4px; /* Jokerler birbirine yakınlaşsın */
    flex: 0 0 auto; /* Genişliği içeriği kadar olsun, büzüşmesin */
    margin-right: 5px;
}

/* 2. ORTA GRUP (Gönder Butonu) */
#enterBtn.big-submit-btn {
    flex: 1; /* Kalan tüm boşluğu bu doldursun (Ortalar) */
    width: auto; /* Sabit genişlik iptal */
    min-width: 80px; /* Çok da küçülmesin */
    margin: 0 5px; /* Sağdan soldan hafif boşluk */
    white-space: nowrap; /* Yazı taşmasın */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 3. SAĞ GRUP (Pas Butonu) */
#passBtn.pass-btn {
    flex: 0 0 auto; /* İçeriği kadar yer kaplasın */
    margin-left: 5px;
    white-space: nowrap;
}

/* --- TELEFONLARA ÖZEL HASSAS AYAR (Responsive) --- */
@media (max-width: 380px) {
    /* Çok küçük ekranlarda (iPhone SE, S8 vb.) */
    
    /* Joker butonlarını biraz daha ufalt */
    .round-btn {
        width: 36px !important;
        height: 36px !important;
        font-size: 1rem !important;
    }
    
    /* Pas butonu içindeki yazıyı küçült */
    .pass-btn {
        height: 36px !important;
        padding: 0 10px !important;
        font-size: 0.8rem !important;
    }
    
    /* Gönder butonu yazı boyutu ve yüksekliği */
    #enterBtn.big-submit-btn {
        height: 40px !important;
        font-size: 0.95rem !important;
    }
    
    /* Joker fiyat etiketlerini mikroskopik yap */
    .joker-btn .price-badge {
        font-size: 8px !important;
        padding: 1px 2px !important;
        right: -2px !important;
    }
}
/* --- YENİ EKLENTİLER --- */

/* 1. Oyun İçi Cüzdan Stili */
.g-stat.wallet {
    background: #FFF8E1; /* Altın sarısımsı zemin */
    color: #F57F17;      /* Koyu turuncu yazı */
    border: 1px solid #FFE082;
    min-width: auto;     /* İçeriğe göre uzasın */
    padding: 4px 12px;
}

/* Gece Modunda Cüzdan */
[data-theme="dark"] .g-stat.wallet {
    background: #3E2723 !important;
    color: #FFD700 !important;
    border-color: #5D4037 !important;
}

/* 2. HARCAMA ANİMASYONU (Floating Text) - OKUNABİLİRLİK */
.floating-cost {
    position: fixed;
    font-size: 1.5rem;       /* Yazıyı büyüttük */
    font-weight: 900;        /* Kalınlaştırdık */
    color: #D32F2F;          /* Parlak Kırmızı */
    text-shadow: 
        -1px -1px 0 #fff,  
        1px -1px 0 #fff,
        -1px 1px 0 #fff,
        1px 1px 0 #fff;      /* Beyaz dış kontur (Outline) sayesinde her zeminde okunur */
    pointer-events: none;
    z-index: 99999;
    animation: floatDownFade 1s forwards; /* Aşağı doğru süzülme */
}

/* Aşağı doğru düşüp kaybolma animasyonu */
@keyframes floatDownFade {
    0% {
        opacity: 1;
        transform: translate(-50%, -100%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, 50px) scale(0.8); /* 50px aşağı iner */
    }
}

/* Gece Modunda Outline Siyah Olsun (Göz almasın) */
[data-theme="dark"] .floating-cost {
    color: #FF5252;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
/* Pasif harfler (Q, W, X) için stil */
.vk-key.passive-key {
    opacity: 0.25 !important;
    background-color: rgba(0,0,0,0.1) !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    border-color: transparent !important;
}

/* Gece modu için uyumluluk */
[data-theme="dark"] .vk-key.passive-key {
    background-color: rgba(255,255,255,0.05) !important;
}
/* --- GECE MODU: MODAL BUTON RENKLERİ --- */

/* Çıkış Onay Modalı (Exit Confirm Backdrop) */
[data-theme="dark"] #btn-exit-yes {
    background-color: #c62828 !important; /* Koyu Kırmızı - Evet/Çıkış */
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(198, 40, 40, 0.4);
}

[data-theme="dark"] #btn-exit-no {
    background-color: #2E7D32 !important; /* Koyu Yeşil - Hayır/İptal */
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.4);
}

/* Diğer Onay Modalları (Custom Confirm Modal - Yeni yaptığımız) */
[data-theme="dark"] #custom-confirm-modal #btn-confirm-yes {
    background-color: #2E7D32 !important; /* Koyu Yeşil - Başlat/Onayla */
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.4);
}

[data-theme="dark"] #custom-confirm-modal #btn-confirm-no {
    background-color: #424242 !important; /* Koyu Gri - İptal */
    color: #e0e0e0 !important;
}
/* --- GECE MODU TAB DÜZELTMESİ --- */

/* Tab Butonları (Puanlarım, Global Skorlar vb.) */
[data-theme="dark"] .tab-btn {
    color: #888; /* Pasifken gri olsun */
    background: transparent;
}

/* Seçili Olan Tab (Aktif) */
[data-theme="dark"] .tab-btn.active {
    color: #fff !important; /* Seçiliyken BEYAZ olsun */
    border-bottom: 2px solid #4CAF50; /* Altında yeşil çizgi */
    background: rgba(255, 255, 255, 0.05); /* Hafif bir arka plan */
}

/* Alt Seçenekler (4 Harf, 5 Harf, Kolay, Zor vb. - Chip Butonlar) */
[data-theme="dark"] .chip-btn {
    background-color: #333;
    color: #ccc;
    border: 1px solid #444;
}

[data-theme="dark"] .chip-btn.active {
    background-color: #ffffff !important; /* Seçiliyken Yeşil */
    color: #000000 !important;
    border-color: #ffffff !important;
}
.round-btn.pass-paid {
    background-color: #FFB300; /* Pas butonu rengi */
    color: white;
    border: none;
    box-shadow: 0 4px 0 rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.round-btn.pass-paid:active {
    transform: translateY(4px);
    box-shadow: none;
}

/* Küçük butonun üzerindeki fiyat etiketi (Siyah/Kahverengi kutucuk) */
.round-btn .price-badge {
    position: absolute;
    bottom: -6px;
    right: -6px;
    background: #3E2723; /* Soldaki ikonlarla aynı koyu arka plan */
    color: #fff;
    font-size: 9px;
    padding: 2px 5px;
    border-radius: 6px;
    font-weight: bold;
    border: 2px solid #fff; /* Etrafında beyaz kontur olsun */
    line-height: 1;
    z-index: 10;
}

/* Gece modu uyumu */
[data-theme="dark"] .round-btn .price-badge {
    border-color: #333; /* Gece modunda kontur koyu olsun */
}
/* Ayarlar Kartı */
.settings-card {
    background: var(--bg-panel, #fff);
    padding: 25px;
    border-radius: 20px;
    width: 90%;
    max-width: 360px;
    text-align: center;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

/* Menü Öğeleri */
.settings-menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%; /* Kutunun tamamını kaplasın */
}

.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between; /* İkonu sola, Oku sağa iter */
    width: 100%; /* Buton genişliği ful olsun */
    
    /* Görsel Makyaj */
    background: var(--bg-main, #f9f9f9);
    border: 1px solid #e0e0e0;
    padding: 15px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-main, #333);
    transition: all 0.2s;
    font-family: inherit; /* Fontun bozulmaması için */
}

.menu-item:active {
    transform: scale(0.98);
    background: #e8e8e8;
}
.menu-item .icon {
    font-size: 1.3rem;
    width: 30px;        /* İkonların genişliği sabit olsun ki hizalar kaymasın */
    text-align: center;
}

.menu-item .text {
    flex: 1;            /* KRİTİK NOKTA: Kalan tüm boşluğu yazı kaplasın */
    text-align: left;   /* Yazıyı sola yasla */
    padding-left: 15px; /* İkonla yazı arasına boşluk */
    font-weight: 600;
}

.menu-item .arrow {
    font-size: 1.4rem;
    color: #bbb;
    font-weight: bold;
}
/* Uzun Metinler İçin Kaydırma Kutusu */
.scroll-box {
    max-height: 250px;       /* Yükseklik sınırı */
    overflow-y: auto;        /* Dikey kaydırma */
    text-align: left;        /* Sola yasla */
    background: #fdfdfd;
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #555;
}

/* Gece Modu Desteği */
[data-theme="dark"] .settings-card { background: #222; color: #fff; }
[data-theme="dark"] .menu-item { background: #333; border-color: #444; color: #eee; }
[data-theme="dark"] .scroll-box { background: #333; border-color: #444; color: #ccc; }
/* 1. Header'ı Tek Satıra Sabitleme */
#info-bar, .header-bar {
    display: flex !important;
    flex-wrap: nowrap !important; /* Asla alt satıra geçme */
    align-items: center;
    justify-content: space-between;
    white-space: nowrap; /* Metinlerin kaymasını engelle */
    overflow-x: auto; /* Çok daralırsa kaydırılabilir olsun ama patlamasın */
    overflow-y: hidden;
    padding: 10px 5px;
    gap: 5px;
}

/* Küçük ekranlarda badge içindeki yazıları biraz küçült */
@media (max-width: 380px) {
    .stat-badge {
        font-size: 0.85rem !important;
        padding: 4px 8px !important;
    }
}

/* 2. Joker Butonlarının Eşit Görünmesi (Disabled Durumu) */
/* Tüm joker butonlarını hedefliyoruz */
#info-left-group button:disabled,
.joker-btn:disabled,
#btnAddTime:disabled,
#btnHint:disabled,
#btnLife:disabled {
    opacity: 0.5 !important;
    filter: grayscale(100%) !important;
    background-color: rgba(255, 255, 255, 0.1) !important; /* Hepsine aynı şeffaf zemin */
    border: 1px solid rgba(255, 255, 255, 0.1) !important; /* Hepsine aynı silik çerçeve */
    color: #aaa !important;
    box-shadow: none !important;
    transform: none !important;
    cursor: not-allowed;
}

/* Aktif halleri için de standart (Zaten varsa gerek yok ama garanti olsun) */
#info-left-group button, .joker-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Yuvarlak butonlar için */
    border-radius: 50%; 
    width: 45px;
    height: 45px;
    padding: 0;
}
/* --- 1. HEADER (Üst Bilgi Çubuğu) SABİTLEME --- */
#info-bar, .header-bar {
    display: flex !important;
    flex-wrap: nowrap !important; /* Asla alt satıra inme */
    align-items: center;
    justify-content: space-between;
    white-space: nowrap !important; /* Yazıların kaymasını engelle */
    overflow: hidden; /* Taşarsa gizle (veya overflow-x: auto ile kaydırılabilir yap) */
    width: 100%;
    box-sizing: border-box;
    padding: 10px 5px;
}

/* Mobilde yazı boyutunu biraz küçültüp sığmasını garantile */
@media (max-width: 380px) {
    #info-bar span, .stat-badge {
        font-size: 0.8rem !important;
        padding: 4px 6px !important;
    }
}
/* --- 1. PROFİL EKRANI KAYDIRMAYI KAPAT --- */
#screen-profile {
    overflow: hidden !important; /* Kaydırmayı engelle */
    height: 100dvh;
    display: flex;
    flex-direction: column;
}

.profile-content {
    /* İçerik ortalansın ve sığsın */
    justify-content: flex-start;
    padding-bottom: 20px;
}

/* --- 2. AYARLAR İÇİN TOGGLE SWITCH (Aç/Kapa Butonu) --- */
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-main, #f9f9f9);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-main, #333);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider { background-color: #4CAF50; }
input:checked + .slider:before { transform: translateX(22px); }

/* Gece Modu Uyumu */
[data-theme="dark"] .setting-row { background: #333; border-color: #444; color: #eee; }
/* --- HEADER HİZALAMA DÜZELTMESİ --- */

/* 1. Header'ın kendisini dikeyde ortala */
.game-header {
    display: flex;
    align-items: center; /* Dikey ortalama */
    height: 50px; /* Header yüksekliğini sabitle */
    overflow: hidden; /* Dışarı taşanları gizle */
}

/* 2. Ortadaki istatistik grubunu hizala */
.game-stats-center {
    display: flex;
    align-items: center; /* Kutuları dikeyde ortala */
    justify-content: center;
    gap: 8px;
    height: 100%;
}

/* 3. Tüm kutucukları (Altın, Süre, Puan, Can) eşitle */
.g-stat {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px !important; /* Hepsine AYNI yüksekliği ver */
    padding: 0 12px !important; /* İç boşluğu sabitle */
    border-radius: 16px; /* Yuvarlaklık */
    font-size: 0.85rem !important; /* Yazı boyutu taşmasın */
    line-height: 1; /* Satır yüksekliğini sıkılaştır */
    white-space: nowrap; /* Yazının asla alt satıra inmemesini sağla */
    
    /* Eğer flex bozulursa diye boyutları sabitle */
    flex-shrink: 0; 
    box-sizing: border-box;
}

/* 4. Cüzdan kutusu için özel ayar (Rengi kalsın ama boyutu uysun) */
.g-stat.wallet {
    min-width: auto; /* Gereksiz genişlemeyi önle */
    /* Diğer g-stat ayarları zaten yukarıdan miras alacak */
}
/* --- AVATAR KUTUSUNU DİKEY UZATMA (4 SÜTUN) --- */

/* 1. Izgara Ayarları */
.avatar-selection-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important; /* Her satırda 4 tane */
    gap: 12px !important;         /* Aralarındaki boşluk */
    
    /* Yükseklik sınırını KALDIRIYORUZ, içeriğe göre uzayacak */
    max-height: none !important; 
    height: auto !important;
    overflow: visible !important; /* İç scroll'u kapat */
    
    padding: 10px 5px !important;
}

/* 2. Resim Boyutları */
.avatar-selection-grid img {
    width: 55px !important;  /* Boyutları netleştirdik */
    height: 55px !important;
    margin: 0 auto !important; /* Hücre içinde ortala */
}

/* 3. Beyaz Kutunun (Modal) Kendisi */
/* İçerik uzadıkça beyaz kutu da aşağı doğru uzasın */
#avatar-modal .modal-content {
    height: auto !important;       /* Otomatik yükseklik */
    max-height: 85vh !important;   /* Ekranın %85'ini geçmesin (butonlar kaybolmasın diye) */
    overflow-y: auto !important;   /* Eğer ekran çok küçükse tüm kutu kaydırılabilsin */
    display: flex;
    flex-direction: column;
}