:root {
    --bg: #faf6f0;
    --card-bg: #fffef9;
    --border: #d9c8b2;
    --text-main: #3e2e1f;
    --text-muted: #7a6a5c;
    --primary: #8b5a2b;
    --primary-hover: #6b4423;
    --primary-light: #f4e8d8;
    --primary-gradient: linear-gradient(135deg, #8b5a2b, #a0522d);
    --success: #4a7c59;
    --success-bg: #e7f0e7;
    --success-dark: #2d5a3f;
    --error: #a3463a;
    --error-bg: #fce8e6;
    --warning: #b68b40;
    --warning-bg: #fdf8eb;
    --modal-bg: rgba(46, 40, 30, 0.55);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font-serif: 'Merriweather', Georgia, 'Times New Roman', serif;
}

body.dark-mode {
    --bg: #2b1f14;
    --card-bg: #3c2e20;
    --border: #5b4a38;
    --text-main: #e6d5b8;
    --text-muted: #b8a48b;
    --primary: #c49a6c;
    --primary-hover: #a87d51;
    --primary-light: #4e3c2a;
    --primary-gradient: linear-gradient(135deg, #c49a6c, #a87d51);
    --success: #6d9e7a;
    --success-bg: #2e3e2f;
    --success-dark: #5a8f6a;
    --error: #c4726a;
    --error-bg: #452a28;
    --warning: #c9a44b;
    --warning-bg: #3e3220;
    --modal-bg: rgba(20, 15, 8, 0.7);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-serif);
}

svg {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

svg path, 
svg circle, 
svg polyline, 
svg line, 
svg rect, 
svg polygon {
    fill: inherit;
    stroke: inherit;
}

body {
    background-color: var(--bg);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(139,90,43,0.03) 0%, transparent 60%),
        repeating-linear-gradient(0deg, rgba(0,0,0,0.02) 0px, rgba(0,0,0,0.02) 1px, transparent 1px, transparent 3px);
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 99998;
    opacity: 0.06;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 300px 300px;
    mix-blend-mode: multiply;
}

.container {
    max-width: 920px;
    margin: 0 auto;
    padding: 32px 24px;
    width: 100%;
}

/* Toast */
#toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}
.toast {
    background: var(--card-bg);
    border-left: 4px solid var(--primary);
    padding: 14px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    animation: slideUp 0.35s ease;
    pointer-events: auto;
    font-size: 0.95rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }
.toast .undo-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9rem;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.3s ease-in-out; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes bounceIn {
    0% { transform: scale(0.95); opacity: 0; }
    60% { transform: scale(1.02); }
    100% { transform: scale(1); opacity: 1; }
}
.bounce-in { animation: bounceIn 0.4s ease; }

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 16px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 16px;
    position: relative;
    z-index: 10;
}
.title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}
.app-logo-wrapper {
    width: 57px;
    height: 57px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.app-logo {
    width: 57px;
    height: 57px;
    object-fit: contain;
    /* Move the black image out of view and project a themed shadow into the view */
    filter: drop-shadow(70px 0 0 var(--primary));
    transform: translateX(-70px);
    transition: filter var(--transition);
}
@media (max-width: 600px) {
    .app-logo-wrapper {
        width: 48px;
        height: 48px;
    }
    .app-logo {
        width: 48px;
        height: 48px;
        filter: drop-shadow(60px 0 0 var(--primary));
        transform: translateX(-60px);
    }
    h1 {
        font-size: 1.3rem;
    }
    .import-btn {
        min-width: 44px;
        width: 44px;
        padding: 10px !important;
    }
    .import-btn .btn-text {
        display: none;
    }
}
h1 {
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--primary);
}
.header-actions-group { display: flex; gap: 12px; }

button {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: none;
    outline: none;
    font-family: var(--font-serif);
    color: var(--text-main);
}
.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255,255,255,0.15);
}
.btn-primary:hover:not(:disabled) {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.btn-primary:disabled {
    background: #b8a48b;
    cursor: not-allowed;
    box-shadow: none;
}
.btn-secondary {
    background: var(--card-bg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--primary-light); }
.btn-redo {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}
.btn-redo:hover { background: var(--primary-light) !important; }
.btn-danger {
    color: var(--error);
    border: 1px solid var(--error);
    background: transparent;
}
.btn-danger:hover { background: var(--error-bg); }
.btn-ghost {
    color: var(--text-muted);
    padding: 8px 14px;
}
.btn-ghost:hover { background: var(--border); color: var(--text-main); }
.btn-icon {
    padding: 8px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover { background: var(--border); color: var(--text-main); }
.w-100 { width: 100%; }

/* Greeting */
.greeting {
    text-align: left;
    font-size: 2rem;
    font-weight: 300;
    margin-bottom: 35px;
    color: var(--text-main);
    animation: fadeIn 0.5s;
}

/* --- Dashboard --- */
#deck-list { display: flex; flex-direction: column; gap: 24px; }

@property --pulse-angle {
    syntax: '<angle>';
    inherits: false;
    initial-value: 0deg;
}

@keyframes pulse-border-travel {
    from { --pulse-angle: 0deg; }
    to   { --pulse-angle: 360deg; }
}

.deck-card {
    position: relative;
    overflow: visible; /* Changed from visible in redesign */
    background: var(--card-bg);
    padding: 0; /* Changed to 0 as we use panels now */
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 6px solid var(--primary);
    margin-bottom: 24px;
}
.deck-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.deck-card.last-studied::before {
    content: '';
    position: absolute;
    inset: -1.5px;
    border-radius: calc(var(--radius-xl) + 1.5px);
    padding: 1.5px;
    background: conic-gradient(
        from var(--pulse-angle),
        transparent 0deg,
        transparent 270deg,
        rgba(200, 130, 60, 0.8) 320deg,
        rgba(200, 130, 60, 0.3) 340deg,
        transparent 360deg
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: pulse-border-travel 2.5s linear infinite;
    pointer-events: none;
    z-index: 0;
}

.deck-main-panel { padding: 24px; position: relative; z-index: 1; }
@media (max-width: 600px) { .deck-main-panel { padding: 16px; } }

.deck-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    gap: 16px;
}
.deck-menu-wrap, .menu-wrap { position: relative; }
.deck-card:has(.dropdown-menu.show) { z-index: 10; }
.deck-title { font-size: 1.4rem; font-weight: 600; line-height: 1.3; }

.metrics-grid {
    display: flex;
    gap: 32px;
    align-items: center;
    margin-bottom: 24px;
}
.metric-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}
.metric-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}
.metric-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-top: 4px;
}

@media (max-width: 600px) {
    .metrics-grid {
        flex-direction: column;
        gap: 16px;
        background: var(--bg);
        padding: 16px;
        border-radius: var(--radius-md);
        border: 1px solid var(--border);
        align-items: stretch;
    }
    .metric-item.acc-box {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        border-top: 1px solid var(--border);
        padding-top: 16px;
    }
    .metric-item.acc-box .metric-value {
        margin-top: 0;
        font-size: 1.4rem;
    }
}

.progress-bar-wrap { width: 100%; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.progress-bar-fill { height: 100%; background: var(--primary-gradient); transition: width 0.4s; }

.deck-actions-row {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}
.deck-actions-row .btn-primary.btn-lg {
    min-width: 150px;
    padding: 12px 24px;
    font-size: 1rem;
}
.mobile-tools-row { display: flex; gap: 8px; }

@media (max-width: 600px) {
    .deck-actions-row { flex-direction: column; align-items: stretch; }
    .deck-actions-row .btn-primary.btn-lg { width: 100%; }
    .mobile-tools-row {
        width: 100%;
        background: var(--bg);
        padding: 6px;
        border-radius: var(--radius-md);
        border: 1px solid var(--border);
    }
    .btn-chapters-toggle { flex: 1; border-radius: var(--radius-sm) !important; gap: 8px; }
    .btn-chapters-toggle::after { content: 'Chapters'; font-size: 0.9rem; font-weight: 600; }
}

.btn-chapters-toggle {
    background: var(--primary-light);
    color: var(--primary);
    width: 44px;
    height: 44px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-chapters-toggle svg { width: 20px; height: 20px; }
.btn-chapters-toggle:hover { background: var(--primary); color: #fff; transform: translateY(-1px); }
.btn-chapters-toggle .chevron { transition: transform 0.3s; }
.btn-chapters-toggle.open .chevron { transform: rotate(180deg); }

/* Chapters Drawer (Tree Line) */
.chapters-drawer {
    display: none;
    border-top: 1px solid var(--border);
    background: var(--card-bg);
}
.chapters-drawer.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.chapter-tree-root {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.chapter-node {
    display: flex;
    flex-direction: column;
}

.chapter-row {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    gap: 12px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}
.chapter-row:hover {
    background: var(--bg);
}

.chapter-main-tap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    min-width: 0;
}

.chapter-title-line {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 0.95rem;
}
.tree-chevron {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: transform 0.2s;
    flex-shrink: 0;
}
.tree-chevron svg { width: 14px; height: 14px; }
.chapter-node.open > .chapter-row .tree-chevron {
    transform: rotate(90deg);
    color: var(--primary);
}
.chapter-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
}

.chapter-stats-line {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 22px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.acc-badge {
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-weight: 700;
}
.acc-badge.green {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(74,124,89,0.3);
}
.acc-badge.orange {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: rgba(182,139,64,0.3);
}
.acc-badge.red {
    background: var(--error-bg);
    color: var(--error);
    border-color: rgba(163,70,58,0.3);
}
.acc-badge.muted {
    background: var(--bg);
    color: var(--text-muted);
    border-color: var(--border);
}

.chapter-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.btn-mini-play {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-mini-play svg { width: 16px; height: 16px; }
.btn-mini-play:hover {
    background: var(--primary);
    color: #fff;
    transform: scale(1.05);
}
.btn-mini-menu {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-mini-menu svg { width: 18px; height: 18px; }
.btn-mini-menu:hover {
    background: var(--border);
    color: var(--text-main);
}

.chapter-children {
    display: none;
    flex-direction: column;
    gap: 4px;
    margin-left: 19px;
    padding-left: 12px;
    border-left: 2px solid var(--border);
    margin-top: 4px;
    margin-bottom: 8px;
}
.chapter-node.open > .chapter-children {
    display: flex;
}

body.dark-mode .chapter-children {
    border-left-color: var(--border);
}

@media (max-width: 600px) {
    .chapter-row {
        padding: 10px 8px;
    }
    .chapter-stats-line {
        padding-left: 22px;
    }
}

/* Dropdown styling */
.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    min-width: 170px;
    overflow: hidden;
    display: none;
}
.dropdown-menu.show {
    display: block;
    animation: fadeIn 0.15s ease;
}
.dropdown-item {
    width: 100%;
    text-align: left;
    padding: 11px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    justify-content: flex-start;
    gap: 10px;
    display: flex;
    align-items: center;
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--font-serif);
    color: var(--text-main);
}
.dropdown-item:hover { background: var(--primary-light); }
.dropdown-item.danger { color: var(--error); }
.dropdown-item.danger:hover { background: var(--error-bg); }
.dropdown-item svg {
    flex-shrink: 0;
    color: var(--text-muted);
    width: 16px;  /* â† add this */
    height: 16px; /* â† add this */
}
.dropdown-item.danger svg { color: var(--error); }
.menu-divider { height: 1px; background: var(--border); margin: 4px 0; }

.menu-stat {
    padding: 6px 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    line-height: 1.4;
}

/* Quiz */
#quiz-view {
    display: none;
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    margin: -24px;
    padding: 16px 24px;
    background: var(--bg);
}
#quiz-view.hidden { display: none !important; }
#quiz-view.fade-in { display: flex; animation: fadeIn 0.3s ease-in-out; }

/* Quiz header bottom-edge progress bar */
.quiz-header-progress {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 4px;
    display: flex;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    overflow: hidden;
    background: var(--border);
}
.qhp-fill {
    height: 100%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.qhp-done { background: var(--success); }
.qhp-wrong { background: var(--error); }

/* Anki-style counts */
.quiz-anki-counts {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}
.qac {
    font-size: 1rem;
    font-weight: 800;
    min-width: 24px;
    text-align: center;
    line-height: 1;
}
.qac-new  { color: #5b8fc9; }
.qac-wrong { color: var(--error); }
.qac-done  { color: var(--success); }
body.dark-mode .qac-new { color: #7fb3e8; }

#quiz-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 16px 24px 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 0;
    position: relative;
}

.quiz-meta-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quiz-scrollable {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 24px 0 130px;
    -webkit-overflow-scrolling: touch;
}

.question-box {
    background: var(--card-bg);
    padding: 32px 28px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.5;
    border: 1px solid var(--border);
    border-left: 5px solid var(--primary);
}
.options-container { display: flex; flex-direction: column; gap: 14px; }
.option-wrapper { position: relative; }
.option-btn {
    background: var(--card-bg);
    border: 2px solid var(--border);
    padding: 16px 20px 16px 56px;
    border-radius: var(--radius-lg);
    text-align: left;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    min-height: 60px;
    color: var(--text-main);
    position: relative;
    font-weight: 600;
    width: 100%;
    user-select: none;
    -webkit-user-select: none;
}
.option-btn:hover:not(:disabled) {
    border-color: var(--primary);
    background: var(--bg);
}
.option-btn .radio-circle {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: 2px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.9rem;
    transition: all var(--transition);
}
.option-btn.correct {
    background: var(--success-bg);
    border-color: var(--success);
    color: #1e3a2f;
}
.option-btn.correct .radio-circle { background: var(--success); border-color: var(--success); color: #fff; }
.option-btn.wrong {
    background: var(--error-bg);
    border-color: var(--error);
    color: #5c1f18;
}
.option-btn.wrong .radio-circle { background: var(--error); border-color: var(--error); color: #fff; }

.option-btn.strikethrough { text-decoration: line-through; opacity: 0.7; }

body.dark-mode .option-btn.correct { color: #c8e6c9; }
body.dark-mode .option-btn.wrong { color: #ffcdd2; }

.matching-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.matching-row {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 0.9fr);
    gap: 12px;
    align-items: center;
}
.matching-prompt {
    font-weight: 700;
    line-height: 1.45;
}
.matching-select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text-main);
    padding: 10px 12px;
    font: inherit;
    font-weight: 600;
}
.matching-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.matching-feedback {
    grid-column: 1 / -1;
    display: none;
    font-size: 0.9rem;
    font-weight: 700;
}
.matching-row.correct {
    background: var(--success-bg);
    border-color: var(--success);
}
.matching-row.wrong {
    background: var(--error-bg);
    border-color: var(--error);
}
.matching-row.correct .matching-feedback,
.matching-row.wrong .matching-feedback {
    display: block;
}
.matching-row.correct .matching-feedback { color: var(--success); }
.matching-row.wrong .matching-feedback { color: var(--error); }
.matching-check-btn {
    margin-top: 4px;
    min-height: 52px;
}
@media (max-width: 600px) {
    .matching-row {
        grid-template-columns: 1fr;
    }
}

.note-box {
    background: #fef9e7;
    border-left: 4px solid var(--warning);
    padding: 12px 16px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.95rem;
    margin-top: 8px;
    color: #6c5218;
    animation: fadeIn 0.3s ease;
}
body.dark-mode .note-box {
    background: #2e2510;
    color: #c9a44b;
}
.general-note {
    background: var(--bg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    padding: 20px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    animation: fadeIn 0.3s ease;
    margin-top: 24px;
}

.controls {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    background: inherit;
}
.grade-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    padding: 14px 28px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: var(--shadow-md);
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}
/* Desktop order: wrong (X) left, correct (âœ“) right */
#wrong-btn { order: 1; }
#correct-btn { order: 2; }
/* Settings entry only makes sense in mobile â‹® menu (header already has settings btn on desktop) */
.quiz-mobile-menu .deck-menu-item:first-child { display: none; }
#next-btn {
    width: 100%;
    padding: 22px 24px;
    font-size: 1.4rem;
    border-radius: var(--radius-lg);
    font-weight: 800;
    letter-spacing: 0.02em;
}
#mark-correct-btn {
    width: auto;
    align-self: center;
    padding: 10px 24px;
    font-size: 0.85rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    letter-spacing: 0.01em;
    border: 1px solid var(--border);
    background: var(--card-bg);
}

/* Star */
.star-btn svg { color: var(--text-muted); transition: color 0.2s, fill 0.2s; }
.star-btn.starred svg { color: #f4b400; fill: #f4b400; stroke: #f4b400; }
.star-btn:hover svg { color: #f4b400; }
.star-badge { background: #fef5d1; color: #b38f00; border-color: #f4b400; }

/* Feedback animations */
@keyframes feedback-correct-soft {
    0% { background-color: var(--card-bg); transform: scale(1); }
    15% { background-color: var(--success-bg); transform: scale(1.01); }
    100% { background-color: var(--card-bg); transform: scale(1); }
}
@keyframes feedback-wrong-soft {
    0% { background-color: var(--card-bg); transform: scale(1); }
    15% { background-color: var(--error-bg); transform: scale(0.99); }
    100% { background-color: var(--card-bg); transform: scale(1); }
}
.feedback-correct { animation: feedback-correct-soft 0.6s ease-out; }
.feedback-wrong { animation: feedback-wrong-soft 0.6s ease-out; }

@keyframes flash-correct {
    0% { background-color: var(--success); border-color: var(--success); color: #fff; transform: scale(1.05); }
    100% { transform: scale(1); }
}
@keyframes flash-wrong {
    0% { background-color: var(--error); border-color: var(--error); color: #fff; transform: scale(1.05); }
    100% { transform: scale(1); }
}
.flash-correct { animation: flash-correct 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.flash-wrong { animation: flash-wrong 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

body.in-quiz header .header-actions-group .btn-primary { display: none !important; }

.grade-btn {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    border: 2.5px solid var(--border);
    background: var(--card-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--text-muted);
    box-shadow: var(--shadow-sm);
}
.grade-wrong:hover:not(:disabled) {
    border-color: var(--error);
    background: var(--error-bg);
    color: var(--error);
    transform: scale(1.07);
    box-shadow: var(--shadow-md);
}
.grade-correct:hover:not(:disabled) {
    border-color: var(--success);
    background: var(--success-bg);
    color: var(--success);
    transform: scale(1.07);
    box-shadow: var(--shadow-md);
}
.grade-wrong.active {
    border-color: var(--error);
    background: var(--error-bg);
    color: var(--error);
    box-shadow: 0 0 0 3px rgba(163,70,58,0.15);
}
.grade-correct.active {
    border-color: var(--success);
    background: var(--success-bg);
    color: var(--success);
    box-shadow: 0 0 0 3px rgba(74,124,89,0.15);
}
.grade-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}
.grade-btn:disabled:hover {
    border-color: var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
    transform: none;
    box-shadow: var(--shadow-sm);
}

/* Browse */
#browse-view { background: var(--bg); min-height: 100vh; padding: 24px 16px 24px; }
#browse-header {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 24px; flex-wrap: wrap;
}
#browse-deck-title {
    font-weight: 700; font-size: 1.1rem; flex: 1;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.browse-count-badge {
    background: var(--primary-light); color: var(--primary);
    font-size: 0.8rem; font-weight: 700; padding: 3px 10px;
    border-radius: 20px; white-space: nowrap;
}
.undo-count-badge {
    display: inline-block; background: var(--primary); color: #fff;
    font-size: 0.7rem; font-weight: 800; padding: 1px 6px;
    border-radius: 20px; margin-left: 4px; vertical-align: middle;
}
#browse-toolbar {
    display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
    margin-bottom: 16px;
}
#browse-search-input {
    flex: 1; min-width: 180px; padding: 10px 14px;
    border: 1px solid var(--border); border-radius: var(--radius-md);
    font-size: 0.95rem; font-family: inherit;
    background: var(--card-bg); color: var(--text-main);
}
#browse-search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-pill {
    padding: 6px 14px; border-radius: 20px; font-size: 0.85rem; font-weight: 700;
    border: 1.5px solid var(--border); background: var(--card-bg); color: var(--text-muted);
    cursor: pointer; transition: all var(--transition);
}
.filter-pill:hover { border-color: var(--primary); color: var(--primary); }
.filter-pill.active { background: var(--primary-gradient); color: #fff; border-color: transparent; }
#browse-sort-select {
    padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-md);
    font-size: 0.9rem; font-family: inherit; background: var(--card-bg); color: var(--text-main);
    cursor: pointer;
}
#browse-bulk-bar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    background: var(--primary-light); border: 1.5px solid var(--primary);
    border-radius: var(--radius-md); padding: 10px 16px; margin-bottom: 12px;
    animation: fadeIn 0.2s ease;
}
.bulk-select-label { display: flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; }
.bulk-select-label input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
#browse-selected-count { font-weight: 700; color: var(--primary); }
.bulk-actions { display: flex; gap: 8px; margin-left: auto; }

#browse-select-bar {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 12px;
}
.browse-select-all-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: var(--radius-md);
    border: 1.5px solid var(--border); background: var(--card-bg);
    color: var(--text-muted); font-family: var(--font-serif);
    font-size: 0.85rem; font-weight: 700; cursor: pointer;
    transition: all var(--transition);
}
.browse-select-all-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.browse-select-all-btn.active { background: var(--primary-gradient); color: #fff; border-color: transparent; }
.browse-select-hint { font-size: 0.8rem; color: var(--text-muted); }
#browse-list { display: flex; flex-direction: column; gap: 10px; }
.browse-empty { text-align: center; padding: 40px; color: var(--text-muted); font-size: 1rem; }
.browse-item {
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 14px 16px;
    display: flex; align-items: flex-start; gap: 12px;
    transition: box-shadow var(--transition);
}
.browse-item:hover { box-shadow: var(--shadow-md); }
.browse-checkbox { margin-top: 3px; width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--primary); cursor: pointer; }
.browse-body { flex: 1; min-width: 0; }
.browse-q { font-weight: 600; font-size: 0.95rem; line-height: 1.5; margin-bottom: 8px; }
.browse-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.browse-badge {
    font-size: 0.75rem; font-weight: 700; padding: 2px 8px;
    border-radius: 20px; background: var(--bg); border: 1px solid var(--border);
    color: var(--text-muted); white-space: nowrap;
}
.ans-badge  { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.wrong-badge { background: var(--error-bg); color: var(--error); border-color: var(--error); }
.done-badge  { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.tag-badge   { background: var(--bg); color: var(--text-muted); }
.muted-badge { opacity: 0.7; }

.browse-actions { display: flex; gap: 4px; flex-shrink: 0; }
.browse-danger { color: var(--error) !important; }
.browse-danger:hover { background: var(--error-bg) !important; }

/* Confirm modal must always sit on top of any other open modal */
#confirm-modal { z-index: 4000; }
#browse-tag-select {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 0.875rem;
    font-family: var(--font-serif);
    cursor: pointer;
}

/* Pagination bar */
.browse-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px 0 8px;
}
.pag-btn {
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card-bg);
    color: var(--primary);
    font-family: var(--font-serif);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    min-width: 90px;
    transition: background var(--transition), border-color var(--transition);
}
.pag-btn:hover:not(:disabled) { background: var(--primary-light); border-color: var(--primary); }
.pag-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.pag-info { font-size: 0.875rem; color: var(--text-muted); white-space: nowrap; }

/* Keyboard legend */
.kbd-legend-title {
    font-weight: 800;
    font-size: 0.8rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}
.kbd-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 8px 0;
    font-size: 0.9rem;
    color: var(--text-main);
}
.kbd-row span { color: var(--text-muted); font-size: 0.85rem; }
kbd, .gesture-key {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.78rem;
    font-family: var(--font-serif);
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    box-shadow: 0 2px 0 var(--border);
    display: inline-block;
}

.swipe-hint { display: none; }

/* Quiz mobile/desktop action visibility */
.quiz-mobile-menu { display: block; }
.quiz-desktop-action { display: none !important; }

@media (max-width: 600px) {
    .mobile-only { display: flex; }
    .kbd-shortcut { display: none !important; }
    .swipe-hint { display: flex !important; }

    /* ---- Mobile Quiz Layout ---- */
    #quiz-view {
        position: fixed;
        inset: 0;
        z-index: 2000;
        margin: 0;
        padding: 0;
        height: 100dvh;
        width: 100vw;
        display: none;
        flex-direction: column;
        background: var(--bg);
    }
    #quiz-view.fade-in { display: flex; }

    body.in-quiz .container > header { display: none; }

    /* Single-row compact header */
    #quiz-header {
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
        padding: 10px 12px 14px;
        gap: 8px;
        border-radius: 0;
        border-left: none;
        background: var(--card-bg);
        flex-shrink: 0;
    }
    #quiz-header .btn-secondary,
    #browse-header .btn-secondary {
        padding: 6px;
        border-radius: var(--radius-md);
        min-width: 38px;
        height: 38px;
        flex-shrink: 0;
    }
    #quiz-header .btn-secondary span,
    #browse-header .btn-secondary span { display: none; }

    #deck-title { display: none !important; }

    .progress-container {
        position: static;
        width: auto !important;
        margin: 0 !important;
        height: auto;
        z-index: auto;
    }
    .progress-bar { height: 10px; border-radius: 5px; background: var(--border); }

    .header-actions { display: flex; align-items: center; flex-shrink: 0; }
    .quiz-meta-actions { display: flex; align-items: center; gap: 2px; }

    /* Show â‹® menu, hide individual report/edit buttons */
    .quiz-mobile-menu { display: block; }
    .quiz-desktop-action { display: none !important; }
    /* Restore settings entry in mobile â‹® menu */
    .quiz-mobile-menu .deck-menu-item:first-child { display: flex; }

    /* Mobile header bottom-edge bar: square corners */
    .quiz-header-progress { border-radius: 0; }

    .quiz-scrollable {
        padding: 16px 12px calc(124px + env(safe-area-inset-bottom, 0px));
        flex: 1;
        overflow-y: auto;
    }

    /* Question box */
    .question-box {
        padding: 18px 14px;
        font-size: 1.1rem;
        margin-bottom: 12px;
        border-radius: var(--radius-lg);
    }

    /* Options */
    .options-container { gap: 10px; }
    .option-btn {
        padding: 12px 14px 12px 48px;
        font-size: 0.95rem;
        min-height: 52px;
        border-radius: var(--radius-md);
    }
    .option-btn .radio-circle {
        left: 12px;
        width: 26px;
        height: 26px;
        font-size: 0.85rem;
    }

    /* Grade buttons: full-width bottom bar */
    .grade-buttons {
        position: fixed;
        bottom: 0; left: 0;
        width: 100%;
        transform: none;
        border-radius: 0;
        border: none;
        border-top: 1px solid var(--border);
        gap: 12px;
        padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 10px));
        background: var(--card-bg);
        justify-content: center;
        box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
        z-index: 2001;
    }
    .grade-btn-wrap {
        flex: 1;
        max-width: 200px;
        display: flex;
        justify-content: center;
    }
    .grade-btn {
        width: 100%;
        height: 84px;
        border-radius: var(--radius-md);
        box-shadow: none;
        padding: 0;
    }
    /* Swap order: wrong left, correct right */
    #wrong-btn { order: 1; }
    #correct-btn { order: 2; }

    /* Non-selectable option text */
    .option-btn {
        -webkit-user-select: none;
        user-select: none;
    }

    /* ---- Mobile Browse Layout ---- */
    #browse-view {
        padding: 12px 8px 60px;
    }
    #browse-header {
        padding: 8px 0;
        margin-bottom: 12px;
        gap: 8px;
    }
    #browse-deck-title {
        font-size: 1rem;
    }
    #browse-toolbar {
        gap: 8px;
        margin-bottom: 12px;
    }
    #browse-search-input {
        min-width: 100px;
        padding: 8px 10px;
        font-size: 0.9rem;
    }
    .filter-pills {
        gap: 4px;
    }
    .filter-pill {
        padding: 5px 10px;
        font-size: 0.75rem;
    }
    #browse-sort-select {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
    #browse-select-bar {
        margin-bottom: 8px;
    }
    .browse-select-all-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    .browse-item {
        padding: 10px 12px;
        gap: 8px;
    }
    .browse-q {
        font-size: 0.9rem;
    }
    .browse-badge {
        font-size: 0.7rem;
        padding: 2px 6px;
    }
    .browse-checkbox {
        width: 14px;
        height: 14px;
    }
    #browse-bulk-bar {
        padding: 8px 12px;
        margin-bottom: 8px;
    }
    .bulk-actions .btn-secondary,
    .bulk-actions .btn-danger {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
    .browse-pagination {
        padding: 12px 0;
    }
    .pag-btn {
        padding: 8px 12px;
        min-width: 70px;
        font-size: 0.8rem;
    }
}

/* Skeleton loading for premade decks */
@keyframes skel-shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}
.premade-skeleton { padding: 8px 4px; display: flex; flex-direction: column; gap: 16px; }
.skel-folder { display: flex; flex-direction: column; gap: 8px; }
.skel-children { padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.skel-line {
    height: 14px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--border) 25%, var(--primary-light) 50%, var(--border) 75%);
    background-size: 800px 100%;
    animation: skel-shimmer 1.4s ease-in-out infinite;
}
.skel-folder-line { width: 55%; height: 16px; }
.skel-file-line   { width: 75%; }
.skel-short       { width: 50%; }

/* Settings divider */
.settings-divider {
    border-top: 1px solid var(--border);
    margin: 8px 0;
}

/* Recycle bin items */
.recycle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    flex-wrap: wrap;
}
.recycle-item:last-child { border-bottom: none; }
.recycle-info { flex: 1; min-width: 0; }
.recycle-name {
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.recycle-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.recycle-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.recycle-actions .btn-secondary,
.recycle-actions .btn-danger {
    padding: 6px 12px;
    font-size: 0.82rem;
}
.spinner {
    width: 32px; height: 32px; border: 4px solid var(--border);
    border-top-color: var(--primary); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
    text-align: center; padding: 60px 20px; color: var(--text-muted);
    background: var(--card-bg); border-radius: var(--radius-lg);
    border: 2px dashed var(--border); font-size: 1.1rem;
    display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.footer-links {
    margin-top: 48px; display: flex; justify-content: center; gap: 32px;
}
.link-btn {
    background: none; border: none; color: var(--text-muted);
    font-size: 0.95rem; cursor: pointer; transition: color var(--transition);
    font-weight: 700;
}
.link-btn:hover { color: var(--primary); text-decoration: underline; }

.format-example {
    background: var(--bg); padding: 14px; border-radius: var(--radius-sm);
    font-family: monospace; font-size: 0.85rem; white-space: pre-wrap;
    word-break: break-all; color: var(--text-main); margin: 12px 0;
    border: 1px solid var(--border);
}
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--modal-bg);
    display: flex; align-items: center; justify-content: center;
    z-index: 3000; padding: 20px;
    backdrop-filter: blur(8px);
}
.hidden { display: none !important; }
.modal-content {
    background: var(--card-bg);
    padding: 28px;
    border-radius: var(--radius-xl);
    width: 100%; max-width: 450px;
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: fadeIn 0.25s ease;
    border: 1px solid var(--border);
}
.settings-content { max-width: 380px; }
.modal-header {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 24px;
    color: var(--primary);
    letter-spacing: -0.02em;
}
.modal-close {
    position: absolute; top: 12px; right: 12px;
    cursor: pointer; color: var(--text-muted);
}
.modal-close:hover { color: var(--error); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 700; font-size: 0.9rem; }
.form-group input[type="text"], .form-group textarea, .form-group select {
    width: 100%; padding: 12px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 1rem; font-family: inherit;
    background: var(--bg);
    color: var(--text-main);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.settings-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.mobile-only { display: none; }
.theme-toggle-group {
    display: flex;
    gap: 3px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
}
.theme-btn {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: background 0.2s, color 0.2s;
    padding: 0;
}
.theme-btn:hover { background: var(--border); color: var(--text-main); }
.theme-btn.active {
    background: var(--primary-light);
    color: var(--primary);
}
.toggle-switch {
    position: relative; display: inline-block; width: 48px; height: 26px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--border); border-radius: 26px; transition: 0.3s;
    border: 1px solid var(--text-muted);
}
.slider:before {
    position: absolute; content: ""; height: 20px; width: 20px; left: 2px; bottom: 2px;
    background-color: var(--card-bg); border-radius: 50%; transition: 0.3s;
}
input:checked + .slider { background-color: var(--primary); border-color: var(--primary); }
input:checked + .slider:before { transform: translateX(22px); background-color: #fff; }
.premade-folder > summary {
    font-weight: 700; cursor: pointer; padding: 10px; border-radius: var(--radius-sm);
    list-style: none; display: flex; align-items: center; gap: 8px;
    transition: background var(--transition);
}
.premade-folder > summary:hover { background: var(--border); }
.premade-folder > summary::-webkit-details-marker { display: none; }
.premade-file {
    padding: 10px 10px 10px 32px; cursor: pointer; border-radius: var(--radius-sm);
    display: flex; align-items: center; gap: 8px; font-size: 0.95rem;
    transition: background var(--transition);
}
.premade-file:hover { background: var(--primary-light); color: var(--primary-hover); }

/* Announcement Card */
.announcement-card {
    background: var(--primary-light);
    border: 1px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    animation: fadeIn 0.4s ease;
}
.announcement-content {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.95rem;
}
.announcement-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}
.announcement-icon svg { width: 24px; height: 24px; }
.announcement-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.announcement-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
    white-space: nowrap;
}
@media (max-width: 600px) {
    .announcement-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .announcement-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ---------- Swipe hint overlay ---------- */
@media (hover: none) and (pointer: coarse) {
#swipe-hint-overlay {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}
#swipe-hint-overlay.swipe-hint-visible { opacity: 1; }
.swipe-hint-inner {
    background: rgba(0,0,0,0.72);
    color: #fff;
    border-radius: 16px;
    padding: 14px 24px;
    text-align: center;
    backdrop-filter: blur(6px);
}
.swipe-hint-arrows {
    display: flex;
    gap: 32px;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 6px;
}
.swipe-arrow.swipe-left  { color: #ff6b6b; animation: nudge-left  1s ease infinite; }
.swipe-arrow.swipe-right { color: #6bcb77; animation: nudge-right 1s ease infinite; }
.swipe-hint-label { font-size: 0.85rem; opacity: 0.85; }

@keyframes nudge-left  { 0%,100%{transform:translateX(0)} 50%{transform:translateX(-6px)} }
@keyframes nudge-right { 0%,100%{transform:translateX(0)} 50%{transform:translateX( 6px)} }
}
