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

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

body {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #fef9e7;
    min-height: 100vh;
    color: #5d4e37;
    line-height: 1.6;
}

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

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

.header-content {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    margin-bottom: 20px;
    position: relative;
}

.tabs-nav {
    position: absolute;
    top: 0;
    left: 0;
}

.tabs {
    position: relative;
    display: flex;
    gap: 8px;
}

.tab-btn {
    background: none !important;
    border: none;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: #8b7355;
    cursor: pointer;
    transition: color 0.3s ease;
    position: relative;
    outline: none;
    transform: none !important;
}

.tab-btn.active {
    color: #8b7355;
    background: none !important;
}

.tab-btn:hover {
    color: #8b7355;
    background: none !important;
    transform: none !important;
}

.tab-btn:focus {
    outline: none;
    background: none !important;
}

.tab-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: #d4af37;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-50%);
}

.tab-btn:hover::after,
.tab-btn.active::after {
    width: 100%;
}

.logo-container {
    margin-bottom: -60px;
}

.logo {
    height: 280px;
    width: auto;
    max-width: 100%;
    object-fit: cover;
    object-position: center;
}

header p {
    color: #8b7355;
    font-size: 1.1rem;
    font-weight: 400;
}

.quizlet-import-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fefcf3;
    color: #5d4e37;
    border: 2px solid #f4e4bc;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(139, 105, 20, 0.1);
}

.quizlet-import-btn:hover {
    background: #f4e4bc;
    border-color: #d4af37;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 105, 20, 0.2);
}

.section {
    background: #ffffff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(139, 105, 20, 0.08);
    margin-bottom: 24px;
    border: 1px solid #f4e4bc;
}

.hidden {
    display: none;
}

h2 {
    color: #8b6914;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
}

#input-data {
    width: 100%;
    height: 180px;
    padding: 16px;
    border: 2px solid #f4e4bc;
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    resize: vertical;
    margin-bottom: 20px;
    background: #fefcf3;
    color: #5d4e37;
    transition: border-color 0.2s ease;
}

#input-data:focus {
    outline: none;
    border-color: #d4af37;
}

#input-data::placeholder {
    color: #a89984;
}

button {
    background: #d4af37;
    color: #5d4e37;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

button:hover {
    background: #b8941f;
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

.secondary-btn {
    background: #8b7355;
    color: white;
    margin-top: 20px;
}

.secondary-btn:hover {
    background: #6d5a44;
}

.learning-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    gap: 16px;
}

.progress-bar {
    position: relative;
    flex: 1;
    height: 8px;
    background: #f4e4bc;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #d4af37;
    border-radius: 4px;
    width: 0%;
    transition: width 0.4s ease;
}

.progress-text {
    position: absolute;
    top: -24px;
    right: 0;
    font-size: 14px;
    font-weight: 500;
    color: #8b7355;
}

.direction-toggle {
    background: #fefcf3;
    color: #5d4e37;
    border: 2px solid #f4e4bc;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.direction-toggle:hover {
    background: #f4e4bc;
    border-color: #d4af37;
    transform: translateY(-1px);
}

.toggle-icon {
    font-size: 16px;
    color: #d4af37;
}

.question-container {
    margin-bottom: 32px;
}

#question-type {
    color: #8b6914;
    margin-bottom: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#question-text {
    font-size: 1.4rem;
    margin-bottom: 24px;
    font-weight: 500;
    color: #5d4e37;
}

.options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.option-btn {
    background: #fefcf3;
    color: #5d4e37;
    border: 2px solid #f4e4bc;
    padding: 16px;
    text-align: left;
    transition: all 0.2s ease;
    border-radius: 8px;
    font-weight: 400;
    position: relative;
}

.option-btn::before {
    content: attr(data-number);
    position: absolute;
    top: 8px;
    right: 12px;
    background: #d4af37;
    color: #5d4e37;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.option-btn:hover {
    background: #f4e4bc;
    border-color: #d4af37;
}

.option-btn.correct {
    background: #e8f5e8;
    border-color: #4caf50;
    color: #2e7d32;
}

.option-btn.incorrect {
    background: #ffebee;
    border-color: #f44336;
    color: #c62828;
}

.option-btn.disabled {
    pointer-events: none;
    opacity: 0.6;
}

#answer-input {
    width: 100%;
    padding: 16px;
    border: 2px solid #f4e4bc;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 16px;
    background: #fefcf3;
    color: #5d4e37;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

#answer-input:focus {
    outline: none;
    border-color: #d4af37;
}

#feedback {
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

#feedback.correct {
    background: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #4caf50;
}

#feedback.incorrect {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #f44336;
}

#feedback-text {
    margin-bottom: 16px;
}

.stats {
    display: flex;
    justify-content: space-around;
    background: #fefcf3;
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #f4e4bc;
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 13px;
    color: #8b7355;
    margin-bottom: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat span:last-child {
    font-size: 1.8rem;
    font-weight: 600;
    color: #8b6914;
}

#completion-section {
    text-align: center;
}

#completion-section h2 {
    color: #8b6914;
    margin-bottom: 16px;
    font-size: 2rem;
}

#completion-section p {
    color: #8b7355;
    font-size: 1.1rem;
    margin-bottom: 24px;
}

#final-stats {
    background: #fefcf3;
    padding: 24px;
    border-radius: 8px;
    margin: 24px 0;
    font-size: 1rem;
    color: #5d4e37;
    border: 1px solid #f4e4bc;
}

#final-stats div {
    margin-bottom: 8px;
}

#final-stats div:last-child {
    margin-bottom: 0;
}

/* Tutorial Styles */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.tutorial-overlay.hidden {
    display: none !important;
}

.tutorial-content {
    background: #ffffff;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    box-shadow: 0 8px 32px rgba(139, 105, 20, 0.15);
    border: 2px solid #f4e4bc;
    overflow: hidden;
}

.tutorial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px 20px;
    border-bottom: 1px solid #f4e4bc;
    background: #fefcf3;
}

.tutorial-header h3 {
    color: #8b6914;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.tutorial-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #8b7355;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    z-index: 1001;
    position: relative;
}

.tutorial-close:hover {
    background: rgba(139, 115, 85, 0.1);
    transform: none;
}

.tutorial-steps {
    padding: 28px;
    min-height: 280px;
    position: relative;
}

.tutorial-step {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tutorial-step.active {
    display: block;
}

.tutorial-step h4 {
    color: #8b6914;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.tutorial-step p {
    color: #5d4e37;
    line-height: 1.6;
    margin-bottom: 16px;
}

.tutorial-example {
    background: #fefcf3;
    border: 1px solid #f4e4bc;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.tutorial-example strong {
    color: #8b6914;
    display: block;
    margin-bottom: 8px;
}

.tutorial-example code {
    background: #fff;
    border: 1px solid #f4e4bc;
    border-radius: 4px;
    padding: 8px;
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: #5d4e37;
}

.tutorial-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 28px 24px;
    background: #fefcf3;
    border-top: 1px solid #f4e4bc;
}

.tutorial-nav-btn {
    background: #d4af37;
    color: #5d4e37;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1001;
    position: relative;
}

.tutorial-nav-btn:hover {
    background: #b8941f;
    transform: translateY(-1px);
}

.tutorial-start-btn {
    background: #d4af37;
    color: #5d4e37;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1001;
    position: relative;
}

.tutorial-start-btn:hover {
    background: #b8941f;
    transform: translateY(-1px);
}

.tutorial-dots {
    display: flex;
    gap: 8px;
}

.tutorial-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f4e4bc;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.tutorial-dot.active {
    background: #d4af37;
}

.tutorial-dot:hover {
    background: #b8941f;
}

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

/* Special Characters Styles */
.special-chars-container {
    background: #fefcf3;
    border: 2px solid #f4e4bc;
    border-radius: 8px;
    margin: 16px 0;
    overflow: hidden;
}

.special-chars-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f4e4bc;
    font-weight: 500;
    color: #8b6914;
    font-size: 14px;
}

.hide-special-chars {
    background: none;
    border: none;
    font-size: 16px;
    color: #8b7355;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.hide-special-chars:hover {
    background: rgba(139, 115, 85, 0.2);
    transform: none;
}

.special-chars-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px;
}

.special-char-btn {
    background: #ffffff;
    border: 2px solid #d4af37;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #5d4e37;
    min-width: 40px;
    text-align: center;
}

.special-char-btn:hover {
    background: #d4af37;
    color: #5d4e37;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

.special-char-btn:active {
    transform: translateY(0);
}

@media (max-width: 600px) {
    .container {
        padding: 20px 16px;
    }

    header h1 {
        font-size: 2rem;
    }

    .section {
        padding: 24px;
    }

    .options {
        grid-template-columns: 1fr;
    }

    .stats {
        flex-direction: column;
        gap: 16px;
    }

    .tutorial-content {
        width: 95%;
        max-height: 90vh;
    }

    .tutorial-header,
    .tutorial-steps,
    .tutorial-navigation {
        padding-left: 20px;
        padding-right: 20px;
    }

    .tutorial-navigation {
        flex-direction: column;
        gap: 12px;
    }

    .tutorial-dots {
        order: -1;
    }

    .special-chars-buttons {
        gap: 6px;
        padding: 12px;
    }

    .special-char-btn {
        padding: 6px 10px;
        font-size: 14px;
        min-width: 36px;
    }

    .header-content {
        flex-direction: column;
        align-items: center;
    }

    .tabs-nav {
        position: static;
        margin-top: 16px;
    }
}

/* Flashcards Styles */
#flashcards-section {
    text-align: center;
}

.flashcard-container {
    max-width: 600px;
    margin: 0 auto;
}

.flashcard {
    width: 100%;
    height: 300px;
    perspective: 1000px;
    margin-bottom: 24px;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    cursor: pointer;
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border: 2px solid #f4e4bc;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(139, 105, 20, 0.1);
}

.flashcard-back {
    transform: rotateY(180deg);
    background: #fefcf3;
}

.flashcard-content {
    padding: 24px;
    font-size: 1.2rem;
    font-weight: 500;
    color: #5d4e37;
    word-wrap: break-word;
    max-width: 100%;
}

.flashcard-tracking {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
}

.tracking-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.correct-btn {
    background: #4caf50;
    color: white;
}

.correct-btn:hover {
    background: #388e3c;
    transform: translateY(-1px);
}

.wrong-btn {
    background: #f44336;
    color: white;
}

.wrong-btn:hover {
    background: #d32f2f;
    transform: translateY(-1px);
}

.tracking-btn:disabled {
    background: #e0e0e0;
    color: #9e9e9e;
    cursor: not-allowed;
    transform: none;
}

.flashcard-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.flashcard-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
    padding: 16px;
    background: #fefcf3;
    border-radius: 8px;
    border: 1px solid #f4e4bc;
}

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

.stat-item .stat-label {
    display: block;
    font-size: 12px;
    color: #8b7355;
    margin-bottom: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-item span:last-child {
    font-size: 1.4rem;
    font-weight: 600;
    color: #8b6914;
}

.flashcard-btn {
    background: #d4af37;
    color: #5d4e37;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.flashcard-btn:hover {
    background: #b8941f;
    transform: translateY(-1px);
}

.flashcard-btn:disabled {
    background: #f4e4bc;
    color: #8b7355;
    cursor: not-allowed;
    transform: none;
}

.flashcard-counter {
    font-size: 16px;
    font-weight: 500;
    color: #8b6914;
}

.flashcard-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
}

@media (max-width: 600px) {
    .flashcard {
        height: 250px;
    }

    .flashcard-content {
        font-size: 1rem;
        padding: 20px;
    }

    .flashcard-actions {
        flex-direction: column;
        gap: 12px;
    }

    .flashcard-stats {
        flex-direction: column;
        gap: 12px;
    }

    .flashcard-tracking {
        flex-direction: column;
        gap: 12px;
    }
}