@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    
    --color-correct: #22c55e;
    --color-present: #eab308;
    --color-absent: #475569;
    --color-empty: #1e293b;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
}

header {
    width: 100%;
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(90deg, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 800px;
    padding: 2rem 1rem;
}

/* Ekran Yönetimi */
.screen {
    display: none;
    width: 100%;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

/* Lobi Ekranı */
.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

input {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.2);
    color: white;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

input:focus {
    border-color: var(--primary);
}

button {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

button:hover {
    background: var(--primary-hover);
}

button:active {
    transform: scale(0.98);
}

.divider {
    text-align: center;
    position: relative;
    margin: 1rem 0;
    color: #94a3b8;
    font-size: 0.875rem;
}

.room-list-container {
    margin-top: 1rem;
    border-top: 1px solid var(--glass-border);
    padding-top: 1rem;
}

.room-list-header {
    font-size: 0.875rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 0.75rem;
    text-align: left;
}

#room-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 150px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Scrollbar styling for room list */
#room-list::-webkit-scrollbar {
    width: 6px;
}
#room-list::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}
#room-list::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}

.room-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.room-item:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.room-item-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.room-item-code {
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 1px;
}

.room-item-creator {
    font-size: 0.75rem;
    color: #94a3b8;
}

.room-item-join {
    font-size: 0.75rem;
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 600;
}

/* Oyun Ekranı */
.game-layout {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
    align-items: center;
}

@media (min-width: 768px) {
    .game-layout {
        flex-direction: row;
        align-items: flex-start;
        justify-content: center;
    }
}

.opponents-layout {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
    max-width: 600px;
}

.board-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.board-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #cbd5e1;
}

.board {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 5px;
}

.board.mini {
    gap: 3px;
}

.row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
}

.board.mini .row {
    gap: 3px;
}

.tile {
    width: 50px;
    height: 50px;
    border: 2px solid var(--color-empty);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    transition: all 0.3s;
}

.board.mini .tile {
    width: 25px;
    height: 25px;
    font-size: 0;
    border-width: 1px;
}

.tile.filled {
    border-color: var(--glass-border);
    animation: pop 0.1s;
}

.tile.correct {
    background-color: var(--color-correct);
    border-color: var(--color-correct);
}

.tile.present {
    background-color: var(--color-present);
    border-color: var(--color-present);
}

.tile.absent {
    background-color: var(--color-absent);
    border-color: var(--color-absent);
}

/* Klavye */
.keyboard {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 2rem;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.key {
    flex: 1;
    background: var(--color-empty);
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    height: 50px;
    cursor: pointer;
    text-transform: uppercase;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s;
    user-select: none;
    padding: 0;
    touch-action: manipulation;
}

.key.large {
    flex: 1.5;
    font-size: 0.9rem;
}

@media (max-width: 500px) {
    .keyboard {
        gap: 5px;
    }
    .keyboard-row {
        gap: 4px;
    }
    .key {
        height: 42px;
        font-size: 1rem;
    }
    .key.large {
        font-size: 0.75rem;
    }
}

@media (max-width: 380px) {
    .keyboard {
        gap: 4px;
    }
    .keyboard-row {
        gap: 2px;
    }
    .key {
        height: 38px;
        font-size: 0.85rem;
        border-radius: 3px;
    }
    .key.large {
        font-size: 0.65rem;
    }
}

.key:hover {
    background: var(--color-absent);
}

.key.correct { background-color: var(--color-correct); }
.key.present { background-color: var(--color-present); }
.key.absent { background-color: var(--color-absent); }

/* Animasyonlar */
@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
}
.modal.active {
    display: flex;
}
.modal-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    backdrop-filter: blur(10px);
}
.modal h2 { margin-bottom: 1rem; }
