* {
    box-sizing: border-box;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #0a0c10 0%, #0e1621 50%, #0a0c10 100%);
    color: #e6edf3;
    overflow-x: hidden;
    position: relative;
}

/* Animated gradient background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 50%, rgba(31, 111, 235, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(63, 185, 80, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Stars */
.star {
    position: fixed;
    border-radius: 50%;
    background: #ffffff;
    z-index: 0;
    opacity: 0.6;
    box-shadow: 0 0 2px rgba(255, 255, 255, 0.5);
}

/* Header */
header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 0;
    padding: 0 24px;
    height: 70px;
    z-index: 10;
    background: rgba(10, 12, 16, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(31, 111, 235, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    line-height: 70px;
    background: linear-gradient(135deg, #ffffff 0%, #1f6feb 50%, #3fb950 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 10px rgba(31, 111, 235, 0.3);
}

#backButton {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(31, 111, 235, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(31, 111, 235, 0.5);
    border-radius: 12px;
    padding: 8px 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

#backButton:hover {
    background: rgba(31, 111, 235, 0.4);
    transform: translateY(-50%) scale(1.05);
    border-color: #1f6feb;
}

header button {
    background: rgba(31, 111, 235, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(31, 111, 235, 0.5);
    border-radius: 12px;
    padding: 8px 16px;
    cursor: pointer;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

header button:hover {
    background: rgba(31, 111, 235, 0.4);
    transform: translateY(-2px);
    border-color: #1f6feb;
}

/* Settings */
.settings-btn {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(51, 51, 51, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 8px 16px;
    cursor: pointer;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-btn:hover {
    opacity: 1;
    background: rgba(31, 111, 235, 0.6);
    transform: translateY(-50%) scale(1.05);
}

.settings-panel {
    position: fixed;
    top: 70px;
    right: -280px;
    width: 260px;
    padding: 20px;
    border-radius: 0 0 0 20px;
    background: rgba(22, 27, 34, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 5;
    border-left: 1px solid rgba(31, 111, 235, 0.3);
    border-bottom: 1px solid rgba(31, 111, 235, 0.3);
    box-shadow: -5px 5px 20px rgba(0, 0, 0, 0.3);
}

.settings-panel.open {
    right: 0;
}

.settings-toggle-label {
    display: block;
    margin-bottom: 12px;
    cursor: pointer;
}

.settings-toggle-btn {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    color: #e6edf3;
}

.settings-toggle-btn.active {
    background: #1f6feb;
    border-color: #1f6feb;
}

.settings-toggle-btn .settings-indicator {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #30363d;
    transition: all 0.2s ease;
}

.settings-toggle-btn.active .settings-indicator {
    background: #3fb950;
    box-shadow: 0 0 8px rgba(63, 185, 80, 0.5);
}

.settings-toggle-btn:hover {
    transform: translateY(-1px);
    border-color: #1f6feb;
}

/* Container */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 30px 20px;
    position: relative;
    z-index: 1;
    margin-bottom: 50px;
}

/* Welcome Section */
.welcome-section {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInUp 0.6s ease;
}

.welcome-section h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #e6edf3, #8b949e);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.welcome-section p {
    color: #8b949e;
    font-size: 1.1rem;
}

/* Stats Cards */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: rgba(22, 27, 34, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(31, 111, 235, 0.2);
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    animation: fadeInUp 0.6s ease;
    animation-fill-mode: both;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }

.stat-card:hover {
    transform: translateY(-5px);
    border-color: rgba(31, 111, 235, 0.5);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #1f6feb;
    margin: 10px 0;
}

.stat-label {
    color: #8b949e;
    font-size: 0.9rem;
}

/* Cards Header */
.cards-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 30px 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(31, 111, 235, 0.3);
}

.cards-header h3 {
    margin: 0;
    font-size: 1.3rem;
    color: #e6edf3;
}

.card-count {
    color: #8b949e;
    font-size: 0.9rem;
}

/* Inputs */
.pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
    margin-top: 20px;
    animation: fadeIn 0.3s ease;
}

input[type="text"] {
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(48, 54, 61, 0.6);
    background: rgba(13, 17, 23, 0.8);
    backdrop-filter: blur(5px);
    color: #e6edf3;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

input[type="text"]:focus {
    outline: none;
    border-color: #1f6feb;
    box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.2);
    background: rgba(13, 17, 23, 1);
}

input::placeholder {
    color: #6e7681;
}

/* Editor buttons */
.io-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 30px;
}

button {
    background: linear-gradient(135deg, #1f6feb, #1a5fd4);
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:hover::before {
    width: 300px;
    height: 300px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(31, 111, 235, 0.4);
}

.upload-box {
    padding: 12px;
    border-radius: 12px;
    border: 2px dashed rgba(31, 111, 235, 0.5);
    background: rgba(13, 17, 23, 0.6);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.upload-box:hover {
    border-color: #1f6feb;
    background: rgba(31, 111, 235, 0.1);
    transform: translateY(-2px);
}

.upload-box input {
    display: none;
}

/* Viewer */
#viewer {
    margin-top: 30px;
    position: relative;
    height: 450px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: rgba(22, 27, 34, 0.5);
    border-radius: 24px;
    backdrop-filter: blur(10px);
    padding: 20px;
    animation: fadeIn 0.5s ease;
}

.viewer-hidden {
    display: none !important;
}

#cardWrapper {
    position: relative;
    width: 100%;
    flex: 1;
}

/* Card */
.card {
    position: absolute;
    width: 100%;
    height: 280px;
    border-radius: 24px;
    background: linear-gradient(135deg, #161b22, #0d1117);
    border: 1px solid rgba(31, 111, 235, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    text-align: center;
    padding: 30px;
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), left 0.45s ease;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.face {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    backface-visibility: hidden;
    padding: 30px;
    word-wrap: break-word;
    overflow-y: auto;
}

.back {
    transform: rotateY(180deg);
}

.card.flip {
    transform: rotateY(180deg);
}

/* Viewer buttons */
.viewer-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.viewer-buttons button {
    padding: 10px 24px;
    font-weight: 600;
}

/* Counter */
.card-counter {
    text-align: center;
    margin-bottom: 15px;
    font-size: 0.9rem;
    opacity: 0.8;
    width: 100%;
    font-weight: 500;
}

/* Mode toggle */
.mode-toggle {
    align-self: center;
    text-align: center;
    margin-bottom: 15px;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 0.9rem;
    background: rgba(48, 54, 61, 0.8);
    backdrop-filter: blur(10px);
    font-weight: 600;
}

/* Stats */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 1rem;
    margin-bottom: 15px;
    width: 100%;
    padding: 10px;
    background: rgba(13, 17, 23, 0.5);
    border-radius: 40px;
    backdrop-filter: blur(5px);
}

.stats-bar .correct {
    color: #3fb950;
    font-weight: 600;
}

.stats-bar .wrong {
    color: #f85149;
    font-weight: 600;
}

.stats-bar .percentage {
    opacity: 0.8;
    font-weight: 600;
}

/* Correct / wrong */
.correct-btn {
    background: linear-gradient(135deg, #2ea043, #238636);
}

.wrong-btn {
    background: linear-gradient(135deg, #d73a49, #b31e2e);
}

/* Side buttons */
.side-btn {
    position: absolute;
    top: 48%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 1.4rem;
    z-index: 4;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

#sideWrong {
    left: -80px;
}

#sideCorrect {
    right: -80px;
}

/* Toggle Button Styles */
.toggle-group {
    display: flex;
    gap: 12px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.toggle-btn {
    flex: 1;
    position: relative;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.95rem;
    color: #e6edf3;
}

.toggle-btn.active {
    background: #1f6feb;
    border-color: #1f6feb;
}

.toggle-btn .indicator {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #30363d;
    transition: all 0.2s ease;
}

.toggle-btn.active .indicator {
    background: #3fb950;
    box-shadow: 0 0 8px rgba(63, 185, 80, 0.5);
}

.toggle-btn:hover {
    transform: translateY(-1px);
    border-color: #1f6feb;
}

/* PDF Options Panel */
.pdf-options-panel {
    margin-bottom: 15px;
    padding: 15px;
    background: #0d1117;
    border-radius: 12px;
    border: 1px solid #30363d;
    display: none;
}

.pdf-options-panel.show {
    display: block;
    animation: slideDown 0.2s ease;
}

.pdf-options-title {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    color: #8b949e;
    text-align: left;
}

.format-buttons {
    display: flex;
    gap: 10px;
}

.format-btn {
    flex: 1;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    color: #e6edf3;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.format-btn.active {
    background: #1f6feb;
    border-color: #1f6feb;
}

.format-btn .radio-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #30363d;
    transition: all 0.2s ease;
}

.format-btn.active .radio-dot {
    background: #3fb950;
    box-shadow: 0 0 6px rgba(63, 185, 80, 0.5);
}

.format-btn:hover {
    transform: translateY(-1px);
    border-color: #1f6feb;
}

/* Star Toggle Button */
.star-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    background: rgba(22, 27, 34, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid #30363d;
    border-radius: 30px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.star-toggle:hover {
    transform: scale(1.05);
    background: rgba(31, 111, 235, 0.9);
}

.star-toggle .star-icon {
    font-size: 1.1rem;
}

.star-toggle .star-text {
    font-size: 0.85rem;
}

/* Toast Popup Notifications */
.toast-popup {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 12px 24px;
    min-width: 250px;
    max-width: 400px;
    text-align: center;
    z-index: 1002;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    cursor: pointer;
}

.toast-popup.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-popup.success {
    border-left: 4px solid #3fb950;
}

.toast-popup.error {
    border-left: 4px solid #f85149;
}

.toast-popup.info {
    border-left: 4px solid #1f6feb;
}

.toast-popup.warning {
    border-left: 4px solid #f0883e;
}

.toast-popup-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-popup-icon {
    font-size: 1.2rem;
}

.toast-popup-message {
    flex: 1;
    font-size: 0.9rem;
    color: #e6edf3;
}

.toast-popup-close {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    font-size: 1.1rem;
}

.toast-popup-close:hover {
    opacity: 1;
}

/* Cookie Consent Popup */
.cookie-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1001;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cookie-popup.show {
    opacity: 1;
}

.cookie-popup-content {
    background: #161b22;
    border-radius: 16px;
    padding: 28px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    border: 1px solid #30363d;
}

.cookie-popup.show .cookie-popup-content {
    transform: scale(1);
}

.cookie-popup h3 {
    margin: 0 0 15px 0;
    color: #e6edf3;
    font-size: 1.3rem;
}

.cookie-popup p {
    margin: 0 0 15px 0;
    color: #8b949e;
    line-height: 1.5;
}

.cookie-popup ul {
    margin: 15px 0;
    padding-left: 20px;
}

.cookie-popup li {
    margin: 8px 0;
    color: #8b949e;
    text-align: left;
}

.cookie-popup-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

.cookie-popup-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.cookie-popup-buttons button:hover {
    transform: translateY(-2px);
}

.cookie-popup-buttons .accept-btn {
    background: #1f6feb;
    color: white;
}

.cookie-popup-buttons .decline-btn {
    background: #30363d;
    color: #e6edf3;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 20px 15px;
    }
    
    .welcome-section h2 {
        font-size: 1.8rem;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .pair {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .io-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .side-btn {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    #sideWrong {
        left: -50px;
    }
    
    #sideCorrect {
        right: -50px;
    }
    
    .card {
        font-size: 1rem;
        padding: 20px;
    }
    
    .face {
        padding: 20px;
    }
}

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

::-webkit-scrollbar-track {
    background: rgba(13, 17, 23, 0.5);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #1f6feb;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3fb950;
}

/* Hide scrollbar for Chrome, Safari and Opera */
::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
* {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}