/* --- Aktiv Grotesk Font Faces --- */

/* Standard width */
@font-face { font-family: 'Aktiv Grotesk'; src: url('fonts/AktivGrotesk_Trial_Hair.ttf') format('truetype'); font-weight: 100; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk'; src: url('fonts/AktivGrotesk_Trial_HairIt.ttf') format('truetype'); font-weight: 100; font-style: italic; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk'; src: url('fonts/AktivGrotesk_Trial_Th.ttf') format('truetype'); font-weight: 200; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk'; src: url('fonts/AktivGrotesk_Trial_ThIt.ttf') format('truetype'); font-weight: 200; font-style: italic; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk'; src: url('fonts/AktivGrotesk_Trial_Lt.ttf') format('truetype'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk'; src: url('fonts/AktivGrotesk_Trial_LtIt.ttf') format('truetype'); font-weight: 300; font-style: italic; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk'; src: url('fonts/AktivGrotesk_Trial_Rg.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk'; src: url('fonts/AktivGrotesk_Trial_It.ttf') format('truetype'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk'; src: url('fonts/AktivGrotesk_Trial_Md.ttf') format('truetype'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk'; src: url('fonts/AktivGrotesk_Trial_MdIt.ttf') format('truetype'); font-weight: 500; font-style: italic; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk'; src: url('fonts/AktivGrotesk_Trial_SBd.ttf') format('truetype'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk'; src: url('fonts/AktivGrotesk_Trial_SBdIt.ttf') format('truetype'); font-weight: 600; font-style: italic; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk'; src: url('fonts/AktivGrotesk_Trial_Bd.ttf') format('truetype'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk'; src: url('fonts/AktivGrotesk_Trial_BdIt.ttf') format('truetype'); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk'; src: url('fonts/AktivGrotesk_Trial_XBd.ttf') format('truetype'); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk'; src: url('fonts/AktivGrotesk_Trial_XBdIt.ttf') format('truetype'); font-weight: 800; font-style: italic; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk'; src: url('fonts/AktivGrotesk_Trial_Blk.ttf') format('truetype'); font-weight: 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk'; src: url('fonts/AktivGrotesk_Trial_BlkIt.ttf') format('truetype'); font-weight: 900; font-style: italic; font-display: swap; }

/* Condensed width */
@font-face { font-family: 'Aktiv Grotesk Cd'; src: url('fonts/AktivGroteskCd_Trial_Hair.ttf') format('truetype'); font-weight: 100; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk Cd'; src: url('fonts/AktivGroteskCd_Trial_Th.ttf') format('truetype'); font-weight: 200; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk Cd'; src: url('fonts/AktivGroteskCd_Trial_Lt.ttf') format('truetype'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk Cd'; src: url('fonts/AktivGroteskCd_Trial_Rg.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk Cd'; src: url('fonts/AktivGroteskCd_Trial_Md.ttf') format('truetype'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk Cd'; src: url('fonts/AktivGroteskCd_Trial_SBd.ttf') format('truetype'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk Cd'; src: url('fonts/AktivGroteskCd_Trial_Bd.ttf') format('truetype'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk Cd'; src: url('fonts/AktivGroteskCd_Trial_XBd.ttf') format('truetype'); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk Cd'; src: url('fonts/AktivGroteskCd_Trial_Blk.ttf') format('truetype'); font-weight: 900; font-style: normal; font-display: swap; }

/* Extended width */
@font-face { font-family: 'Aktiv Grotesk Ex'; src: url('fonts/AktivGroteskEx_Trial_Hair.ttf') format('truetype'); font-weight: 100; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk Ex'; src: url('fonts/AktivGroteskEx_Trial_Th.ttf') format('truetype'); font-weight: 200; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk Ex'; src: url('fonts/AktivGroteskEx_Trial_Lt.ttf') format('truetype'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk Ex'; src: url('fonts/AktivGroteskEx_Trial_Rg.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk Ex'; src: url('fonts/AktivGroteskEx_Trial_Md.ttf') format('truetype'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk Ex'; src: url('fonts/AktivGroteskEx_Trial_SBd.ttf') format('truetype'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk Ex'; src: url('fonts/AktivGroteskEx_Trial_Bd.ttf') format('truetype'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk Ex'; src: url('fonts/AktivGroteskEx_Trial_XBd.ttf') format('truetype'); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk Ex'; src: url('fonts/AktivGroteskEx_Trial_Blk.ttf') format('truetype'); font-weight: 900; font-style: normal; font-display: swap; }

:root {
    --primary: #1293C5;
    --primary-hover: #0d7aa6;
    --bg-app: #A49A87;
    --bg-panel: #FAF8F4;
    --bg-panel-mid: #CEC0B1;
    --border: #BAB0A4;
    --border-strong: #D1D5DB;
    --text-main: #1F2325;
    --text-muted: #3E4244;
    --danger: #FF1807;
    --success: #33CA00;
    --font-main: 'Aktiv Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-cd: 'Aktiv Grotesk Cd', 'Aktiv Grotesk', sans-serif;
    --font-ex: 'Aktiv Grotesk Ex', 'Aktiv Grotesk', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-app);
    height: 100vh;
    overflow: hidden;
    color: var(--text-main);
}

/* --- Layout --- */
.main-container { height: 100vh; display: flex; flex-direction: column; }
.content-area { flex: 1; display: flex; position: relative; overflow: hidden; }

.canvas-container {
    flex: 1;
    position: relative;
    background: #000000;
    overflow: hidden;
}

/* --- Mobile App --- */
#mobile-app {
    display: none; flex-direction: column;
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: #c8cfd6;
    overflow: hidden;
    padding-top: 60px;
    padding-top: max(60px, calc(env(safe-area-inset-top, 0px) + 12px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (max-width: 768px) {
    html, body {
        background: #c8cfd6 !important;
        overflow: hidden !important;
        overscroll-behavior: none;
    }
    #mobile-app { display: flex; }
    .main-container { display: none; }
}

/* Mobile header */
.mobile-header {
    display: flex; align-items: center; gap: 12px;
    padding: 4px 20px 10px;
    flex-shrink: 0;
    min-height: 44px;
}
.mobile-logo { height: 36px; display: block; }
.mobile-header-text { flex: 1; min-width: 0; }
.mobile-title {
    font-family: var(--font-main);
    font-weight: 700; font-size: 15px;
    color: #2b2e2b;
    line-height: 1.2;
}
.mobile-subtitle {
    font-family: var(--font-cd);
    font-size: 12px; font-weight: 600;
    color: #1293C5;
    margin-top: 2px;
}

/* Mobile cards — horizontal scroll-snap */
.mobile-cards {
    flex: 1 1 0;
    height: 0;
    min-height: 0;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    overscroll-behavior-x: contain;
    gap: 16px;
    padding: 4px 20px 4px;
    scrollbar-width: none;
    align-items: stretch;
}
.mobile-cards::-webkit-scrollbar { display: none; }

.mobile-card {
    flex: 0 0 calc(100% - 16px);
    height: 100%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    display: flex; flex-direction: column;
    min-height: 0;
}

/* Card title — always visible above the flip */
.mc-title {
    font-family: var(--font-cd);
    font-size: 11px; font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #3E4244;
    margin-bottom: 6px;
    padding-left: 2px;
}

/* Flip container */
.mc-flip-container {
    flex: 1;
    perspective: 1200px;
    min-height: 0;
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-panel);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.mc-flip-container:has(.mc-front-dark) {
    background: #000000;
}
.mc-flip-inner {
    width: 100%; height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}
.mc-flip-inner.flipped { transform: rotateY(180deg); }

.mc-front, .mc-back {
    position: absolute; inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 14px;
    overflow: hidden;
    display: flex; flex-direction: column;
}
.mc-front { background: var(--bg-panel); }
.mc-front.mc-front-dark { background: #000000; }
.mc-back {
    background: var(--bg-panel);
    transform: rotateY(180deg);
}

/* Front face — viz + stats overlay */
.mc-front-viz {
    flex: 1; position: relative;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.mc-front-viz svg { width: 100%; height: 100%; display: block; }

.mc-stats-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(250,248,244,0.92) 30%);
    padding: 24px 16px 12px;
}
.mc-stats-value {
    font-family: var(--font-ex);
    font-size: 28px; font-weight: 800;
    color: var(--text-main); line-height: 1;
}
.mc-stats-sub {
    font-family: var(--font-cd);
    font-size: 12px; color: var(--text-muted);
    margin-top: 2px;
}
.mc-tap-hint {
    font-family: var(--font-cd);
    font-size: 10px; color: var(--primary);
    opacity: 0.6; margin-top: 6px;
}

/* Dark front variant (Boxtown) */
.mc-front-dark .mc-stats-overlay {
    background: linear-gradient(transparent, rgba(0,0,0,0.88) 30%);
}
.mc-front-dark .mc-stats-value { color: #f0ede8; }
.mc-front-dark .mc-stats-sub { color: rgba(240,237,232,0.6); }
.mc-front-dark .mc-tap-hint { color: #71C0DE; }

/* Stats front variant (Title Words card) */
.mc-front-stats {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px 16px 10px;
    display: flex; flex-direction: column;
    flex: 1;
}
.mc-stats-factgrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    flex: 1;
}
.mc-stats-fact {
    background: rgba(0,0,0,0.04);
    border-radius: 10px;
    padding: 16px 16px 14px;
    display: flex; flex-direction: column; justify-content: center;
}
.mc-stats-fact-value {
    font-family: var(--font-ex);
    font-size: 30px; font-weight: 800;
    color: var(--text-main); line-height: 1;
}
.mc-stats-fact-label {
    font-family: var(--font-cd);
    font-size: 10px; font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 6px;
}
.mc-stats-fact.wide { grid-column: span 2; }
.mc-top-words-row {
    display: flex; align-items: center; gap: 6px;
    font-family: var(--font-cd);
    font-size: 11px; color: var(--text-main);
    margin-bottom: 4px;
}
.mc-top-words-bar {
    flex: 1; height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.mc-top-words-fill {
    height: 100%; border-radius: 2px;
}
.mc-top-words-count {
    font-size: 10px; color: var(--text-muted);
    min-width: 20px; text-align: right;
}
.mc-stats-section-label {
    font-family: var(--font-cd);
    font-size: 10px; font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 16px 0 8px;
}
.mc-stats-tap-hint {
    font-family: var(--font-cd);
    font-size: 10px; color: var(--primary);
    opacity: 0.6; margin-top: 10px;
    text-align: center;
}

/* Back face — full viz */
.mc-back-viz {
    flex: 1; overflow: auto;
    display: flex; align-items: center; justify-content: center;
    position: relative;
}
.mc-back-viz svg { width: 100%; height: 100%; display: block; }
.mc-back-hint {
    position: absolute; bottom: 10px; left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-cd);
    font-size: 11px; color: rgba(255,255,255,0.6);
    background: rgba(0,0,0,0.4);
    padding: 6px 16px; border-radius: 12px;
    pointer-events: auto;
    cursor: pointer;
    z-index: 2;
}
.mc-back-hint.light {
    color: var(--text-muted);
    background: rgba(255,255,255,0.7);
}

/* ── Folder Icon Grid (Directories card front) ── */
.mc-foldergrid-wrapper {
    flex: 1; display: flex; flex-direction: column;
    overflow: hidden; background: #FAF8F4; border-radius: 14px;
}
.mc-foldergrid-back {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 12px; cursor: pointer; flex-shrink: 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.mc-foldergrid-back:active { background: rgba(0,0,0,0.04); }
.mc-foldergrid-back-arrow {
    font-size: 16px; color: var(--primary); font-weight: 600;
}
.mc-foldergrid-back-path {
    font-family: var(--font-cd); font-size: 11px; font-weight: 500;
    color: var(--text-muted); overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap;
}
.mc-foldergrid {
    flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    padding: 6px 4px;
    align-content: space-evenly;
}
.mc-foldergrid-tile {
    display: flex; flex-direction: column; align-items: center;
    gap: 2px; padding: 6px 2px 4px;
    cursor: pointer; border-radius: 8px;
    transition: background 0.12s;
}
.mc-foldergrid-tile:active { background: rgba(0,0,0,0.05); }
.mc-foldergrid-icon { flex-shrink: 0; }
.mc-foldergrid-name {
    font-family: var(--font-cd); font-size: 9px; font-weight: 600;
    color: var(--text-main); text-align: center;
    line-height: 1.2; max-width: 100%;
    overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
}
.mc-foldergrid-count {
    font-family: var(--font-cd); font-size: 8px; color: var(--text-muted);
}
.mc-foldergrid-leaf .mc-foldergrid-icon { opacity: 0.85; }
.mc-foldergrid-pages .mc-foldergrid-name {
    font-weight: 500; color: var(--text-muted); font-style: italic;
}

/* ── Screenshot carousel (Directories card back) ── */
.mc-screenshots-back {
    flex: 1; display: flex; flex-direction: column;
    overflow: hidden; background: #FAF8F4; border-radius: 14px;
}
.mc-screenshots-header {
    font-family: var(--font-cd); font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-muted); padding: 10px 14px 6px;
    display: flex; justify-content: space-between; align-items: center;
    flex-shrink: 0;
}
.mc-ss-counter {
    font-weight: 500; font-size: 10px; color: var(--text-muted);
    letter-spacing: 0; text-transform: none;
}
.mc-ss-track {
    flex: 1; display: flex;
    overflow-x: auto; scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scrollbar-width: none;
    gap: 0;
}
.mc-ss-track::-webkit-scrollbar { display: none; }
.mc-ss-slide {
    flex: 0 0 100%; scroll-snap-align: center;
    display: flex; flex-direction: column;
    padding: 4px 14px 10px;
}
.mc-ss-img {
    width: 100%; flex: 1; object-fit: contain;
    border-radius: 8px; background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    min-height: 0;
}
.mc-ss-title {
    font-family: var(--font-cd); font-size: 11px; color: var(--text-main);
    padding: 8px 4px 0; line-height: 1.3; text-align: center;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    flex-shrink: 0;
}
.mc-ss-link {
    display: block; text-align: center;
    font-family: var(--font-cd); font-size: 10px; font-weight: 600;
    color: var(--primary); text-decoration: none;
    padding: 6px 4px 2px;
    flex-shrink: 0;
}
.mc-ss-link:active { opacity: 0.6; }

/* Screenshot long-press toast */
.mc-ss-toast {
    position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.75); color: white;
    font-family: var(--font-cd); font-size: 11px; font-weight: 600;
    padding: 6px 14px; border-radius: 8px;
    pointer-events: none; z-index: 10;
    animation: mc-toast-in 0.2s ease;
}
@keyframes mc-toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(6px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Boxtown drill-down nav bar */
.bt-nav-bar {
    position: absolute; top: 6px; left: 6px; right: 6px; z-index: 5;
    display: flex; align-items: center; gap: 6px;
    padding: 5px 10px; border-radius: 8px;
    background: rgba(255,255,255,0.1);
    cursor: pointer;
}
.bt-nav-bar:active { background: rgba(255,255,255,0.18); }
.bt-nav-arrow {
    font-size: 14px; color: var(--primary); font-weight: 600;
}
.bt-nav-path {
    font-family: var(--font-cd); font-size: 10px; font-weight: 500;
    color: rgba(255,255,255,0.5);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Word detail panel (Title Words card back overlay) ── */
.mc-word-detail {
    position: absolute; inset: 0; background: #FFFFFF; z-index: 5;
    display: flex; flex-direction: column; border-radius: 14px; overflow: hidden;
}
.mc-word-detail-header {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.mc-word-detail-back {
    font-size: 16px; cursor: pointer; color: var(--primary);
    background: none; border: none; padding: 2px 6px;
}
.mc-word-detail-title {
    font-family: var(--font-ex); font-size: 18px; font-weight: 700;
    color: var(--text-main);
}
.mc-word-detail-count {
    font-family: var(--font-cd); font-size: 11px; color: var(--text-muted);
    margin-left: auto;
}
.mc-word-detail-list {
    flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 8px;
}
.mc-word-title-row {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 6px; border-radius: 6px;
}
.mc-word-title-row:active { background: rgba(0,0,0,0.04); }
.mc-word-title-thumb {
    width: 48px; height: 32px; border-radius: 3px;
    object-fit: cover; background: #eee; flex-shrink: 0;
}
.mc-word-title-text {
    font-family: var(--font-cd); font-size: 12px; color: var(--text-main);
    line-height: 1.3; flex: 1; overflow: hidden;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* Loading state for lazy back-face */
.mc-loading {
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 100%;
    font-family: var(--font-cd);
    font-size: 12px; color: var(--text-muted);
}
.mc-loading::after {
    content: '';
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: mc-spin 0.8s linear infinite;
    margin-left: 8px;
}
@keyframes mc-spin { to { transform: rotate(360deg); } }

/* Pull-to-refresh indicator */
.mc-ptr-pill {
    position: absolute; top: 8px; left: 50%;
    transform: translate(-50%, -36px);
    width: 30px; height: 30px; border-radius: 15px;
    background: rgba(0,0,0,0.07);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; z-index: 20; pointer-events: none;
    will-change: transform, opacity;
}
.mc-front-dark .mc-ptr-pill { background: rgba(255,255,255,0.12); }
.mc-ptr-pill svg { stroke: #64748b; display: block; }
.mc-front-dark .mc-ptr-pill svg { stroke: rgba(255,255,255,0.7); }
.mc-ptr-pill.loading svg { animation: mc-ptr-spin 0.6s linear infinite; }
@keyframes mc-ptr-spin { to { transform: rotate(360deg); } }

/* Pagination dots */
.mobile-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 4px 0 2px;
    flex-shrink: 0;
}
.mobile-dot {
    width: 8px; height: 8px;
    border-radius: 4px;
    background: rgba(0,0,0,0.12);
    border: none; padding: 0;
    cursor: pointer;
    transition: all 0.25s ease;
}
.mobile-dot.active {
    width: 24px;
    background: var(--primary);
}

/* Global footer */
.mobile-footer {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 2px 20px 4px;
    flex-shrink: 0;
    font-family: var(--font-cd);
    font-size: 11px; font-weight: 500;
    color: rgba(43,46,43,0.4);
}

/* --- Mobile Dashboard (vertical scroll) --- */
.mobile-dashboard {
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 16px 20px;
    scrollbar-width: none;
}
.mobile-dashboard::-webkit-scrollbar { display: none; }

.mob-section {
    margin-bottom: 20px;
}
.mob-section-head {
    font-family: var(--font-cd);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: rgba(43,46,43,0.5);
    margin-bottom: 10px;
    padding: 0 4px;
}

/* Stats hero */
.mob-stats-hero {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.mob-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 8px;
    text-align: center;
}
.mob-stat-num {
    display: block;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 18px;
    color: var(--primary);
    line-height: 1.2;
}
.mob-stat-label {
    display: block;
    font-family: var(--font-cd);
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(43,46,43,0.45);
    margin-top: 2px;
}

/* Sitemap grid */
.mob-sitemap-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.mob-sitemap-cat {
    font-family: var(--font-cd);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(43,46,43,0.4);
    margin-top: 10px;
    margin-bottom: 2px;
    padding: 0 4px;
}
.mob-sitemap-cat:first-child { margin-top: 0; }
.mob-sitemap-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    border: none;
    border-radius: 8px;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: box-shadow 0.15s;
    width: 100%;
    font-family: var(--font-main);
}
.mob-sitemap-card:active {
    box-shadow: 0 1px 2px rgba(0,0,0,0.12);
    transform: scale(0.98);
}
.mob-sitemap-name {
    font-size: 13px;
    font-weight: 600;
    color: #1F2325;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mob-sitemap-meta {
    font-family: var(--font-cd);
    font-size: 10px;
    font-weight: 600;
    color: rgba(43,46,43,0.4);
    margin-left: 8px;
    flex-shrink: 0;
}

/* Top directories */
.mob-dir-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.mob-dir-row {
    display: grid;
    grid-template-columns: 1fr 40px;
    grid-template-rows: auto auto;
    gap: 0 8px;
    align-items: center;
    padding: 0 4px;
}
.mob-dir-name {
    font-family: monospace;
    font-size: 11px;
    font-weight: 600;
    color: #1F2325;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mob-dir-count {
    font-family: var(--font-cd);
    font-size: 10px;
    font-weight: 600;
    color: rgba(43,46,43,0.5);
    text-align: right;
}
.mob-dir-bar-bg {
    grid-column: 1 / -1;
    height: 4px;
    background: rgba(0,0,0,0.06);
    border-radius: 2px;
    overflow: hidden;
}
.mob-dir-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    opacity: 0.6;
}

/* Title words */
.mob-word-cloud {
    line-height: 1.8;
    padding: 0 4px;
}
.mob-word {
    font-family: var(--font-main);
    font-weight: 600;
    color: #1F2325;
    white-space: nowrap;
    margin-right: 4px;
}
.mob-word sup {
    font-size: 8px;
    font-weight: 500;
    color: rgba(43,46,43,0.35);
    vertical-align: super;
}

/* Desktop prompt */
.mob-desktop-prompt {
    background: white;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.mob-desktop-icon {
    color: var(--primary);
    margin-bottom: 8px;
}
.mob-desktop-title {
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 700;
    color: #1F2325;
    margin-bottom: 6px;
}
.mob-desktop-text {
    font-family: var(--font-main);
    font-size: 12px;
    color: rgba(43,46,43,0.55);
    line-height: 1.5;
}

/* Mobile sitemap detail overlay */
.mob-sitemap-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #FAF8F4;
    z-index: 200;
    display: flex;
    flex-direction: column;
}
.mob-sitemap-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top, 0px));
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    flex-shrink: 0;
}
.mob-sitemap-close {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
    color: #1F2325;
    flex-shrink: 0;
}
.mob-sitemap-dtitle {
    font-family: var(--font-main);
    font-size: 13px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.mob-sitemap-canvas {
    flex: 1;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px;
}
.mob-sitemap-canvas .sitemap-svg {
    height: auto;
    display: block;
}
.mob-sitemap-hint {
    text-align: center;
    padding: 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
    font-family: var(--font-cd);
    font-size: 10px;
    font-weight: 500;
    color: rgba(43,46,43,0.35);
    background: white;
    flex-shrink: 0;
}

/* --- Z-Flip compact mode (square outer screen ~512×512) --- */
@media (max-width: 520px) and (max-height: 520px) {
    .mobile-header { padding: 8px 12px 4px; }
    .mobile-logo { height: 24px; }
    .mobile-title { font-size: 12px; }
    .mobile-subtitle { font-size: 10px; }

    .mobile-cards {
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: auto;
        scroll-snap-type: y mandatory;
        padding: 4px 12px;
        gap: 8px;
    }
    .mobile-card {
        flex: 0 0 auto;
        min-height: 160px; max-height: 200px;
        scroll-snap-align: start;
    }
    .mc-title { font-size: 9px; margin-bottom: 3px; }
    .mc-stats-value { font-size: 18px; }
    .mc-stats-sub { font-size: 10px; }
    .mc-tap-hint { display: none; }
    .mc-front, .mc-back { border-radius: 10px; }

    .mobile-dots { display: none; }
    .mobile-zflip-counter {
        display: flex !important;
        justify-content: center;
        padding: 2px 0;
        font-family: var(--font-cd);
        font-size: 10px; color: var(--text-muted);
    }
    .mobile-footer { padding: 4px 12px 8px; font-size: 10px; }
}

/* Hide zflip counter by default (shown only in zflip media query) */
.mobile-zflip-counter { display: none; }

/* --- Toolbar --- */
.toolbar {
    background: var(--bg-panel);
    padding: 8px 16px; box-shadow: 0 2px 4px rgba(0,0,0,0.06); z-index: 100;
    display: flex; flex-direction: column; gap: 0;
}

.toolbar-content { display: flex; align-items: center; gap: 10px; height: 50px; }
.app-title { font-family: var(--font-main); font-weight: 700; font-size: 14px; white-space: nowrap; color: var(--text-main); }
.separator { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }
.toolbar-site-name {
    font-size: 13px; font-weight: 600; color: var(--primary);
    cursor: pointer; padding: 3px 8px; border-radius: 4px; white-space: nowrap;
}
.toolbar-site-name:hover { background: #eff6ff; }
.ml-auto { margin-left: auto; }
.flex-row { display: flex; gap: 8px; align-items: center; }
.toolbar-label { font-family: var(--font-cd); font-size: 12px; color: var(--text-muted); font-weight: 500; white-space: nowrap; }

.logo-link img { display: block; }

/* --- Buttons --- */
button { cursor: pointer; font-family: inherit; transition: all 0.1s; }

.btn-primary {
    background: var(--primary); color: white; border: none;
    padding: 6px 12px; border-radius: 5px; font-size: 13px; font-weight: 500;
    display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
    background: var(--bg-panel); border: 1px solid var(--border); color: var(--text-main);
    padding: 5px 10px; border-radius: 5px; font-size: 13px; font-weight: 500;
    display: inline-flex; align-items: center; gap: 4px;
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-panel-mid); }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary.active { background: #d4ecf5; border-color: #1293C5; color: #0d6a8f; }

.btn-danger { background: var(--danger); color: white; border: none; padding: 5px 10px; border-radius: 5px; font-size: 12px; }
.btn-share { background: var(--primary); color: white; border: none; padding: 6px 12px; border-radius: 5px; font-size: 13px; font-weight: 500; }
.btn-icon { background: transparent; border: none; padding: 6px; color: var(--text-muted); border-radius: 4px; cursor: pointer; }
.btn-icon:hover { background: #e5e7eb; color: var(--text-main); }
.btn-reset-boxtown { padding: 4px; margin-left: -4px; opacity: 0.5; transition: opacity 0.15s; border: 1px solid #d1d5db; border-radius: 4px; }
.btn-reset-boxtown:hover { opacity: 1; }
.full-width { width: 100%; display: flex; justify-content: center; }

/* --- Sitemap View Toggle (Tree / Folders) --- */
.sm-view-toggle {
    display: flex; align-items: center; gap: 6px;
}
.sm-toggle-label {
    font-family: var(--font-cd); font-size: 12px; font-weight: 600;
    color: var(--text-muted); cursor: pointer; user-select: none;
    transition: color 0.15s;
}
.sm-toggle-label.active { color: var(--text-main); }
.sm-toggle-label:hover { color: var(--text-main); }
.sm-toggle-track {
    width: 32px; height: 18px; background: #d1d5db;
    border-radius: 9px; position: relative; cursor: pointer;
    transition: background 0.2s;
}
.sm-toggle-track.on { background: var(--primary); }
.sm-toggle-thumb {
    width: 14px; height: 14px; background: white;
    border-radius: 7px; position: absolute; top: 2px; left: 2px;
    transition: left 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.sm-toggle-track.on .sm-toggle-thumb { left: 16px; }

/* --- Words Source Toggle --- */
.words-source-toggle {
    display: flex; align-items: center; gap: 2px;
    background: var(--bg-secondary); border-radius: 6px; padding: 2px;
}
.ws-btn {
    font-family: var(--font-cd); font-size: 11px; font-weight: 600;
    color: var(--text-muted); background: transparent; border: none;
    padding: 4px 10px; border-radius: 4px; cursor: pointer;
    transition: all 0.15s; white-space: nowrap;
}
.ws-btn:hover { color: var(--text-main); }
.ws-btn.active {
    background: var(--bg-main); color: var(--text-main);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* --- Desktop Folder Explorer (Directories > Folders view) --- */
.sm-folder-explorer {
    padding: 20px; overflow-y: auto; height: 100%;
    background: var(--bg-panel);
}
.sm-folder-item { /* wrapper for row + children */ }
.sm-folder-row {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 8px; cursor: pointer; border-radius: 6px;
    transition: background 0.12s;
}
.sm-folder-row:hover { background: rgba(0,0,0,0.04); }
.sm-folder-chevron {
    font-size: 10px; color: var(--text-muted);
    width: 14px; text-align: center; flex-shrink: 0;
    transition: transform 0.2s;
}
.sm-folder-item.expanded > .sm-folder-row > .sm-folder-chevron {
    transform: rotate(90deg);
}
.sm-folder-swatch {
    width: 14px; height: 14px; border-radius: 3px; flex-shrink: 0;
}
.sm-folder-name {
    font-family: var(--font-cd); font-size: 13px; font-weight: 600;
    color: var(--text-main); flex: 1; text-transform: uppercase;
    letter-spacing: 0.3px; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap;
}
.sm-folder-count {
    font-family: var(--font-cd); font-size: 11px; color: var(--text-muted);
    flex-shrink: 0;
}
.sm-folder-children { padding-left: 22px; }
.sm-folder-leaf .sm-folder-row { cursor: pointer; }
.sm-folder-leaf .sm-folder-count::after {
    content: ' →'; color: var(--primary); font-size: 10px;
}
.sm-folder-leaf .sm-folder-row:hover { background: rgba(18,147,197,0.08); }

/* --- Inputs --- */
.input-sm {
    padding: 4px 8px; border: 1px solid #cbd5e1; border-radius: 4px;
    font-size: 13px; height: 28px; font-family: inherit;
}

/* --- Search Box --- */
.search-box {
    display: flex; align-items: center; gap: 6px;
    background: #fff5f2; border: 1px solid var(--border);
    border-radius: 5px; padding: 0 8px; height: 28px;
}
.search-box:focus-within { border-color: var(--primary); background: var(--bg-panel); box-shadow: 0 0 0 2px rgba(18, 147, 197, 0.15); }
.search-box svg { flex-shrink: 0; color: var(--text-muted); }
.search-box input {
    border: none; background: transparent; font-size: 13px;
    width: 160px; font-family: inherit; color: var(--text-main);
}
.search-box input:focus { outline: none; }
.search-box input::placeholder { color: #94a3b8; }

/* --- Breadcrumb Bar --- */
.breadcrumb-bar {
    display: flex; align-items: center; gap: 4px;
    padding: 6px 0; font-size: 13px; min-height: 30px;
    border-top: 1px solid var(--border);
}
.breadcrumb-item {
    color: var(--primary); cursor: pointer; font-weight: 500;
    padding: 2px 6px; border-radius: 3px;
}
.breadcrumb-item:hover { background: #eff6ff; }
.breadcrumb-item.current { color: var(--text-main); cursor: default; font-weight: 600; }
.breadcrumb-item.current:hover { background: transparent; }
.breadcrumb-sep { color: #cbd5e1; margin: 0 2px; font-size: 11px; }
.breadcrumb-stats {
    margin-left: auto; font-size: 12px; color: var(--text-muted);
    display: flex; gap: 12px;
}
.breadcrumb-stats .stat-badge {
    background: #f1f5f9; padding: 2px 8px; border-radius: 10px;
    font-variant-numeric: tabular-nums;
}

/* --- Visualization Canvas --- */
#vizCanvas {
    width: 100%; height: 100%;
    position: relative;
    overflow: hidden;
}

/* Treemap cells */
.treemap-cell {
    position: absolute;
    border: 1px solid rgba(255,255,255,0.6);
    overflow: hidden;
    cursor: pointer;
    transition: opacity 0.15s;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
}
.treemap-cell:hover {
    opacity: 0.85;
    z-index: 10;
}
.treemap-cell.directory {
    border: 2px solid rgba(0,0,0,0.15);
}
.treemap-cell .cell-label {
    font-size: 11px;
    font-weight: 500;
    color: rgba(0,0,0,0.7);
    padding: 3px 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    pointer-events: none;
    text-shadow: 0 0 3px rgba(255,255,255,0.8);
}
.treemap-cell.directory > .cell-label {
    font-weight: 700;
    font-size: 12px;
    color: rgba(0,0,0,0.85);
    background: rgba(255,255,255,0.5);
    border-radius: 2px;
    margin: 2px;
}
.treemap-cell.search-match {
    box-shadow: inset 0 0 0 3px #FFAD00;
    z-index: 20;
}
.treemap-cell.dimmed {
    opacity: 0.25;
}

/* Boxtown — Isometric Cityscape */
.bt-iso-building {
    transition: opacity 0.15s;
}
.bt-iso-building:hover {
    opacity: 0.92;
}

/* Boxtown 3D — Breadcrumb trail (on dark canvas) */
.bt-breadcrumb {
    position: absolute; top: 12px; left: 12px; z-index: 10;
    display: flex; align-items: center; gap: 0;
    background: rgba(20, 20, 30, 0.75);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 5px;
    padding: 5px 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    font-family: var(--font-cd);
    backdrop-filter: blur(6px);
}
.bt-crumb {
    font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.5);
    letter-spacing: 0.2px; padding: 2px 4px; border-radius: 3px;
    white-space: nowrap;
}
.bt-crumb-link {
    cursor: pointer; color: #71C0DE;
    transition: background 0.12s, color 0.12s;
}
.bt-crumb-link:hover {
    background: rgba(113, 192, 222, 0.15); color: #a0dcf0;
}
.bt-crumb-current {
    color: rgba(255,255,255,0.85); font-weight: 700;
}
.bt-crumb-sep {
    font-size: 11px; color: rgba(255,255,255,0.25); padding: 0 3px;
    user-select: none;
}

.bt-empty {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-muted); font-size: 14px;
}

/* Surrounding Context mini-map in detail panel */
.ctx-map-wrap {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    background: #1e293b;
    cursor: pointer;
}
.ctx-map-wrap canvas {
    display: block;
    width: 100%;
    height: auto;
}

/* --- Zoom Controls --- */
.zoom-controls {
    position: absolute; bottom: 20px; left: 20px;
    display: flex; align-items: center; gap: 4px;
    background: var(--bg-panel); padding: 4px; border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.12);
    user-select: none;
    z-index: 50;
}
.btn-zoom {
    width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
    background: var(--bg-panel); border: 1px solid transparent; border-radius: 4px;
    color: var(--text-muted); font-weight: 600;
}
.btn-zoom:hover { background: var(--bg-panel-mid); }
.zoom-display { font-size: 12px; min-width: 45px; text-align: center; font-variant-numeric: tabular-nums; }
.separator-vertical { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }

/* --- Right Panel --- */
.right-panel {
    width: 320px; min-width: 280px; background: var(--bg-panel);
    border-left: 1px solid var(--border); display: flex; flex-direction: column;
    position: absolute; right: 0; top: 0; bottom: 0; z-index: 50;
    box-shadow: -4px 0 16px rgba(0,0,0,0.08);
    transform: translateX(0); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.right-panel.hidden { transform: translateX(100%); }

.panel-tabs { display: flex; border-bottom: 1px solid var(--border); }
.panel-tab {
    flex: 1; padding: 12px; background: none; border: none;
    border-bottom: 2px solid transparent; color: var(--text-muted);
    font-family: var(--font-cd); font-weight: 600; font-size: 13px; letter-spacing: 0.3px;
}
.panel-tab:hover { background: var(--bg-panel-mid); color: var(--text-main); }
.panel-tab.active { border-bottom-color: var(--primary); color: var(--primary); }

.panel-content-wrapper { flex: 1; position: relative; display: flex; overflow: hidden; }
.panel-content {
    flex: 1; overflow-y: auto; padding: 16px;
    font-size: 13px; line-height: 1.6; color: #334155;
}

/* Treemap Controls (in sidebar) */
.treemap-controls {
    display: flex; gap: 8px; padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc; flex-shrink: 0;
}
.tc-row { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.tc-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.tc-select { width: 100%; font-size: 12px; padding: 5px 6px; }
#detailContent { display: flex; flex-direction: column; padding: 0; }
#detailContent > #detailInner { flex: 1; overflow-y: auto; padding: 16px; }

/* Detail Panel Content */
.detail-placeholder {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; color: #94a3b8; text-align: center; gap: 12px;
}
.detail-placeholder p { font-size: 14px; }

.detail-section { margin-bottom: 16px; }
.detail-section-title {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 6px;
}
.detail-field { display: flex; gap: 8px; margin-bottom: 4px; }
.detail-label { font-weight: 600; min-width: 80px; color: var(--text-muted); font-size: 12px; }
.detail-value { color: var(--text-main); word-break: break-all; }
.detail-value a { color: var(--primary); text-decoration: none; }
.detail-value a:hover { text-decoration: underline; }

.detail-url {
    background: #f1f5f9; padding: 8px 10px; border-radius: 4px;
    font-family: 'Menlo', monospace; font-size: 11px;
    word-break: break-all; margin-bottom: 12px;
    color: var(--primary);
}

.detail-open-viewer-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; margin-bottom: 12px;
    background: var(--bg-panel); color: var(--primary);
    border: 1px solid var(--border); border-radius: 6px;
    font-size: 12px; font-weight: 600; cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.detail-open-viewer-btn:hover { background: #eff6ff; border-color: var(--primary); }

.detail-bar {
    height: 6px; border-radius: 3px; background: #e5e7eb; margin-top: 4px; overflow: hidden;
}
.detail-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }

.detail-children-list { margin-top: 8px; }
.detail-child-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 4px 8px; border-radius: 4px; cursor: pointer;
    font-size: 12px;
}
.detail-child-row:hover { background: #f1f5f9; }
.detail-child-name { font-weight: 500; color: var(--primary); }
.detail-child-count { color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Copy as Markdown button */
.wpl-copy-md-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--text-muted);
    font-size: 10px; font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    flex-shrink: 0;
}
.wpl-copy-md-btn:hover {
    background: #e8e4dc;
    color: var(--text-main);
    border-color: #9a9084;
}
.wpl-copy-md-btn.wpl-copy-done {
    background: #dcfce7;
    border-color: #86efac;
    color: #16a34a;
}

/* Stats Panel */
.stats-card {
    background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 6px; padding: 12px; margin-bottom: 10px;
}
.stats-card-title { font-family: var(--font-cd); font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; letter-spacing: 0.5px; }
.stats-card-value { font-family: var(--font-ex); font-size: 24px; font-weight: 800; color: var(--text-main); }
.stats-card-sub { font-family: var(--font-cd); font-size: 12px; color: var(--text-muted); }

.stats-bar-chart { margin-top: 12px; }
.stats-bar-row {
    display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px;
}
.stats-bar-label { min-width: 100px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-bar-track { flex: 1; height: 16px; background: #e5e7eb; border-radius: 3px; overflow: hidden; position: relative; }
.stats-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
.stats-bar-count { min-width: 45px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-muted); }

/* Words View (full-canvas word cloud) */
#wordsView {
    width: 100%; height: 100%;
    overflow: hidden;
    position: absolute; inset: 0;
}
#wordsView svg text {
    transition: opacity 0.2s ease;
    user-select: none;
}

/* --- Modals --- */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; backdrop-filter: blur(2px); }
.modal {
    display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: var(--bg-panel); padding: 24px; border-radius: 8px;
    width: 90%; max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.15); z-index: 1001;
}
.modal.active, .modal-overlay.active { display: block; }
.modal h3 { margin-bottom: 12px; font-size: 18px; }
.modal-text { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.share-input-group { display: flex; gap: 8px; margin: 12px 0; }
.input-code { flex: 1; background: #f1f5f9; border: 1px solid var(--border); padding: 8px; border-radius: 4px; font-family: monospace; font-size: 12px; color: #475569; }
.share-url-section { margin-bottom: 12px; }
.share-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.share-details { margin-top: 12px; }
.share-details summary { font-size: 12px; color: var(--text-muted); cursor: pointer; padding: 4px 0; }
.share-details summary:hover { color: var(--primary); }
#shortUrlInput.loading { background: repeating-linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* --- Color Palettes --- */
.legend {
    position: absolute; bottom: 20px; right: 340px;
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: 6px; padding: 8px 12px; z-index: 40;
    font-size: 11px; max-height: 200px; overflow-y: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}
.legend.panel-hidden { right: 20px; }
.legend-title { font-weight: 600; margin-bottom: 4px; color: var(--text-muted); text-transform: uppercase; font-size: 10px; letter-spacing: 0.5px; }
.legend-item { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.legend-swatch { width: 12px; height: 12px; border-radius: 2px; flex-shrink: 0; border: 1px solid rgba(0,0,0,0.1); }
.legend-label { white-space: nowrap; }

/* --- Boxtown Size Toggle --- */
.bt-size-toggle {
    position: absolute; top: 12px; right: 12px;
    display: flex; align-items: center; gap: 6px;
    background: rgba(0,0,0,0.55); backdrop-filter: blur(6px);
    border-radius: 6px; padding: 4px 8px; z-index: 40;
}
.bt-size-label {
    font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.6);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.bt-size-btn {
    font-size: 11px; padding: 3px 10px; border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.2); background: transparent;
    color: rgba(255,255,255,0.7); cursor: pointer; transition: all 0.15s;
}
.bt-size-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }
.bt-size-btn.active {
    background: var(--primary); border-color: var(--primary);
    color: #fff; font-weight: 600;
}

/* --- Sitemap View --- */
#sitemapView {
    width: 100%; height: 100%;
    overflow: auto;
    background: var(--bg-panel);
    position: relative;
}
.sitemap-scroll {
    min-width: 100%;
    min-height: 100%;
    padding: 10px 20px 20px 4px;
    transform-origin: top left;
}
#sitemapSvg {
    display: block;
    margin: 0 auto;
}


/* Connectors */
.sm-connector {
    stroke: #94a3b8;
    stroke-width: 1.5;
    fill: none;
}

/* Node rects */
.sm-node {
    stroke: rgba(255,255,255,0.4);
    stroke-width: 1;
    filter: none;
    transition: filter 0.15s, transform 0.1s;
}
.sm-node-group:hover .sm-node {
    filter: brightness(1.12) drop-shadow(0 2px 6px rgba(0,0,0,0.18));
}

/* Labels */
.sm-label {
    fill: white;
    font-family: 'Aktiv Grotesk', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}
.sm-sublabel {
    fill: rgba(255,255,255,0.8);
    font-family: 'Aktiv Grotesk Cd', 'Aktiv Grotesk', sans-serif;
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

/* Expand/collapse button */
.sm-expand-btn {
    cursor: pointer;
    transition: fill 0.15s;
}
.sm-expand-btn:hover {
    fill: #f0f9ff;
}
.sm-expand-icon {
    pointer-events: none;
}

/* --- Pages Explorer Overlay --- */
.pe-overlay {
    position: fixed; inset: 0; z-index: 1800;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(3px);
    display: none;
    align-items: center; justify-content: center;
}
.pe-overlay.active { display: flex; }

.pe-panel {
    width: 80vw; max-width: 900px; height: 80vh;
    background: white; border-radius: 10px;
    display: flex; flex-direction: column;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    overflow: hidden;
}

.pe-header {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 20px; border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.pe-title { font-size: 16px; font-weight: 700; margin: 0; flex: 1; color: var(--text-main); }

.pe-view-toggle { display: flex; gap: 4px; }
.pe-toggle-btn {
    background: white; border: 1px solid #d1d5db; color: var(--text-muted);
    padding: 5px 8px; border-radius: 4px; display: flex;
    align-items: center; justify-content: center; cursor: pointer;
}
.pe-toggle-btn:hover { background: #f3f4f6; }
.pe-toggle-btn.active { background: #d4ecf5; border-color: #1293C5; color: #0d6a8f; }

.pe-search-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px; border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.pe-search {
    flex: 1; border: 1px solid #d1d5db; border-radius: 6px;
    padding: 6px 12px; font-size: 13px; font-family: inherit;
}
.pe-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,0.15); }
.pe-count { font-size: 12px; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.pe-content {
    flex: 1; overflow-y: auto; padding: 0;
}

/* List view */
.pe-list { list-style: none; margin: 0; padding: 0; }
.pe-list-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px;
    border-bottom: 1px solid #f8fafc;
    cursor: pointer; transition: background 0.1s;
}
.pe-list-item:hover { background: #f8fafc; }
.pe-list-item .pe-item-color {
    width: 4px; height: 32px; border-radius: 2px; flex-shrink: 0;
}
.pe-list-item .pe-item-info { flex: 1; min-width: 0; }
.pe-list-item .pe-item-title {
    font-size: 13px; font-weight: 600; color: var(--text-main);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pe-list-item .pe-item-path {
    font-size: 11px; color: var(--primary); font-family: monospace;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pe-list-item .pe-item-meta {
    display: flex; gap: 12px; font-size: 11px; color: var(--text-muted);
    flex-shrink: 0; font-variant-numeric: tabular-nums;
}

/* Boxes view */
.pe-boxes {
    display: flex; flex-wrap: wrap; gap: 10px;
    padding: 16px 20px;
}
.pe-box {
    width: 160px; min-height: 120px;
    border-radius: 8px;
    cursor: pointer; transition: all 0.15s;
    display: flex; flex-direction: column;
    position: relative; overflow: hidden;
}
.pe-box:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.15); }

/* Screenshot-based box cards */
.pe-box-screenshot { padding: 0; }
.pe-box-screenshot .pe-box-img {
    width: 100%; height: 90px; object-fit: cover; object-position: top left;
    display: block;
    animation: peImgFadeIn 0.3s ease-out;
}
@keyframes peImgFadeIn { from { opacity: 0; } to { opacity: 1; } }
.pe-box-screenshot .pe-box-placeholder { width: 100%; height: 90px; }
.pe-box-screenshot .pe-box-overlay {
    padding: 6px 8px; position: relative;
    background: inherit;
}
.pe-box .pe-box-title {
    font-size: 11px; font-weight: 600; color: white;
    line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.pe-box .pe-box-path {
    font-size: 9px; color: rgba(255,255,255,0.75);
    font-family: monospace; margin-top: 3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pe-box .pe-box-badge {
    position: absolute; top: 6px; right: 6px;
    font-size: 9px; font-weight: 700;
    background: rgba(255,255,255,0.25);
    color: white; padding: 2px 5px;
    border-radius: 3px; z-index: 1;
}


/* List view thumbnails */
.pe-list-thumb {
    width: 48px; height: 30px; object-fit: cover; object-position: top left;
    border-radius: 3px; flex-shrink: 0;
    border: 1px solid var(--border);
}

/* --- Page Viewer Overlay --- */
.pv-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.pv-overlay.active { display: flex; }

.pv-chrome {
    width: 92vw; max-width: 960px; height: auto; max-height: 92vh;
    display: flex; flex-direction: column;
    position: relative;
}

/* Top bar */
.pv-topbar {
    display: flex; align-items: center; gap: 12px;
    background: #1e293b; color: white;
    padding: 8px 16px; height: 48px;
    border-radius: 10px 10px 0 0;
    flex-shrink: 0;
}
.pv-close {
    background: var(--danger); color: white; border: none;
    width: 28px; height: 28px; border-radius: 50%;
    font-size: 18px; display: flex; align-items: center;
    justify-content: center; cursor: pointer;
    line-height: 1; flex-shrink: 0;
    transition: background 0.15s;
}
.pv-close:hover { background: #dc2626; }

.pv-page-info {
    flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px;
}
.pv-page-title {
    font-weight: 600; font-size: 13px; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.pv-page-url {
    font-size: 11px; color: #94a3b8; font-family: monospace;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.pv-counter {
    font-size: 12px; color: #94a3b8; white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.pv-open-tab {
    color: #94a3b8; text-decoration: none; display: flex;
    padding: 4px; border-radius: 4px; flex-shrink: 0;
}
.pv-open-tab:hover { color: white; background: rgba(255,255,255,0.1); }

/* Nav arrows */
.pv-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    z-index: 10; background: rgba(255,255,255,0.95);
    border: 1px solid #d1d5db; border-radius: 50%;
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #374151;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.15s;
}
.pv-nav:hover { background: white; box-shadow: 0 4px 16px rgba(0,0,0,0.25); color: var(--primary); }
.pv-nav:disabled { opacity: 0.3; cursor: default; box-shadow: none; }
.pv-nav-prev { left: -22px; }
.pv-nav-next { right: -22px; }

/* Page card (replaces iframe) */
.pv-card-wrap {
    flex: 1; position: relative; background: #f1f5f9;
    overflow-y: auto;
    display: flex; align-items: flex-start; justify-content: center;
    padding: 24px;
}
.pv-card {
    background: white; border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    max-width: 900px; width: 100%;
    overflow: hidden;
}
@keyframes pvScreenFadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* Detail panel screenshot placeholder */
.detail-screenshot { margin-bottom: 12px; }
.detail-screenshot-ph { width: 100%; }
.detail-screenshot-ph svg { animation: pvScreenFadeIn 0.4s ease-out; }
.pv-card-accent {
    height: 6px; width: 100%;
}

/* Two-column layout: left = stats (1fr), right = screenshot (2fr) */
.pv-card-columns {
    display: flex; min-height: 0;
}
.pv-card-left {
    flex: 1; min-width: 0;
    padding: 24px 24px 20px;
    display: flex; flex-direction: column;
}
.pv-card-right {
    flex: 2; min-width: 0;
    border-left: 1px solid #f1f5f9;
    background: #f8fafc;
    display: flex; align-items: stretch;
}
.pv-card-screenshot-col {
    width: 100%; position: relative;
    overflow: hidden; display: flex;
    align-items: flex-start; justify-content: center;
}
.pv-card-screenshot-col img {
    width: 100%; height: auto; display: block;
    object-fit: cover; object-position: top center;
    cursor: pointer; animation: pvScreenFadeIn 0.4s ease-out;
}
.pv-card-screenshot-ph-col {
    width: 100%; display: flex;
    align-items: center; justify-content: center;
}
.pv-card-screenshot-ph-col svg { animation: pvScreenFadeIn 0.4s ease-out; width: 100%; height: auto; }

.pv-card-title {
    font-size: 18px; font-weight: 700; color: var(--text-main);
    line-height: 1.3; margin-bottom: 4px;
}
.pv-card-h1 {
    font-size: 12px; color: var(--text-muted); font-style: italic;
    margin-bottom: 6px;
}
.pv-card-url {
    font-family: 'Menlo', monospace; font-size: 10px;
    color: var(--primary); word-break: break-all;
    background: #f8fafc; padding: 6px 10px;
    border-radius: 5px; margin-bottom: 12px;
}
.pv-card-open-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--primary); color: white;
    padding: 7px 14px; border-radius: 6px;
    font-size: 12px; font-weight: 600;
    text-decoration: none; margin-bottom: 16px;
    transition: background 0.15s;
}
.pv-card-open-btn:hover { background: var(--primary-hover); }

/* Compact stat grid for the left column */
.pv-card-grid-compact {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 6px 12px; margin-bottom: 14px;
}
.pv-card-stat-sm {
    display: flex; align-items: baseline; gap: 6px;
}
.pv-card-stat-label-sm {
    font-size: 10px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.3px; color: var(--text-muted);
}
.pv-card-stat-val-sm {
    font-size: 15px; font-weight: 700; color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

/* Legacy large grid (kept for compatibility) */
.pv-card-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 16px; margin-bottom: 20px;
}
.pv-card-stat { }
.pv-card-stat-val {
    font-size: 20px; font-weight: 700; color: var(--text-main);
    font-variant-numeric: tabular-nums;
}
.pv-card-stat-label {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--text-muted); margin-top: 2px;
}
.pv-card-bar {
    height: 4px; background: #e5e7eb; border-radius: 2px;
    margin-top: 6px; overflow: hidden;
}
.pv-card-bar-fill { height: 100%; border-radius: 2px; }
.pv-card-path {
    border-top: 1px solid #f1f5f9; padding-top: 12px; margin-top: auto;
}
.pv-card-path-label {
    font-size: 10px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 4px;
}
.pv-card-path-segments {
    font-family: 'Menlo', monospace; font-size: 11px;
}

/* Body content section in page viewer */
.pv-body-content {
    border-top: 1px solid #f1f5f9; padding-top: 16px; margin-top: 8px;
}
.pv-body-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px;
}
.pv-body-label {
    font-size: 10px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--text-muted);
}
.pv-body-actions {
    display: flex; gap: 6px;
}
.pv-body-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 4px; border: 1px solid var(--border);
    background: var(--bg-main); color: var(--text-muted);
    font-size: 11px; font-weight: 600; cursor: pointer;
    transition: all 0.15s; font-family: var(--font-cd);
}
.pv-body-btn:hover {
    color: var(--text-main); border-color: #94a3b8; background: #f8fafc;
}
.pv-body-text {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 13px; line-height: 1.6; color: #374151;
    max-height: 400px; overflow-y: auto;
    padding: 12px; background: #fafaf8; border-radius: 6px;
    border: 1px solid #f1f5f9;
}
.pv-body-text p { margin: 0.6em 0; }
.pv-body-text h1, .pv-body-text h2, .pv-body-text h3,
.pv-body-text h4, .pv-body-text h5, .pv-body-text h6 {
    font-family: var(--font-cd); margin: 1em 0 0.4em; color: #1a1a1a;
}
.pv-body-text h1 { font-size: 1.3em; }
.pv-body-text h2 { font-size: 1.15em; }
.pv-body-text h3 { font-size: 1.05em; }
.pv-body-text ul, .pv-body-text ol { padding-left: 1.5em; margin: 0.5em 0; }
.pv-body-text li { margin: 0.2em 0; }
.pv-body-text blockquote {
    border-left: 3px solid #d1d5db; padding-left: 1em;
    color: #6b7280; margin: 0.8em 0;
}
.pv-body-text a { color: #1293C5; text-decoration: none; }
.pv-body-text a:hover { text-decoration: underline; }

/* Bottom bar */
.pv-bottombar {
    display: flex; align-items: center; gap: 16px;
    background: #1e293b; color: #94a3b8;
    padding: 6px 16px; height: 40px;
    border-radius: 0 0 10px 10px;
    font-size: 12px; flex-shrink: 0;
    overflow: hidden;
}
.pv-meta-item {
    white-space: nowrap; font-variant-numeric: tabular-nums;
}
.pv-meta-item .pv-meta-label { color: #64748b; margin-right: 4px; }
.pv-meta-item .pv-meta-val { color: #e2e8f0; font-weight: 600; }

/* Thumbnail strip */
.pv-thumb-strip {
    display: flex; gap: 4px; margin-left: auto;
    overflow-x: auto; max-width: 50%;
    padding: 2px 0;
    scrollbar-width: none;
}
.pv-thumb-strip::-webkit-scrollbar { display: none; }

.pv-thumb {
    width: 8px; height: 20px;
    border-radius: 2px; flex-shrink: 0;
    cursor: pointer; opacity: 0.4;
    transition: all 0.15s;
    border: 1px solid transparent;
}
.pv-thumb:hover { opacity: 0.8; transform: scaleY(1.2); }
.pv-thumb.active {
    opacity: 1;
    border-color: white;
    box-shadow: 0 0 4px rgba(255,255,255,0.4);
    transform: scaleY(1.3);
}
.pv-thumb.pv-thumb-hot {
    opacity: 0.85;
    position: relative;
}
.pv-thumb.pv-thumb-hot::after {
    content: '';
    position: absolute; top: -3px; left: 50%; transform: translateX(-50%);
    width: 5px; height: 5px; border-radius: 50%;
    background: #33CA00;
    box-shadow: 0 0 4px #33CA00;
}
.pv-thumb.pv-thumb-hot.active::after {
    background: #fff;
    box-shadow: 0 0 6px #33CA00;
}

/* --- Pan Cursor --- */
.canvas-container.pan-ready { cursor: grab; }
.canvas-container.pan-ready * { cursor: grab !important; }
.canvas-container.panning { cursor: grabbing; }
.canvas-container.panning * { cursor: grabbing !important; }

/* --- Suspected Duplicates Panel --- */
.dupes-summary {
    text-align: center; padding: 16px 12px 12px;
    border-bottom: 1px solid #f1f5f9;
}
.dupes-summary-stat {
    font-size: 32px; font-weight: 700; color: var(--danger);
    line-height: 1;
}
.dupes-summary-label {
    font-size: 12px; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px;
}
.dupes-summary-sub {
    font-size: 11px; color: var(--text-muted); margin-top: 4px;
}
.dupes-group {
    border-bottom: 1px solid var(--border);
}
.dupes-group-header {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 16px; background: #fafbfc;
    border-bottom: 1px solid #f1f5f9;
}
.dupes-group-badge {
    background: var(--danger); color: white;
    min-width: 24px; height: 24px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; flex-shrink: 0;
    padding: 0 6px;
}
.dupes-group-info { flex: 1; min-width: 0; }
.dupes-group-title {
    font-size: 12px; font-weight: 600; color: var(--text-main);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dupes-group-reason {
    font-size: 10px; color: var(--text-muted); margin-top: 1px;
    text-transform: uppercase; letter-spacing: 0.3px;
}
.dupes-group-list { padding: 0; }
.dupes-row {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 16px 5px 50px; font-size: 11px;
    border-bottom: 1px solid #fafbfc;
    transition: background 0.1s;
}
.dupes-row:hover { background: #f8fafc; }
.dupes-row-status {
    font-weight: 700; font-variant-numeric: tabular-nums; min-width: 28px;
}
.dupes-row-path {
    flex: 1; color: var(--primary); font-family: 'Menlo', monospace;
    font-size: 10px; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Tooltip --- */
.viz-tooltip {
    position: fixed;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    pointer-events: none;
    z-index: 200;
    max-width: 320px;
    line-height: 1.5;
    display: none;
}
.viz-tooltip .tt-title { font-weight: 600; margin-bottom: 2px; color: var(--text-main); }
.viz-tooltip .tt-url { color: var(--primary); font-family: monospace; font-size: 11px; margin-bottom: 4px; word-break: break-all; }
.viz-tooltip .tt-meta { color: var(--text-muted); font-size: 11px; }
.viz-tooltip .tt-meta span { margin-right: 10px; }

/* ── Sitemaps View ── */
#sitemapsView {
    position: absolute;
    inset: 0;
    overflow: auto;
    background: #fff5f2;
}

/* Landing page */
.sitemaps-landing {
    max-width: 900px;
    margin: 0 auto;
    padding: 48px 32px;
}
.sitemaps-header {
    text-align: center;
    margin-bottom: 40px;
}
.sitemaps-title {
    font-family: var(--font-ex);
    font-size: 28px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}
.sitemaps-subtitle {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-muted);
}
.sitemaps-grid {
    display: flex;
    flex-direction: column;
    gap: 28px;
}
.sitemaps-category {}
.sitemaps-cat-label {
    font-family: var(--font-cd);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding-left: 2px;
}
.sitemaps-cat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}
.sitemaps-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: box-shadow 0.15s, border-color 0.15s;
    text-align: left;
    font-family: var(--font-main);
}
.sitemaps-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    border-color: var(--border-strong);
}
.sitemaps-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.3;
}
.sitemaps-card-meta {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
}

/* Detail view */
.sitemaps-detail {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.sitemaps-detail-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sitemaps-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font-main);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s;
}
.sitemaps-back-btn:hover {
    background: var(--bg-panel-mid);
}
.sitemaps-detail-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    flex: 1;
}
.sitemaps-export-btns {
    display: flex;
    gap: 6px;
}
.sitemaps-export-btn {
    padding: 4px 12px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 5px;
    font-family: var(--font-cd);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.sitemaps-export-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.sitemaps-detail-canvas {
    flex: 1;
    overflow: auto;
    padding: 24px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}
.sitemaps-detail-canvas .sitemap-svg {
    height: auto;
    flex-shrink: 0;
}

/* ── Sitemap view toggle (Outline / Tree) ── */
.sitemaps-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 5px;
    overflow: hidden;
    margin-right: 4px;
}
.sitemaps-toggle-btn {
    padding: 4px 10px;
    background: var(--bg-panel);
    border: none;
    font-family: var(--font-cd);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.sitemaps-toggle-btn + .sitemaps-toggle-btn {
    border-left: 1px solid var(--border);
}
.sitemaps-toggle-btn.active {
    background: var(--primary);
    color: #fff;
}

/* ── Tube map view (Beck-style) ── */
.sitemaps-detail-canvas.tree-mode {
    padding: 0;
    overflow: hidden;
    position: relative;
    background: #fafaf8;
}
.tube-map-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: grab;
}
.tube-map-svg.panning { cursor: grabbing; }

.tube-map-svg .tm-branch { transition: opacity 0.3s ease; cursor: pointer; }
.tube-map-svg .tm-branch.tm-dimmed { opacity: 0.08; }
.tube-map-svg .tm-branch.tm-focused { opacity: 1; }
.tube-map-svg .tm-branch.tm-focused circle { transition: transform 0.15s ease, fill 0.15s ease; }
.tube-map-svg .tm-branch.tm-focused circle:hover { fill: #fffbe6; transform: scale(1.8); transform-origin: center; }
.tube-map-svg .tm-branch.tm-focused text:hover { fill: #b45309; }
.tube-map-svg .tm-spine-line { pointer-events: none; }

.tree-tooltip {
    position: absolute;
    background: #1a1a2e;
    color: #f0f0f0;
    font-family: var(--font-main), system-ui, sans-serif;
    font-size: 13px;
    padding: 7px 12px;
    border-radius: 4px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 10;
    max-width: 320px;
    line-height: 1.35;
    box-shadow: 0 3px 12px rgba(0,0,0,0.25);
}
.tree-tooltip.visible { opacity: 1; }
.tree-tooltip .tt-title { font-weight: 600; font-size: 13px; margin-bottom: 1px; }
.tree-tooltip .tt-path { font-size: 10px; opacity: 0.55; }

.tree-ui-bar {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    display: flex;
    gap: 10px;
    align-items: center;
}
.tree-zoom-hint, .tree-back-btn {
    font-family: var(--font-main), system-ui, sans-serif;
    font-size: 10px;
    color: #888;
    letter-spacing: 0.04em;
    background: rgba(255,255,255,0.92);
    border: 1px solid rgba(0,0,0,0.12);
    padding: 4px 10px;
    border-radius: 4px;
    user-select: none;
}
.tree-back-btn {
    cursor: pointer;
    color: #555;
    display: none;
    transition: background 0.15s;
}
.tree-back-btn:hover { background: rgba(240,240,240,1); }
.tree-back-btn.visible { display: block; }


/* ── SEO ENRICHMENT STYLES ── */

/* SEO halo on treemap cells */
.treemap-cell.seo-top-page {
    box-shadow: inset 0 0 0 2px rgba(251, 191, 36, 0.7), 0 0 8px rgba(251, 191, 36, 0.4);
    z-index: 2;
}
.treemap-cell.seo-top5 {
    box-shadow: inset 0 0 0 2px rgba(245, 158, 11, 0.9), 0 0 12px rgba(245, 158, 11, 0.6);
    z-index: 3;
}
.treemap-cell.seo-top10 {
    box-shadow: inset 0 0 0 2px rgba(251, 191, 36, 0.8), 0 0 10px rgba(251, 191, 36, 0.5);
    z-index: 2;
}

/* Quality flag indicators on treemap */
.treemap-cell.quality-no-meta {
    border-bottom: 2px solid #f97316;
}

/* SEO tooltip line */
.tt-seo {
    color: #fbbf24;
    font-size: 11px;
    margin-top: 4px;
    font-weight: 600;
}

/* Page viewer: SEO panel */
.pv-seo-panel {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
}
.pv-seo-badge {
    font-size: 14px;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 6px;
}
.pv-seo-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: #78350f;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.pv-seo-stats span { font-weight: 600; }
.pv-seo-queries {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.pv-seo-queries-label {
    font-size: 11px;
    color: #92400e;
    font-weight: 600;
    margin-right: 4px;
}
.pv-seo-query-chip {
    background: rgba(245, 158, 11, 0.15);
    color: #78350f;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

/* Quality flags in page viewer */
.pv-quality-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.pv-flag {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 10px;
    font-weight: 500;
}
.pv-flag-warn {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
.pv-flag-info {
    background: #f0f9ff;
    color: #0c4a6e;
    border: 1px solid #bae6fd;
}

/* SEO Dashboard */
.seo-dashboard {
    padding: 16px;
}
.seo-dash-title {
    font-family: var(--font-ex);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 4px 0;
}
.seo-dash-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.seo-dash-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
}
.seo-dash-rank {
    font-family: var(--font-cd);
    font-size: 11px;
    font-weight: 700;
    color: #f59e0b;
    width: 30px;
    flex-shrink: 0;
}
.seo-dash-info {
    flex: 1;
    min-width: 0;
}
.seo-dash-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}
.seo-dash-bar-track {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}
.seo-dash-bar {
    height: 100%;
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    border-radius: 2px;
}
.seo-dash-clicks {
    font-family: var(--font-cd);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    width: 60px;
    text-align: right;
    flex-shrink: 0;
}

/* Link Graph Panel */
.link-graph-panel {
    padding: 16px;
    border-top: 1px solid #e5e7eb;
    margin-top: 8px;
}
.lg-sections { margin-bottom: 16px; }
.lg-section-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 12px;
}
.lg-section-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}
.lg-section-name {
    font-weight: 600;
    color: var(--text-main);
    width: 100px;
    flex-shrink: 0;
}
.lg-section-stat {
    font-family: var(--font-cd);
    font-size: 10px;
    color: var(--text-muted);
    width: 75px;
    text-align: right;
}
.lg-crosslinks {
    border-top: 1px solid #f1f5f9;
    padding-top: 12px;
}
.lg-crosslinks-title {
    font-family: var(--font-cd);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.lg-cross-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
    font-size: 11px;
}
.lg-cross-from, .lg-cross-to {
    font-weight: 500;
    color: var(--text-main);
}
.lg-cross-arrow {
    color: var(--text-muted);
    font-size: 10px;
}
.lg-cross-weight {
    margin-left: auto;
    font-family: var(--font-cd);
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════
   BLUEPRINT VIEW — Site Architecture Diagram
   ══════════════════════════════════════════════════════════════ */

#blueprintView {
    position: absolute;
    inset: 0;
    overflow: auto;
    background: #f8f8f6;
    display: none;
}

.bp-container {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

/* Toolbar / header bar */
.bp-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 2;
}

.bp-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font-main);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s;
}
.bp-back-btn:hover { background: #f0f0ee; }

.bp-breadcrumb {
    font-family: var(--font-main);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    flex: 1;
}
.bp-breadcrumb span {
    color: var(--text-muted);
    font-weight: 400;
}

/* Canvas area */
.bp-canvas {
    flex: 1;
    overflow: auto;
    padding: 32px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.bp-canvas svg {
    flex-shrink: 0;
}

/* SVG element styles (also inlined in SVG for self-contained rendering) */
.bp-section-box {
    cursor: pointer;
    transition: filter 0.12s;
}
.bp-section-box:hover {
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.12));
}
.bp-child-box {
    cursor: pointer;
    transition: filter 0.12s;
}
.bp-child-box:hover {
    filter: drop-shadow(0 1px 4px rgba(0,0,0,0.1));
}
