/* =========================================
   KNOWSCROLL
   Main stylesheet
   ========================================= */

:root {
    --bg: #0b0d12;
    --surface: #151923;
    --surface-light: #1d2230;
    --text: #f4f5f7;
    --text-muted: #969daa;
    --accent: #7c5cff;
    --accent-light: #9b82ff;
    --success: #35d07f;
    --danger: #ff5c6c;
    --border: rgba(255, 255, 255, 0.08);

    --radius: 24px;
    --nav-height: 76px;
}


/* =========================================
   RESET
   ========================================= */

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

html {
    width: 100%;
    height: 100%;
    background: var(--bg);
}

body {
    width: 100%;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;

    overflow-x: hidden;
}


/* =========================================
   APP
   ========================================= */

#app {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;

    display: flex;
    flex-direction: column;

    padding-bottom: var(--nav-height);
}


/* =========================================
   HEADER
   ========================================= */

.top-bar {
    width: 100%;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding:
        max(18px, env(safe-area-inset-top))
        20px
        14px;

    position: relative;
    z-index: 10;
}

.logo {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.6px;
}

.logo span {
    color: var(--accent-light);
}

.streak {
    display: flex;
    align-items: center;
    gap: 5px;

    padding: 7px 11px;

    border-radius: 999px;

    background: var(--surface);

    color: var(--text);

    font-size: 14px;
    font-weight: 700;

    border: 1px solid var(--border);
}


/* =========================================
   MAIN
   ========================================= */

main {
    width: 100%;
    max-width: 700px;

    margin: 0 auto;

    padding:
        4px
        18px
        24px;

    flex: 1;

    display: flex;
    flex-direction: column;
}


/* =========================================
   PROGRESS
   ========================================= */

.progress-container {
    width: 100%;
    margin-bottom: 20px;
}

.progress-text {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 8px;

    color: var(--text-muted);

    font-size: 12px;
    font-weight: 600;
}

.progress-bar {
    width: 100%;
    height: 5px;

    overflow: hidden;

    border-radius: 999px;

    background: var(--surface-light);
}

.progress-fill {
    width: 0%;
    height: 100%;

    border-radius: inherit;

    background: var(--accent);

    transition: width 0.35s ease;
}


/* =========================================
   CATEGORY
   ========================================= */

.category-label {
    align-self: flex-start;

    margin-bottom: 12px;

    padding: 7px 11px;

    border-radius: 999px;

    background: rgba(124, 92, 255, 0.12);

    color: var(--accent-light);

    font-size: 11px;
    font-weight: 800;

    letter-spacing: 0.7px;

    border: 1px solid rgba(124, 92, 255, 0.18);
}


/* =========================================
   CARD AREA
   ========================================= */

.card-area {
    width: 100%;

    flex: 1;

    display: flex;
    align-items: center;
    justify-content: center;

    min-height: 390px;

    perspective: 1000px;
}


/* =========================================
   LEARNING CARD
   ========================================= */

.learning-card {
    width: 100%;
    min-height: 390px;

    padding: 30px 24px;

    display: flex;
    flex-direction: column;

    border-radius: var(--radius);

    background:
        linear-gradient(
            145deg,
            var(--surface),
            #11141c
        );

    border: 1px solid var(--border);

    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.28);

    position: relative;

    overflow: hidden;

    user-select: none;

    transform-origin: center bottom;

    transition:
        transform 0.25s ease,
        opacity 0.25s ease;
}


/* subtle decorative glow */

.learning-card::before {
    content: "";

    position: absolute;

    width: 180px;
    height: 180px;

    top: -90px;
    right: -70px;

    border-radius: 50%;

    background: rgba(124, 92, 255, 0.12);

    filter: blur(10px);

    pointer-events: none;
}


/* =========================================
   CARD TYPE
   ========================================= */

.card-type {
    position: relative;
    z-index: 1;

    color: var(--accent-light);

    font-size: 11px;
    font-weight: 800;

    letter-spacing: 1px;

    margin-bottom: 22px;
}


/* =========================================
   QUESTION
   ========================================= */

#question {
    position: relative;
    z-index: 1;

    margin: auto 0;

    font-size: clamp(25px, 7vw, 40px);

    line-height: 1.12;

    letter-spacing: -1px;

    font-weight: 800;
}


/* =========================================
   ANSWER AREA
   ========================================= */

.answer-area {
    width: 100%;

    margin-top: 25px;

    position: relative;
    z-index: 2;
}

.answer-button {
    width: 100%;

    min-height: 54px;

    padding: 13px 16px;

    border: 1px solid var(--border);

    border-radius: 15px;

    background: var(--surface-light);

    color: var(--text);

    font-size: 15px;
    font-weight: 650;

    text-align: left;

    cursor: pointer;

    transition:
        transform 0.15s ease,
        background 0.15s ease,
        border-color 0.15s ease;
}

.answer-button + .answer-button {
    margin-top: 9px;
}

.answer-button:active {
    transform: scale(0.98);
}

.answer-button:hover {
    background: #252b3a;
}


/* correct */

.answer-button.correct {
    background: rgba(53, 208, 127, 0.14);
    border-color: rgba(53, 208, 127, 0.5);
    color: var(--success);
}


/* wrong */

.answer-button.wrong {
    background: rgba(255, 92, 108, 0.14);
    border-color: rgba(255, 92, 108, 0.5);
    color: var(--danger);
}


/* =========================================
   EXPLANATION
   ========================================= */

.explanation {
    position: relative;
    z-index: 1;

    margin-top: 20px;

    padding: 15px;

    border-radius: 15px;

    background: rgba(255, 255, 255, 0.04);

    color: var(--text-muted);

    font-size: 14px;
    line-height: 1.5;

    display: none;
}

.explanation.visible {
    display: block;

    animation: fadeUp 0.25s ease;
}


/* =========================================
   ACTIONS
   ========================================= */

.actions {
    width: 100%;

    min-height: 58px;

    margin-top: 15px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.action-button {
    min-height: 52px;

    padding: 0 22px;

    border: 0;
    border-radius: 16px;

    background: var(--accent);

    color: white;

    font-size: 15px;
    font-weight: 800;

    cursor: pointer;

    box-shadow:
        0 8px 24px rgba(124, 92, 255, 0.22);

    transition:
        transform 0.15s ease,
        background 0.15s ease;
}

.action-button:active {
    transform: scale(0.96);
}

.action-button:hover {
    background: var(--accent-light);
}


/* =========================================
   SWIPE HINT
   ========================================= */

.swipe-hint {
    text-align: center;

    margin-top: 8px;

    color: #666d7c;

    font-size: 11px;

    opacity: 0.8;
}


/* =========================================
   BOTTOM NAVIGATION
   ========================================= */

.bottom-nav {
    position: fixed;

    left: 0;
    right: 0;
    bottom: 0;

    height: var(--nav-height);

    padding:
        7px
        12px
        max(7px, env(safe-area-inset-bottom));

    display: flex;
    align-items: center;
    justify-content: space-around;

    background: rgba(11, 13, 18, 0.94);

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    border-top: 1px solid var(--border);

    z-index: 100;
}

.nav-item {
    flex: 1;

    height: 58px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 3px;

    border: 0;

    background: transparent;

    color: #666d7c;

    cursor: pointer;

    transition: color 0.2s ease;
}

.nav-item span {
    font-size: 19px;

    line-height: 1;
}

.nav-item small {
    font-size: 10px;
    font-weight: 650;
}

.nav-item.active {
    color: var(--text);
}

.nav-item.active span {
    transform: scale(1.05);
}


/* =========================================
   CARD ANIMATIONS
   ========================================= */

.card-enter {
    animation: cardEnter 0.3s ease both;
}

.card-exit {
    animation: cardExit 0.25s ease both;
}

@keyframes cardEnter {
    from {
        opacity: 0;
        transform:
            translateY(25px)
            scale(0.97);
    }

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

@keyframes cardExit {
    from {
        opacity: 1;
        transform:
            translateY(0)
            scale(1);
    }

    to {
        opacity: 0;
        transform:
            translateY(-60px)
            scale(0.96);
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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


/* =========================================
   TABLET / DESKTOP
   ========================================= */

@media (min-width: 700px) {

    main {
        padding-left: 28px;
        padding-right: 28px;
    }

    .top-bar {
        max-width: 700px;
        margin: 0 auto;
    }

    .learning-card {
        min-height: 470px;

        padding: 40px 38px;
    }

    #question {
        font-size: 42px;
    }

    .bottom-nav {
        max-width: 700px;

        left: 50%;
        right: auto;

        width: 100%;

        transform: translateX(-50%);

        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
    }
}


/* =========================================
   ACCESSIBILITY
   ========================================= */

button:focus-visible {
    outline: 2px solid var(--accent-light);
    outline-offset: 3px;
}


/* =========================================
   REDUCED MOTION
   ========================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
  }
.answer-input {
    width: 100%;

    min-height: 54px;

    padding: 14px 16px;

    border-radius: 15px;

    border: 1px solid var(--border);

    background: var(--surface-light);

    color: var(--text);

    font-size: 16px;

    outline: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.answer-input::placeholder {
    color: var(--text-muted);
}

.answer-input:focus {
    border-color: var(--accent);

    box-shadow:
        0 0 0 3px rgba(124, 92, 255, 0.12);
}
