/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #00AB84;
    --primary-dark: #008b6b;
    --secondary: #66BB6A;
    --error: #EF5350;
    --warning: #FFA726;
    --success: #66BB6A;
    --text: #E8E8E8;
    --text-light: #B0B0B0;
    --bg: #1A1A1A;
    --card-bg: #2A2A2A;
    --border: #3A3A3A;
    --shadow: rgba(0, 0, 0, 0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#app {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: var(--primary);
    color: white;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 4px var(--shadow);
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Main Content */
#main-content {
    flex: 1;
    padding: 1rem;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

/* Container */
.container {
    width: 100%;
}

/* Screen Management */
.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Typography */
h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.info-text {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

/* Buttons */
button, .btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    display: inline-block;
    text-align: center;
    text-decoration: none;
}

button:hover, .btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow);
}

button:active, .btn:active {
    transform: translateY(0);
}

.back-btn {
    background: transparent;
    color: var(--primary);
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--primary);
}

.back-btn:hover {
    background: var(--primary);
    color: white;
}

.btn-secondary {
    background: var(--text-light);
}

.btn-success {
    background: var(--success);
}

.btn-error {
    background: var(--error);
}

/* Cards */
.card-list {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px var(--shadow);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    text-align: center;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px var(--shadow);
    border-color: var(--primary);
}

.card h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.card p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    filter: saturate(1.3) brightness(1.1);
}

.folder-card {
    border-color: var(--border);
}

.folder-card:hover {
    border-color: var(--primary);
}

.folder-card .card-icon {
    filter: saturate(1.4) brightness(1.15) hue-rotate(-10deg);
}

.file-card .card-icon {
    filter: saturate(1.3) brightness(1.1) hue-rotate(5deg);
}

/* Breadcrumb Navigation */
#breadcrumb-container {
    margin-bottom: 1rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow);
}

.breadcrumb-btn {
    background: transparent;
    color: var(--primary);
    border: none;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.breadcrumb-btn:hover {
    background: var(--primary);
    color: white;
    transform: none;
    box-shadow: none;
}

.breadcrumb-separator {
    color: var(--text-light);
    font-size: 1.2rem;
}

/* Mode Cards */
.mode-cards {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.mode-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid var(--border);
}

.mode-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px var(--shadow);
    border-color: var(--primary);
}

.mode-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    filter: saturate(1.2) brightness(1.05);
}

/* Question Card */
.question-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 12px var(--shadow);
    margin-bottom: 1.5rem;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    color: var(--text-light);
}

.question-text {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
}

.stage-badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Input Fields */
input[type="text"], textarea {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    margin-bottom: 1rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

input[type="text"]:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text);
}

/* Feedback Messages */
.feedback {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 500;
    animation: slideIn 0.3s ease;
}

.feedback.correct {
    background: #1B4D2C;
    color: #81C784;
    border-left: 4px solid var(--success);
}

.feedback.incorrect {
    background: #4D1B1B;
    color: #EF9A9A;
    border-left: 4px solid var(--error);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Progress Bar */
.progress-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px var(--shadow);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--success);
    transition: width 0.3s ease;
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Run Header */
.run-header {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.run-header h2 {
    color: white;
    margin: 0;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 1.5rem;
}

.action-buttons button {
    flex: 1;
    min-width: 150px;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

/* Success Message */
.success-message {
    text-align: center;
    padding: 3rem 1rem;
}

.success-message h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.success-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    filter: saturate(1.3) brightness(1.1);
}

/* Footer */
.app-footer {
    background: var(--card-bg);
    padding: 1rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.875rem;
    border-top: 1px solid var(--border);
}

.app-footer a {
    color: var(--primary);
    text-decoration: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-header h1 {
        font-size: 1.25rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .mode-cards {
        grid-template-columns: 1fr;
    }
    
    .card-list {
        grid-template-columns: 1fr;
    }
    
    .action-buttons button {
        width: 100%;
    }
}

/* View Mode Styles */
.view-mode-list {
    width: 100%;
    margin: 1rem 0;
}

.view-mode-header {
    display: grid;
    grid-template-columns: 50px 1fr 1fr;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--primary);
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    color: white;
}

.view-mode-row {
    display: grid;
    grid-template-columns: 50px 1fr auto 1fr;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s;
}

.view-mode-row:hover {
    background: var(--card-bg);
}

.view-mode-row:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}

.view-mode-col-num {
    color: var(--warning);
    text-align: right;
    font-weight: 500;
    min-width: 40px;
}

.view-mode-col-word {
    color: var(--success);
    font-weight: 500;
}

.view-mode-col-arrow {
    color: var(--text-light);
    text-align: center;
    min-width: 30px;
}

.view-mode-col-meaning {
    color: var(--text);
}

/* Responsive View Mode */
@media (max-width: 768px) {
    .view-mode-header {
        grid-template-columns: 40px 1fr 1fr;
    }
    
    .view-mode-row {
        grid-template-columns: 40px 1fr auto 1fr;
        font-size: 0.9rem;
    }
    
    .view-mode-col-num {
        min-width: 30px;
    }
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.p-1 { padding: 1rem; }

.hidden {
    display: none !important;
}
