/* ============================================================
   Edunet Self-hosted Fonts — browser UI
   ============================================================ */

:root {
    /* Corporate palette */
    --en-corporate: #003366;
    --en-corporate-rgb: 0, 51, 102;
    --en-corporate-dark: #002347;
    --en-corporate-light: #1a4d80;
    --en-accent-soft: rgba(0, 51, 102, 0.08);

    /* Neutrals */
    --en-bg: #f5f7fa;
    --en-surface: #ffffff;
    --en-border: #d4dbe6;
    --en-text: #1f2933;
    --en-muted: #6b7684;

    /* Shape */
    --en-radius: 12px;
    --en-radius-sm: 8px;
    --en-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
    --en-shadow-lg: 0 12px 40px rgba(16, 24, 40, .18);

    --en-maxw: 1120px;

    /* Width of the embed-code drawer. Drives the drawer, the content push and
       the tray bar so they stay in sync (the resize handle updates this var). */
    --en-panel-width: min(460px, 92vw);
}

* { box-sizing: border-box; }

html { height: 100%; }
body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--en-bg);
    color: var(--en-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* The active view grows to push the footer to the bottom. */
.en-view { flex: 1 0 auto; }
.en-header, .en-footer { flex-shrink: 0; }

/* Leave room for the fixed selection tray when it is visible. */
body.has-selection { padding-bottom: 72px; }

/* When the embed drawer opens it sits beside the page rather than over it:
   the content area is squeezed in by the drawer's width, so en-detail (and the
   rest of the page) shrinks / shifts left as the drawer slides in from the right. */
body { transition: padding-right .3s ease; }
body.panel-open { padding-right: var(--en-panel-width); }

a { color: var(--en-corporate); }

/* ── Header ─────────────────────────────────────────────── */
.en-header {
    position: sticky;
    top: 0;
    z-index: 500;
    background: var(--en-corporate);
    color: #fff;
    padding: 18px 28px;
}
.en-header-inner {
    max-width: var(--en-maxw);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 14px;
}
.en-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
}
.en-logo {
    width: 34px; height: 34px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .14);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 18px; letter-spacing: -.02em;
}
.en-logo img { width: 100%; object-fit: contain; }
.en-header h1 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    letter-spacing: -.01em;
}
.en-header .en-sub {
    font-size: 13px;
    opacity: .72;
    margin-left: auto;
}

/* ── Hero + search ──────────────────────────────────────── */
.en-hero {
    background: linear-gradient(180deg, var(--en-corporate) 0%, var(--en-corporate-dark) 100%);
    color: #fff;
    padding: 48px 28px 64px;
    text-align: center;
}
.en-hero h2 {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 8px;
    letter-spacing: -.02em;
}
.en-hero p {
    font-size: 15px;
    opacity: .8;
    margin: 0 auto 28px;
    max-width: 540px;
}
.en-search {
    position: relative;
    max-width: 680px;
    margin: 0 auto;
}
.en-search svg {
    position: absolute;
    left: 20px; top: 50%;
    transform: translateY(-50%);
    width: 22px; height: 22px;
    color: var(--en-muted);
    pointer-events: none;
}
#font-search {
    width: 100%;
    font-size: 17px;
    padding: 18px 22px 18px 54px;
    border: none;
    border-radius: 999px;
    background: #fff;
    color: var(--en-text);
    box-shadow: var(--en-shadow-lg);
    outline: none;
}
#font-search::placeholder { color: #9aa4b2; }

/* ── Home body: left tools panel + results ──────────────── */
/* Full-width row: tools panel hugs the screen's left, OUTSIDE the centered
   max-width column; the results column stays centered in the remaining space. */
.en-home-row {
    display: flex;
    align-items: flex-start;
}
.en-home-body {
    flex: 1;
    min-width: 0;
}
.en-tools {
    width: 320px;
    max-width: 320px;
    flex-shrink: 0;
    position: sticky;
    top: 90px;                       /* clear the sticky header (~70px) + gap */
    max-height: calc(100vh - 110px); /* fit the viewport; scroll internally */
    margin: 0;
    background: var(--en-surface);
    border-right: 1px solid var(--en-border);
    padding: 18px;
    overflow-x: hidden;              /* clip during the collapse animation */
    overflow-y: auto;               /* long label lists scroll inside the panel */
    scrollbar-width: thin;                                /* Firefox */
    scrollbar-color: var(--en-border) transparent;
    transition: max-width .2s ease, padding .2s ease, opacity .2s ease;
}
/* Slim custom scrollbar for the tools panel (WebKit/Chromium). */
.en-tools::-webkit-scrollbar { width: 6px; }
.en-tools::-webkit-scrollbar-track { background: transparent; }
.en-tools::-webkit-scrollbar-thumb {
    background: var(--en-border);
    border-radius: 999px;
}
.en-tools::-webkit-scrollbar-thumb:hover { background: var(--en-muted); }
.en-home-row.tools-collapsed .en-tools {
    max-width: 0;
    padding-left: 0;
    padding-right: 0;
    opacity: 0;
    border-right-width: 0;
}
.en-tool { margin-bottom: 18px; }
.en-tool:last-child { margin-bottom: 0; }
.en-tool > label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--en-muted);
    margin-bottom: 8px;
}
.en-tool textarea {
    width: 100%;
    border: 1px solid var(--en-border);
    border-radius: var(--en-radius-sm);
    padding: 9px 11px;
    font-size: 14px;
    font-family: inherit;
    color: var(--en-text);
    resize: vertical;
    outline: none;
}
.en-tool textarea:focus { border-color: var(--en-corporate-light); }
.en-tool input[type=range] { width: 100%; accent-color: var(--en-corporate); cursor: pointer; }
.en-tool-sep { border: 0; border-top: 1px solid var(--en-border); margin: 18px 0; }

/* Category accordions in the tools panel */
.en-acc { border-top: 1px solid var(--en-border); }
.en-acc:first-of-type { border-top: 0; }
.en-acc-head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 0;
    background: none;
    padding: 10px 0;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: var(--en-text);
    text-transform: capitalize;
}
/* When collapsed, hovering the header bolds it so it reads as clickable. */
.en-acc:not(.open):hover { background-color: var(--en-bg); }
.en-acc:not(.open) .en-acc-head:hover { font-weight: 700; color: var(--en-corporate); }
.en-acc-head svg { color: var(--en-muted); transition: transform .15s ease; flex-shrink: 0; }
.en-acc.open .en-acc-head svg { transform: rotate(90deg); }
.en-acc-body { display: none; flex-wrap: wrap; gap: 6px; padding: 2px 0 12px; }
.en-acc.open .en-acc-body { display: flex; }
.en-acc-opt {
    width: 120px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1px solid transparent;
    background: var(--en-accent-soft);
    color: var(--en-corporate);
    border-radius: 999px;
    padding: 0 10px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background .12s ease, color .12s ease;
}
.en-acc-opt:hover { border-color: var(--en-corporate); }
.en-acc-opt.active {
    background: var(--en-corporate);
    color: #fff;
    border-color: var(--en-corporate);
}

/* ── Results area (centered within the space right of the tools panel) ── */
.en-results {
    max-width: var(--en-maxw);
    margin: 32px auto 64px;
    padding: 0 28px;
}
.en-results-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 4px 16px;
    color: var(--en-text);
}
.en-results-bar .en-count {
    font-size: 13px;
    color: var(--en-muted);
}
.en-results-bar .en-view-toggle { margin-left: auto; }
.en-tools-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 28px;
    border: 1px solid var(--en-border);
    background: var(--en-surface);
    color: var(--en-muted);
    border-radius: var(--en-radius-sm);
    cursor: pointer;
    flex-shrink: 0;
}
.en-tools-toggle:hover { color: var(--en-corporate); border-color: var(--en-corporate-light); }

.en-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 18px;
}

/* Infinite-scroll status + sentinel (the observer loads the next page near it). */
.en-scroll-status {
    text-align: center;
    color: var(--en-muted);
    font-size: 13px;
    padding: 18px 0 4px;
    min-height: 18px;
}
#scroll-sentinel { height: 1px; }

/* ── View toggle (grid / list) ──────────────────────────── */
.en-view-toggle {
    display: inline-flex;
    gap: 2px;
    border: 1px solid var(--en-border);
    border-radius: 999px;
    padding: 2px;
    background: var(--en-surface);
}
.en-view-toggle button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 26px;
    border: none;
    background: transparent;
    color: var(--en-muted);
    border-radius: 999px;
    cursor: pointer;
    transition: background .12s, color .12s;
}
.en-view-toggle button:hover { color: var(--en-corporate); }
.en-view-toggle button.active { background: var(--en-accent-soft); color: var(--en-corporate); }
.en-view-toggle button svg { display: block; }

/* ── Font list view ─────────────────────────────────────── */
.en-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.font-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 24px;
    padding: 24px 24px 32px 24px;
    background: var(--en-surface);
    border: 1px solid var(--en-border);
    border-radius: var(--en-radius);
    cursor: pointer;
    box-shadow: var(--en-shadow);
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.font-row:hover {
    transform: translateY(-1px);
    box-shadow: var(--en-shadow-lg);
    border-color: var(--en-corporate-light);
}
.font-row-info {
    width: 100%;
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.font-row-name { font-size: 16px; font-weight: 600; }
.font-row-meta { font-size: 12px; color: var(--en-muted); }
.font-row-sample {
    width: 100%;
    min-width: 0;
    font-size: var(--specimen-size, 40px);
    line-height: 1.25;
    color: var(--en-text);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
/* Per-font label chips, pushed to the right end of the row's info line. */
.font-row-labels {
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}
.font-label {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 9px;
    border-radius: 999px;
    background: var(--en-accent-soft);
    color: var(--en-corporate);
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}
.font-label.active {
    background: var(--en-corporate);
    color: #fff;
}

/* ── Font card ──────────────────────────────────────────── */
.font-card {
    background: var(--en-surface);
    border: 1px solid var(--en-border);
    border-radius: var(--en-radius);
    padding: 22px 22px 24px;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    box-shadow: var(--en-shadow);
}
.font-card:hover {
    background: var(--en-bg);
}
.font-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 14px;
}
.font-card-name {
    font-size: 18px;
    font-weight: 600;
}
.font-card-meta {
    font-size: 12px;
    color: var(--en-muted);
}
.font-card-sample {
    font-size: var(--specimen-size, 40px);
    line-height: 1.25;
    color: var(--en-text);
    white-space: normal;
    overflow-wrap: anywhere;
}

.en-empty {
    text-align: center;
    color: var(--en-muted);
    padding: 60px 0;
    font-size: 15px;
}

/* ── Detail view (in-page) ──────────────────────────────── */
.en-detail {
    max-width: 880px;
    margin: 0 auto;
    padding: 32px 28px 72px;
    animation: en-fade .18s ease;
}
@keyframes en-fade {
    from { transform: translateY(6px); opacity: 0; }
    to   { transform: translateY(0);   opacity: 1; }
}
.en-back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--en-border);
    background: var(--en-surface);
    color: var(--en-corporate);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 999px;
    cursor: pointer;
    margin-bottom: 22px;
    transition: all .12s;
}
.en-back:hover { background: var(--en-accent-soft); border-color: var(--en-corporate-light); }

.en-detail-head {
    border-left: 4px solid var(--en-corporate);
    padding: 4px 0 4px 18px;
    margin-bottom: 30px;
}
.en-detail-head-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.en-detail-head h2 {
    font-size: 30px;
    font-weight: 700;
    margin: 0 0 6px;
    letter-spacing: -.02em;
}
.en-detail-head .fd-meta {
    font-size: 13px;
    color: var(--en-muted);
}
.en-detail-head .fd-meta span { margin-right: 14px; }
#fd-description {
    font-size: 14px;
    color: #4a5560;
    margin-top: 10px;
    max-width: 640px;
    line-height: 1.55;
}

/* Font labels (categories) shown under the description on the detail page. */
.fd-labels { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; }
.fd-label-group { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.fd-label-name {
    font-size: 11px; font-weight: 700; color: var(--en-muted);
    text-transform: uppercase; letter-spacing: .05em; margin-right: 2px;
}
.fd-label-chip {
    background: var(--en-accent-soft); color: var(--en-corporate);
    border-radius: 999px; padding: 3px 10px;
    font-size: 12px; font-weight: 600;
}

.fd-controls {
    display: flex;
    gap: 28px;
    align-items: flex-start;
    flex-wrap: wrap;
}

/* ── Detail sections ────────────────────────────────────── */
.fd-section { margin-bottom: 26px; }
.fd-section > label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--en-muted);
    margin-bottom: 10px;
}

.preview-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
}
#preview-text-input {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    padding: 10px 14px;
    border: 1px solid var(--en-border);
    border-radius: var(--en-radius-sm);
    font-family: inherit;
    outline: none;
}
#preview-text-input:focus { border-color: var(--en-corporate-light); }
#preview-mode-toggle {
    flex-shrink: 0;
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 13px;
    color: var(--en-muted);
}
#preview-mode-toggle:hover { color: var(--en-corporate); border-color: var(--en-corporate-light); }
#preview-mode-toggle svg { display: block; }

.variant-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}
.field-label {
    font-size: 11px;
    color: var(--en-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.variant-btn {
    padding: 6px 15px;
    font-size: 13px;
    border: 1px solid var(--en-border);
    border-radius: 999px;
    cursor: pointer;
    background: #fff;
    color: var(--en-text);
    transition: all .12s;
}
.variant-btn.active {
    background: var(--en-corporate);
    color: #fff;
    border-color: var(--en-corporate);
}

.preview-display {
    padding: 18px 0;
    border-top: 1px solid #f0f2f5;
    border-bottom: 1px solid #f0f2f5;
    margin-top: 14px;
}
.preview-text {
    font-size: 34px;
    line-height: 1.3;
    color: var(--en-text);
    white-space: normal;
    overflow-wrap: anywhere;
}

#all-weights-preview .aw-group { margin-bottom: 18px; }
#all-weights-preview .aw-group:last-child { margin-bottom: 0; }
#all-weights-preview .aw-group-title {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
    color: var(--en-muted); padding-bottom: 6px; border-bottom: 2px solid var(--en-border); margin-bottom: 4px;
}
#all-weights-preview .aw-row {
    padding: 9px 0;
    border-bottom: 1px solid #d4dbe6;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 18px;
}
#all-weights-preview .aw-label {
    font-size: 11px;
    color: var(--en-muted);
    min-width: 92px;
    flex-shrink: 0;
}
#all-weights-preview .aw-sample { font-size: 22px; width: 100%; min-width: 0; order: 3; overflow-wrap: anywhere; }
#all-weights-preview .aw-actions { display: flex; gap: 6px; flex-shrink: 0; }
#all-weights-preview .aw-add {
    flex-shrink: 0;
    border: 1px solid var(--en-border);
    background: #fff;
    color: var(--en-corporate);
    font-size: 12px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: all .12s;
}
#all-weights-preview .aw-add:hover { background: var(--en-accent-soft); border-color: var(--en-corporate-light); }
#all-weights-preview .aw-add.added { background: var(--en-corporate); color: #fff; border-color: var(--en-corporate); }

/* URL builder */
.url-builder-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.url-btn {
    padding: 5px 13px;
    font-size: 12px;
    border: 1px solid var(--en-border);
    border-radius: 999px;
    cursor: pointer;
    background: #fff;
    transition: all .12s;
}
.url-btn.active {
    background: var(--en-accent-soft);
    border-color: var(--en-corporate-light);
    color: var(--en-corporate);
    font-weight: 600;
}
.url-italic-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--en-text);
    cursor: pointer;
    margin-bottom: 12px;
}

.code-block {
    position: relative;
    background: #0f1b2d;
    border-radius: var(--en-radius-sm);
    padding: 16px 18px;
    font-family: "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    color: #e6edf3;
    margin-bottom: 8px;
}
.copy-btn {
    position: absolute;
    top: 9px; right: 10px;
    font-size: 11px;
    padding: 4px 11px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .18);
    color: #e6edf3;
    border-radius: 6px;
    cursor: pointer;
    transition: background .1s;
}
.copy-btn:hover { background: rgba(255, 255, 255, .2); }
.copy-btn.copied { color: #7ee2a8; border-color: #7ee2a8; }
.snippet-hint {
    font-size: 12px;
    color: var(--en-muted);
    margin-bottom: 8px;
}

/* ── Buttons ────────────────────────────────────────────── */
.en-btn-primary {
    border: none;
    background: var(--en-corporate);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 999px;
    cursor: pointer;
    transition: background .12s;
}
.en-btn-primary:hover { background: var(--en-corporate-light); }
.en-btn-light {
    border: 1px solid rgba(255, 255, 255, .35);
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 9px 18px;
    border-radius: 999px;
    cursor: pointer;
    transition: background .12s;
}
.en-btn-light:hover { background: rgba(255, 255, 255, .22); }
.en-link-btn {
    border: none;
    background: none;
    color: var(--en-corporate);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}
.en-link-btn:hover { text-decoration: underline; }

/* ── Footer ─────────────────────────────────────────────── */
@font-face {
    font-family: 'BoomBox';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/font/boombox/boombox_normal_400.woff') format('woff');
}
.en-footer {
    text-align: center;
    padding: 1.2em 0 1em 0;
    font-size: 10px;
    color: var(--en-muted);
    border-top: 1px solid var(--en-border);
    background: var(--en-surface);
}
.en-footer-brand {
    font-family: "Boombox", sans-serif;
    color: var(--en-corporate);
}

/* ── Selection tray ─────────────────────────────────────── */
.en-tray {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 900;
    transition: right .3s ease;
}
/* While the drawer is open, end the tray bar at the drawer's left edge so the
   "Hide embed code" toggle stays visible beside the panel. */
body.panel-open .en-tray { right: var(--en-panel-width); }
.en-tray-bar {
    background: var(--en-corporate);
    color: #fff;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 -4px 20px rgba(16, 24, 40, .18);
}
#selection-summary { font-size: 14px; font-weight: 600; }

.en-tray-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    width: var(--en-panel-width);
    background: var(--en-surface);
    border-left: 1px solid var(--en-border);
    overflow-y: auto;
    padding: 22px 28px 26px;
    box-shadow: -8px 0 30px rgba(16, 24, 40, .18);
    z-index: 950;
    /* Slide in from the right edge. */
    transform: translateX(100%);
    transition: transform .3s ease;
}
.en-tray-panel.open {
    transform: translateX(0);
}
/* Drag handle on the left edge: pull leftward to widen the panel. */
.en-tray-resizer {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 7px;
    cursor: ew-resize;
    z-index: 2;
}
.en-tray-resizer:hover,
.en-tray-resizer.dragging {
    background: var(--en-corporate);
    opacity: .5;
}
/* Suppress transitions while actively dragging so the panel, the content push
   and the bar all track the cursor instantly. */
body.resizing,
body.resizing .en-tray,
.en-tray-panel.resizing {
    transition: none;
}
.en-tray-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.en-tray-panel-head strong { font-size: 15px; }

/* Selected family rows */
.sel-item {
    border: 1px solid var(--en-border);
    border-radius: var(--en-radius-sm);
    padding: 14px 16px;
    margin-bottom: 12px;
}
.sel-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.sel-item-name { font-size: 15px; font-weight: 600; }
.sel-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sel-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    background: var(--en-accent-soft);
    color: var(--en-corporate);
    border-radius: 999px;
    padding: 4px 6px 4px 12px;
}
.sel-chip button {
    border: none;
    background: rgba(var(--en-corporate-rgb), .15);
    color: var(--en-corporate);
    width: 18px; height: 18px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
}
.sel-chip button:hover { background: var(--en-corporate); color: #fff; }

/* Drawer close (×) buttons are mobile-only; the media query reveals them. */
.en-tools-close, .en-tray-close { display: none; }

/* ── Mobile: tools panel + selection panel become full-width overlays ────── */
@media (max-width: 768px) {
    .en-tools {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        max-height: 100vh;
        width: 100%;
        max-width: 100%;
        z-index: 600;                 /* above the sticky header (500) */
        border-right: 0;
        box-shadow: var(--en-shadow-lg);
        transform: translateX(0);
        opacity: 1;
        padding: 18px;
        transition: transform .2s ease;
    }
    /* Closed state on mobile: slide off-canvas (keep size/padding, unlike the
       desktop max-width collapse). */
    .en-home-row.tools-collapsed .en-tools {
        max-width: 100%;
        padding: 18px;
        opacity: 1;
        transform: translateX(-100%);
    }
    /* Full-width drawer covers the toggle, so close from inside the panel. */
    .en-tools-close {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 8px;
        right: 10px;
        width: 36px;
        height: 36px;
        border: 0;
        background: none;
        font-size: 28px;
        line-height: 1;
        color: var(--en-muted);
        cursor: pointer;
    }
    .en-tools-close:hover { color: var(--en-corporate); }

    /* Selection panel: full-width overlay (same as the tools drawer). */
    .en-tray-panel { width: 100%; padding-top: 52px; }  /* room for the × above the head */
    body.panel-open { padding-right: 0; }        /* don't squeeze the content */
    body.panel-open .en-tray { right: 0; }       /* keep the bar full-width behind */
    .en-tray-resizer { display: none; }          /* no resize on mobile */
    .en-tray-close {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 8px;
        right: 10px;
        width: 36px;
        height: 36px;
        border: 0;
        background: none;
        font-size: 28px;
        line-height: 1;
        color: var(--en-muted);
        cursor: pointer;
        z-index: 3;
    }
    .en-tray-close:hover { color: var(--en-corporate); }
}
