/* ==========================================================================
   ToolCMB — Base64 Encoder / Decoder (extends /assets/css/style.css design tokens)
   ==========================================================================
   01. Page & hero          06. Output views & preview   11. Content blocks
   02. App card & toolbar   07. Notes & errors           12. Overlays, toasts, lang
   03. Panes & text areas   08. Files (drop zone, list)  13. Responsive
   04. Swap gutter          09. Settings panel           14. Contrast
   05. Status line          10. Form controls, full screen
   ========================================================================== */

/* ---------- 01. Page & hero --------------------------------------------- */
.b64-hero { position: relative; padding: 32px 0 18px; isolation: isolate; overflow: hidden; }
.b64-hero .hero-bg { opacity: .8; }
.b64-hero .breadcrumbs ol { margin-bottom: 20px; }
.b64-hero .breadcrumbs .icon { width: 16px; height: 16px; }
.b64-hero-head { display: flex; align-items: center; gap: 18px; }
.b64-hero-head h1 { margin: 0; font-size: clamp(1.9rem, 4vw, 2.6rem); letter-spacing: -.03em; }
.b64-hero-head .lead { margin: 6px 0 0; font-size: 1.05rem; max-width: 820px; }
.b64-trust { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 0; padding: 0; list-style: none; }
.b64-trust li {
    display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border); font-size: .85rem; font-weight: 550; color: var(--text-2);
}
.b64-trust .icon { color: var(--primary); }
.b64-tool { padding: 6px 0 64px; scroll-margin-top: var(--header-h, 68px); }

/* quick presets */
.b64-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; }
.b64-quick-lbl { font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-right: 2px; }
.b64-qc {
    display: inline-flex; align-items: center; height: 34px; padding: 0 13px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-size: .83rem; font-weight: 650; cursor: pointer;
    transition: border-color .15s var(--ease), color .15s, background-color .15s, box-shadow .15s;
}
.b64-qc:hover { border-color: var(--primary); color: var(--link); }
.b64-qc.is-active { border-color: var(--primary); background: var(--primary-soft); color: var(--link); box-shadow: inset 0 0 0 1px var(--primary-ring); }
.b64-qc:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 2px; }
.b64-blocked { margin-bottom: 16px; padding: 18px 20px; border-radius: var(--radius-lg); background: rgba(220, 38, 38, .08); border: 1px solid rgba(220, 38, 38, .25); }
.b64-blocked p { margin: 6px 0 0; }

/* ---------- 02. App card & toolbar -------------------------------------- */
.b64-app {
    --b64-ed-h: clamp(420px, calc(100vh - 260px), 760px);
    position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.b64-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.b64-bar-main, .b64-bar-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }

/* Encode / Decode switch */
.b64-mode { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--border); }
.b64-mode-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 16px; border: 0; border-radius: 10px;
    background: none; color: var(--text-2); font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; transition: background-color .15s, color .15s, box-shadow .15s;
}
.b64-mode-btn .icon { width: 16px; height: 16px; }
.b64-mode-btn:hover { color: var(--text); }
.b64-mode-btn[aria-pressed="true"] { background: #0E7490; color: #fff; box-shadow: 0 6px 16px -8px rgba(8, 145, 178, .8); }
.b64-mode-btn:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 2px; }

/* Text / Files tabs */
.b64-src { display: inline-flex; gap: 2px; }
.b64-src-btn {
    display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent;
    background: none; color: var(--text-2); font: inherit; font-size: .88rem; font-weight: 650; cursor: pointer;
}
.b64-src-btn .icon { width: 16px; height: 16px; }
.b64-src-btn:hover { color: var(--text); }
.b64-src-btn[aria-selected="true"] { color: var(--link); border-bottom-color: var(--primary); }
.b64-src-btn:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: -2px; border-radius: 8px; }

.b64-field-inline { display: inline-flex; align-items: center; gap: 7px; margin: 0; font-size: .78rem; font-weight: 700; letter-spacing: .02em; color: var(--muted); }
.b64-field-inline > span { white-space: nowrap; }
.b64-field-inline select { width: auto; min-width: 118px; max-width: 220px; font-weight: 650; color: var(--text); }
.b64-ib { width: 38px; height: 38px; }
.b64-ib[aria-pressed="true"], .b64-ib[aria-expanded="true"] { border-color: var(--primary); color: var(--link); background: var(--primary-soft); }

/* mode-dependent visibility */
.b64-app[data-mode="enc"] .b64-when-dec, .b64-app[data-mode="dec"] .b64-when-enc { display: none !important; }

/* ---------- 03. Panes & text areas -------------------------------------- */
.b64-panes { display: grid; grid-template-columns: minmax(0, 1fr) 52px minmax(0, 1fr); height: var(--b64-ed-h); }
.b64-panes[hidden] { display: none; }
.b64-pane { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.b64-pane-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 50px; padding: 7px 10px; border-bottom: 1px solid var(--border); }
.b64-pane-title { display: inline-flex; align-items: center; margin: 0 4px 0 4px; font-size: .9rem; font-weight: 700; letter-spacing: -.01em; }
.b64-pane-title > span { display: inline-flex; align-items: center; gap: 8px; }
.b64-pane-title .icon { width: 17px; height: 17px; color: var(--primary); }
.b64-pane-tools { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.b64-tb {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; min-width: 34px; padding: 0 9px; border: 1px solid transparent; border-radius: 9px;
    background: none; color: var(--text-2); font: inherit; font-size: .82rem; font-weight: 600; white-space: nowrap; cursor: pointer; transition: background-color .15s, color .15s, border-color .15s;
}
.b64-tb .icon { width: 16px; height: 16px; flex: none; }
.b64-tb:hover:not([disabled]) { background: var(--surface-2); color: var(--text); }
.b64-tb:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 1px; }
.b64-tb[disabled] { opacity: .45; cursor: not-allowed; }
.b64-tb--icon { padding: 0; width: 34px; }
.b64-tb--danger:hover:not([disabled]) { color: var(--danger); }
.b64-dl { height: 34px; margin-left: 4px; padding: 0 12px; gap: 6px; font-size: .82rem; }
.b64-dl[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }

.b64-intype { display: inline-flex; gap: 4px; }
.b64-chip { height: 28px; padding: 0 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-2); font: inherit; font-size: .76rem; font-weight: 700; cursor: pointer; }
.b64-chip:hover { border-color: var(--primary); color: var(--link); }
.b64-chip[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--link); }
.b64-chip:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 1px; }

.b64-editor { position: relative; flex: 1; min-height: 0; display: flex; }
.b64-ta {
    flex: 1; width: 100%; min-height: 0; margin: 0; padding: 14px 16px; border: 0; border-radius: 0; resize: none; outline: none;
    background: var(--surface); color: var(--text); font: var(--b64-fs, 13.5px)/1.65 var(--mono); tab-size: 4;
    overflow-wrap: anywhere; word-break: break-all; white-space: pre-wrap;
}
.b64-app.is-nowrap .b64-ta { white-space: pre; overflow-wrap: normal; word-break: normal; overflow-x: auto; }
.b64-ta::placeholder { color: var(--muted); opacity: .9; font-family: var(--font); }
.b64-ta:focus-visible { box-shadow: inset 0 0 0 2px var(--primary-ring); }
.b64-ta[readonly] { cursor: text; }
.b64-app[data-view="hex"] #b64Out { white-space: pre; word-break: normal; overflow-wrap: normal; overflow-x: auto; }

/* stacked layout */
.b64-panes[data-layout="stack"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 52px auto; height: auto; }
.b64-panes[data-layout="stack"] .b64-pane { height: calc(var(--b64-ed-h) * .62); }

/* ---------- 04. Swap gutter --------------------------------------------- */
.b64-gutter { position: relative; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.b64-swap {
    position: relative; z-index: 2; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border-strong);
    background: var(--surface); color: var(--link); cursor: pointer; box-shadow: var(--shadow-sm); transition: transform .25s var(--ease), border-color .15s, background-color .15s;
}
.b64-swap:hover { border-color: var(--primary); background: var(--primary-soft); transform: rotate(180deg); }
.b64-swap:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 2px; }
.b64-swap .icon { width: 18px; height: 18px; }
.b64-swap-v { display: none; }
.b64-panes[data-layout="stack"] .b64-gutter { border: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.b64-panes[data-layout="stack"] .b64-swap-h { display: none; }
.b64-panes[data-layout="stack"] .b64-swap-v { display: block; }

/* ---------- 05. Status line --------------------------------------------- */
.b64-status { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; min-height: 36px; padding: 6px 12px; border-top: 1px solid var(--border); font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.b64-state { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; color: var(--text-2); }
.b64-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.b64-state[data-state="ok"] { color: var(--success); }
.b64-state[data-state="ok"]::before { background: var(--success); box-shadow: 0 0 0 3px rgba(5, 150, 105, .15); }
.b64-state[data-state="bad"] { color: var(--danger); }
.b64-state[data-state="bad"]::before { background: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .15); }
.b64-state[data-state="busy"]::before { background: var(--primary); animation: b64-pulse 1s ease-in-out infinite; }
[data-theme="dark"] .b64-state[data-state="ok"] { color: #34D399; }
[data-theme="dark"] .b64-state[data-state="bad"] { color: #F87171; }
.b64-meta { overflow-wrap: anywhere; }
.b64-live-hint { margin-left: auto; color: var(--text-2); }
.b64-live-hint[hidden] { display: none; }
@keyframes b64-pulse { 50% { opacity: .35; } }

/* ---------- 06. Output views & preview ---------------------------------- */
.b64-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); }
.b64-tab { display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border: 0; border-radius: 8px; background: none; color: var(--text-2); font: inherit; font-size: .8rem; font-weight: 650; cursor: pointer; }
.b64-tab:hover:not([disabled]) { color: var(--text); }
.b64-tab[disabled] { opacity: .4; cursor: not-allowed; }
.b64-tab[hidden] { display: none; }
.b64-tab[aria-selected="true"] { background: var(--surface); color: var(--link); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--primary-ring); }
.b64-tab:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 1px; }
.b64-out, .b64-prev { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.b64-out[hidden], .b64-prev[hidden] { display: none; }
.b64-out-empty { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 24px; text-align: center; background: var(--surface); }
.b64-out-empty[hidden] { display: none; }
.b64-out-empty[data-kind="empty"] .b64-oe-error, .b64-out-empty[data-kind="error"] .b64-oe-empty { display: none; }
.b64-oe-ico { display: inline-grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; color: var(--primary); background: var(--primary-soft); }
.b64-oe-ico .icon { width: 28px; height: 28px; }
.b64-oe-ico.is-bad { color: var(--danger); background: rgba(220, 38, 38, .08); }
.b64-oe-title { margin: 14px 0 4px; font-weight: 750; font-size: 1.05rem; }
.b64-oe-text { margin: 0 auto; max-width: 380px; font-size: .9rem; color: var(--muted); overflow-wrap: anywhere; }
.b64-oe-private { display: inline-flex; align-items: center; gap: 7px; margin: 18px 0 0; padding: 6px 12px; border-radius: 999px; background: rgba(5, 150, 105, .08); color: #047857; font-size: .8rem; font-weight: 650; }
[data-theme="dark"] .b64-oe-private { color: #34D399; background: rgba(52, 211, 153, .1); }
.b64-link { display: inline; padding: 0; border: 0; background: none; color: var(--link); font: inherit; font-weight: 650; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.b64-link:hover { text-decoration-thickness: 2px; }

.b64-prev { overflow: auto; padding: 16px; gap: 14px; }
.b64-prev-media {
    display: grid; place-items: center; min-height: 180px; flex: 1 1 auto; padding: 12px; border-radius: var(--radius); border: 1px solid var(--border);
    background-color: var(--surface-2);
    background-image: linear-gradient(45deg, var(--border) 25%, transparent 25%), linear-gradient(-45deg, var(--border) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--border) 75%), linear-gradient(-45deg, transparent 75%, var(--border) 75%);
    background-size: 18px 18px; background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}
.b64-prev-media img, .b64-prev-media video { display: block; max-width: 100%; max-height: 46vh; height: auto; border-radius: 6px; box-shadow: var(--shadow-sm); }
.b64-prev-media audio { width: min(100%, 420px); }
.b64-noprev { display: grid; justify-items: center; gap: 8px; padding: 16px; border-radius: var(--radius); background: var(--surface); text-align: center; color: var(--muted); font-size: .9rem; }
.b64-noprev .icon { width: 44px; height: 44px; color: var(--primary); }
.b64-noprev p { margin: 0; max-width: 320px; }
.b64-prev-info { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 16px; margin: 0; }
.b64-prev-info div { min-width: 0; }
.b64-prev-info dt { font-size: .7rem; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.b64-prev-info dd { margin: 2px 0 0; font-size: .88rem; font-weight: 600; overflow-wrap: anywhere; }
.b64-prev-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.b64-prev-actions .btn { gap: 7px; }
.btn-sm { height: 38px; padding: 0 16px; font-size: .86rem; }

/* ---------- 07. Notes & errors ------------------------------------------ */
.b64-error { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-top: 1px solid rgba(220, 38, 38, .25); background: rgba(220, 38, 38, .06); animation: pop .2s var(--ease); }
.b64-error[hidden] { display: none; }
.b64-error-ico { flex: none; width: 20px; height: 20px; margin-top: 1px; color: var(--danger); }
.b64-error-body { flex: 1; min-width: 0; }
.b64-error-title { margin: 0; font-size: .84rem; font-weight: 750; color: var(--danger); font-variant-numeric: tabular-nums; }
.b64-error-msg { margin: 2px 0 0; font-size: .86rem; line-height: 1.45; color: var(--text); overflow-wrap: anywhere; }
.b64-error-actions { display: flex; flex-wrap: wrap; gap: 6px; flex: none; }
.b64-error-actions [hidden] { display: none; }
[data-theme="dark"] .b64-error-title, [data-theme="dark"] .b64-error-ico { color: #F87171; }
.b64-notes { display: grid; gap: 1px; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border); max-height: 132px; overflow: auto; }
.b64-notes[hidden] { display: none; }
.b64-note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 7px 12px 7px 34px; position: relative; font-size: .8rem; line-height: 1.45; color: var(--text-2); }
.b64-note::before { content: "i"; position: absolute; left: 12px; top: 8px; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; font: 700 .7rem/1 var(--font); color: #fff; background: var(--primary-dark); }
.b64-note.is-warn { background: rgba(217, 119, 6, .07); }
.b64-note.is-warn::before { content: "!"; background: #B45309; }
.b64-note.is-ok::before { content: "✓"; background: var(--success); }
.b64-note .b64-link { font-size: .8rem; }

/* ---------- 08. Files ---------------------------------------------------- */
.b64-files { padding: 16px; min-height: 360px; }
.b64-files[hidden] { display: none; }
.b64-drop {
    display: grid; justify-items: center; gap: 6px; padding: 40px 20px; border: 2px dashed var(--border-strong); border-radius: var(--radius-lg);
    background: var(--surface-2); text-align: center; cursor: pointer; transition: border-color .15s, background-color .15s;
}
.b64-drop:hover, .b64-drop:focus-visible { border-color: var(--primary); background: var(--primary-soft); outline: none; }
.b64-drop-ico { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; color: #fff; background: linear-gradient(135deg, var(--primary-light), var(--primary-dark)); box-shadow: 0 10px 24px -10px rgba(8, 145, 178, .7); }
.b64-drop-ico .icon { width: 30px; height: 30px; }
.b64-drop-title { margin: 8px 0 0; font-size: 1.1rem; font-weight: 750; }
.b64-drop-hint { margin: 0 0 8px; max-width: 520px; font-size: .88rem; color: var(--muted); }
.b64-drop-btn { gap: 7px; pointer-events: none; }
.b64-drop.is-compact { grid-template-columns: auto 1fr auto; justify-items: start; align-items: center; gap: 4px 14px; padding: 14px 16px; text-align: left; }
.b64-drop.is-compact .b64-drop-ico { grid-row: span 2; width: 44px; height: 44px; border-radius: 14px; }
.b64-drop.is-compact .b64-drop-ico .icon { width: 22px; height: 22px; }
.b64-drop.is-compact .b64-drop-title { margin: 0; font-size: .95rem; }
.b64-drop.is-compact .b64-drop-hint { margin: 0; grid-column: 2; font-size: .8rem; }
.b64-drop.is-compact .b64-drop-btn { grid-column: 3; grid-row: 1 / span 2; }
.b64-fbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 16px 0 10px; }
.b64-fbar[hidden] { display: none; }
.b64-fsum { margin: 0 auto 0 0; font-size: .86rem; font-weight: 650; color: var(--text-2); font-variant-numeric: tabular-nums; }
.b64-fbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.b64-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.b64-item {
    display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 10px 12px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); animation: pop .2s var(--ease);
}
.b64-item[data-state="err"] { border-color: rgba(220, 38, 38, .35); background: rgba(220, 38, 38, .03); }
.b64-thumb { display: grid; place-items: center; width: 52px; height: 52px; overflow: hidden; border-radius: 10px; background: var(--surface-2); color: var(--primary); }
.b64-thumb img { width: 100%; height: 100%; object-fit: cover; }
.b64-thumb .icon { width: 24px; height: 24px; }
.b64-item-main { min-width: 0; }
.b64-item-name { margin: 0; font-weight: 650; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b64-item-meta { margin: 2px 0 0; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.b64-item-meta.is-bad { color: var(--danger); }
[data-theme="dark"] .b64-item-meta.is-bad { color: #F87171; }
.b64-peek { display: block; margin-top: 6px; padding: 5px 8px; border-radius: 7px; background: var(--surface-2); color: var(--text-2); font: .74rem/1.4 var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b64-item-actions { display: flex; align-items: center; gap: 4px; }
.b64-item-actions .btn { gap: 6px; }
.b64-rm { width: 34px; height: 34px; }
.b64-spin { width: 20px; height: 20px; margin: 0 8px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--primary); animation: b64-spin .8s linear infinite; }
@keyframes b64-spin { to { transform: rotate(360deg); } }

/* ---------- 09. Settings panel ------------------------------------------ */
.b64-panel {
    position: absolute; top: 58px; right: 10px; z-index: 40; width: 370px; max-height: calc(100% - 68px); min-height: 200px; overflow: auto; overscroll-behavior: contain;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: pop .18s var(--ease); scrollbar-width: thin;
}
.b64-panel[hidden] { display: none; }
.b64-panel-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 6px; padding: 12px 12px 10px 18px; background: var(--surface); border-bottom: 1px solid var(--border); }
.b64-panel-title { display: flex; align-items: center; gap: 8px; margin: 0 auto 0 0; font-size: 1rem; }
.b64-panel-title .icon { color: var(--primary); }
.b64-panel-body { padding: 4px 18px 18px; }
.b64-link-btn { display: inline-flex; align-items: center; gap: 5px; padding: 4px 6px; border: 0; background: none; color: var(--muted); font: inherit; font-size: .82rem; font-weight: 600; border-radius: 8px; cursor: pointer; }
.b64-link-btn:hover { color: var(--link); background: var(--surface-2); }
.b64-link-btn .icon { width: 14px; height: 14px; }
.b64-sub { margin: 18px 0 0; font-size: .74rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.b64-set-note { display: flex; gap: 8px; margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--border); font-size: .78rem; line-height: 1.5; color: var(--muted); }
.b64-set-note .icon { flex: none; margin-top: 2px; color: var(--primary); }
.b64-keys { margin-top: 18px; border-top: 1px solid var(--border); }
.b64-keys summary { display: flex; align-items: center; gap: 8px; padding: 14px 0 0; font-size: .86rem; font-weight: 650; cursor: pointer; list-style: none; }
.b64-keys summary::-webkit-details-marker { display: none; }
.b64-keys summary .icon:first-child { color: var(--primary); }
.b64-keys .b64-caret { margin-left: auto; transition: transform .2s var(--ease); color: var(--muted); }
.b64-keys[open] .b64-caret { transform: rotate(180deg); }
.b64-keys dl { display: grid; gap: 6px; margin: 10px 0 0; }
.b64-keys dl div { display: flex; justify-content: space-between; gap: 10px; font-size: .8rem; }
.b64-keys dd { margin: 0; color: var(--muted); text-align: right; }
.b64-app kbd { font: 650 .72rem var(--font); padding: 2px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }

/* ---------- 10. Form controls & full screen ----------------------------- */
.b64-field { margin: 12px 0 0; padding: 0; border: 0; min-width: 0; }
.b64-field > legend, .b64-field > label { display: block; padding: 0; margin: 0 0 7px; font-size: .84rem; font-weight: 650; color: var(--text-2); }
.b64-field--row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.b64-field--row > label, .b64-field--row > legend { margin: 0; float: left; }
.b64-field--row .b64-seg { margin-left: auto; min-width: 180px; }
.b64-wrapn { margin-top: 10px; font-size: .84rem; color: var(--text-2); }
.b64-wrapn[hidden] { display: none; }
.b64-w { width: 110px; flex: none; }
.b64-seg { display: grid; gap: 3px; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.b64-seg--2 { grid-template-columns: repeat(2, 1fr); }
.b64-seg--3 { grid-template-columns: repeat(3, 1fr); }
.b64-seg--4 { grid-template-columns: repeat(4, 1fr); }
.b64-seg label { position: relative; margin: 0; }
.b64-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.b64-seg span { display: flex; align-items: center; justify-content: center; min-height: 32px; padding: 3px 4px; border-radius: 9px; font-size: .78rem; font-weight: 650; line-height: 1.2; text-align: center; color: var(--text-2); cursor: pointer; transition: all .15s var(--ease); }
.b64-seg span:hover { color: var(--text); }
.b64-seg input:checked + span { background: var(--surface); color: var(--link); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--primary-ring); }
.b64-seg input:focus-visible + span { outline: 3px solid var(--primary-ring); outline-offset: 1px; }
.b64-seg--mono span { font-family: var(--mono); font-size: .74rem; }
.b64-input { width: 100%; min-width: 0; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: .9rem; outline: none; transition: border-color .2s, box-shadow .2s; }
select.b64-input { padding-right: 8px; cursor: pointer; }
.b64-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }
.b64-input:disabled { opacity: .5; cursor: not-allowed; }
.b64-input--sm { height: 34px; font-size: .84rem; border-radius: 9px; }
.b64-switch { display: flex; align-items: flex-start; gap: 10px; margin: 12px 0 0; font-size: .86rem; line-height: 1.4; color: var(--text-2); cursor: pointer; }
.b64-switch small { display: block; margin-top: 2px; font-size: .76rem; color: var(--muted); }
.b64-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.b64-switch-ui { position: relative; flex: none; width: 36px; height: 20px; margin-top: 1px; border-radius: 999px; background: var(--border-strong); transition: background-color .2s var(--ease); }
.b64-switch-ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .3); transition: transform .2s var(--ease); }
.b64-switch input:checked + .b64-switch-ui { background: var(--primary-dark); }
.b64-switch input:checked + .b64-switch-ui::after { transform: translateX(16px); }
.b64-switch input:focus-visible + .b64-switch-ui { outline: 3px solid var(--primary-ring); outline-offset: 2px; }
.b64-mini { width: 34px; height: 34px; flex: none; }
.btn-xs { height: 32px; padding: 0 12px; font-size: .8rem; gap: 6px; }

.b64-full-off { display: none; }
.b64-app.is-full .b64-full-on { display: none; }
.b64-app.is-full .b64-full-off { display: block; }
.b64-app.is-full { position: fixed; inset: 0; z-index: 900; display: flex; flex-direction: column; border-radius: 0; border: 0; overflow: auto; }
.b64-app.is-full .b64-panes { flex: 1; height: auto; min-height: 0; }
.b64-app.is-full .b64-files { flex: 1; }
body.b64-noscroll { overflow: hidden; }

/* ---------- 11. Content blocks ------------------------------------------ */
.b64-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 0; padding: 0; list-style: none; }
.b64-step { position: relative; padding: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.b64-step h3 { margin: 16px 0 8px; }
.b64-step p { margin: 0; color: var(--muted); font-size: .95rem; }
.b64-step-n { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; color: #fff; font-weight: 800; background: linear-gradient(135deg, var(--primary-light), var(--primary-dark)); }
.b64-features { grid-template-columns: repeat(4, 1fr); }
.b64-guide { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; }
.b64-guide-main { max-width: 800px; min-width: 0; }
.b64-guide-main > h2:first-child { margin-top: 0; }
.b64-guide-main > p { margin: 0 0 1em; }
.b64-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 1em; }
.b64-gtable { width: 100%; border-collapse: collapse; font-size: .92rem; }
.b64-gtable th, .b64-gtable td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.b64-gtable thead th { font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); background: var(--surface-2); }
.b64-gtable th[scope="row"] { white-space: nowrap; font-weight: 650; }
.b64-gtable code { font-size: .82rem; overflow-wrap: anywhere; }
.b64-gtable--mono td { font-family: var(--mono); font-size: .86rem; text-align: center; }
.b64-gtable--mono td strong { color: var(--link); font-size: 1.05rem; }
.b64-ad { min-height: 120px; margin-top: 20px; }

/* ---------- 12. Overlays, toasts, language ------------------------------ */
.b64-lang { position: relative; }
.b64-lang-btn { width: auto; padding: 0 12px; gap: 6px; display: inline-flex; }
.b64-lang-code { font-size: .76rem; font-weight: 750; letter-spacing: .03em; }
.b64-lang-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 150; min-width: 180px; margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); animation: pop .18s var(--ease); }
.b64-lang-menu a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 8px; color: var(--text); font-size: .92rem; font-weight: 550; text-decoration: none !important; }
.b64-lang-menu a:hover { background: var(--surface-2); }
.b64-lang-menu a[aria-current] { color: var(--link); font-weight: 650; }
.b64-dropveil { position: fixed; inset: 0; z-index: 950; display: grid; place-items: center; padding: 16px; background: rgba(6, 182, 212, .14); backdrop-filter: blur(3px); animation: fade .15s; pointer-events: none; }
.b64-dropveil[hidden] { display: none; }
.b64-dropveil > div { display: grid; place-content: center; justify-items: center; gap: 10px; width: 100%; height: 100%; border: 3px dashed var(--primary); border-radius: var(--radius-xl); color: var(--primary-dark); font-size: 1.3rem; font-weight: 750; }
[data-theme="dark"] .b64-dropveil > div { color: var(--primary-light); }
.b64-dropveil .icon { width: 56px; height: 56px; }
.b64-toasts { position: fixed; left: 50%; bottom: 24px; z-index: 1000; display: flex; flex-direction: column; align-items: center; gap: 8px; transform: translateX(-50%); pointer-events: none; }
.b64-toast { padding: 10px 18px; border-radius: 999px; background: var(--navy); color: #fff; font-size: .88rem; font-weight: 600; box-shadow: var(--shadow-lg); animation: pop .2s var(--ease); transition: opacity .3s, transform .3s; white-space: nowrap; }
[data-theme="dark"] .b64-toast { background: #1E293B; border: 1px solid var(--border-strong); }
.b64-toast.is-ok { background: #047857; }
.b64-toast.is-warn { background: #B45309; }
.b64-toast.is-out { opacity: 0; transform: translateY(8px); }
.b64-langhint { position: fixed; left: 16px; bottom: 16px; z-index: 650; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; max-width: min(520px, calc(100vw - 32px)); padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); font-size: .9rem; animation: pop .25s var(--ease); }
.b64-langhint[hidden] { display: none; }
.b64-langhint span { flex: 1 1 200px; }

/* ---------- 13. Responsive ---------------------------------------------- */
@media (max-width: 1280px) {
    .b64-features { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1100px) {
    .b64-guide { grid-template-columns: minmax(0, 1fr); gap: 32px; }
    .b64-guide-side .sticky { position: static; }
    .b64-bar-opts { width: 100%; }
}
@media (max-width: 900px) {
    .header-actions { margin-left: auto; }
    .b64-panes, .b64-panes[data-layout="split"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 48px auto; height: auto; }
    .b64-pane, .b64-panes[data-layout="stack"] .b64-pane { height: clamp(300px, 52vh, 560px); }
    .b64-gutter { border: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
    .b64-swap-h { display: none; }
    .b64-swap-v { display: block; }
    .b64-steps { grid-template-columns: 1fr; }
    .b64-panel { position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 82vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding-bottom: env(safe-area-inset-bottom); z-index: 960; }
}
@media (max-width: 600px) {
    .b64-lang-btn { width: 40px; padding: 0; justify-content: center; }
    .b64-lang-code { display: none; }
    .b64-hero { padding: 20px 0 10px; }
    .b64-hero-head .tile { display: none; }
    .b64-trust { gap: 6px; }
    .b64-trust li { font-size: .78rem; padding: 5px 10px; }
    .b64-quick { flex-wrap: nowrap; gap: 6px; margin: 0 -16px 12px; padding: 2px 16px 4px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .b64-quick::-webkit-scrollbar { display: none; }
    .b64-quick-lbl { display: none; }
    .b64-qc { flex: none; }
    .b64-app { margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; }
    .b64-bar { padding: 8px 10px; }
    .b64-bar-main { width: 100%; justify-content: space-between; }
    .b64-mode { flex: 1; }
    .b64-mode-btn { padding: 0 10px; }
    .b64-src-btn { padding: 0 9px; }
    .b64-src-btn span { font-size: .84rem; }
    .b64-bar-opts { display: grid; grid-template-columns: 1fr 1fr auto auto; }
    .b64-field-inline { display: grid; gap: 2px; font-size: .7rem; }
    .b64-field-inline select { min-width: 0; max-width: none; width: 100%; }
    .b64-bar-opts .b64-ib { align-self: end; }
    .b64-pane, .b64-panes[data-layout="stack"] .b64-pane { height: clamp(240px, 42vh, 440px); }
    .b64-pane-head { padding: 6px 8px; }
    .b64-tb span { display: none; }
    .b64-tb { width: 34px; padding: 0; }
    .b64-dl span { display: none; }
    .b64-dl { width: 36px; padding: 0; justify-content: center; }
    .b64-error { flex-wrap: wrap; }
    .b64-error-actions { width: 100%; padding-left: 30px; }
    .b64-toast { white-space: normal; text-align: center; }
    .b64-features { grid-template-columns: 1fr; }
    .b64-langhint { left: 12px; right: 12px; bottom: 12px; max-width: none; }
    .b64-files { padding: 12px 10px; }
    .b64-drop { padding: 28px 14px; }
    .b64-drop.is-compact { grid-template-columns: auto 1fr; }
    .b64-drop.is-compact .b64-drop-btn { display: none; }
    .b64-item { grid-template-columns: 44px minmax(0, 1fr); gap: 10px; }
    .b64-thumb { width: 44px; height: 44px; }
    .b64-item-actions { grid-column: 1 / -1; justify-content: flex-end; }
    .b64-item-actions .b64-tb span, .b64-item-actions .btn span { display: inline; }
    .b64-item-actions .b64-tb { width: auto; padding: 0 9px; }
    .b64-fbar-actions { width: 100%; justify-content: space-between; }
    .b64-fbar .b64-field-inline { display: inline-flex; font-size: .78rem; }
    .b64-fbar .b64-field-inline select { width: auto; }
    .b64-fbar .b64-dl span { display: inline; }
    .b64-fbar .b64-dl { width: auto; padding: 0 12px; }
}
@media print { .b64-tool, .b64-langhint { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .b64-app *, .b64-toast, .b64-panel { animation: none !important; transition: none !important; } }

/* ---------- 14. Contrast (WCAG AA for small text, light theme) ---------- */
:root:not([data-theme="dark"]) .b64-qc.is-active,
:root:not([data-theme="dark"]) .b64-tab[aria-selected="true"],
:root:not([data-theme="dark"]) .b64-seg input:checked + span,
:root:not([data-theme="dark"]) .b64-src-btn[aria-selected="true"],
:root:not([data-theme="dark"]) .b64-chip[aria-pressed="true"],
:root:not([data-theme="dark"]) .b64-swap,
:root:not([data-theme="dark"]) .b64-link { color: #0E7490; }
