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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden; /* individual screens handle their own scroll */
    height: 100%;
    margin: 0;
}

html {
    height: 100%;
}

.container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

.screen {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: none;
    justify-content: center;
    align-items: center;
    overflow-y: auto;        /* allow scroll within each screen */
    -webkit-overflow-scrolling: touch;
}

.screen.active {
    display: flex;
}

.hidden {
    display: none !important;
}

/* Background Pattern */
.background-pattern {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    z-index: -1;
}

.background-pattern::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(45deg, transparent, transparent 35px, rgba(255,255,255,.03) 35px, rgba(255,255,255,.03) 70px);
    font-size: 150px;
    opacity: 0.3;
}

/* Start Screen - Full screen centered */
.start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.content {
    text-align: center;
    padding: 40px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
}

.game-title {
    font-size: 3em;
    color: #667eea;
    margin-bottom: 40px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: 3px;
}

.btn-primary, .btn-secondary, .btn-submit, .btn-skip, .btn-logout {
    padding: 15px 40px;
    margin: 10px;
    border: none;
    border-radius: 50px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

/* Avatar Selection */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 30px 0;
}

.avatar-option {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.avatar-option:hover {
    transform: scale(1.1);
}

.avatar-option.selected {
    border: 4px solid #667eea;
    border-radius: 15px;
    padding: 5px;
}

.avatar {
    width: 100px;
    height: 100px;
    border-radius: 15px;
    background-size: cover;
    background-position: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.avatar-1 { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.avatar-2 { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.avatar-3 { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.avatar-4 { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.avatar-5 { background: linear-gradient(135deg, #30cfd0 0%, #330867 100%); }
.avatar-6 { background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); }

.avatar::after {
    content: '👤';
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 50px;
    width: 100%;
    height: 100%;
}

.game-code-input, .player-name-input, .admin-input, .answer-input, .form-input {
    width: 100%;
    padding: 15px;
    margin: 15px 0;
    border: 2px solid #ddd;
    border-radius: 15px;
    font-size: 1.1em;
    text-align: center;
    transition: border-color 0.3s ease;
}

.game-code-input:focus, .player-name-input:focus, .admin-input:focus, .answer-input:focus, .form-input:focus {
    outline: none;
    border-color: #667eea;
}

/* Game Screen */
.game-container {
    width: 100%;
    min-height: 100%;
    height: auto;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    display: flex;
    flex-direction: column;
    overflow-y: auto;   /* allow scroll on short screens */
    -webkit-overflow-scrolling: touch;
}

/* Row 1: player + score */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.97);
    flex-shrink: 0;
}

/* Row 2: letter bar full width */
.letter-indicators-bar {
    background: rgba(255, 255, 255, 0.92);
    padding: 10px 12px;
    flex-shrink: 0;
    border-top: 1px solid rgba(0,0,0,0.06);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background-size: cover;
    flex-shrink: 0;
}

#gamePlayerName {
    font-weight: bold;
    font-size: 1em;
    color: #2c3e50;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.letter-indicators {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
}

.letter-indicator {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.78em;
    border: 2px solid #ddd;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.letter-indicator.current {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: scale(1.25);
    box-shadow: 0 2px 8px rgba(102,126,234,0.5);
}

.letter-indicator.correct {
    background: #43e97b;
    color: white;
    border-color: #43e97b;
}

.letter-indicator.wrong {
    background: #f5576c;
    color: white;
    border-color: #f5576c;
}

.letter-indicator.skipped {
    background: #ffa726;
    color: white;
    border-color: #ffa726;
}

.score-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1.4em;
    font-weight: bold;
    color: #2c3e50;
}

.star {
    font-size: 1.2em;
}

.game-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px 30px;
    gap: 18px;
}

.timer-display {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.8em;
    color: white;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 28px;
    border-radius: 50px;
}

.clock-icon {
    font-size: 1.1em;
}

.current-letter-display {
    /* no extra margin needed, gap on parent handles it */
}

.letter-bubble {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4.5em;
    font-weight: bold;
    color: #2c3e50;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

.question-card {
    background: rgba(255, 255, 255, 0.97);
    padding: 22px 24px;
    border-radius: 20px;
    width: 100%;
    max-width: 580px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.18);
}

.question-icon {
    font-size: 2em;
    margin-bottom: 10px;
}

.question-text {
    font-size: 1.25em;
    color: #2c3e50;
    line-height: 1.5;
}

.answer-section {
    width: 100%;
    max-width: 580px;
}

.answer-input {
    width: 100%;
    padding: 16px 20px;
    font-size: 1.15em;
    border-radius: 50px;
    border: none;
    margin-bottom: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.button-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 10px;
}

.btn-submit {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
    flex: 1;
}

.btn-skip {
    background: linear-gradient(135deg, #ffa726 0%, #fb8c00 100%);
    color: white;
    flex: 1;
}

/* Results Screen */
.results-container, .leaderboard-container {
    background: white;
    padding: 20px;
    border-radius: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    text-align: center;
}

.results-container h1, .leaderboard-container h1 {
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 2.5em;
}

.score-display {
    display: flex;
    justify-content: space-around;
    margin: 40px 0;
    flex-wrap: wrap;
    gap: 15px;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    border-radius: 15px;
    min-width: 120px;
}

.score-item.correct {
    background: #43e97b;
    color: white;
}

.score-item.wrong {
    background: #f5576c;
    color: white;
}

.score-item.skipped {
    background: #ffa726;
    color: white;
}

.score-item .label {
    font-size: 1.2em;
    margin-bottom: 10px;
}

.score-item .value {
    font-size: 3em;
    font-weight: bold;
}

.button-group-vertical {
    display: flex;
    flex-direction: column;
}

/* Leaderboard */
.leaderboard-list {
    margin: 30px 0;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin: 10px 0;
    background: #f5f5f5;
    border-radius: 15px;
    transition: transform 0.3s ease;
}

.leaderboard-item:hover {
    transform: translateX(5px);
}

.leaderboard-item.top-1 {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: white;
    font-weight: bold;
}

.leaderboard-item.top-2 {
    background: linear-gradient(135deg, #C0C0C0 0%, #808080 100%);
    color: white;
}

.leaderboard-item.top-3 {
    background: linear-gradient(135deg, #CD7F32 0%, #8B4513 100%);
    color: white;
}

.leaderboard-player {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Admin Panel */
.admin-container {
    width: 100%;
    height: 100%;
    background: #f5f5f5;
    overflow-y: auto;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.admin-header h1 {
    color: #2c3e50;
}

.btn-logout {
    background: #f5576c;
    color: white;
    padding: 10px 30px;
}

.admin-tabs {
    display: flex;
    background: white;
    padding: 0 40px;
    gap: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.tab-btn {
    padding: 15px 30px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.1em;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.admin-tab-content {
    padding: 40px;
}

.add-question-form, .create-game-form {
    background: white;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.add-question-form h3, .create-game-form h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.questions-list, .games-list, .reports-list {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.question-item, .game-item, .report-item {
    padding: 15px;
    margin: 10px 0;
    background: #f9f9f9;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-delete {
    background: #f5576c;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-delete:hover {
    background: #e74c3c;
}

.game-code-display {
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
    background: #f0f0f0;
    padding: 10px 20px;
    border-radius: 10px;
    display: inline-block;
    margin: 10px 0;
}

/* Responsive Design */
.btn-exit {
    background: linear-gradient(135deg, #f5576c 0%, #c0392b 100%);
    color: white;
    margin-top: 20px;
    padding: 12px 30px;
    border: none;
    border-radius: 50px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.3);
    width: 100%;
}

.btn-exit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.5);
}

.company-item {
    padding: 15px;
    margin: 10px 0;
    background: #f9f9f9;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.add-company-form {
    background: white;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.add-company-form h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

/* ===== SORU BANKASI - CATEGORY STYLES ===== */
.question-bank-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.question-bank-header h2 {
    color: #2c3e50;
    margin: 0;
}

.btn-add-category {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}

.btn-add-category:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(102,126,234,0.45);
}

.add-category-inline {
    background: white;
    border: 2px solid #667eea;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(102,126,234,0.15);
}

.add-category-inline h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.form-buttons {
    display: flex;
    gap: 12px;
    margin-top: 15px;
}

.form-buttons button {
    flex: 1;
}

/* Category Card */
.category-card {
    background: white;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    overflow: hidden;
    border: 1px solid #eee;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 25px;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.category-header:hover {
    background: linear-gradient(135deg, #eef1ff 0%, #e8eeff 100%);
}

.category-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-icon {
    font-size: 1.4em;
}

.category-name {
    font-size: 1.15em;
    font-weight: bold;
    color: #2c3e50;
}

.category-count {
    font-size: 0.85em;
    color: #888;
    background: #eee;
    padding: 3px 10px;
    border-radius: 20px;
}

.category-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-edit-category {
    background: #3498db;
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s;
}

.btn-edit-category:hover { background: #2980b9; }

.btn-delete-category {
    background: #f5576c;
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s;
}

.btn-delete-category:hover { background: #e74c3c; }

.category-toggle {
    background: none;
    border: none;
    font-size: 1.3em;
    cursor: pointer;
    color: #667eea;
    padding: 0 5px;
    transition: transform 0.3s;
}

.category-toggle.open { transform: rotate(180deg); }

/* Category Body (questions) */
.category-body {
    padding: 20px 25px;
    display: none;
}

.category-body.open {
    display: block;
}

/* Add Question form inside category */
.add-question-inline {
    background: #f8f9ff;
    border: 1px dashed #667eea;
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 18px;
    display: none;
}

.add-question-inline.open {
    display: block;
}

.add-question-inline-form {
    display: grid;
    grid-template-columns: auto 1fr 1fr auto;
    gap: 10px;
    align-items: end;
}

.add-question-inline-form select,
.add-question-inline-form input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 0.95em;
}

.add-question-inline-form select:focus,
.add-question-inline-form input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-add-question-inline {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9em;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-add-question-inline:hover { opacity: 0.9; }

.btn-show-add-question {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
    margin-bottom: 15px;
    transition: all 0.2s;
}

.btn-show-add-question:hover { opacity: 0.9; }

/* Category question item */
.cat-question-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin: 8px 0;
    background: #f9f9f9;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    gap: 10px;
}

.cat-question-info {
    flex: 1;
    min-width: 0;
}

.cat-question-letter {
    display: inline-block;
    background: #667eea;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    text-align: center;
    line-height: 28px;
    font-weight: bold;
    font-size: 0.9em;
    margin-right: 10px;
    flex-shrink: 0;
}

.cat-question-text {
    font-size: 0.95em;
    color: #2c3e50;
}

.cat-question-answer {
    font-size: 0.85em;
    color: #27ae60;
    font-weight: bold;
}

.btn-delete-question {
    background: #f5576c;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.8em;
    flex-shrink: 0;
    transition: all 0.2s;
}

.btn-delete-question:hover { background: #e74c3c; }

/* No questions message */
.no-questions-msg {
    text-align: center;
    color: #aaa;
    padding: 20px;
    font-style: italic;
}

.no-categories-msg {
    text-align: center;
    color: #aaa;
    padding: 40px;
    font-style: italic;
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

/* Form label */
.form-label {
    display: block;
    font-weight: bold;
    color: #555;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.form-field {
    margin-bottom: 15px;
}

/* Category rename form inline */
.category-rename-form {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 5px 0;
}

.category-rename-input {
    flex: 1;
    padding: 8px 14px;
    border: 2px solid #667eea;
    border-radius: 10px;
    font-size: 1em;
}

.btn-save-rename, .btn-cancel-rename {
    padding: 8px 16px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
}

.btn-save-rename { background: #43e97b; color: white; }
.btn-cancel-rename { background: #ddd; color: #555; }

@media (max-width: 768px) {
    .game-title {
        font-size: 2em;
    }

    .avatar-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .letter-bubble {
        width: 90px;
        height: 90px;
        font-size: 3.2em;
    }

    .question-text {
        font-size: 1.1em;
    }

    .timer-display {
        font-size: 1.5em;
        padding: 8px 22px;
    }

    .score-display {
        flex-direction: column;
        gap: 15px;
    }

    .score-item {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }

    .button-group {
        flex-direction: row;
    }

    .admin-tabs {
        flex-direction: column;
        padding: 10px;
    }

    .add-question-inline-form {
        grid-template-columns: 1fr 1fr;
    }

    .add-question-inline-form select {
        grid-column: span 2;
    }

    .add-question-inline-form .btn-add-question-inline {
        grid-column: span 2;
    }

    .question-bank-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 1.5em;
    }

    .content {
        padding: 20px;
    }

    .avatar {
        width: 70px;
        height: 70px;
    }

    .avatar::after {
        font-size: 35px;
    }

    /* Game screen on very small phones */
    .letter-indicator {
        width: 24px;
        height: 24px;
        font-size: 0.68em;
    }

    .letter-bubble {
        width: 80px;
        height: 80px;
        font-size: 2.8em;
    }

    .timer-display {
        font-size: 1.3em;
        padding: 7px 18px;
    }

    .question-card {
        padding: 16px 18px;
    }

    .question-text {
        font-size: 1em;
    }

    .answer-input {
        padding: 13px 18px;
        font-size: 1em;
    }

    .btn-submit, .btn-skip {
        padding: 12px 20px;
        font-size: 1em;
    }

    .btn-exit {
        padding: 10px 20px;
        font-size: 0.95em;
    }
}
