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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #fafaf8;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    max-width: 500px;
    width: 100%;
    overflow: hidden;
}

header {
    background: #4a90a4;
    color: white;
    padding: 20px 25px;
    text-align: center;
}

header h1 {
    font-size: 1.6em;
    margin: 0;
    font-weight: 600;
}

main {
    padding: 20px 20px;
    min-height: 300px;
}

.loading {
    text-align: center;
    padding: 30px 10px;
    color: #666;
    font-size: 1em;
}

.hidden {
    display: none !important;
}

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

.word-display {
    background: #f5f8fa;
    border: 2px solid #e0ecf1;
    border-radius: 8px;
    padding: 25px 15px;
    text-align: center;
    margin-bottom: 10px;
}

.word {
    font-size: clamp(1.2em, 5vw, 2.8em);
    font-weight: 700;
    color: #333;
    word-break: break-word;
    overflow-wrap: break-word;
    margin: 0;
    line-height: 1.3;
    text-align: center;
}

.question {
    text-align: center;
    font-size: 1.3em;
    color: #555;
}

.question strong {
    color: #667eea;
}

.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.btn {
    padding: 10px 18px;
    font-size: 0.95em;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn:active {
    opacity: 0.85;
    transform: translateY(0);
}

.btn-primary {
    background: #27ae60;
    color: white;
}

.btn-primary:hover {
    background: #229954;
}

.btn-large {
    padding: 14px 28px;
    font-size: 1.05em;
    margin-top: 20px;
    width: 100%;
}

/* Keyboard Shortcuts Info Box */
.keyboard-shortcuts-info {
    background: #f0f4f8;
    border: 2px solid #4a90a4;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.info-title {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #333;
}

.shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: white;
    border-radius: 6px;
}

.shortcut-key {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    background: #4a90a4;
    color: white;
    border-radius: 6px;
    font-weight: 700;
    font-size: 1em;
    flex-shrink: 0;
}

.shortcut-label {
    color: #333;
    font-weight: 500;
    font-size: 0.9em;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8em;
    color: #666;
    cursor: pointer;
}

.checkbox-label input {
    cursor: pointer;
}

.btn-yes {
    background: #6ec96e;
    color: white;
}

.btn-no {
    background: #e07856;
    color: white;
}

.btn-yes.keyboard-selected {
    background: #229954;
}

.btn-yes.keyboard-deselected {
    background: #a8dba8;
}

.btn-no.keyboard-selected {
    background: #c93f1f;
}

.btn-no.keyboard-deselected {
    background: #f5b5a0;
}

.btn-next {
    background: #4a90a4;
    color: white;
    width: 100%;
}

.result-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-message {
    padding: 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95em;
    text-align: center;
}

.result-correct {
    background: #e8f5e9;
    color: #2e7d32;
    border: 2px solid #6ec96e;
}

.result-incorrect {
    background: #ffebee;
    color: #c62828;
    border: 2px solid #e07856;
}

.links-section {
    background: #f5f8fa;
    border: 1px solid #e0ecf1;
    border-radius: 6px;
    padding: 10px;
}

.links-section p {
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
    font-size: 0.95em;
}

.dictionary-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.dictionary-link {
    background: white;
    border: 1px solid #ddd;
    padding: 6px 10px;
    border-radius: 5px;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-block;
    white-space: nowrap;
    font-size: 0.85em;
}

.dictionary-link:hover {
    background: #f5f8fa;
    border-color: #4a90a4;
}

.dictionary-link.dict-a {
    border-left: 3px solid #6ec96e;
}

.dictionary-link.dict-b {
    border-left: 3px solid #e07856;
}

.inline-link {
    color: #4a90a4;
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
}

.inline-link:hover {
    color: #2c5b72;
}

.stats {
    text-align: center;
    color: #999;
    font-size: 0.8em;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
    margin-top: 10px;
}

.stats p {
    margin: 3px 0;
}

.streak-stats {
    font-weight: 600;
    color: #333;
    font-size: 0.95em;
}

.streak-stats #streak {
    color: #e07856;
    font-weight: 700;
}

.streak-stats #maxStreak {
    color: #6ec96e;
    font-weight: 700;
}

.error-container {
    text-align: center;
    padding: 20px 15px;
    background: #ffebee;
    border: 2px solid #e07856;
    border-radius: 6px;
    color: #c62828;
}

.error-container p {
    margin-bottom: 12px;
    font-size: 0.95em;
}

#retryBtn {
    background: #e07856;
    color: white;
    padding: 8px 16px;
    display: inline-block;
    border-radius: 6px;
    font-size: 0.95em;
}

.about-content {
    padding: 10px 0;
}

.about-content h2 {
    font-size: 1.3em;
    color: #333;
    margin: 10px 0 12px 0;
    font-weight: 600;
}

.about-content p {
    color: #555;
    line-height: 1.6;
    margin: 0 0 15px 0;
    font-size: 0.95em;
}

.about-links {
    margin-top: 20px;
    text-align: center;
}

footer {
    padding: 12px 20px;
    text-align: center;
    border-top: 1px solid #e2e8f0;
    background: #fafaf8;
}

.footer-link {
    color: #4a90a4;
    text-decoration: none;
    font-size: 0.85em;
    font-weight: 500;
    transition: color 0.2s;
}

.footer-link:hover {
    color: #2c5b72;
    text-decoration: underline;
}

.source {
    background: #f5f8fa;
    border-left: 3px solid #4a90a4;
    padding: 12px 15px;
    border-radius: 4px;
    margin: 15px 0;
}

.source p {
    margin: 6px 0;
    font-size: 0.9em;
    line-height: 1.5;
    color: #555;
}

.password-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.password-dialog {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    padding: 30px 25px;
    max-width: 350px;
    width: 90%;
    text-align: center;
}

.password-dialog h2 {
    font-size: 1.4em;
    color: #333;
    margin: 0 0 15px 0;
    font-weight: 600;
}

.password-dialog p {
    color: #666;
    margin: 0 0 15px 0;
    font-size: 0.95em;
}

#passwordInput {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 15px;
    font-size: 1em;
    border: 2px solid #e0ecf1;
    border-radius: 6px;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

#passwordInput:focus {
    outline: none;
    border-color: #4a90a4;
}

#passwordSubmit {
    width: 100%;
    background: #4a90a4;
    color: white;
    padding: 10px 18px;
    font-size: 0.95em;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

#passwordSubmit:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

#passwordSubmit:active {
    opacity: 0.85;
    transform: translateY(0);
}

.password-error {
    color: #e07856;
    font-size: 0.85em;
    margin-top: 10px;
    margin-bottom: 0;
    font-weight: 500;
}

/* Leaderboard Modal Styles */
.leaderboard-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.leaderboard-dialog {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    padding: 30px 25px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.leaderboard-dialog h2 {
    font-size: 1.6em;
    color: #333;
    margin: 0 0 15px 0;
    font-weight: 600;
}

.leaderboard-dialog p {
    color: #666;
    margin: 0 0 15px 0;
    font-size: 0.95em;
}

.leaderboard-dialog p strong {
    color: #4a90a4;
    font-size: 1.3em;
}

#usernameInput {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    font-size: 1em;
    border: 2px solid #e0ecf1;
    border-radius: 6px;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

#usernameInput:focus {
    outline: none;
    border-color: #4a90a4;
}

.modal-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.btn-submit {
    background: #6ec96e;
    color: white;
}

.btn-skip {
    background: #999;
    color: white;
}

.leaderboard-error {
    color: #e07856;
    font-size: 0.85em;
    margin-top: 10px;
    font-weight: 500;
}

/* Leaderboard View Styles */
.leaderboard-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.leaderboard-header h2 {
    font-size: 1.5em;
    color: #333;
    margin: 0;
}

.btn-back-to-quiz {
    background: #4a90a4;
    color: white;
    padding: 8px 16px;
    font-size: 0.85em;
}

.leaderboard-entries {
    list-style: none;
    padding: 0;
    margin: 0;
}

.leaderboard-entry {
    display: grid;
    grid-template-columns: 40px 1fr auto 80px;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    transition: background 0.2s;
}

.leaderboard-entry:hover {
    background: #f5f8fa;
}

.leaderboard-entry.top-three {
    background: #fffbf0;
    font-weight: 600;
}

.leaderboard-entry .rank {
    font-size: 1.2em;
    font-weight: 700;
    color: #999;
    text-align: center;
}

.leaderboard-entry.top-three .rank {
    font-size: 1.5em;
}

.leaderboard-entry .username {
    color: #333;
    font-size: 0.95em;
}

.leaderboard-entry .streak {
    color: #6ec96e;
    font-weight: 700;
    font-size: 0.9em;
}

.leaderboard-entry .date {
    color: #999;
    font-size: 0.75em;
    text-align: right;
}

.leaderboard-stats {
    background: #f5f8fa;
    border: 1px solid #e0ecf1;
    border-radius: 6px;
    padding: 15px;
    margin-top: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.8em;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.8em;
    font-weight: 700;
    color: #4a90a4;
}

.footer-separator {
    margin: 0 10px;
    color: #ccc;
}

.loading-text, .empty-text, .error-text {
    text-align: center;
    padding: 30px 15px;
    color: #666;
    font-size: 0.95em;
}

.error-text {
    color: #e07856;
}

@media (max-width: 600px) {
    .leaderboard-entry {
        grid-template-columns: 30px 1fr auto;
        gap: 8px;
        font-size: 0.9em;
    }

    .leaderboard-entry .date {
        grid-column: 2 / -1;
        text-align: left;
        margin-top: 5px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .modal-buttons {
        grid-template-columns: 1fr;
    }
    header h1 {
        font-size: 1.4em;
    }

    .word {
        font-size: 2.2em;
    }

    main {
        padding: 15px 15px;
    }

    .button-group {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* Statistika Page Styles */

.statistika-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.statistika-intro {
    background: #f0f8fb;
    border-left: 4px solid #4a90a4;
    padding: 15px;
    border-radius: 4px;
}

.statistika-intro p {
    margin: 0;
    color: #333;
    font-size: 0.95em;
    line-height: 1.5;
}

.statistika-stats {
    margin: 10px 0;
}

.stats-grid-statistika {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

.stats-grid-statistika .stat-item {
    background: #f9f9f9;
    padding: 12px;
    border-radius: 6px;
    text-align: center;
}

.stats-grid-statistika .stat-label {
    display: block;
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
}

.stats-grid-statistika .stat-value {
    display: block;
    font-size: 1.5em;
    font-weight: 600;
    color: #4a90a4;
}

.statistika-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 10px 0;
}

.statistika-tab-btn {
    padding: 12px 15px;
    border: 2px solid #ddd;
    background: white;
    color: #333;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.statistika-tab-btn:hover {
    border-color: #4a90a4;
    color: #4a90a4;
}

.statistika-tab-btn.active {
    background: #4a90a4;
    color: white;
    border-color: #4a90a4;
}

.wrong-answers-container {
    margin: 15px 0;
}

.wrong-answers-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 15px 0;
}

.word-chip {
    display: inline-block;
    padding: 6px 12px;
    background: #f0f8fb;
    border: 1px solid #4a90a4;
    border-radius: 20px;
    color: #4a90a4;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9em;
    white-space: nowrap;
    transition: all 0.2s;
}

.word-chip:hover {
    background: #4a90a4;
    color: white;
}

.pagination,
.leaderboard-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.pagination-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    border-color: #4a90a4;
    color: #4a90a4;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 0.9em;
    color: #666;
}

@media (max-width: 600px) {
    .stats-grid-statistika {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .stats-grid-statistika .stat-item {
        padding: 10px;
    }

    .stats-grid-statistika .stat-label {
        font-size: 0.8em;
    }

    .stats-grid-statistika .stat-value {
        font-size: 1.3em;
    }

    .statistika-tabs {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .statistika-tab-btn {
        padding: 10px 12px;
        font-size: 0.85em;
    }

    .wrong-answers-chips {
        gap: 6px;
    }

    .word-chip {
        padding: 5px 10px;
        font-size: 0.85em;
    }

    .pagination {
        gap: 10px;
    }

    .pagination-btn {
        padding: 6px 10px;
        font-size: 0.85em;
    }

    .pagination-info {
        font-size: 0.85em;
    }
}

/* Landing Page Styles */

.landing-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.landing-content h2 {
    color: #4a90a4;
    font-size: 1.3em;
    margin-bottom: 10px;
    margin-top: 10px;
}

.landing-content p {
    line-height: 1.6;
    color: #333;
    margin-bottom: 10px;
}

.privacy-note {
    background: #f0f8fb;
    border-left: 4px solid #4a90a4;
    padding: 12px 15px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #555;
    line-height: 1.5;
}

.consent-choice {
    background: #fafaf8;
    border: 2px solid #4a90a4;
    border-radius: 8px;
    padding: 20px;
    margin-top: 10px;
    text-align: center;
}

.consent-choice p {
    margin-bottom: 15px;
    font-size: 1.05em;
    color: #333;
}

.consent-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}


@media (max-width: 600px) {
    .consent-buttons {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .landing-content h2 {
        font-size: 1.15em;
    }

    .privacy-note {
        font-size: 0.85em;
        padding: 10px 12px;
    }

    .consent-choice {
        padding: 15px;
    }

    .consent-choice p {
        font-size: 0.95em;
    }
}
