/* --- CORE DESIGN SYSTEM --- */
:root {
    --bg-dark: #0f0f11;
    --bg-panel: #1e1e24;
    --text-main: #e0e0e0;
    --text-muted: #949494;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.4);
    --gold: #fbbf24;
    --border: #2d2d35;
    --font-size-base: 16px;
    --c-a1: #64748b;
    --c-a2: #0ea5e9;
    --c-b1: #10b981;
    --c-b2: #f59e0b;
    --c-c1: #ef4444;
}

* {
    box-sizing: border-box;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* Focus states for accessibility */
button:focus-visible,
.card:focus-visible,
input:focus-visible,
.chip:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.card:focus-visible {
    transform: scale(1.02);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent);
    color: white;
    padding: 8px 16px;
    z-index: 9999;
    text-decoration: none;
    border-radius: 0 0 8px 0;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* GPU Acceleration for animations */
.card,
.modal,
.overlay,
.onboarding-icon,
.goal-btn,
.achievement-item,
.chip {
    will-change: transform, opacity;
    transform: translateZ(0);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    margin: 0;
    padding-bottom: 90px;
    font-size: var(--font-size-base);
    line-height: 1.5;
    overflow-y: auto;
    overflow-x: hidden;
}

body.mode-active {
    overflow: hidden;
}

/* JUICY EFFECTS */
@keyframes flashGreen {
    0% {
        box-shadow: inset 0 0 0 0 transparent;
    }

    50% {
        box-shadow: inset 0 0 50px rgba(16, 185, 129, 0.5);
    }

    100% {
        box-shadow: inset 0 0 0 0 transparent;
    }
}

@keyframes flashRed {
    0% {
        box-shadow: inset 0 0 0 0 transparent;
    }

    50% {
        box-shadow: inset 0 0 50px rgba(239, 68, 68, 0.5);
    }

    100% {
        box-shadow: inset 0 0 0 0 transparent;
    }
}

.flash-success {
    animation: flashGreen 0.4s ease-out;
}

.flash-error {
    animation: flashRed 0.4s ease-out;
}

#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* HEADER & UI ELEMENTS */
.header {
    position: sticky;
    top: 0;
    background-color: rgba(15, 15, 17, 0.96);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    margin: 0;
    font-size: 1.3rem;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.action-row {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}

.btn {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    color: #ccc;
    padding: 10px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: var(--accent);
    color: white;
    border: 1px solid var(--accent);
    font-weight: 700;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-pro {
    background: linear-gradient(135deg, #fbbf24, #d97706);
    color: #1a1a1a;
    border: none;
    font-weight: 800;
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.3);
}

.btn-random {
    background: linear-gradient(135deg, #8b5cf6, #d946ef);
    color: white;
    border: none;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-icon {
    padding: 0;
    width: 40px;
    height: 40px;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.2rem;
}

.search-box {
    background: #18181b;
    border: 1px solid var(--border);
    color: white;
    padding: 12px 15px;
    border-radius: 12px;
    width: 100%;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.search-box:focus {
    border-color: var(--accent);
}

.stats-wrapper {
    background: #18181b;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.stats-bar {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    justify-content: space-between;
    margin-bottom: 6px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.s-val {
    font-weight: bold;
}

.c-red {
    color: #ef4444;
}

.c-yellow {
    color: #eab308;
}

.c-green {
    color: #22c55e;
}

.progress-track {
    width: 100%;
    height: 4px;
    background: #333;
    border-radius: 2px;
    overflow: hidden;
    display: flex;
}

.prog-green {
    height: 100%;
    background: #22c55e;
    transition: width 0.5s;
}

.prog-yellow {
    height: 100%;
    background: #eab308;
    transition: width 0.5s;
}

.prog-red {
    height: 100%;
    background: #ef4444;
    transition: width 0.5s;
}

.filters {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
    justify-content: center;
    /* Center filters for aesthetic look */
}

.chip {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    color: #888;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    font-weight: 500;
}

.chip.active {
    background: #eee;
    color: #111;
    border-color: #fff;
    font-weight: 700;
    transform: translateY(-1px);
}

.chip[data-level="A1"].active {
    background: var(--c-a1);
    border-color: var(--c-a1);
    color: white;
}

.chip[data-level="A2"].active {
    background: var(--c-a2);
    border-color: var(--c-a2);
    color: white;
}

.chip[data-level="B1"].active {
    background: var(--c-b1);
    border-color: var(--c-b1);
    color: white;
}

.chip[data-level="B2"].active {
    background: var(--c-b2);
    border-color: var(--c-b2);
    color: black;
}

.chip[data-level="C1"].active {
    background: var(--c-c1);
    border-color: var(--c-c1);
    color: white;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
    gap: 12px;
    padding: 15px;
    max-width: 900px;
    margin: 0 auto;
}

.card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 10px;
    text-align: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    user-select: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    border-color: #444;
}

.card:active {
    transform: scale(0.96);
}

.card.st-0 {
    border-top: 3px solid #ef4444;
}

.card.st-1 {
    border-top: 3px solid #eab308;
}

.card.st-2 {
    border-top: 3px solid #22c55e;
}

.word-txt {
    font-weight: 700;
    font-size: 1.1rem;
    display: block;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.card.locked {
    border-color: var(--gold);
    border-top: 3px solid var(--gold);
    background: rgba(251, 191, 36, 0.05);
}

.card.locked .word-txt {
    filter: blur(4px);
    opacity: 0.7;
}

.lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.1);
}

.lock-icon {
    font-size: 1.2rem;
    color: var(--gold);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.pro-badge {
    font-size: 0.6rem;
    background: var(--gold);
    color: black;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: bold;
    margin-top: 2px;
}

.cefr-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 800;
    display: inline-block;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.cefr-A1 {
    background: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
    border: 1px solid #64748b;
}

.cefr-A2 {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid #3b82f6;
}

.cefr-B1 {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid #22c55e;
}

.cefr-B2 {
    background: rgba(234, 179, 8, 0.2);
    color: #facc15;
    border: 1px solid #eab308;
}

.cefr-C1 {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid #ef4444;
}

.cefr-unknown {
    background: #333;
    color: #888;
}

.has-note-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 5px var(--accent);
    display: none;
}

.has-note .has-note-dot {
    display: block;
}

.load-more-container {
    text-align: center;
    padding: 30px;
    display: none;
    margin-bottom: 30px;
}

.btn-load {
    background: transparent;
    color: var(--text-muted);
    border: 2px solid #333;
    padding: 12px 40px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s;
}

.btn-load:hover {
    border-color: var(--accent);
    color: white;
    background: rgba(59, 130, 246, 0.1);
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #666;
    border: 2px dashed #333;
    border-radius: 16px;
    margin: 20px 0;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

.ad-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(15, 15, 17, 0.95);
    border-top: 1px solid var(--gold);
    padding: 15px;
    text-align: center;
    z-index: 900;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    backdrop-filter: blur(10px);
}

.ad-text {
    font-size: 0.9rem;
    color: #eee;
    font-weight: 500;
}

.ad-btn {
    background: var(--gold);
    color: black;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 800;
    cursor: pointer;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    z-index: 5000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #333;
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: #1e1e24;
    color: #fff;
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 3000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid #444;
    font-weight: 500;
    pointer-events: none;
}

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

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.2s;
}

.overlay.open {
    display: flex;
    opacity: 1;
}

.modal {
    background: #18181b;
    width: 90%;
    max-width: 420px;
    border-radius: 20px;
    border: 1px solid #333;
    padding: 25px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.2s;
}

.overlay.open .modal {
    transform: scale(1);
}

.modal-pro {
    text-align: center;
    border: 2px solid var(--gold);
    background: #111;
}

.pro-title {
    font-size: 2rem;
    color: var(--gold);
    margin-bottom: 5px;
    font-weight: 900;
    letter-spacing: -1px;
}

.pro-hook {
    color: #fff;
    font-style: italic;
    font-size: 1rem;
    margin-bottom: 25px;
    opacity: 0.8;
}

.pro-list {
    text-align: left;
    margin: 20px 0;
    color: #ddd;
    font-size: 1rem;
    list-style: none;
    padding: 0;
    line-height: 1.8;
}

.pro-list li {
    margin-bottom: 8px;
    padding-left: 25px;
    position: relative;
}

.pro-list li::before {
    content: "✨";
    position: absolute;
    left: 0;
}

.price-tag {
    font-size: 1.1rem;
    color: #888;
    margin: 20px 0;
    font-weight: 600;
    background: #222;
    padding: 10px;
    border-radius: 10px;
}

.price-tag span {
    color: white;
    font-size: 1.4rem;
    margin-left: 5px;
}

.m-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.m-word {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0;
    line-height: 1;
    color: white;
    letter-spacing: -1px;
}

.m-desc {
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* CONTEXT UI */
.m-word-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.m-ipa {
    font-family: 'Lucida Sans Unicode', 'Arial Unicode MS', sans-serif;
    color: #888;
    font-size: 1.1rem;
}

.m-pos {
    font-style: italic;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.9rem;
    background: rgba(59, 130, 246, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.m-context-box {
    background: #27272a;
    border-left: 4px solid var(--accent);
    padding: 15px;
    border-radius: 0 12px 12px 0;
    margin-top: 20px;
    display: none;
}

.m-ex-en {
    font-size: 1.1rem;
    color: #eee;
    margin-bottom: 8px;
    font-weight: 500;
    line-height: 1.4;
}

.m-ex-tr {
    font-size: 0.95rem;
    color: #999;
    font-style: italic;
}

.highlight-word {
    color: var(--gold);
    font-weight: bold;
}

.close-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 2rem;
    line-height: 0.5;
    cursor: pointer;
    transition: 0.2s;
}

.close-btn:hover {
    color: white;
}

.m-tools {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.tool-btn {
    background: #27272a;
    border: 1px solid #3f3f46;
    color: #a1a1aa;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: 0.2s;
}

.tool-btn:hover {
    background: #3f3f46;
    color: white;
    transform: translateY(-2px);
}

.quiz-area {
    animation: fadeIn 0.3s;
    margin-top: 10px;
}

.quiz-q {
    color: #888;
    text-align: center;
    margin-bottom: 15px;
    font-size: 0.95rem;
    font-weight: 500;
}

.quiz-opts {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quiz-btn {
    background: #27272a;
    border: 1px solid #3f3f46;
    color: #e4e4e7;
    padding: 16px;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    font-size: 1.05rem;
    transition: all 0.2s;
    font-weight: 500;
}

.quiz-btn:active {
    transform: scale(0.98);
}

.quiz-btn.correct {
    background: rgba(34, 197, 94, 0.15);
    border-color: #22c55e;
    color: #4ade80;
    font-weight: 700;
}

.quiz-btn.wrong {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #f87171;
    opacity: 0.7;
}

.status-area {
    display: none;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    margin-top: 20px;
    border-top: 1px solid #333;
    padding-top: 20px;
}

.status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.s-btn {
    padding: 15px 5px;
    background: #222;
    border: 1px solid #333;
    color: #666;
    cursor: pointer;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.8rem;
    transition: 0.2s;
}

.s-btn.act-0 {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2);
}

.s-btn.act-1 {
    background: rgba(234, 179, 8, 0.2);
    border-color: #eab308;
    color: #eab308;
    box-shadow: 0 4px 10px rgba(234, 179, 8, 0.2);
}

.s-btn.act-2 {
    background: rgba(34, 197, 94, 0.2);
    border-color: #22c55e;
    color: #22c55e;
    box-shadow: 0 4px 10px rgba(34, 197, 94, 0.2);
}

textarea {
    width: 100%;
    height: 80px;
    background: #111;
    border: 1px solid #333;
    color: white;
    padding: 12px;
    border-radius: 10px;
    resize: none;
    margin-bottom: 12px;
    font-family: inherit;
    font-size: 0.95rem;
}

textarea:focus {
    border-color: var(--accent);
}

/* RANDOM SPECIFIC */
.rnd-wrapper {
    display: none;
    height: 85vh;
    flex-direction: column;
    padding: 20px;
}

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

.rnd-card {
    background: #1e1e24;
    border: 1px solid #333;
    border-radius: 20px;
    padding: 30px 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.rnd-word {
    font-size: 2.8rem;
    font-weight: 900;
    color: white;
    margin-bottom: 30px;
    letter-spacing: -1px;
    text-align: center;
}

.rnd-opts {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.rnd-btn {
    background: #2a2a30;
    border: 1px solid #444;
    color: #eee;
    padding: 18px;
    border-radius: 14px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: 0.2s;
    font-weight: 500;
    text-align: center;
}

.rnd-btn:active {
    transform: scale(0.98);
}

.rnd-btn.correct {
    background: #10b981;
    border-color: #10b981;
    color: white;
    font-weight: 700;
}

.rnd-btn.wrong {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
    opacity: 0.6;
}

.rnd-status {
    display: none;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    width: 100%;
    margin-top: 20px;
}

.rnd-status-title {
    text-align: center;
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.rnd-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

/* 🔥 GRIND MODE SPECIFIC (SWIPE EDITION) 🔥 */
.grind-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #0f0c29, #302b63, #24243e);
    z-index: 6000;
    display: none;
    flex-direction: column;
    padding: 20px;
    color: white;
    overflow: hidden;
    touch-action: none;
}

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

.grind-streak {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fbbf24;
    text-shadow: 0 0 15px rgba(251, 191, 36, 0.8);
    display: flex;
    align-items: center;
    gap: 5px;
}

.grind-progress-bg {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-bottom: 30px;
    overflow: hidden;
}

.grind-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #facc15, #f97316);
    width: 0%;
    transition: width 0.3s;
}

.grind-card-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
    position: relative;
}

.grind-card {
    width: 100%;
    max-width: 360px;
    aspect-ratio: 3.5/5;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(25px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    cursor: grab;
    position: absolute;
    transform-style: preserve-3d;
    transition: transform 0.1s linear;
}

.grind-card.animating {
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.4s;
}

.grind-card.flipped {
    transform: rotateY(180deg);
}

.grind-front,
.grind-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px;
    text-align: center;
}

.grind-back {
    transform: rotateY(180deg);
    background: rgba(30, 30, 36, 0.95);
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.grind-word {
    font-size: 3.2rem;
    font-weight: 900;
    letter-spacing: -2px;
    margin-bottom: 15px;
    color: #fff;
}

.grind-meaning {
    font-size: 1.8rem;
    color: #a78bfa;
    font-weight: 700;
}

.grind-hint {
    position: absolute;
    bottom: 30px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
}

.swipe-overlay {
    position: absolute;
    top: 40px;
    font-size: 2rem;
    font-weight: 900;
    text-transform: uppercase;
    border: 4px solid;
    padding: 5px 20px;
    border-radius: 10px;
    opacity: 0;
    transform: rotate(-15deg);
}

.swipe-overlay.nope {
    right: 40px;
    color: #ef4444;
    border-color: #ef4444;
    transform: rotate(15deg);
}

.swipe-overlay.yeah {
    left: 40px;
    color: #10b981;
    border-color: #10b981;
}

.grind-actions {
    width: 100%;
    max-width: 360px;
    margin: 20px auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-yellow-grind {
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid #fbbf24;
    color: #fbbf24;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.grind-guide {
    text-align: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.8rem;
    margin-top: 10px;
}

/* FLASHCARD CONTAINER */
.fc-container {
    text-align: center;
    padding: 20px;
    display: none;
    height: 85vh;
    justify-content: center;
    flex-direction: column;
}

.fc-card {
    background: #1e1e24;
    padding: 40px 20px;
    border-radius: 20px;
    margin-bottom: 20px;
    border: 1px solid #333;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    max-height: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.fc-word {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 15px;
    letter-spacing: -1px;
}

.fc-meaning {
    font-size: 1.5rem;
    color: #3b82f6;
    margin-top: 20px;
    display: none;
    font-weight: 700;
    animation: fadeIn 0.3s;
}

.fc-answer {
    margin-top: 25px;
    color: #aaa;
    display: none;
    animation: fadeIn 0.3s;
}

.fc-controls {
    display: none;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

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

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

/* ONBOARDING */
/* ONBOARDING */
.onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5500;
    background: linear-gradient(135deg, #0f0f11 0%, #1a1a2e 100%);
    display: none;
    /* Default hidden */
    overflow-y: auto;
    /* Allow scrolling on small screens */
}

.onboarding-container {
    text-align: center;
    padding: 40px 30px;
    max-width: 400px;
}

.onboarding-step {
    display: none;
    animation: fadeIn 0.5s ease-out;
}

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

.onboarding-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.onboarding-title {
    font-size: 2rem;
    font-weight: 800;
    color: white;
    margin-bottom: 15px;
    line-height: 1.2;
}

.onboarding-desc {
    color: #999;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 30px;
}

.onboarding-btn {
    width: 100%;
    padding: 18px;
    font-size: 1.1rem;
    border-radius: 16px;
}

.goal-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.goal-btn {
    background: #1e1e24;
    border: 2px solid #333;
    color: white;
    padding: 20px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.goal-btn:hover {
    border-color: var(--accent);
    transform: scale(1.02);
}

.goal-btn.recommended {
    border-color: var(--gold);
    background: rgba(251, 191, 36, 0.1);
}

.goal-time {
    font-size: 1.5rem;
    font-weight: 800;
}

.goal-label {
    font-size: 0.9rem;
    color: #888;
}

/* ACHIEVEMENTS */
.achievement-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #1e1e24;
    border-radius: 12px;
    border: 1px solid #333;
}

.achievement-item.unlocked {
    border-color: var(--gold);
    background: rgba(251, 191, 36, 0.05);
}

.achievement-item.locked {
    opacity: 0.5;
}

.ach-icon {
    font-size: 2rem;
}

.ach-info {
    flex: 1;
}

.ach-name {
    font-weight: 700;
    color: white;
    font-size: 1rem;
}

.ach-desc {
    color: #888;
    font-size: 0.85rem;
}

/* RESPONSIVE DESIGN */
@media (min-width: 768px) {
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 16px;
        padding: 20px;
    }

    .header {
        padding: 20px 30px;
    }

    .modal {
        max-width: 500px;
    }

    .rnd-word {
        font-size: 3.5rem;
    }

    .fc-word {
        font-size: 3.5rem;
    }

    .action-row {
        justify-content: center;
    }

    .filters {
        justify-content: center;
    }
}

@media (min-width: 1024px) {
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        max-width: 1200px;
        gap: 18px;
        padding: 25px;
    }

    .header {
        padding: 20px 40px;
    }

    .card {
        padding: 20px 14px;
    }

    .word-txt {
        font-size: 1.2rem;
    }

    body {
        padding-bottom: 60px;
    }
}

/* =============================================
   YOKDIL MODES
   ============================================= */

/* YÖKDİL Button */
.btn-yokdil {
    background: linear-gradient(135deg, #7c3aed, #a855f7) !important;
    color: white !important;
    font-weight: 700;
    border: none !important;
}

/* Mode Selector Buttons */
.yokdil-mode-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px;
    background: #1e1e24;
    border: 1px solid #333;
    border-radius: 16px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    width: 100%;
}

.yokdil-mode-btn:hover {
    border-color: #7c3aed;
    transform: scale(1.02);
    background: rgba(124, 58, 237, 0.08);
}

.yokdil-mode-icon {
    font-size: 2rem;
    min-width: 44px;
    text-align: center;
}

.yokdil-mode-info {
    flex: 1;
}

.yokdil-mode-title {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 4px;
}

.yokdil-mode-desc {
    color: #888;
    font-size: 0.85rem;
}

.yokdil-mode-tag {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 1px;
}

/* Game View */
.yokdil-view {
    display: none;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #0a0a0f;
    z-index: 3000;
    overflow-y: auto;
}

.yokdil-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #27272a;
    position: sticky;
    top: 0;
    z-index: 10;
}

.yokdil-exit-btn {
    background: linear-gradient(135deg, #991b1b, #dc2626);
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.yokdil-exit-btn:active {
    transform: scale(0.95);
    background: #b91c1c;
}

.yokdil-counter {
    font-weight: 700;
    color: #a1a1aa;
    font-size: 0.95rem;
}

.yokdil-score {
    font-weight: 800;
    color: #22c55e;
    font-size: 1.1rem;
}

.yokdil-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    animation: fadeIn 0.3s;
}

/* Question Styles */
.yokdil-prompt {
    color: #a1a1aa;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.yokdil-sentence {
    font-size: 1.4rem;
    color: white;
    font-weight: 600;
    line-height: 1.6;
    padding: 25px;
    background: #1e1e24;
    border: 1px solid #333;
    border-radius: 16px;
    margin-bottom: 25px;
}

.yokdil-turkish-word {
    font-size: 2rem;
    font-weight: 900;
    color: #a855f7;
    text-align: center;
    margin: 20px 0 10px;
    letter-spacing: -0.5px;
}

.yokdil-hint-text {
    color: #71717a;
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 25px;
    font-style: italic;
}

.yokdil-family-root {
    font-size: 1.3rem;
    color: white;
    text-align: center;
    margin: 15px 0;
}

.yokdil-family-members {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 25px;
}

.family-tag {
    padding: 6px 14px;
    background: #27272a;
    border: 1px solid #3f3f46;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #a1a1aa;
    font-weight: 600;
}

.family-tag.target {
    background: rgba(124, 58, 237, 0.15);
    border-color: #7c3aed;
    color: #a855f7;
}

/* Options */
.yokdil-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.yokdil-opt-btn {
    background: #27272a;
    border: 1px solid #3f3f46;
    color: #e4e4e7;
    padding: 16px 20px;
    border-radius: 14px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.yokdil-opt-btn:active {
    transform: scale(0.98);
}

.yokdil-opt-btn.correct {
    background: rgba(34, 197, 94, 0.2);
    border-color: #22c55e;
    color: #4ade80;
    font-weight: 800;
}

.yokdil-opt-btn.wrong {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #f87171;
    opacity: 0.7;
}

/* Feedback */
.yokdil-feedback {
    margin-top: 20px;
    padding: 20px;
    background: #1e1e24;
    border: 1px solid #3f3f46;
    border-radius: 16px;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.yokdil-correct-sentence {
    font-size: 1.1rem;
    color: #d4d4d8;
    line-height: 1.5;
    margin-bottom: 10px;
}

.yokdil-translation {
    color: #71717a;
    font-size: 0.95rem;
    margin-bottom: 10px;
    font-style: italic;
}

.yokdil-meaning {
    color: #a855f7;
    font-weight: 700;
    font-size: 1rem;
}

.yokdil-answer-word {
    font-size: 1.8rem;
    font-weight: 900;
    color: #22c55e;
    text-align: center;
    margin-bottom: 8px;
}

.yokdil-ipa {
    text-align: center;
    color: #888;
    font-size: 1rem;
    margin-bottom: 10px;
}

/* Word Family Answers */
.yokdil-family-answer {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.family-answer-item {
    color: #d4d4d8;
    font-size: 1rem;
}

.family-pos {
    color: #7c3aed;
    font-weight: 600;
}

/* Results */
.yokdil-results {
    text-align: center;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.yokdil-result-emoji {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

.yokdil-result-score {
    font-size: 3rem;
    font-weight: 900;
    color: white;
    margin-bottom: 5px;
}

.yokdil-result-pct {
    font-size: 1.5rem;
    color: #a855f7;
    font-weight: 700;
    margin-bottom: 15px;
}

.yokdil-result-msg {
    font-size: 1.1rem;
    color: #a1a1aa;
}

/* Cloze Test */
.yokdil-cloze-para {
    font-size: 1.15rem;
    color: #d4d4d8;
    line-height: 1.8;
    padding: 22px;
    background: #1e1e24;
    border: 1px solid #333;
    border-radius: 16px;
    margin-bottom: 18px;
}

.yokdil-cloze-q {
    color: #a1a1aa;
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.cloze-active {
    color: #a855f7;
    font-weight: 800;
    background: rgba(168, 85, 247, 0.15);
    padding: 2px 8px;
    border-radius: 6px;
    border-bottom: 2px solid #a855f7;
}

.cloze-blank {
    color: #71717a;
    font-weight: 600;
}

.cloze-filled {
    color: #22c55e;
    font-weight: 700;
}

.highlight-word {
    color: #a855f7;
    font-weight: 800;
    background: rgba(168, 85, 247, 0.12);
    padding: 1px 5px;
    border-radius: 4px;
}

/* Modal scrollable for many modes */
#yokdilMenuOverlay .modal {
    max-height: 85vh;
    overflow-y: auto;
}

/* ===== MOBILE RESPONSIVE — YÖKDİL MODES ===== */
@media (max-width: 480px) {

    /* Exam bank feedback sections */
    .yokdil-feedback div[style*="background:#1a1a2e"],
    .yokdil-feedback div[style*="background:#1a2e1a"],
    .yokdil-feedback div[style*="background:#1a1500"] {
        font-size: 0.8rem !important;
        padding: 8px 10px !important;
    }

    .yokdil-sentence {
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
    }

    .yokdil-prompt {
        font-size: 0.85rem !important;
    }

    .yokdil-opt-btn {
        padding: 12px 14px !important;
        font-size: 0.95rem !important;
    }

    .yokdil-feedback {
        padding: 14px !important;
    }

    /* YÖKDİL menu: ensure scroll on small screens */
    #yokdilMenuOverlay .modal {
        max-height: 80vh;
        padding: 12px !important;
    }

    .yokdil-mode-btn {
        padding: 10px 12px !important;
    }

    .yokdil-mode-title {
        font-size: 0.95rem !important;
    }

    .yokdil-mode-desc {
        font-size: 0.75rem !important;
    }

    /* Polarity quiz: bigger touch targets */
    .yokdil-options[style*="display:flex"] .yokdil-opt-btn {
        padding: 18px !important;
        font-size: 1.1rem !important;
    }
}

@media (max-width: 360px) {
    .yokdil-opt-btn {
        padding: 10px 12px !important;
        font-size: 0.85rem !important;
    }

    .yokdil-sentence {
        font-size: 0.85rem !important;
    }

    .yokdil-feedback {
        padding: 10px !important;
    }
}