/* ============================================================
   style.css — MATH-OP
   Kahoot tarzı, canlı ve enerjik tasarım
   Akıllı tahta + mobil uyumlu
   ============================================================ */

/* ---------- RESET & TEMEL DEĞİŞKENLER ---------- */
:root {
    /* Kahoot Renk Paleti */
    --c-red:       #E21B3C;
    --c-blue:      #1368CE;
    --c-yellow:    #D89E00;
    --c-green:     #26890C;

    /* Türetilmiş renkler */
    --c-red-l:     #FF3355;
    --c-blue-l:    #2B7FE0;
    --c-yellow-l:  #F5B800;
    --c-green-l:   #32A80F;
    --c-red-bg:    #FDE8EC;
    --c-blue-bg:   #E8F0FD;
    --c-yellow-bg: #FDF5E0;
    --c-green-bg:  #E8F5E4;

    /* Genel renkler */
    --c-primary:   var(--c-blue);
    --c-primary-l: var(--c-blue-l);
    --c-gold:      var(--c-yellow);
    --c-gold-d:    #B8860B;
    --c-success:   var(--c-green);
    --c-danger:    var(--c-red);
    --c-bg:        #F4F7F6;
    --c-surface:   #ffffff;
    --c-border:    #D0D8D5;
    --c-text:      #1a1a2e;
    --c-muted:     #5A6B65;

    /* Tipografi */
    --font-ui:     'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono:   'Consolas', 'Courier New', monospace;
    --font-fun:    'Segoe UI', 'Comic Sans MS', system-ui, sans-serif;

    /* Boyutlar */
    --tile-sz:     clamp(56px, 12vw, 76px);
    --btn-h:       clamp(52px, 9vw, 64px);
    --radius:      14px;
    --radius-lg:   20px;
    --gap:         12px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: var(--font-ui);
    background: var(--c-bg);
    color: var(--c-text);
    touch-action: manipulation;
}

/* ---------- ARKA PLAN MATEMATİK DOKUSU ---------- */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image:
        /* Kırmızı semboller */
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Ctext x='10' y='60' font-size='50' fill='%23E21B3C' opacity='0.06' font-family='Arial'%3E%2B%3C/text%3E%3C/svg%3E"),
        /* Mavi semboller */
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Ctext x='15' y='70' font-size='55' fill='%231368CE' opacity='0.06' font-family='Arial'%3E%C3%97%3C/text%3E%3C/svg%3E"),
        /* Yeşil semboller */
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Ctext x='20' y='85' font-size='60' fill='%2326890C' opacity='0.06' font-family='Arial'%3E%C3%B7%3C/text%3E%3C/svg%3E"),
        /* Sarı semboller */
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90'%3E%3Ctext x='12' y='65' font-size='48' fill='%23D89E00' opacity='0.06' font-family='Arial'%3E%3D%3C/text%3E%3C/svg%3E"),
        /* Kırmızı pi */
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150'%3E%3Ctext x='30' y='100' font-size='65' fill='%23E21B3C' opacity='0.05' font-family='Arial'%3E%CF%80%3C/text%3E%3C/svg%3E"),
        /* Mavi yüzde */
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='130' height='130'%3E%3Ctext x='25' y='90' font-size='55' fill='%231368CE' opacity='0.05' font-family='Arial'%3E%25%3C/text%3E%3C/svg%3E"),
        /* Yeşil toplam */
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='110' height='110'%3E%3Ctext x='18' y='78' font-size='52' fill='%2326890C' opacity='0.05' font-family='Arial'%3E%E2%88%91%3C/text%3E%3C/svg%3E"),
        /* Sarı eksi */
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='95' height='95'%3E%3Ctext x='15' y='68' font-size='50' fill='%23D89E00' opacity='0.06' font-family='Arial'%3E%E2%88%92%3C/text%3E%3C/svg%3E");
    background-position:
        0 0, 300px 50px, 150px 200px, 450px 150px,
        500px 300px, 100px 400px, 350px 350px, 200px 100px;
    background-repeat: repeat;
    pointer-events: none;
}

/* ---------- HEADER ---------- */
.app-header {
    width: 100%;
    background: linear-gradient(135deg, var(--c-blue), #0D47A1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    box-shadow: 0 4px 20px rgba(19,104,206,.35);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h1 {
    font-size: clamp(20px, 5vw, 30px);
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-family: var(--font-fun);
    text-shadow: 2px 2px 4px rgba(0,0,0,.2);
}

/* Sayac */
#timer {
    font-size: clamp(22px, 5.5vw, 36px);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    background: rgba(255,255,255,.2);
    padding: 6px 20px;
    border-radius: 12px;
    letter-spacing: 2px;
    transition: color .3s;
    backdrop-filter: blur(4px);
}
#timer.urgent {
    color: var(--c-yellow-l);
    animation: blink .5s infinite alternate;
}
@keyframes blink { to { opacity: .4; } }

/* ---------- TAB NAVİGASYON ---------- */
.tab-nav {
    display: flex;
    width: 100%;
    max-width: 520px;
    margin: 20px auto 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
}

.tab-btn {
    flex: 1;
    height: var(--btn-h);
    border: none;
    background: #D0D8D5;
    font-size: clamp(16px, 4vw, 20px);
    font-weight: 800;
    cursor: pointer;
    touch-action: manipulation;
    transition: background .2s, color .2s, transform .1s;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.tab-btn[data-mode="kelime"].active {
    background: var(--c-red);
    color: #fff;
    box-shadow: inset 0 -4px 0 rgba(0,0,0,.2);
}
.tab-btn[data-mode="islem"].active {
    background: var(--c-blue);
    color: #fff;
    box-shadow: inset 0 -4px 0 rgba(0,0,0,.2);
}
.tab-btn:focus-visible {
    outline: 3px solid var(--c-yellow);
    outline-offset: -3px;
}

/* ---------- ANA OYUN ALANI ---------- */
.game-wrap {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    padding: 20px 16px 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* Mod panelleri */
.panel { display: none; width: 100%; flex-direction: column; align-items: center; gap: 18px; }
.panel.active { display: flex; }

/* ---------- PANEL BAŞLIKLARI ---------- */
.panel-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--c-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    align-self: flex-start;
}

/* ---------- HARF FİŞLERİ (Kelime Modu) ---------- */
.tile-pool {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--gap);
    width: 100%;
}

.tile {
    width: var(--tile-sz);
    height: var(--tile-sz);
    border: 3px solid var(--c-red);
    border-radius: var(--radius);
    background: var(--c-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(22px, 5vw, 32px);
    font-weight: 900;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 4px 8px rgba(226,27,60,.15), inset 0 -3px 0 rgba(0,0,0,.1);
    transition: transform .12s, background .15s, border-color .15s, box-shadow .15s;
    position: relative;
    color: var(--c-red);
}
.tile:nth-child(4n+2) { border-color: var(--c-blue); color: var(--c-blue); box-shadow: 0 4px 8px rgba(19,104,206,.15), inset 0 -3px 0 rgba(0,0,0,.1); }
.tile:nth-child(4n+3) { border-color: var(--c-green); color: var(--c-green); box-shadow: 0 4px 8px rgba(38,137,12,.15), inset 0 -3px 0 rgba(0,0,0,.1); }
.tile:nth-child(4n+4) { border-color: var(--c-yellow); color: #8B6914; box-shadow: 0 4px 8px rgba(216,158,0,.15), inset 0 -3px 0 rgba(0,0,0,.1); }

.tile:active, .tile.selected, .tile.pressing {
    background: var(--c-yellow);
    border-color: var(--c-gold-d);
    color: #1a1a2e;
    transform: scale(.88);
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
}
.tile.used {
    opacity: .2;
    pointer-events: none;
    filter: grayscale(1);
}
.tile.joker {
    border-color: var(--c-yellow);
    color: #8B6914;
    background: var(--c-yellow-bg);
}
.tile.joker::after {
    content: '';
    position: absolute;
    top: 3px; right: 4px;
    font-size: 12px;
    color: var(--c-yellow);
}
.tile.joker.resolved {
    background: var(--c-yellow-bg);
    border-color: var(--c-gold-d);
}

/* ---------- CEVAP SLOTLARI (Kelime Modu) ---------- */
.answer-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    min-height: calc(var(--tile-sz) + 8px);
    width: 100%;
    padding: 10px;
    background: rgba(19,104,206,.04);
    border-radius: var(--radius-lg);
    border: 3px dashed rgba(19,104,206,.2);
}

.slot {
    width: var(--tile-sz);
    height: var(--tile-sz);
    border: 3px dashed #A0B0A8;
    border-radius: var(--radius);
    background: rgba(255,255,255,.6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(22px, 5vw, 32px);
    font-weight: 900;
    cursor: pointer;
    touch-action: manipulation;
    transition: background .15s, border .15s, transform .1s;
    color: var(--c-text);
}
.slot.filled {
    border-style: solid;
    border-color: var(--c-blue);
    background: var(--c-blue-bg);
    box-shadow: 0 3px 8px rgba(19,104,206,.12);
}
.slot.joker-slot {
    border-color: var(--c-yellow);
    background: var(--c-yellow-bg);
    color: #8B6914;
}

/* ---------- JOKER HARF SEÇİM MODALI ---------- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }

.modal {
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 12px 40px rgba(0,0,0,.3);
    border-top: 5px solid var(--c-yellow);
}
.modal h2 {
    font-size: 19px;
    margin-bottom: 18px;
    color: var(--c-blue);
    text-align: center;
    font-weight: 800;
}

.alpha-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 7px;
}
.alpha-btn {
    aspect-ratio: 1;
    border: 2.5px solid var(--c-border);
    border-radius: 10px;
    background: var(--c-surface);
    font-size: clamp(15px, 3.5vw, 20px);
    font-weight: 800;
    cursor: pointer;
    touch-action: manipulation;
    transition: background .12s, transform .1s, border-color .1s;
    color: var(--c-text);
}
.alpha-btn:active {
    background: var(--c-yellow);
    border-color: var(--c-gold-d);
    transform: scale(.92);
}

/* ---------- İŞLEM MODU: HEDEF SAYISI ---------- */
.target-display {
    font-size: clamp(48px, 14vw, 80px);
    font-weight: 900;
    color: var(--c-surface);
    font-variant-numeric: tabular-nums;
    background: linear-gradient(135deg, var(--c-blue), #0D47A1);
    padding: 14px 40px;
    border-radius: var(--radius-lg);
    box-shadow: 0 6px 24px rgba(19,104,206,.3);
    letter-spacing: 4px;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0,0,0,.2);
}

/* ---------- İŞLEM MODU: SAYI IZGARASI ---------- */
.number-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gap);
    width: 100%;
    max-width: 340px;
}

.num-tile {
    width: 100%;
    height: var(--tile-sz);
    border: 3px solid var(--c-blue);
    border-radius: var(--radius);
    background: var(--c-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(22px, 5.5vw, 32px);
    font-weight: 900;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 4px 8px rgba(19,104,206,.15), inset 0 -3px 0 rgba(0,0,0,.1);
    transition: transform .12s, background .15s, border-color .15s, box-shadow .15s;
    color: var(--c-blue);
}
.num-tile:nth-child(2) { border-color: var(--c-green); color: var(--c-green); box-shadow: 0 4px 8px rgba(38,137,12,.15), inset 0 -3px 0 rgba(0,0,0,.1); }
.num-tile:nth-child(3) { border-color: var(--c-red); color: var(--c-red); box-shadow: 0 4px 8px rgba(226,27,60,.15), inset 0 -3px 0 rgba(0,0,0,.1); }
.num-tile:nth-child(4) { border-color: var(--c-yellow); color: #8B6914; box-shadow: 0 4px 8px rgba(216,158,0,.15), inset 0 -3px 0 rgba(0,0,0,.1); }
.num-tile:nth-child(5) { border-color: var(--c-green); color: var(--c-green); box-shadow: 0 4px 8px rgba(38,137,12,.15), inset 0 -3px 0 rgba(0,0,0,.1); }
.num-tile:nth-child(6) { border-color: var(--c-red); color: var(--c-red); box-shadow: 0 4px 8px rgba(226,27,60,.15), inset 0 -3px 0 rgba(0,0,0,.1); }

.num-tile:active, .num-tile.selected, .num-tile.pressing {
    background: var(--c-yellow);
    border-color: var(--c-gold-d);
    color: #1a1a2e;
    transform: scale(.88);
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
}
.num-tile.used {
    opacity: .2;
    pointer-events: none;
    filter: grayscale(1);
}

/* ---------- OPERATÖR BUTONLARI ---------- */
.op-row {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

.op-btn {
    width: clamp(58px, 15vw, 74px);
    height: clamp(58px, 15vw, 74px);
    border: 3px solid transparent;
    border-radius: 16px;
    font-size: clamp(24px, 6.5vw, 34px);
    font-weight: 800;
    cursor: pointer;
    touch-action: manipulation;
    transition: background .15s, color .15s, transform .1s, box-shadow .15s;
    color: #fff;
}
.op-btn[data-op="+"] { background: var(--c-red); box-shadow: 0 4px 12px rgba(226,27,60,.3); }
.op-btn[data-op="-"] { background: var(--c-blue); box-shadow: 0 4px 12px rgba(19,104,206,.3); }
.op-btn[data-op="*"] { background: var(--c-green); box-shadow: 0 4px 12px rgba(38,137,12,.3); }
.op-btn[data-op="/"] { background: var(--c-yellow); color: #1a1a2e; box-shadow: 0 4px 12px rgba(216,158,0,.3); }

.op-btn:active {
    transform: scale(.9);
    box-shadow: none;
}
.op-btn.active {
    transform: scale(1.1);
    box-shadow: 0 0 0 4px rgba(255,255,255,.5), 0 6px 20px rgba(0,0,0,.25);
    border-color: #fff;
}
.op-btn:focus-visible {
    outline: 3px solid var(--c-yellow);
}

/* ---------- ADIM LİSTESİ ---------- */
.steps-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.step-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--c-green-bg);
    border-left: 5px solid var(--c-green);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: clamp(14px, 3.5vw, 17px);
    font-weight: 700;
    font-family: var(--font-mono);
    gap: 10px;
    box-shadow: 0 2px 6px rgba(38,137,12,.1);
}

.step-del {
    background: var(--c-red-bg);
    border: none;
    color: var(--c-red);
    font-size: 20px;
    cursor: pointer;
    touch-action: manipulation;
    padding: 4px 8px;
    border-radius: 8px;
    line-height: 1;
    flex-shrink: 0;
    font-weight: 800;
    transition: background .15s;
}
.step-del:hover { background: var(--c-red); color: #fff; }

/* ---------- GENEL BUTONLAR ---------- */
.btn-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.btn {
    height: var(--btn-h);
    padding: 0 28px;
    border: none;
    border-radius: 14px;
    font-size: clamp(15px, 3.5vw, 18px);
    font-weight: 800;
    cursor: pointer;
    touch-action: manipulation;
    box-shadow: 0 4px 12px rgba(0,0,0,.15), inset 0 -3px 0 rgba(0,0,0,.12);
    transition: transform .1s, box-shadow .15s;
    letter-spacing: .5px;
    text-transform: uppercase;
}
.btn:active {
    transform: scale(.94);
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
.btn:focus-visible { outline: 3px solid var(--c-yellow); outline-offset: 2px; }

.btn-primary { background: var(--c-blue); color: #fff; }
.btn-gold    { background: var(--c-yellow); color: #1a1a2e; }
.btn-danger  { background: var(--c-red); color: #fff; }
.btn-outline {
    background: transparent;
    border: 3px solid var(--c-blue);
    color: var(--c-blue);
    box-shadow: none;
}
.btn-green { background: var(--c-green); color: #fff; }

/* ---------- SONUÇ KUTUSU ---------- */
#result-box {
    width: 100%;
    padding: 18px 20px;
    border-radius: var(--radius-lg);
    background: var(--c-surface);
    font-size: clamp(15px, 3.5vw, 17px);
    line-height: 1.7;
    text-align: center;
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
    display: none;
    animation: popIn .3s cubic-bezier(.34,1.56,.64,1);
}
#result-box.show { display: block; }

@keyframes popIn {
    from { opacity: 0; transform: scale(.9) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

#result-box.success { border-left: 6px solid var(--c-green); background: var(--c-green-bg); }
#result-box.partial { border-left: 6px solid var(--c-yellow); background: var(--c-yellow-bg); }
#result-box.fail    { border-left: 6px solid var(--c-red); background: var(--c-red-bg); }

#result-box b   { color: var(--c-blue); }
#result-box small { color: var(--c-muted); font-size: 90%; display: block; margin-top: 6px; }

/* ---------- HEADER RIGHT ---------- */
.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* ---------- ODA ROZET (header'da) ---------- */
.room-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,.2);
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 2px;
    backdrop-filter: blur(4px);
}
.room-badge.hidden { display: none; }

.btn-room-leave {
    background: rgba(255,255,255,.25);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.btn-room-leave:hover { background: var(--c-red); }

/* ---------- ODA GİRİŞ EKRANI — KAHOOT TARZI ---------- */
.room-panel {
    position: fixed;
    inset: 0;
    background: var(--c-bg);
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}
.room-panel.hidden { display: none; }

/* Oda paneli arka plan dokusu */
.room-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Ctext x='10' y='60' font-size='50' fill='%23E21B3C' opacity='0.07' font-family='Arial'%3E%2B%3C/text%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Ctext x='15' y='70' font-size='55' fill='%231368CE' opacity='0.07' font-family='Arial'%3E%C3%97%3C/text%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Ctext x='20' y='85' font-size='60' fill='%2326890C' opacity='0.07' font-family='Arial'%3E%C3%B7%3C/text%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90'%3E%3Ctext x='12' y='65' font-size='48' fill='%23D89E00' opacity='0.07' font-family='Arial'%3E%3D%3C/text%3E%3C/svg%3E");
    background-repeat: repeat;
    pointer-events: none;
    z-index: 0;
}

.room-card {
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 12px 40px rgba(0,0,0,.15);
    display: flex;
    flex-direction: column;
    gap: 20px;
    text-align: center;
    position: relative;
    z-index: 1;
    border-top: 6px solid var(--c-blue);
}

.room-card-title {
    font-size: 32px;
    font-weight: 900;
    color: var(--c-blue);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: var(--font-fun);
}

.room-card-desc {
    font-size: 16px;
    color: var(--c-muted);
    line-height: 1.5;
    margin-bottom: 4px;
}

.room-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.room-form-group label {
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--c-muted);
}

.room-input {
    height: 56px;
    border: 3px solid var(--c-border);
    border-radius: var(--radius);
    padding: 0 18px;
    font-size: 20px;
    font-weight: 700;
    font-family: var(--font-ui);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
    text-align: center;
}
.room-input:focus {
    border-color: var(--c-blue);
    box-shadow: 0 0 0 4px rgba(19,104,206,.15);
}

.room-pin {
    font-size: 24px;
    letter-spacing: 6px;
    font-weight: 900;
    max-width: 180px;
}

.room-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.room-divider {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--c-muted);
    font-size: 14px;
    font-weight: 700;
}
.room-divider::before,
.room-divider::after {
    content: '';
    flex: 1;
    height: 2px;
    background: var(--c-border);
}

.room-join-row {
    display: flex;
    gap: 12px;
    width: 100%;
    align-items: center;
    justify-content: center;
}

.btn-room {
    min-width: 160px;
    min-height: 72px;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 2px;
    border-radius: 16px;
    text-transform: uppercase;
    transition: transform .12s, box-shadow .12s;
}
.btn-room:active {
    transform: scale(.95);
}

.btn-primary.btn-room {
    background: linear-gradient(180deg, var(--c-blue), #0D47A1);
    box-shadow: 0 6px 20px rgba(19,104,206,.35), inset 0 -4px 0 rgba(0,0,0,.15);
}

.btn-gold.btn-room {
    background: linear-gradient(180deg, var(--c-yellow-l), var(--c-yellow));
    box-shadow: 0 6px 20px rgba(216,158,0,.35), inset 0 -4px 0 rgba(0,0,0,.12);
    color: #1a1a2e;
}

.btn-room-skip {
    min-height: 56px;
    font-size: 18px;
    font-weight: 800;
    border-radius: 14px;
    margin-top: 6px;
    border-width: 3px;
    padding: 0 24px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: opacity .15s, transform .1s;
}
.btn-room-skip:hover { opacity: 1; }

.room-msg {
    font-size: 15px;
    font-weight: 700;
    padding: 12px;
    border-radius: 10px;
    display: none;
}
.room-msg.show { display: block; }
.room-msg.success { background: var(--c-green-bg); color: var(--c-green); }
.room-msg.error { background: var(--c-red-bg); color: var(--c-red); }

/* ---------- CANLI LEADERBOARD ---------- */
.room-leaderboard.hidden { display: none; }

.room-pin-info {
    text-align: center;
    font-size: 14px;
    color: var(--c-muted);
    padding: 10px 0;
    border-bottom: 3px solid var(--c-bg);
    margin-bottom: 10px;
}

.room-pin-info strong {
    font-size: 20px;
    color: var(--c-blue);
    letter-spacing: 3px;
}

.lb-count {
    display: block;
    font-size: 12px;
    margin-top: 4px;
    font-weight: 700;
}

.lb-player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 14px;
    transition: background .2s;
}
.lb-player:nth-child(odd) { background: var(--c-bg); }

.lb-rank {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 900;
    flex-shrink: 0;
    background: var(--c-border);
    color: #fff;
}
.lb-rank.rank-1 { background: var(--c-yellow); color: #1a1a2e; }
.lb-rank.rank-2 { background: #90a4ae; color: #fff; }
.lb-rank.rank-3 { background: #8d6e63; color: #fff; }

.lb-name {
    flex: 1;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-name.is-me { color: var(--c-blue); font-weight: 900; }

.lb-score {
    font-weight: 900;
    font-size: 17px;
    color: var(--c-green);
    flex-shrink: 0;
}

.lb-detail {
    font-size: 11px;
    color: var(--c-muted);
    flex-shrink: 0;
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- ARKADASLIK SİSTEMİ ---------- */
.friends-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 14px;
    border-bottom: 3px solid var(--c-bg);
    margin-bottom: 4px;
}

.friend-mycode-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.friend-mycode-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--c-muted);
    letter-spacing: 1px;
}

.friend-mycode {
    font-size: 18px;
    font-weight: 900;
    color: var(--c-blue);
    letter-spacing: 2px;
    background: var(--c-blue-bg);
    padding: 6px 14px;
    border-radius: 10px;
    font-family: var(--font-mono);
    user-select: all;
    border: 2px solid rgba(19,104,206,.2);
}

.btn-copy {
    background: var(--c-blue);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.btn-copy:active { opacity: .7; transform: scale(.95); }
.btn-copy.copied { background: var(--c-green); }

.friend-add-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.friend-code-input {
    height: 38px !important;
    font-size: 14px !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 800;
    padding: 0 10px !important;
}

.friends-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 240px;
    overflow-y: auto;
}

.friend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 13px;
    transition: background .15s;
}
.friend-row:nth-child(odd) { background: var(--c-bg); }
.friend-row.is-me {
    background: var(--c-blue-bg);
    border-left: 4px solid var(--c-blue);
}

.friend-rank {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 900;
    flex-shrink: 0;
    background: var(--c-border);
    color: #fff;
}
.friend-rank.rank-1 { background: var(--c-yellow); color: #1a1a2e; }
.friend-rank.rank-2 { background: #90a4ae; }
.friend-rank.rank-3 { background: #8d6e63; }

.friend-info {
    flex: 1;
    min-width: 0;
}

.friend-name {
    font-weight: 800;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.friend-score {
    font-weight: 900;
    font-size: 15px;
    color: var(--c-green);
    flex-shrink: 0;
}

.friend-stats {
    font-size: 10px;
    color: var(--c-muted);
}

.friend-total {
    font-weight: 900;
    font-size: 15px;
    color: var(--c-green);
    flex-shrink: 0;
}

.friend-del {
    background: none;
    border: none;
    color: var(--c-red);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    line-height: 1;
    flex-shrink: 0;
    opacity: .4;
    transition: opacity .15s, background .15s;
    font-weight: 900;
}
.friend-del:hover { opacity: 1; background: var(--c-red-bg); }

/* ---------- LAYOUT WRAP (game + scoreboard) ---------- */
.layout-wrap {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 24px;
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 12px;
}

/* ---------- SKOR TABLOSU ---------- */
.scoreboard {
    width: 270px;
    flex-shrink: 0;
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    padding: 20px 18px;
    position: sticky;
    top: 80px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
    border-top: 5px solid var(--c-green);
}

.scoreboard-title {
    font-size: 16px;
    font-weight: 900;
    color: var(--c-blue);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--c-bg);
}

.scoreboard-summary {
    display: flex;
    justify-content: space-around;
    gap: 6px;
}

.score-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.score-stat-value {
    font-size: 26px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}
.score-stat:nth-child(1) .score-stat-value { color: var(--c-blue); }
.score-stat:nth-child(2) .score-stat-value { color: var(--c-green); }
.score-stat:nth-child(3) .score-stat-value { color: var(--c-red); }

.score-stat-label {
    font-size: 11px;
    color: var(--c-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 700;
}

.scoreboard-subtitle {
    font-size: 12px;
    font-weight: 800;
    color: var(--c-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.scoreboard-list-wrap {
    max-height: 320px;
    overflow-y: auto;
}

.scoreboard-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.score-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    gap: 8px;
    transition: background .15s;
}

.score-entry:nth-child(odd) {
    background: var(--c-bg);
}

.score-entry-mode {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 3px 7px;
    border-radius: 6px;
    font-weight: 800;
    flex-shrink: 0;
}

.score-entry-mode.kelime {
    background: var(--c-red-bg);
    color: var(--c-red);
}

.score-entry-mode.islem {
    background: var(--c-blue-bg);
    color: var(--c-blue);
}

.score-entry-word {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--c-text);
}

.score-entry-pts {
    font-weight: 900;
    color: var(--c-green);
    font-size: 15px;
    flex-shrink: 0;
}

.score-empty {
    text-align: center;
    color: var(--c-muted);
    font-size: 13px;
    padding: 16px 0;
    line-height: 1.6;
}

.btn-sm {
    height: 36px;
    padding: 0 18px;
    font-size: 12px;
    border-radius: 10px;
    align-self: center;
}

/* ---------- TOAST BİLDİRİM SİSTEMİ ---------- */

.toast-container {
    position: fixed;
    top: 74px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast-item {
    background: linear-gradient(135deg, var(--c-green), var(--c-green-l));
    color: #fff;
    padding: 14px 22px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 6px 24px rgba(0,0,0,.2);
    transform: translateX(130%);
    opacity: 0;
    transition: transform .35s cubic-bezier(.34,1.56,.64,1), opacity .3s ease;
    pointer-events: auto;
    max-width: 340px;
    word-break: break-word;
    border-left: 4px solid rgba(255,255,255,.4);
}

.toast-item.show {
    transform: translateX(0);
    opacity: 1;
}

/* ---------- MOBIL SKOR TABLOSU TOGGLE ---------- */

.btn-score-toggle {
    display: none;
    width: 100%;
    max-width: 680px;
    height: 48px;
    background: linear-gradient(135deg, var(--c-green), #1E7A08);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    margin-top: 12px;
    transition: transform .1s;
    order: 2;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 12px rgba(38,137,12,.25);
}
.btn-score-toggle:active { transform: scale(.97); }
.btn-score-toggle.active { background: linear-gradient(135deg, #1E7A08, var(--c-green)); }

/* ---------- RESPONSIVE AYARLAR ---------- */

@media (max-width: 800px) {
    .layout-wrap {
        flex-direction: column;
        align-items: center;
    }
    .scoreboard {
        width: 100%;
        max-width: 680px;
        position: static;
        margin-top: 0;
        order: 3;
        display: none;
    }
    .scoreboard.mobile-open {
        display: flex;
    }
    .btn-score-toggle {
        display: block;
    }
    .game-wrap {
        order: 1;
    }

    .room-card {
        padding: 28px 20px;
    }
    .btn-room {
        min-height: 60px;
        font-size: 19px;
    }
    .room-input {
        height: 50px;
        font-size: 18px;
    }
    .room-card-title {
        font-size: 26px;
    }

    .toast-container {
        right: 8px;
        left: 8px;
    }
    .toast-item {
        max-width: 100%;
    }
}

@media (max-width: 360px) {
    :root {
        --tile-sz: 48px;
        --btn-h:   46px;
    }
    .alpha-grid { grid-template-columns: repeat(5, 1fr); }
    .room-card-title { font-size: 22px; }
    .btn-room { min-height: 54px; font-size: 17px; }
}

/* Akilli tahta (buyuk ekran, touch) */
@media (min-width: 800px) {
    :root {
        --tile-sz: 80px;
        --btn-h:   64px;
    }
    .game-wrap { max-width: 780px; }
}

/* Akilli tahta — devasa butonlar */
@media (min-width: 1024px) {
    .btn-room {
        min-height: 88px;
        font-size: 26px;
        border-radius: 20px;
    }
    .room-input {
        height: 68px;
        font-size: 24px;
        border-radius: 18px;
    }
    .room-card {
        max-width: 620px;
        padding: 40px 36px;
    }
    .room-card-title {
        font-size: 40px;
    }
    .room-pin {
        font-size: 28px;
        max-width: 200px;
        letter-spacing: 8px;
    }
    .op-btn {
        width: 80px;
        height: 80px;
        font-size: 36px;
        border-radius: 18px;
    }
}

/* ---------- BOUNCE ANİMASYONU ---------- */
@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); opacity: 1; }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.tile, .num-tile {
    animation: bounceIn .4s ease backwards;
}
.tile:nth-child(1), .num-tile:nth-child(1) { animation-delay: 0s; }
.tile:nth-child(2), .num-tile:nth-child(2) { animation-delay: .04s; }
.tile:nth-child(3), .num-tile:nth-child(3) { animation-delay: .08s; }
.tile:nth-child(4), .num-tile:nth-child(4) { animation-delay: .12s; }
.tile:nth-child(5), .num-tile:nth-child(5) { animation-delay: .16s; }
.tile:nth-child(6), .num-tile:nth-child(6) { animation-delay: .20s; }
.tile:nth-child(7), .num-tile:nth-child(7) { animation-delay: .24s; }
.tile:nth-child(8), .num-tile:nth-child(8) { animation-delay: .28s; }

/* ============================================================
   WORDLE MODU
   ============================================================ */

/* Wordle Board */
.wordle-board {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 0;
}

.wordle-row {
    display: flex;
    gap: 6px;
}

.wordle-cell {
    width: clamp(52px, 13vw, 68px);
    height: clamp(52px, 13vw, 68px);
    border: 3px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(22px, 5.5vw, 32px);
    font-weight: 900;
    text-transform: uppercase;
    transition: border-color .15s;
    user-select: none;
}

.wordle-cell.wordle-filled {
    border-color: var(--c-muted);
    animation: popIn .1s ease;
}

/* Renk durumları */
.wordle-cell.wordle-correct {
    background: var(--c-green);
    border-color: var(--c-green);
    color: #fff;
    box-shadow: 0 3px 8px rgba(38,137,12,.3);
}

.wordle-cell.wordle-present {
    background: var(--c-yellow);
    border-color: var(--c-yellow);
    color: #1a1a2e;
    box-shadow: 0 3px 8px rgba(216,158,0,.3);
}

.wordle-cell.wordle-absent {
    background: var(--c-muted);
    border-color: var(--c-muted);
    color: #fff;
    box-shadow: 0 3px 8px rgba(90,107,101,.2);
}

/* Flip animasyonu */
.wordle-cell.wordle-flip {
    animation: wordleFlip .5s ease forwards;
}

@keyframes wordleFlip {
    0%   { transform: rotateX(0deg); }
    50%  { transform: rotateX(90deg); }
    100% { transform: rotateX(0deg); }
}

/* Wordle Klavye */
.wordle-keyboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 0;
    width: 100%;
}

.wk-row {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.wk-key {
    min-width: clamp(28px, 7.5vw, 44px);
    height: clamp(44px, 10vw, 56px);
    border: none;
    border-radius: 8px;
    background: var(--c-surface);
    border: 2px solid var(--c-border);
    font-size: clamp(13px, 3vw, 16px);
    font-weight: 800;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .1s, background .15s;
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

.wk-key:active, .wk-key.pressing {
    transform: scale(.9);
}

.wk-wide {
    min-width: clamp(52px, 13vw, 72px);
    font-size: clamp(11px, 2.5vw, 14px);
    padding: 0 6px;
}

/* Klavye renk durumları */
.wk-key.wk-correct {
    background: var(--c-green);
    border-color: var(--c-green);
    color: #fff;
}

.wk-key.wk-present {
    background: var(--c-yellow);
    border-color: var(--c-yellow);
    color: #1a1a2e;
}

.wk-key.wk-absent {
    background: #787c7e;
    border-color: #787c7e;
    color: #fff;
    opacity: .7;
}

/* Akıllı tahta — büyük tuşlar */
@media (min-width: 1024px) {
    .wordle-cell {
        width: 72px;
        height: 72px;
        font-size: 34px;
    }
    .wk-key {
        min-width: 48px;
        height: 60px;
        font-size: 17px;
    }
    .wk-wide {
        min-width: 80px;
    }
}

/* Hidden utility */
.hidden { display: none !important; }
