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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #e0e0e0;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    color: #e94560;
    margin-bottom: 5px;
}

.subtitle {
    color: #8892b0;
    font-size: 1.1rem;
}

/* Start Screen */
.start-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

.start-content {
    background: rgba(255, 255, 255, 0.05);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.start-content h2 {
    color: #e94560;
    margin-bottom: 15px;
}

.start-content p {
    color: #8892b0;
    margin-bottom: 25px;
}

#start-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#username-input,
#pin-input {
    padding: 15px;
    font-size: 1.1rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    text-align: center;
}

#username-input:focus,
#pin-input:focus {
    outline: none;
    border-color: #e94560;
}

#username-input::placeholder,
#pin-input::placeholder {
    color: #6c757d;
}

#pin-input {
    letter-spacing: 8px;
    font-size: 1.3rem;
}

.error-message {
    color: #e74c3c;
    font-size: 0.9rem;
    padding: 10px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 5px;
}

/* User display in status bar */
.user-display {
    color: #2ecc71;
    font-weight: bold;
}

/* New Game button */
.btn-danger {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.btn-danger:hover {
    background: rgba(231, 76, 60, 0.4);
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    gap: 10px;
}

.status-stats {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.status-stats span {
    font-size: 0.9rem;
}

#level-display {
    color: #e94560;
    font-weight: bold;
}

#progress-display::before {
    content: "⭐ ";
}

#completed-display::before {
    content: "✓ ";
    color: #2ecc71;
}

.status-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
}

.dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    background: #1a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    min-width: 120px;
    z-index: 100;
    margin-top: 5px;
    overflow: hidden;
}

.dropdown-content button {
    display: block;
    width: 100%;
    padding: 10px 15px;
    background: none;
    border: none;
    color: #e0e0e0;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
}

.dropdown-content button:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Story Section */
.story-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.story-section h2 {
    color: #8892b0;
    font-size: 1rem;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#story-level {
    color: #e94560;
}

.story-content {
    max-height: 200px;
    overflow-y: auto;
    padding-right: 10px;
}

.story-content p {
    margin-bottom: 8px;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background 0.3s;
}

.story-content p.current {
    background: rgba(233, 69, 96, 0.2);
    border-left: 3px solid #e94560;
    font-weight: 500;
}

.story-content p.completed {
    color: #6c757d;
    text-decoration: line-through;
    opacity: 0.6;
}

/* Evaluation Section */
.evaluation-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.evaluation-section h3 {
    color: #8892b0;
    font-size: 0.9rem;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.eval-content p {
    margin-bottom: 8px;
}

/* Task Section */
.task-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 20px;
}

.task-section h3 {
    color: #e0e0e0;
    margin-bottom: 15px;
}

.review-notice {
    background: rgba(243, 156, 18, 0.2);
    color: #f39c12;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: 500;
    text-align: center;
}

.current-sentence {
    font-size: 1.4rem;
    color: #fff;
    background: rgba(233, 69, 96, 0.1);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #e94560;
    margin-bottom: 20px;
}

#translation-input {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    margin-bottom: 15px;
    transition: border-color 0.3s;
}

#translation-input:focus {
    outline: none;
    border-color: #e94560;
}

#translation-input::placeholder {
    color: #6c757d;
}

.button-row {
    display: flex;
    gap: 10px;
}

.btn-primary, .btn-secondary, .btn-small {
    padding: 12px 25px;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, background 0.3s;
}

.btn-primary {
    background: #e94560;
    color: white;
    flex: 1;
}

.btn-primary:hover {
    background: #d63050;
    transform: translateY(-2px);
}

.btn-primary:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-small {
    padding: 8px 15px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.1);
    color: #8892b0;
}

.btn-small:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Hint Display */
.hint-display {
    margin-top: 15px;
    padding: 15px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 8px;
    border-left: 3px solid #3498db;
}

.hint-display p {
    margin-bottom: 5px;
}

/* Validation Result */
.validation-result {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 20px;
}

.validation-result h3 {
    color: #8892b0;
    font-size: 0.9rem;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-display {
    font-size: 1.3rem;
    margin-bottom: 15px;
}

.score-value {
    font-weight: bold;
    padding: 5px 15px;
    border-radius: 20px;
}

.score-value.excellent {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

.score-value.good {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
}

.score-value.poor {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.level-change {
    margin: 15px 0;
    padding: 15px;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
}

.level-change.advanced {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

.level-change.demoted {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

#next-btn {
    margin-top: 15px;
    width: 100%;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #1a1a2e;
    padding: 30px;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-content h2 {
    color: #e94560;
    margin-bottom: 20px;
}

.close-btn {
    float: right;
    font-size: 1.5rem;
    cursor: pointer;
    color: #8892b0;
}

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

#status-details p {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#status-details strong {
    color: #e94560;
}

.words-list {
    margin-top: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    font-size: 0.9rem;
    max-height: 100px;
    overflow-y: auto;
}

/* Large Modal for Word Tables */
.modal-large {
    max-width: 800px;
}

.modal-subtitle {
    color: #8892b0;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.count-badge {
    font-size: 0.9rem;
    color: #8892b0;
    font-weight: normal;
}

.table-container {
    max-height: 400px;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.words-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.words-table thead {
    position: sticky;
    top: 0;
    background: #16213e;
    z-index: 1;
}

.words-table th {
    text-align: left;
    padding: 12px 10px;
    color: #e94560;
    font-weight: 600;
    border-bottom: 2px solid rgba(233, 69, 96, 0.3);
}

.words-table td {
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.words-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.word-cell {
    font-weight: 500;
    color: #fff;
}

.count-correct {
    color: #2ecc71;
}

.count-incorrect {
    color: #e74c3c;
}

.success-rate {
    font-weight: 600;
}

.rate-good {
    color: #2ecc71;
}

.rate-medium {
    color: #f39c12;
}

.rate-poor {
    color: #e74c3c;
}

.empty-message {
    text-align: center;
    color: #8892b0;
    padding: 30px !important;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #8892b0;
}

.loading p {
    font-size: 1.2rem;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 15px;
    }

    header h1 {
        font-size: 2rem;
    }

    .status-stats {
        gap: 10px;
    }

    .current-sentence {
        font-size: 1.2rem;
    }

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

    .btn-primary, .btn-secondary {
        width: 100%;
    }
}
