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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0a0a0a;
    min-height: 100vh;
    padding: 0;
    margin: 0;
    color: #333;
}

.container {
    width: 100%;
    min-height: 100vh;
    margin: 0;
}

.view {
    display: none;
    background: #0a0a0a;
    min-height: 100vh;
    padding: 60px 80px;
    box-shadow: none;
    border: none;
    position: relative;
}

.view.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

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

h1 {
    text-align: left;
    color: #ffffff;
    margin-bottom: 48px;
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -1px;
}

h2 {
    color: #ffffff;
    margin-bottom: 32px;
    font-size: 1.75rem;
    font-weight: 600;
}

.main-header {
    margin-bottom: 64px;
    padding-bottom: 32px;
    border-bottom: 1px solid #2a2a2a;
}

.version-info {
    position: absolute;
    bottom: 20px;
    right: 20px;
    font-size: 0.75rem;
    color: #666;
    font-family: monospace;
}

h3 {
    color: #e0e0e0;
    margin-bottom: 16px;
    font-size: 1.2rem;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.btn-primary {
    background: #ffffff;
    color: #0a0a0a;
}

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

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

.btn-secondary {
    background: #2a2a2a;
    color: #ffffff;
    border: 1px solid #3a3a3a;
}

.btn-secondary:hover {
    background: #3a3a3a;
    border-color: #4a4a4a;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

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

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

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.button-group {
    display: flex;
    gap: 16px;
    justify-content: flex-start;
    margin-bottom: 64px;
}

/* Sets List */
#bundledSetsContainer {
    margin-bottom: 48px;
}

.sets-container {
    margin-top: 0;
}

.sets-list {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.set-item {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.2s ease;
    cursor: pointer;
    min-height: 140px;
}

.set-item:hover {
    border-color: #3a3a3a;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    background: #1f1f1f;
}

.set-item.bundled-set {
    border-color: #4a4a4a;
    background: #1f1f1f;
}

.bundled-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    font-size: 0.7rem;
    color: #999;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.set-info {
    flex: 1;
}

.set-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 4px;
}

.set-meta {
    font-size: 0.9rem;
    color: #999;
}

.set-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-icon {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.empty-message {
    text-align: center;
    color: #666;
    padding: 40px;
    font-style: italic;
}

/* Editor */
.editor-header, .setup-header, .results-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 48px;
    padding-bottom: 24px;
    border-bottom: 1px solid #2a2a2a;
}

.editor-header h2, .setup-header h2, .results-header h2 {
    margin: 0;
    flex: 1;
    font-size: 2rem;
}

.form-group {
    margin-bottom: 32px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #e0e0e0;
}

.form-group input[type="text"],
.form-group input[type="number"],
.select-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
    background: #252525;
    color: #ffffff;
}

.select-input option {
    background: #252525;
    color: #ffffff;
}

.form-group input:focus,
.select-input:focus {
    outline: none;
    border-color: #ffffff;
    background: #2a2a2a;
}

.hint {
    display: block;
    margin-top: 4px;
    font-size: 0.85rem;
    color: #999;
}

.cards-editor {
    margin-top: 48px;
}

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

.cards-header-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #e0e0e0;
    font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #ffffff;
}

.cards-list {
    display: grid;
    gap: 20px;
    max-height: calc(100vh - 400px);
    overflow-y: auto;
    padding-right: 12px;
}

.card-item {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 24px;
}

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

.card-item-number {
    font-weight: 600;
    color: #ffffff;
}

.card-item-inputs {
    display: grid;
    gap: 16px;
}

.questions-section {
    display: grid;
    gap: 12px;
}

.questions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.questions-header label {
    font-size: 0.9rem;
    color: #e0e0e0;
    font-weight: 500;
}

.questions-list {
    display: grid;
    gap: 10px;
}

.question-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 8px;
    border: 1px solid #e1e5e9;
    border-radius: 4px;
    background: white;
    margin-bottom: 4px;
    transition: all 0.2s ease;
}

.question-item:hover {
    border-color: #007acc;
    box-shadow: 0 2px 4px rgba(0, 122, 204, 0.1);
}

.question-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.question-drag-handle {
    cursor: grab;
    color: #666;
    font-size: 12px;
    line-height: 1;
    padding: 4px 2px;
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 20px;
}

.question-drag-handle:active {
    cursor: grabbing;
}

.question-input-wrapper {
    flex: 1;
}

.question-input-wrapper textarea {
    width: 100%;
}

.question-placeholder {
    border: 2px dashed #007acc;
    background: rgba(0, 122, 204, 0.05);
    opacity: 0.7;
}

.question-placeholder .placeholder-text {
    color: #007acc;
    font-style: italic;
    padding: 8px 0;
    text-align: center;
}

.question-placeholder .question-drag-handle {
    color: #007acc;
}


.hints-section {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.hints-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hints-header label {
    font-size: 0.9rem;
    color: #e0e0e0;
    font-weight: 500;
}

.hints-list {
    display: grid;
    gap: 8px;
}

.hint-item {
    display: flex;
    gap: 8px;
    align-items: center;
}

.hint-item input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    background: #252525;
    color: #ffffff;
    transition: border-color 0.2s;
}

.hint-item input:focus {
    outline: none;
    border-color: #ffffff;
    background: #2a2a2a;
}

.hint-item input::placeholder {
    color: #666;
}

.card-hints {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    text-align: right;
    max-width: 60%;
    line-height: 1.4;
    z-index: 10;
}

.answer-syntax-hint {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.answer-syntax-hint small {
    font-size: 0.75rem;
    color: #999;
    font-style: italic;
}

.accepted-answers-list {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.accepted-forms-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
    font-style: italic;
}

.accepted-forms {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.accepted-form-item {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border-left: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-tiny {
    padding: 6px 10px;
    font-size: 0.85rem;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-item-inputs textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    transition: border-color 0.2s;
    background: #1a1a1a;
    color: #ffffff;
}

.card-item-inputs textarea:focus {
    outline: none;
    border-color: #ffffff;
    background: #252525;
}

.editor-actions {
    display: flex;
    gap: 16px;
    margin-top: 48px;
    justify-content: flex-start;
    padding-top: 32px;
    border-top: 1px solid #2a2a2a;
}

/* Study View */
.study-header {
    margin-bottom: 48px;
    padding-bottom: 24px;
    border-bottom: 1px solid #2a2a2a;
}

.progress-info {
    text-align: center;
}

#progressText {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #e0e0e0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #2a2a2a;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #ffffff;
    transition: width 0.3s ease;
    width: 0%;
}

.card-container {
    perspective: 1000px;
    margin-bottom: 48px;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flashcard {
    width: 100%;
    max-width: 700px;
    height: 450px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    cursor: pointer;
    margin: 0 auto;
}

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

.flashcard.slide-out {
    animation: slideOut 0.6s ease-out forwards;
}

.flashcard.slide-in {
    animation: slideIn 0.6s ease-out forwards;
}

@keyframes slideOut {
    from {
        transform: translateY(0) rotateY(0deg);
        opacity: 1;
    }
    to {
        transform: translateY(100vh) rotateY(0deg);
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-100vh) rotateY(0deg);
        opacity: 0;
    }
    to {
        transform: translateY(0) rotateY(0deg);
        opacity: 1;
    }
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.card-front {
    background: #0a0a0a;
    color: white;
    border: 2px solid #ffffff;
}

.card-back {
    background: #1a1a1a;
    color: white;
    transform: rotateY(180deg);
    border: 2px solid #ffffff;
}

.card-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}


.card-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    line-height: 1.6;
    text-align: center;
    word-wrap: break-word;
    overflow-y: auto;
}


.study-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.answer-buttons {
    display: flex;
    gap: 16px;
    width: 100%;
    max-width: 400px;
}

.answer-buttons .btn {
    flex: 1;
    padding: 16px;
    font-size: 1.1rem;
}

.hint-button {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    width: 100%;
    max-width: 400px;
}

.points-display {
    font-size: 0.9rem;
    color: #e0e0e0;
    font-weight: 600;
}

/* Results View */
.results-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
    max-width: 900px;
}

.stat-card {
    background: #252525;
    color: white;
    padding: 24px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border: 1px solid #3a3a3a;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cards-results-container {
    margin-top: 48px;
    margin-bottom: 32px;
}

.cards-results-container h3 {
    color: #ffffff;
    margin-bottom: 24px;
    font-size: 1.5rem;
}

.cards-results-list {
    display: grid;
    gap: 16px;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 12px;
}

.cards-results-list::-webkit-scrollbar {
    width: 8px;
}

.cards-results-list::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

.cards-results-list::-webkit-scrollbar-thumb {
    background: #3a3a3a;
    border-radius: 4px;
}

.cards-results-list::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a;
}

.card-result-item {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
}

.card-result-item:hover {
    border-color: #3a3a3a;
    background: #1f1f1f;
}

.card-result-item.correct {
    border-left: 4px solid #27ae60;
}

.card-result-item.wrong {
    border-left: 4px solid #e74c3c;
}

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

.card-result-number {
    font-weight: 600;
    color: #ffffff;
    font-size: 1rem;
}

.card-result-badge {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-result-badge.correct {
    background: rgba(39, 174, 96, 0.2);
    color: #27ae60;
    border: 1px solid rgba(39, 174, 96, 0.3);
}

.card-result-badge.wrong {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.card-result-content {
    display: grid;
    gap: 12px;
}

.card-result-question,
.card-result-answer {
    color: #e0e0e0;
    line-height: 1.6;
}

.card-result-question strong,
.card-result-answer strong {
    color: #ffffff;
    font-weight: 600;
    margin-right: 8px;
}

.results-actions {
    display: flex;
    gap: 16px;
    justify-content: flex-start;
    padding-top: 32px;
    border-top: 1px solid #2a2a2a;
}

.setup-content {
    max-width: 500px;
    margin: 0;
}

/* Scrollbar styling */
.cards-list::-webkit-scrollbar {
    width: 8px;
}

.cards-list::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

.cards-list::-webkit-scrollbar-thumb {
    background: #3a3a3a;
    border-radius: 4px;
}

.cards-list::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a;
}

/* Responsive */
@media (max-width: 1200px) {
    .view {
        padding: 40px 60px;
    }
}

@media (max-width: 768px) {
    .view {
        padding: 32px 40px;
    }
    
    h1 {
        font-size: 2.5rem;
        margin-bottom: 32px;
    }
    
    .button-group {
        flex-direction: column;
        gap: 12px;
    }
    
    .sets-list {
        grid-template-columns: 1fr;
    }
    
    .set-item {
        min-height: auto;
    }
    
    .flashcard {
        height: 350px;
    }
    
    .results-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .view {
        padding: 24px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .editor-header h2, .setup-header h2, .results-header h2 {
        font-size: 1.5rem;
    }
    
    .answer-buttons {
        flex-direction: column;
    }
    
    .flashcard {
        height: 300px;
    }
}

