/* ── Skor 4 — koyu tema ─────────────────────────────── */
:root {
    --bg: #0f1220;
    --panel: #1a1f35;
    --panel-2: #232a4a;
    --accent: #7c5cff;
    --accent-2: #00e5a0;
    --text: #eef0ff;
    --muted: #9aa3c7;
    --error: #ff5c7a;
    --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: radial-gradient(1200px 700px at 70% -10%, #1c1640 0%, var(--bg) 55%);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ── Geri linki ─────────────────────────────────────── */
.back-link {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 50;
    color: var(--muted);
    text-decoration: none;
    background: rgba(26, 31, 53, 0.85);
    border: 1px solid rgba(124, 92, 255, 0.25);
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 0.9rem;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    transition: color .2s, border-color .2s, transform .2s;
}
.back-link:hover { color: var(--text); border-color: var(--accent); transform: translateX(-2px); }

/* ── Ekranlar / paneller ────────────────────────────── */
.screen {
    width: 100%;
    max-width: 560px;
    padding: 72px 16px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
#screen-game { max-width: 720px; }

.panel {
    width: 100%;
    background: var(--panel);
    border: 1px solid rgba(124, 92, 255, 0.18);
    border-radius: var(--radius);
    padding: 28px 24px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.logo {
    text-align: center;
    font-size: 2.4rem;
    letter-spacing: 1px;
    margin-bottom: 4px;
}
.logo-4 {
    color: var(--accent);
    text-shadow: 0 0 24px rgba(124, 92, 255, 0.6);
}
.tagline {
    text-align: center;
    color: var(--muted);
    margin-bottom: 24px;
}

.muted { color: var(--muted); font-weight: 400; }

.field-label {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
    margin: 16px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

input[type="text"] {
    width: 100%;
    background: var(--bg);
    border: 1px solid rgba(124, 92, 255, 0.25);
    border-radius: 12px;
    color: var(--text);
    padding: 12px 14px;
    font-size: 1rem;
    min-height: 44px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.25);
}
#room-input { text-transform: uppercase; letter-spacing: 4px; }

/* ── Avatar seçici ──────────────────────────────────── */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}
.avatar-btn {
    font-size: 1.5rem;
    min-height: 48px;
    background: var(--bg);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: transform .15s, border-color .15s, background .15s;
}
.avatar-btn:hover { transform: scale(1.12); background: var(--panel-2); }
.avatar-btn.selected {
    border-color: var(--accent);
    background: rgba(124, 92, 255, 0.18);
    box-shadow: 0 0 12px rgba(124, 92, 255, 0.4);
}

/* ── Butonlar ───────────────────────────────────────── */
.btn {
    font-family: inherit;
    font-size: 1rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    min-height: 44px;
    padding: 10px 18px;
    transition: transform .15s, box-shadow .2s, background .2s, opacity .2s;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #5a3de0);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 8px 22px rgba(124, 92, 255, 0.35);
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(124, 92, 255, 0.5);
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid rgba(124, 92, 255, 0.35);
}
.btn-ghost:hover { background: rgba(124, 92, 255, 0.15); border-color: var(--accent); }

.btn-big { width: 100%; margin-top: 22px; font-size: 1.1rem; min-height: 52px; }

.entry-status {
    text-align: center;
    color: var(--accent-2);
    margin-top: 14px;
    font-size: 0.95rem;
}

/* ── Bekleme odası ──────────────────────────────────── */
.lobby-panel h2 { text-align: center; margin-bottom: 18px; }

.room-code-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 20px;
}
.room-code-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg);
    border: 1px dashed rgba(124, 92, 255, 0.45);
    border-radius: 12px;
    padding: 8px 18px;
}
.room-code-box .muted { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 1px; }
.room-code-box strong {
    font-size: 1.5rem;
    letter-spacing: 6px;
    color: var(--accent-2);
}

.players-title { margin: 8px 0 10px; font-size: 1rem; }

.player-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.player-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg);
    border: 1px solid rgba(124, 92, 255, 0.15);
    border-radius: 12px;
    padding: 10px 14px;
    min-height: 48px;
    animation: fade-in .25s ease;
}
.player-item.me { border-color: rgba(0, 229, 160, 0.5); }
.player-avatar { font-size: 1.4rem; }
.player-name { flex: 1; font-weight: 600; }
.host-badge { font-size: 1.1rem; }

.host-note { text-align: center; margin-top: 18px; }

/* ── Oyun ekranı ────────────────────────────────────── */
.game-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.scoreboard {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
}
.score-card {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--panel);
    border: 2px solid transparent;
    border-radius: var(--radius);
    padding: 10px 14px;
    min-height: 60px;
    transition: border-color .25s, box-shadow .25s;
}
.score-card.p1.active { border-color: var(--accent); box-shadow: 0 0 18px rgba(124, 92, 255, 0.45); }
.score-card.p2.active { border-color: var(--accent-2); box-shadow: 0 0 18px rgba(0, 229, 160, 0.4); }
.score-avatar { font-size: 1.5rem; }
.score-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.score-name {
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.score-disc-label {
    font-size: 0.72rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 5px;
}
.score-wins {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent-2);
    min-width: 28px;
    text-align: center;
}
.score-card.p1 .score-wins { color: var(--accent); }
.score-vs { color: var(--muted); font-weight: 800; font-size: 0.85rem; }

.mini-disc {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--muted);
    flex-shrink: 0;
}
.mini-disc.p1 { background: var(--accent); box-shadow: 0 0 8px rgba(124, 92, 255, 0.8); }
.mini-disc.p2 { background: var(--accent-2); box-shadow: 0 0 8px rgba(0, 229, 160, 0.8); }

.turn-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--panel);
    border: 1px solid rgba(124, 92, 255, 0.2);
    border-radius: 999px;
    padding: 10px 22px;
    font-weight: 600;
    min-height: 44px;
    transition: border-color .25s, box-shadow .25s;
}
.turn-banner.my-turn {
    border-color: var(--accent-2);
    box-shadow: 0 0 20px rgba(0, 229, 160, 0.35);
    animation: pulse 1.6s ease-in-out infinite;
}

/* ── Tahta ──────────────────────────────────────────── */
.board-frame {
    width: 100%;
    background: linear-gradient(160deg, #262c52, var(--panel));
    border: 1px solid rgba(124, 92, 255, 0.3);
    border-radius: var(--radius);
    padding: clamp(8px, 2vw, 16px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.board {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: clamp(4px, 1.2vw, 8px);
}

.cell {
    aspect-ratio: 1;
    min-width: 40px;
    background: var(--bg);
    border-radius: 50%;
    box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.6);
    cursor: pointer;
    position: relative;
    overflow: visible;
    transition: box-shadow .2s;
}
.cell:hover { box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(124, 92, 255, 0.35); }

.disc {
    position: absolute;
    inset: 8%;
    border-radius: 50%;
    opacity: 0;
    transition: opacity .15s;
}
.disc.filled { opacity: 1; }
.disc.p1 {
    background: radial-gradient(circle at 32% 28%, #a68fff, var(--accent) 60%, #4c33b8);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
}
.disc.p2 {
    background: radial-gradient(circle at 32% 28%, #7dffd4, var(--accent-2) 60%, #00976a);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
}

.disc.ghost { opacity: 0.35; }

.disc.dropping {
    animation: drop .5s cubic-bezier(0.22, 0.9, 0.35, 1.15);
}
@keyframes drop {
    0%   { transform: translateY(calc(var(--drop-cells, 1) * -112%)); }
    75%  { transform: translateY(0); }
    87%  { transform: translateY(calc(-7% * var(--drop-cells, 1) / 3)); }
    100% { transform: translateY(0); }
}

.disc.win {
    animation: win-glow 0.9s ease-in-out infinite alternate;
    z-index: 2;
}
@keyframes win-glow {
    from { box-shadow: 0 0 6px 2px rgba(255, 255, 255, 0.5); filter: brightness(1.1); }
    to   { box-shadow: 0 0 22px 8px rgba(255, 255, 255, 0.85); filter: brightness(1.5); }
}

/* ── Oyun sonu katmanı ──────────────────────────────── */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 18, 32, 0.82);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 100;
    animation: fade-in .3s ease;
}
.overlay-panel {
    max-width: 420px;
    text-align: center;
    animation: pop-in .35s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.gameover-emoji { font-size: 3.2rem; margin-bottom: 8px; }
#gameover-title { margin-bottom: 6px; }

.gameover-series {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 18px;
    flex-wrap: wrap;
}
.series-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg);
    border-radius: 12px;
    padding: 8px 14px;
    border: 1px solid rgba(124, 92, 255, 0.25);
    font-size: 0.92rem;
}
.series-chip strong { font-size: 1.15rem; }
.series-chip.p1 strong { color: var(--accent); }
.series-chip.p2 strong { color: var(--accent-2); }

/* ── Toast ──────────────────────────────────────────── */
.toasts {
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 200;
    width: min(92vw, 380px);
}
.toast {
    background: var(--panel-2);
    border-left: 4px solid var(--accent);
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    font-size: 0.95rem;
    animation: toast-in .3s cubic-bezier(0.34, 1.3, 0.64, 1);
}
.toast-error { border-left-color: var(--error); }
.toast-success { border-left-color: var(--accent-2); }
.toast-out { opacity: 0; transform: translateY(10px); transition: opacity .3s, transform .3s; }

/* ── Animasyonlar ───────────────────────────────────── */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: scale(1); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 12px rgba(0, 229, 160, 0.25); }
    50% { box-shadow: 0 0 26px rgba(0, 229, 160, 0.55); }
}

/* ── Mobil ──────────────────────────────────────────── */
@media (max-width: 560px) {
    .screen { padding-top: 64px; }
    .panel { padding: 22px 16px; }
    .avatar-grid { grid-template-columns: repeat(4, 1fr); }
    .score-vs { display: none; }
    .scoreboard { flex-direction: column; }
    .score-card { width: 100%; min-height: 52px; }
    .cell { min-width: 0; }
    .logo { font-size: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
