/* Flashcard study UI — aligned with flashcards-deck / studyTorium tokens (#3dd68c, #161616) */

#main-content.fc-knowt-main-mode {
    background: transparent;
    max-width: none;
}

.fc-knowt-root {
    --fc-teal: #3dd68c;
    --fc-teal-dim: rgba(61, 214, 140, 0.14);
    --fc-surface: #161616;
    --fc-surface-2: #1c1c1c;
    --fc-bg: #0a0a0a;
    --fc-text: #f8fafc;
    --fc-muted: #94a3b8;
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0.5rem 0 1rem;
    color: var(--fc-text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    box-sizing: border-box;
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fc-knowt-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 1rem;
    margin-bottom: 1rem;
    flex-shrink: 0;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.fc-knowt-search-wrap {
    flex: 1 1 0;
    min-width: 0;
    position: relative;
}

.fc-knowt-search-wrap::before {
    content: '⌕';
    position: absolute;
    left: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.95rem;
    color: var(--fc-muted);
    pointer-events: none;
    opacity: 0.85;
}

.fc-knowt-search {
    width: 100%;
    box-sizing: border-box;
    padding: 0.55rem 0.85rem 0.55rem 2.35rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--fc-surface);
    color: var(--fc-text);
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.15s ease;
}

.fc-knowt-search:focus {
    border-color: rgba(61, 214, 140, 0.45);
}

.fc-knowt-search::placeholder {
    color: #64748b;
}

.fc-knowt-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.fc-knowt-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.55rem;
    border-radius: 999px;
    background: var(--fc-surface);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--fc-muted);
}

.fc-knowt-stat--accent {
    background: var(--fc-teal-dim);
    border-color: rgba(61, 214, 140, 0.35);
    color: var(--fc-teal);
}

.fc-knowt-stat--purple {
    border-color: rgba(167, 139, 250, 0.35);
    color: #c4b5fd;
}

.fc-knowt-stat--coin {
    border-color: rgba(251, 146, 60, 0.35);
    color: #fdba74;
}

.fc-knowt-add-btn {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: none;
    background: linear-gradient(145deg, #2eb574, var(--fc-teal));
    color: #041208;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    transition: filter 0.15s ease, transform 0.1s ease;
}

.fc-knowt-add-btn:hover {
    filter: brightness(1.08);
}

.fc-knowt-add-btn:active {
    transform: scale(0.96);
}

.fc-knowt-card-area {
    position: relative;
    margin-bottom: 1rem;
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Fixed face size — long text scrolls inside; short terms don’t shrink the card */
.fc-knowt-card {
    position: relative;
    --fc-card-face-h: min(58vh, 520px);
    height: var(--fc-card-face-h);
    min-height: var(--fc-card-face-h);
    max-height: var(--fc-card-face-h);
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 28px;
    background: var(--fc-surface);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.fc-knowt-card:hover {
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.6);
}

.fc-knowt-card:focus-visible {
    outline: 2px solid var(--fc-teal);
    outline-offset: 3px;
}

.fc-knowt-card-inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    height: 100%;
    min-height: 0;
    min-width: 0;
    padding: 3.25rem 1.75rem 2.75rem;
    box-sizing: border-box;
    overflow-x: hidden;
}

.fc-knowt-card-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    z-index: 2;
}

.fc-knowt-pill {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: transparent;
    color: var(--fc-text);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.fc-knowt-pill:hover {
    background: rgba(255, 255, 255, 0.08);
}

.fc-knowt-icon-btn {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: var(--fc-text);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.fc-knowt-icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.fc-knowt-icon-btn--starred {
    color: #fbbf24;
}

.fc-knowt-card-label {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--fc-muted);
    z-index: 2;
}

.fc-knowt-card-content {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
    /* rem-only: vw changes with scrollbar/layout and can reflow line lengths */
    font-size: clamp(1.2rem, 1.35rem, 1.85rem);
    font-weight: 500;
    text-align: center;
    color: var(--fc-text);
    line-height: 1.45;
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 100%;
    box-sizing: border-box;
}

.fc-knowt-card-hint-banner {
    flex-shrink: 0;
    margin-top: 0.75rem;
    padding: 0.5rem 0.85rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.82rem;
    color: var(--fc-muted);
    max-width: 100%;
    text-align: center;
    max-height: 35%;
    overflow-y: auto;
    scrollbar-gutter: stable;
    min-width: 0;
    box-sizing: border-box;
}

.fc-knowt-flip-hint {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.78rem;
    color: #64748b;
    font-style: italic;
    pointer-events: none;
}

.fc-knowt-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-top: 0.25rem;
    flex-shrink: 0;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.fc-knowt-sort {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    flex-shrink: 0;
    min-width: 0;
}

.fc-knowt-sort-kicker {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--fc-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.fc-knowt-front-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.fc-knowt-front-btn {
    padding: 0.38rem 0.75rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.35);
    color: var(--fc-muted);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.fc-knowt-front-btn:hover {
    color: var(--fc-text);
    border-color: rgba(255, 255, 255, 0.22);
}

.fc-knowt-front-btn.is-selected {
    border-color: rgba(61, 214, 140, 0.55);
    background: rgba(61, 214, 140, 0.16);
    color: var(--fc-teal);
}

.fc-knowt-nav {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.fc-knowt-nav-btn {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: none;
    background: var(--fc-teal);
    color: #041208;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter 0.15s ease, opacity 0.15s ease;
}

.fc-knowt-nav-btn:hover:not(:disabled) {
    filter: brightness(1.08);
}

.fc-knowt-nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.fc-knowt-counter {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--fc-text);
    min-width: 4.5ch;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.fc-knowt-actions-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.fc-knowt-tool {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--fc-surface);
    color: var(--fc-muted);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.fc-knowt-tool:hover {
    color: var(--fc-text);
    border-color: rgba(255, 255, 255, 0.18);
    background: var(--fc-surface-2);
}

.fc-knowt-tool--active {
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.35);
}

.fc-knowt-settings-wrap {
    position: relative;
}

.fc-knowt-settings-popover {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    min-width: 11rem;
    padding: 0.4rem 0;
    border-radius: 14px;
    background: #161616;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
    z-index: 40;
}

.fc-knowt-settings-popover[hidden] {
    display: none !important;
}

.fc-knowt-settings-popover button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.55rem 1rem;
    border: none;
    background: none;
    color: var(--fc-text);
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
}

.fc-knowt-settings-popover button:hover {
    background: rgba(255, 255, 255, 0.06);
}

.fc-knowt-settings-popover button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.fc-knowt-empty {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1rem;
    color: var(--fc-muted);
    font-size: 0.95rem;
}

@media (max-width: 560px) {
    .fc-knowt-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .fc-knowt-stats {
        justify-content: center;
        flex-wrap: wrap;
    }

    .fc-knowt-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .fc-knowt-nav {
        justify-content: center;
    }

    .fc-knowt-actions-row {
        justify-content: center;
    }
}
