/* ═══════════════════════════════════════
   HEADER
   ═══════════════════════════════════════ */

.header {
    border-bottom: 1px solid var(--paper-warm);
    background: rgba(252, 249, 245, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    max-width: 720px;
    margin: 0 auto;
    padding: 0 20px;
    height: 56px;
    gap: 12px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2px;
}

.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--ink-light);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.back-btn:hover {
    color: var(--terracotta);
    background: var(--terracotta-glow);
}

.back-btn:active {
    transform: scale(0.94);
}

.back-btn svg { width: 20px; height: 20px; }

.header-title {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 500;
    color: var(--ink-dark);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.header-purchase {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
    white-space: nowrap;
    transition: color var(--transition-fast);
    text-decoration: none;
}

.header-purchase:hover {
    color: var(--accent-dark);
}

/* ═══════════════════════════════════════
   PROGRESS
   ═══════════════════════════════════════ */

.progress-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--terracotta);
    font-variant-numeric: tabular-nums;
    background: var(--terracotta-glow);
    padding: 5px 12px;
    border-radius: 20px;
    letter-spacing: 0.01em;
}

/* ═══════════════════════════════════════
   LOGO — HOMEPAGE BRAND
   ═══════════════════════════════════════ */

.logo-wrap {
    padding: 48px 0 32px;
    text-align: center;
    position: relative;
}

.logo-wrap::after {
    content: '';
    display: block;
    width: 40px;
    height: 3px;
    background: var(--terracotta);
    border-radius: 2px;
    margin: 20px auto 0;
    opacity: 0.4;
}

.logo {
    font-family: var(--font-display);
    font-size: 34px;
    font-weight: 600;
    color: var(--ink-dark);
    letter-spacing: -0.01em;
    line-height: 1.15;
}

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

.logo-subtitle {
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--ink-light);
    letter-spacing: 0.18em;
    margin-top: 8px;
    text-transform: uppercase;
    font-weight: 500;
}

/* ═══════════════════════════════════════
   DECK GRID
   ═══════════════════════════════════════ */

.deck-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    padding: 0 0 32px;
}

.deck-card {
    background: var(--paper-white);
    border-radius: 14px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    animation: cardIn 0.5s var(--ease-out) backwards;
}

.deck-card:nth-child(1) { animation-delay: 0.05s; }
.deck-card:nth-child(2) { animation-delay: 0.12s; }
.deck-card:nth-child(3) { animation-delay: 0.19s; }
.deck-card:nth-child(4) { animation-delay: 0.26s; }

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

.deck-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    transform: translateY(-4px);
}

.deck-card:active {
    transform: translateY(-1px);
}

/* ── Card header ── */

.card-header {
    padding: 18px 24px 14px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.deck-card:hover .card-icon {
    transform: scale(1.05);
}

/* ── Card icon themes ── */

.theme-blue .card-icon { background: #e8f4fd; }
.theme-purple .card-icon { background: #f3e8fd; }
.theme-green .card-icon { background: #e8f8f0; }
.theme-orange .card-icon { background: #fef3e8; }
.theme-pink .card-icon { background: #fde8f0; }

.card-info {
    flex: 1;
    min-width: 0;
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--ink-dark);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-count {
    font-size: 0.85rem;
    color: var(--ink-light);
}

/* ── Card content ── */

.card-content {
    padding: 0 24px 16px;
}

.card-summary {
    font-size: 0.85rem;
    color: var(--ink-medium);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.55rem;
}

/* ── Card tags ── */

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 22px;
    margin-top: 10px;
}

.tag {
    background: var(--paper-cream);
    color: var(--ink-light);
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 500;
    pointer-events: none;
}

/* ── Card footer ── */

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--paper-cream);
    border-top: 1px solid var(--paper-warm);
}

.card-meta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    color: var(--ink-light);
}

.card-meta svg {
    width: 13px;
    height: 13px;
    opacity: 0.45;
}

/* ── Deck action buttons ── */

.deck-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.preview-btn {
    background: transparent;
    color: var(--accent);
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.preview-btn:hover {
    background: var(--accent);
    color: white;
}

.deck-btn {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    transition: all var(--transition-fast);
    text-decoration: none;
    cursor: pointer;
    letter-spacing: 0.01em;
}

.deck-btn-primary {
    background: var(--accent-glow);
    color: var(--accent-dark);
}

.deck-btn-primary:hover {
    background: var(--accent);
    color: white;
}

/* ═══════════════════════════════════════
   PURCHASE LINK
   ═══════════════════════════════════════ */

.deck-purchase {
    border-top: 1px solid var(--paper-warm);
    margin-top: 14px;
    padding-top: 12px;
    position: relative;
    z-index: 1;
}

.purchase-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-light);
    transition: color var(--transition-fast);
    text-decoration: none;
}

.purchase-link:hover {
    color: var(--terracotta);
}

.sidebar-purchase {
    flex-shrink: 0;
    padding: 12px 18px;
    border-top: 1px solid var(--paper-warm);
}

.sidebar-purchase .purchase-link {
    font-size: 12px;
}

/* ═══════════════════════════════════════
   STUDY LAYOUT
   ═══════════════════════════════════════ */

.study-page {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    --sidebar-w: 260px;
}

/* ── Header offset to align with card area ── */

.header-row {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    flex-shrink: 0;
}

.header-offset {
    /* occupies first grid column */
}

.header-offset + .header-inner {
    grid-column: 2;
    max-width: 720px;
    padding: 0 20px;
    height: 52px;
    justify-self: center;
    width: 100%;
}

/* ── Body ── */

.study-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* ── Sidebar ── */

.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--paper-cream);
    border-right: 1px solid var(--paper-warm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--paper-warm);
}

.sidebar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-dark);
    font-family: var(--font-display);
    letter-spacing: 0.01em;
}

.sidebar-close {
    display: none;
    font-size: 22px;
    color: var(--ink-light);
    padding: 0;
    line-height: 1;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

/* ── Main Content ── */

.study-main {
    flex: 1;
    min-width: 0;
    max-width: 720px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
}

.card-frame {
    flex: 1;
    width: 100%;
    border: none;
    background: var(--paper-cream);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-height: 200px;
}

.action-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    flex-shrink: 0;
}

/* ── Directory Items ── */

.dir-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 20px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-left: 3px solid transparent;
}

.dir-item:hover {
    background: var(--paper-warm);
}

.dir-item.active {
    background: var(--terracotta-glow);
    border-left-color: var(--terracotta);
}

.dir-item.active .dir-name {
    color: var(--terracotta-dark);
    font-weight: 500;
}

.dir-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.dir-indent {
    width: 16px;
    color: var(--ink-muted);
    font-size: 12px;
}

.dir-name {
    font-size: 14px;
    color: var(--ink-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dir-count {
    font-size: 12px;
    color: var(--ink-light);
    background: var(--paper-warm);
    padding: 2px 8px;
    border-radius: 10px;
    flex-shrink: 0;
}

.dir-item.dir-folder { font-weight: 500; }
.dir-item.dir-folder .dir-name { color: var(--ink-dark); }
.dir-item.dir-folder.active .dir-name { color: var(--terracotta-dark); }

.dir-item {
    padding-left: calc(var(--level, 0) * 30px + 12px);
}

.dir-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.dir-collapse {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 10px;
    cursor: pointer;
    user-select: none;
    color: var(--ink-light);
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.dir-collapse:hover { color: var(--ink-dark); }

.dir-icon { margin-right: 4px; font-size: 14px; }
.dir-item.dir-hidden { display: none; }

.dir-item.active .dir-count {
    background: var(--terracotta);
    color: white;
}

.sidebar-overlay { display: none; }

/* ── Menu Button (mobile toggle) ── */

.menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--ink-medium);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 20px;
}

.menu-btn:hover {
    color: var(--terracotta);
    background: var(--terracotta-glow);
}

/* ═══════════════════════════════════════
   RESPONSIVE: MOBILE
   ═══════════════════════════════════════ */

@media (max-width: 767px) {
    .menu-btn { display: flex; }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(26, 21, 18, 0.35);
        z-index: 998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s ease;
    }

    .sidebar-overlay.show { opacity: 1; visibility: visible; }

    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        z-index: 999;
        transition: left 0.3s var(--ease-out);
        box-shadow: 4px 0 28px rgba(44, 33, 22, 0.12);
    }

    .sidebar.open { left: 0; }

    .sidebar-close {
        display: flex;
        width: 32px;
        height: 32px;
        align-items: center;
        justify-content: center;
        border-radius: var(--radius-sm);
    }

    .sidebar-close:hover {
        background: var(--paper-warm);
        color: var(--ink-dark);
    }

    .study-main { width: 100%; }
    .study-body { position: relative; }
    .header-offset { display: none; }
    .header-row { grid-template-columns: 1fr; }
    .header-offset + .header-inner { grid-column: 1; height: 50px; }

    .header-inner {
        padding: 0 12px;
        height: 50px;
        gap: 8px;
    }

    .header-title { font-size: 15px; }
    .progress-text { font-size: 12px; padding: 5px 10px; }
    .header-purchase { font-size: 12px; }

    .logo { font-size: 28px; }
    .logo-subtitle { font-size: 11px; letter-spacing: 0.15em; }
    .logo-wrap { padding: 36px 0 24px; }

    .deck-grid { gap: 16px; padding: 0 0 32px; }
    .deck-card { border-radius: 12px; }
    .card-header { padding: 14px 16px 12px; gap: 12px; }
    .card-icon { width: 42px; height: 42px; font-size: 20px; }
    .card-title { font-size: 0.95rem; }
    .card-count { font-size: 0.75rem; }
    .card-content { padding: 0 16px 14px; }
    .card-summary { font-size: 0.8rem; -webkit-line-clamp: 1; }
    .card-tags { gap: 4px; margin-top: 8px; }
    .tag { padding: 2px 6px; font-size: 0.7rem; }
    .card-footer { padding: 10px 16px; }
    .preview-btn { font-size: 0.75rem; padding: 5px 10px; }
    .deck-btn { font-size: 11px; padding: 2px 7px; }
    .study-main { padding: 0 12px; }
}

/* ═══════════════════════════════════════
   ACTION BUTTONS
   ═══════════════════════════════════════ */

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.action-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.action-btn:active:not(:disabled) {
    transform: scale(0.96);
}

.action-btn-toggle {
    background: var(--terracotta);
    color: white;
    min-width: 100px;
    box-shadow: 0 2px 10px rgba(197, 83, 44, 0.25);
}

.action-btn-toggle:hover:not(:disabled) {
    background: var(--terracotta-dark);
    box-shadow: 0 4px 16px rgba(197, 83, 44, 0.35);
}

.action-btn-nav {
    background: var(--paper-cream);
    color: var(--ink-medium);
    border: 1px solid var(--paper-warm);
    min-width: 80px;
}

.action-btn-nav:hover:not(:disabled) {
    background: var(--paper-warm);
    color: var(--ink-dark);
}

/* ═══════════════════════════════════════
   BUTTONS (generic)
   ═══════════════════════════════════════ */

.action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding: 28px 0;
}

.action-btn svg { width: 18px; height: 18px; }

.action-btn-know {
    background: var(--sage);
    color: white;
    box-shadow: 0 2px 10px rgba(107, 143, 114, 0.25);
}

.action-btn-know:hover {
    background: #5a7d60;
    box-shadow: 0 4px 16px rgba(107, 143, 114, 0.35);
}

.action-btn-fuzzy {
    background: var(--paper-cream);
    color: var(--ink-medium);
    border: 1px solid var(--paper-warm);
}

.action-btn-fuzzy:hover {
    background: var(--paper-warm);
    border-color: var(--ink-muted);
    color: var(--ink-dark);
}

.action-btn-forgot {
    background: var(--paper-cream);
    color: #b8432f;
    border: 1px solid rgba(184, 67, 47, 0.3);
}

.action-btn-forgot:hover {
    background: #b8432f;
    color: white;
    border-color: #b8432f;
}


/* ═══════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════ */

.footer {
    padding: 36px 0 48px;
    text-align: center;
    margin-top: auto;
    position: relative;
}

.footer::before {
    content: '';
    display: block;
    width: 32px;
    height: 2px;
    background: var(--ink-muted);
    border-radius: 1px;
    margin: 0 auto 20px;
    opacity: 0.35;
}

.footer-quote {
    font-family: var(--font-display);
    font-size: 14px;
    color: var(--ink-light);
    letter-spacing: 0.06em;
    font-weight: 400;
    font-style: italic;
}

/* ═══════════════════════════════════════
   COMPLETE PAGE
   ═══════════════════════════════════════ */

.complete-page {
    min-height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 24px;
}

.complete-icon {
    width: 72px;
    height: 72px;
    background: var(--sage);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    animation: scaleIn 0.5s var(--ease-out);
}

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

.complete-icon svg { width: 32px; height: 32px; color: white; }

.complete-title {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 600;
    color: var(--ink-dark);
    margin-bottom: 10px;
}

.complete-subtitle {
    font-size: 15px;
    color: var(--ink-medium);
    margin-bottom: 28px;
}

.complete-stats {
    display: flex;
    gap: 32px;
    margin-bottom: 36px;
}

.stat-item { text-align: center; }

.stat-value {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 600;
    color: var(--terracotta);
}

.stat-label {
    font-size: 13px;
    color: var(--ink-light);
    margin-top: 4px;
}

.complete-actions {
    display: flex;
    gap: 16px;
}

/* ═══════════════════════════════════════
   MISC: EMPTY STATE, SKELETON, FLASHCARD
   ═══════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.btn-primary { background: var(--terracotta); color: white; }
.btn-primary:hover { background: var(--terracotta-dark); }

.btn-secondary {
    background: var(--paper-cream);
    color: var(--ink-dark);
    border: 1px solid var(--paper-warm);
}
.btn-secondary:hover { background: var(--paper-warm); }

.empty-state {
    text-align: center;
    padding: 80px 24px;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.35;
}

.empty-title {
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--ink-dark);
    margin-bottom: 6px;
    font-weight: 600;
}

.empty-desc {
    font-size: 14px;
    color: var(--ink-light);
}

.loading-skeleton {
    background: linear-gradient(90deg, var(--paper-cream) 25%, var(--paper-warm) 50%, var(--paper-cream) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Flashcard 3D flip (legacy/preview) ── */

.flashcard-container {
    perspective: 1200px;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
}

.flashcard {
    position: relative;
    width: 100%;
    min-height: 360px;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s var(--ease-out);
}

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

.flashcard-face {
    position: absolute;
    width: 100%;
    min-height: 360px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: var(--radius-lg);
    padding: 40px;
}

.flashcard-front {
    background: var(--paper-white);
    border: 1px solid var(--paper-warm);
    box-shadow: var(--shadow-card);
}

.flashcard-back {
    background: var(--paper-cream);
    border: 1px solid var(--paper-warm);
    box-shadow: var(--shadow-card);
    transform: rotateY(180deg);
}

.card-content { width: 100%; text-align: left; }

.flip-hint {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--ink-muted);
}

.flashcard.flipping { pointer-events: none; }

.flashcard-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--ink-muted);
    margin-bottom: 24px;
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.flashcard-title {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 600;
    color: var(--ink-dark);
    line-height: 1.3;
    margin-bottom: 20px;
}

.flashcard-divider {
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--terracotta), transparent);
    margin: 16px 0;
}

.flashcard-content {
    font-size: 16px;
    color: var(--ink-medium);
    line-height: 1.8;
    max-width: 400px;
}

.flashcard-hint {
    position: absolute;
    bottom: 20px;
    font-size: 13px;
    color: var(--ink-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.flashcard-hint svg { width: 14px; height: 14px; }

/* ── Action Buttons (study page legacy) ── */

.action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding: 28px 0;
}

/* ═══════════════════════════════════════
   HOME PAGE (Hero)
   ═══════════════════════════════════════ */

.home-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 24px;
    text-align: center;
    overflow-y: auto;
}

.home-hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    max-width: 520px;
    width: 100%;
}

.home-logo {
    font-family: var(--font-display);
    font-size: 40px;
    font-weight: 600;
    color: var(--ink-dark);
    letter-spacing: -0.01em;
    margin-bottom: 12px;
}

.home-logo .accent {
    color: var(--terracotta);
}

.home-tagline {
    font-size: 14px;
    color: var(--ink-light);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 32px;
    font-weight: 500;
}

.home-desc {
    max-width: 440px;
    font-size: 15px;
    color: var(--ink-medium);
    line-height: 1.8;
    margin-bottom: 40px;
}

/* ── Feature highlights ── */

.home-features {
    display: flex;
    gap: 12px;
    margin-bottom: 40px;
    width: 100%;
}

.home-feature {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 14px;
    border-radius: var(--radius-md);
    background: var(--paper-cream);
    border: 1px solid var(--paper-warm);
    transition: all 0.35s var(--ease-out);
}

.home-feature:hover {
    background: var(--paper-white);
    border-color: rgba(197, 83, 44, 0.15);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.feature-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--terracotta-glow);
    color: var(--terracotta);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.35s var(--ease-out);
}

.home-feature:hover .feature-icon {
    transform: scale(1.1);
}

.feature-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.feature-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-dark);
}

.feature-desc {
    font-size: 12px;
    color: var(--ink-light);
    line-height: 1.5;
}

.home-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 36px;
    background: var(--terracotta);
    color: white;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 500;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 12px rgba(197, 83, 44, 0.25);
    cursor: pointer;
}

.home-cta:hover {
    background: var(--terracotta-dark);
    box-shadow: 0 4px 20px rgba(197, 83, 44, 0.35);
    transform: translateY(-2px);
}

/* ═══════════════════════════════════════
   TAG PILLS
   ═══════════════════════════════════════ */

.tag-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 0 8px;
}

.tag-crumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.tag-crumb {
    font-size: 13px;
    color: var(--ink-light);
    cursor: pointer;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color var(--transition-fast);
}

.tag-crumb:hover {
    color: var(--terracotta);
}

.tag-crumb.current {
    color: var(--terracotta-dark);
    cursor: default;
}

.tag-crumb-sep {
    color: var(--ink-muted);
    font-size: 14px;
}

.tag-pills-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-medium);
    background: var(--paper-cream);
    border: 1px solid var(--paper-warm);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
}

.tag-pill:hover {
    background: var(--paper-warm);
    color: var(--ink-dark);
}

.tag-pill.active {
    background: var(--terracotta);
    color: white;
    border-color: var(--terracotta);
}

.tag-result {
    font-size: 12px;
    color: var(--ink-muted);
    margin-top: 4px;
}

/* ═══════════════════════════════════════
   DECK DETAIL
   ═══════════════════════════════════════ */

.detail-page {
    padding-bottom: 48px;
    overflow-y: auto;
}

.detail-header {
    padding: 32px 0 24px;
}

.detail-title {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 600;
    color: var(--ink-dark);
    margin-bottom: 6px;
}

.detail-count {
    font-size: 14px;
    color: var(--ink-light);
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 16px 0;
}

.detail-tag {
    padding: 3px 10px;
    border-radius: 14px;
    font-size: 12px;
    color: var(--terracotta-dark);
    background: var(--terracotta-glow);
}

.detail-body {
    font-size: 15px;
    color: var(--ink-medium);
    line-height: 1.85;
    margin-bottom: 32px;
}

.detail-body h1,
.detail-body h2,
.detail-body h3 {
    font-family: var(--font-display);
    color: var(--ink-dark);
    margin: 24px 0 12px;
    font-weight: 600;
}

.detail-body h1 { font-size: 20px; }
.detail-body h2 { font-size: 18px; }
.detail-body h3 { font-size: 16px; }

.detail-body p { margin-bottom: 12px; }

.detail-body ul,
.detail-body ol {
    padding-left: 20px;
    margin-bottom: 12px;
}

.detail-body li { margin-bottom: 4px; }

.detail-body blockquote {
    border-left: 3px solid var(--terracotta);
    padding: 8px 16px;
    margin: 12px 0;
    background: var(--terracotta-glow);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--ink-dark);
}

.detail-body code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--paper-cream);
    color: var(--terracotta-dark);
}

.detail-body pre {
    margin: 12px 0;
    padding: 16px;
    border-radius: var(--radius-sm);
    background: var(--paper-cream);
    overflow-x: auto;
}

.detail-body pre code {
    padding: 0;
    background: none;
    color: var(--ink-dark);
    font-size: 13px;
}

.detail-body a {
    color: var(--terracotta);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.detail-body a:hover {
    color: var(--terracotta-dark);
}

.detail-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-actions .btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    background: var(--terracotta);
    color: white;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.detail-actions .btn-primary:hover {
    background: var(--terracotta-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(197, 83, 44, 0.3);
}

.detail-actions .purchase-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--paper-warm);
    font-size: 14px;
    color: var(--ink-light);
    transition: all var(--transition-fast);
}

.detail-actions .purchase-link:hover {
    color: var(--terracotta);
    border-color: var(--terracotta);
}

.detail-sep {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--ink-muted);
    font-size: 12px;
}

.detail-sep::before,
.detail-sep::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--paper-warm);
}

@media (max-width: 767px) {
    .home-logo { font-size: 32px; }
    .home-desc { font-size: 14px; }
    .home-features { flex-direction: column; gap: 10px; }
    .home-feature { flex-direction: row; padding: 14px 18px; text-align: left; }
    .home-hero { justify-content: flex-start; padding-top: 24px; }
    .detail-title { font-size: 22px; }
}

/* ═══════════════════════════════════════
   HEADER: BRAND & ABOUT LINK (homepage)
   ═══════════════════════════════════════ */

.header-brand {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 600;
    color: var(--ink-dark);
    letter-spacing: -0.01em;
    cursor: default;
    user-select: none;
}

.header-brand .accent {
    color: var(--terracotta);
}

.header-about-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-light);
    text-decoration: none;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.header-about-link:hover {
    color: var(--terracotta);
    background: var(--terracotta-glow);
}

.footer-about-link {
    display: inline-block;
    font-size: 12px;
    color: var(--ink-muted);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    margin-bottom: 12px;
}

.footer-about-link:hover {
    color: var(--terracotta);
    background: var(--terracotta-glow);
}

/* ═══════════════════════════════════════
   DOCS PAGE — three-column layout
   ═══════════════════════════════════════ */

.docs-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.docs-layout {
    display: grid;
    grid-template-columns: 260px 1fr 200px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Left Sidebar ── */

.docs-sidebar-left {
    background: var(--paper-cream);
    border-right: 1px solid var(--paper-warm);
    overflow-y: auto;
    padding: 16px 0;
    overscroll-behavior: contain;
}

.doc-nav-group {
    margin-bottom: 4px;
}

.doc-nav-group-title {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    user-select: none;
    transition: color var(--transition-fast);
}

.doc-nav-group-title:hover {
    color: var(--ink-medium);
}

.doc-nav-group-title.collapsed .doc-nav-chevron {
    transform: rotate(-90deg);
}

.doc-nav-chevron {
    margin-left: auto;
    transition: transform var(--transition-fast);
    color: var(--ink-muted);
}

.doc-nav-items.collapsed {
    display: none;
}

.doc-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px 8px 28px;
    font-size: 13px;
    font-weight: 400;
    color: var(--ink-medium);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all var(--transition-fast);
}

.doc-nav-item:hover {
    background: var(--paper-warm);
    color: var(--ink-dark);
}

.doc-nav-item.active {
    background: var(--terracotta-glow);
    border-left-color: var(--terracotta);
    color: var(--terracotta-dark);
    font-weight: 500;
}

.doc-nav-item-icon {
    font-size: 15px;
    flex-shrink: 0;
}

/* ── Main Content ── */

.docs-main {
    min-width: 0;
    padding: 32px 48px 64px;
    max-width: 780px;
    margin: 0 auto;
    width: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.docs-content-loading {
    text-align: center;
    padding: 60px 0;
    color: var(--ink-light);
}

.docs-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--ink-light);
    margin-bottom: 12px;
}

.docs-breadcrumb a {
    color: var(--ink-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.docs-breadcrumb a:hover {
    color: var(--terracotta);
}

.docs-breadcrumb-sep {
    color: var(--ink-muted);
    font-size: 16px;
}

.docs-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--ink-muted);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.docs-meta-dot {
    color: var(--ink-muted);
    font-weight: 300;
}

.docs-meta-tags {
    display: inline-flex;
    gap: 4px;
}

.docs-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--paper-cream);
    border: 1px solid var(--paper-warm);
    border-radius: 4px;
    font-size: 11px;
    color: var(--ink-light);
}

.docs-title {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 600;
    color: var(--ink-dark);
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--paper-warm);
}

/* ── Docs Body (Markdown content) ── */

.docs-body {
    font-size: 15px;
    color: var(--ink-medium);
    line-height: 1.85;
    margin-bottom: 48px;
}

.docs-body h1,
.docs-body h2,
.docs-body h3 {
    font-family: var(--font-display);
    color: var(--ink-dark);
    margin: 28px 0 12px;
    font-weight: 600;
    scroll-margin-top: 72px;
}

.docs-body h1 { font-size: 22px; padding-bottom: 8px; border-bottom: 1px solid var(--paper-warm); }
.docs-body h2 { font-size: 19px; }
.docs-body h3 { font-size: 16px; }

.docs-body p { margin-bottom: 12px; }

.docs-body ul,
.docs-body ol {
    padding-left: 20px;
    margin-bottom: 14px;
}

.docs-body li { margin-bottom: 6px; }
.docs-body li strong { color: var(--ink-dark); }

.docs-body blockquote {
    border-left: 3px solid var(--terracotta);
    padding: 10px 18px;
    margin: 16px 0;
    background: var(--terracotta-glow);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--ink-dark);
    font-style: italic;
}

.docs-body blockquote p { margin-bottom: 0; }

.docs-body hr {
    border: none;
    height: 1px;
    background: var(--paper-warm);
    margin: 32px 0;
}

.docs-body code {
    font-family: 'Menlo', 'Consolas', 'Monaco', monospace;
    font-size: 0.88em;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--paper-cream);
    color: var(--terracotta-dark);
}

.docs-body pre {
    margin: 16px 0;
    padding: 18px;
    border-radius: var(--radius-sm);
    background: #1e1e24;
    overflow-x: auto;
    border: 1px solid #2d2d36;
}

.docs-body pre code {
    padding: 0;
    background: none;
    color: #e0e0e0;
    font-size: 13px;
    line-height: 1.6;
}

.docs-body a {
    color: var(--terracotta);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.docs-body a:hover {
    color: var(--terracotta-dark);
}

.docs-body strong {
    font-weight: 600;
    color: var(--ink-dark);
}

/* ── Callout boxes ── */

.callout {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin: 16px 0;
    font-size: 14px;
    line-height: 1.7;
    border-left: 4px solid transparent;
}

.callout-info {
    background: #eaf4fb;
    border-color: #38bdf8;
    color: #1e4a6b;
}

.callout-warning {
    background: #fef6e8;
    border-color: var(--amber);
    color: #7a5d10;
}

.callout-success {
    background: #ecf8f1;
    border-color: var(--sage);
    color: #2d5a3d;
}

.callout p { margin-bottom: 0; }
.callout strong { color: inherit; }

/* ── Prev/Next Pager ── */

.docs-pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding-top: 32px;
    border-top: 1px solid var(--paper-warm);
}

.docs-pager a {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 20px;
    border: 1px solid var(--paper-warm);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.docs-pager a:hover {
    border-color: var(--terracotta);
    background: var(--terracotta-glow);
}

.docs-pager-next {
    text-align: right;
    grid-column: 2;
}

.docs-pager-prev {
    grid-column: 1;
}

.docs-pager-label {
    font-size: 11px;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.docs-pager-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-dark);
}

.docs-pager a:hover .docs-pager-title {
    color: var(--terracotta-dark);
}

/* ── Right TOC ── */

.docs-sidebar-right {
    overflow-y: auto;
    padding: 24px 0 24px 16px;
    overscroll-behavior: contain;
    border-left: 1px solid var(--paper-warm);
}

.doc-toc-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.doc-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.doc-toc-item {
    margin-bottom: 2px;
}

.doc-toc-link {
    display: block;
    padding: 5px 10px;
    font-size: 12px;
    color: var(--ink-light);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: all var(--transition-fast);
    line-height: 1.5;
}

.doc-toc-link:hover {
    color: var(--ink-dark);
    background: var(--paper-cream);
}

.doc-toc-link.active {
    color: var(--terracotta);
    border-left-color: var(--terracotta);
    font-weight: 500;
}

.doc-toc-indent {
    padding-left: 24px;
}

/* ── Mobile Menu Button ── */

.docs-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--ink-medium);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 20px;
    background: none;
    border: none;
}

.docs-menu-btn:hover {
    color: var(--terracotta);
    background: var(--terracotta-glow);
}

/* ═══════════════════════════════════════
   DOCS RESPONSIVE
   ═══════════════════════════════════════ */

@media (max-width: 1100px) {
    .docs-layout {
        grid-template-columns: 260px 1fr;
    }
    .docs-sidebar-right {
        display: none;
    }
}

/* ═══════════════════════════════════════
   PRO PAGE — tool host
   ═══════════════════════════════════════ */

.pro-page { display:flex; flex-direction:column; height:calc(100vh - 56px); overflow:hidden; background:var(--bg-primary); }
.pro-layout { display:flex; flex:1; min-height:0; }
.pro-tabs { width:140px; flex-shrink:0; background:var(--bg-secondary); border-right:1px solid var(--border); padding:8px 0; overflow-y:auto; }
.pro-tab { display:flex; align-items:center; gap:6px; padding:8px 12px; cursor:pointer; font-size:12px; color:var(--text-secondary); border-left:3px solid transparent; transition:all var(--transition-fast); border-radius:0 var(--radius-sm) var(--radius-sm) 0; }
.pro-tab:hover { background:var(--bg-hover); color:var(--text-primary); }
.pro-tab.active { background:var(--accent-glow); border-left-color:var(--accent); color:var(--accent-dark); font-weight:600; }
.pro-tab-icon { font-size:14px; flex-shrink:0; }
.pro-tab-name { white-space:nowrap; }
.pro-content { flex:1; min-width:0; background:var(--bg-primary); }
.pro-frame { width:100%; height:100%; border:none; background:#fff; }

@media (max-width: 767px) {
    .pro-tabs { width:110px; }
    .pro-tab { padding:6px 10px; font-size:11px; }
}
        grid-template-columns: 1fr;
    }
    .docs-menu-btn {
        display: flex;
    }
    .docs-sidebar-left {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        height: 100dvh;
        z-index: 999;
        transition: left 0.3s var(--ease-out);
        box-shadow: 4px 0 28px rgba(44, 33, 22, 0.12);
        padding-top: 20px;
    }
    .docs-sidebar-left.open {
        left: 0;
    }
    .docs-main {
        padding: 24px 20px 48px;
    }
    .docs-title {
        font-size: 22px;
    }
    .docs-pager {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .docs-pager a {
        grid-column: 1 !important;
    }
    .header-about-link {
        font-size: 12px;
        padding: 4px 8px;
    }
}
