@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Cinzel:wght@400;700&display=swap');

:root {
    --bg-primary: #fafaf9;
    --bg-secondary: #f5f5f4;
    --bg-card: #ffffff;
    --bg-hover: #e7e5e4;
    --border: #e7e5e4;
    --border-hover: #d6d3d1;
    --accent: #d49512;
    --accent-hover: #b8860b;
    --accent-glow: rgba(212,149,18,0.1);
    --text: #1c1917;
    --text-muted: #78716c;
    --text-dim: #a8a29e;
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
    --primary: #d49512;
    --border-color: #e7e5e4;
    --text-main: #1c1917;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --accent-custom: ; /* set via settings JS */
}

.dark {
    --bg-primary: #0b0a09;
    --bg-secondary: #1a1817;
    --bg-card: #1a1817;
    --bg-hover: #2a2726;
    --border: rgba(255,255,255,0.08);
    --border-hover: rgba(255,255,255,0.15);
    --accent: #f7b415;
    --accent-hover: #eab308;
    --accent-glow: rgba(247,180,21,0.12);
    --text: #f5f5f4;
    --text-muted: #a8a29e;
    --text-dim: #78716c;
    --primary: #f7b415;
    --border-color: rgba(255,255,255,0.08);
    --text-main: #f5f5f4;
}

html.no-transition,
html.no-transition * {
  transition: none !important;
}

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

body { min-height: 100vh; }

* {
    transition: background-color 0.25s ease,
                border-color 0.25s ease,
                color 0.15s ease,
                box-shadow 0.25s ease;
}

html, body {
    height: 100%;
    background: var(--bg-primary);
    color: var(--text);
    font-family: var(--font-sans);
    overflow: hidden;
}

textarea, input[type="text"], input[type="search"] {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    font-family: var(--font-sans);
    outline: none;
}

textarea:focus, input[type="text"]:focus, input[type="search"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ─── Topbar ─── */
.topbar {
    display: flex;
    align-items: center;
    height: 56px;
    padding: 0 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 8px;
    position: relative;
    z-index: 100;
}

.topbar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 1.1rem;
    margin-right: 24px;
}

.topbar-logo img {
    width: 32px;
    height: 32px;
}

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



.topbar-nav {
    display: flex;
    gap: 4px;
    align-items: center;
    height: 100%;
}

.topbar-nav-item {
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s;
    border: none;
    background: none;
    font-family: var(--font-sans);
}

.topbar-nav-item:hover {
    color: var(--text);
}

.topbar-nav-item.active {
    color: var(--accent);
}

.topbar-nav-item.has-mega::after {
    content: '▾';
    margin-left: 4px;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    color: var(--text-muted);
    font-family: var(--font-sans);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
}

.topbar-cluster {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

.theme-toggle:hover {
    color: var(--accent);
    background: var(--bg-hover);
}

.theme-icon {
    width: 20px;
    height: 20px;
    display: block;
}

.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun { display: none; }
.dark .theme-toggle .icon-moon { display: none; }
.dark .theme-toggle .icon-sun { display: block; }

/* ─── Topbar tool chip + info ─── */
.topbar-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    pointer-events: none;
    z-index: 50;
}
.topbar-tool-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 14px;
    border-radius: 999px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.topbar-info {
    background: none;
    border: 1px solid var(--border);
    cursor: pointer;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.topbar-info:hover { color: var(--accent); border-color: var(--accent); background: var(--bg-hover); }
.topbar-info svg { width: 17px; height: 17px; }
.topbar-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 12px;
    width: min(300px, calc(100vw - 24px));
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.35);
    z-index: 300;
}
.topbar-popover[hidden] { display: none; }
.topbar-popover-title { font-weight: 700; font-size: 0.95rem; color: var(--text); margin-bottom: 6px; }
.topbar-popover-desc { font-size: 0.82rem; color: var(--text-muted); line-height: 1.55; margin-bottom: 12px; }
.topbar-popover-link { text-decoration: none; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ─── Mega Menu ─── */
.mega-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: none;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.4);
    z-index: 200;
    margin-top: 0;
}

.topbar-nav-item:hover .mega-menu,
.topbar-nav-item:focus-within .mega-menu,
.mega-menu:hover {
    display: flex;
}

.mega-apps { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.mega-app {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-radius: 9px;
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text); font-size: 0.82rem; font-weight: 600; text-decoration: none;
}
.mega-app:hover, .mega-app.active { border-color: var(--accent); color: var(--accent); }
.mega-app .tool-icon-svg svg { width: 16px; height: 16px; }
.mega-cols { display: grid; grid-template-columns: repeat(3, 220px); gap: 16px; }

.mega-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mega-col h4 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    margin: 0;
    padding: 8px 8px 4px;
}
.mega-col h4 + h4 { margin-top: 8px; }

.mega-col a {
    display: block;
    padding: 7px 8px 7px 24px;
    border-radius: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.15s;
}

.mega-col a:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.mega-col a.active {
    color: var(--accent);
    background: var(--accent-glow);
}

/* ─── Nav Overlay ─── */
.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 199;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity .25s;
}
.nav-overlay.open { display: block; opacity: 1; }

/* ─── Nav Close (mobile only) ─── */
.nav-close-wrap { display: none; }
.nav-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-dim);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    border-bottom: 1px solid var(--border);
}
.nav-close:hover { color: var(--text); }

/* ─── Main Content ─── */
.main-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.main-content.landing-bg {
    background: var(--bg-secondary);
}

/* ─── Landing Page ─── */
.landing {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 30px 40px;
    width: 100%;
}

.landing h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
}

.landing .subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 40px;
    line-height: 1.6;
}

.landing .section-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text);
}

/* ─── Tool Cards Grid ─── */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin-bottom: 50px;
}

.tool-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    position: relative;
}

.card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: .6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: var(--accent);
    color: #fff;
    line-height: 1.5;
}

.tool-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 24px var(--accent-glow);
    transform: translateY(-2px);
}

.tool-card .card-icon {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.tool-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.tool-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ─── Landing Categories ─── */
.tool-category { margin-bottom: 34px; }
.tool-category .tools-grid { margin-bottom: 0; }
.category-title { display: flex; align-items: center; gap: 8px; }
.category-icon { font-size: 1.1rem; }
.category-count {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 1px 9px;
    margin-left: auto;
}
.featured-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.featured-card { border-color: var(--accent); }
.featured-card .card-icon { font-size: 2rem; margin-bottom: 12px; }
.featured-card h3 { font-size: 1.05rem; }

/* ─── Lucide Icons ─── */
.tool-icon-svg { display: inline-flex; vertical-align: middle; }
.tool-icon-svg svg { width: 1em; height: 1em; }
.card-icon, .category-icon, .tool-emoji { color: var(--accent); }

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-hover);
    color: var(--text);
    transition: all 0.15s;
    user-select: none;
}

.btn:hover {
    background: var(--border-hover);
    border-color: var(--border-hover);
}

.btn:active {
    transform: scale(0.97);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}

.btn-accent:hover {
    box-shadow: 0 0 16px var(--accent-glow);
}

/* ─── Tool Header ─── */
.tool-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.tool-header.full-width {
    max-width: none;
    margin: 0;
}

.tool-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.tool-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ─── Tool Content ─── */
.tool-content {
    flex: 1;
    min-height: calc(100vh - 56px);
    padding: 20px 30px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.tool-content:not(.full-width) {
    flex: 1 0 auto;
    overflow: visible;
}

.tool-content.full-width {
    max-width: none;
    margin: 0;
}

.toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* ─── Editor Panes ─── */
.editors-row {
    display: flex;
    gap: 16px;
    flex: 1;
    overflow: hidden;
}

.editor-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.editor-pane.drag-active {
    border-color: var(--accent);
    box-shadow: 0 0 24px var(--accent-glow);
}

.pane-header {
    padding: 10px 15px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pane-header .file-name {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-dim);
}

.pane-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-dim);
    font-size: 0.85rem;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    font-family: var(--font-sans);
    transition: color 0.15s, background 0.15s;
}
.pane-clear:hover {
    color: var(--error);
    background: rgba(239,68,68,0.1);
}

.editor-pane textarea {
    flex: 1;
    width: 100%;
    border: none;
    resize: none;
    padding: 15px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    outline: none;
    background: var(--bg-card);
    color: var(--text);
    line-height: 1.6;
}

/* ─── Drop Zone ─── */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 30px 20px;
    text-align: center;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    margin: 10px;
}

.drop-zone:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.drop-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-glow);
    border-style: solid;
}

.drop-zone .drop-icon { font-size: 2rem; margin-bottom: 8px; opacity: 0.5; }
.drop-zone p { color: var(--text-muted); font-size: 0.85rem; margin: 4px 0; }
.drop-zone .browse-link { color: var(--accent); font-weight: 500; text-decoration: underline; }
.drop-zone .accepted-formats { font-size: 0.75rem; color: var(--text-dim); margin-top: 8px; }

/* ─── Diff View ─── */
#diff-area {
    gap: 0;
}

.diff-header-toolbar {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 16px;
}

.diff-header-toolbar .toolbar {
    border: none;
    border-radius: 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.diff-headers {
    display: flex;
}

.diff-header-pane {
    flex: 1;
    padding: 10px 15px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-card);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
}

.diff-header-pane:first-child {
    border-right: 1px solid var(--border);
}

.diff-file-name {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-dim);
}

#monaco-diff-container {
    flex: 1;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    min-height: 400px;
    height: calc(100vh - 260px);
}

#monaco-json-container {
    flex: 1;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    min-height: 400px;
}

/* ─── Diff Options ─── */
.diff-options {
    display: flex;
    gap: 12px;
    align-items: center;
}

.diff-nav {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.diff-nav .btn {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* ─── Toggle ─── */
.toggle-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
}

.toggle-group input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: var(--accent);
}

/* ─── Simple Grid ─── */
.simple-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.simple-grid textarea,
.simple-grid input[type="text"],
.simple-grid input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    resize: vertical;
    outline: none;
    background: var(--bg-card);
    color: var(--text);
}

.simple-grid textarea:focus,
.simple-grid input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.simple-grid label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ─── Form Select ─── */
select.form-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    background: var(--bg-hover);
    color: var(--text);
    cursor: pointer;
    outline: none;
    font-family: var(--font-sans);
}

select.form-select:focus {
    border-color: var(--accent);
}

/* ─── Status ─── */
.status-indicator {
    font-size: 0.85rem;
    font-weight: 600;
    margin-left: auto;
}

.status-indicator.valid { color: var(--success); }
.status-indicator.invalid { color: var(--error); }

/* ─── Validation Results ─── */
.validation-results {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
}

.validation-results h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-section { margin-bottom: 15px; }
.result-section h4 { font-size: 0.85rem; margin-bottom: 8px; color: var(--text-muted); }
.result-list { list-style: none; padding: 0; }

.result-list li {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-bottom: 4px;
    font-family: var(--font-mono);
}

.result-list li.error { background: rgba(239,68,68,0.1); color: var(--error); border-left: 3px solid var(--error); }
.result-list li.warning { background: rgba(245,158,11,0.1); color: var(--warning); border-left: 3px solid var(--warning); }
.result-list li.success { background: rgba(34,197,94,0.1); color: var(--success); border-left: 3px solid var(--success); }

/* ─── Writing Tools ─── */
.w-rows { display: flex; flex-direction: column; gap: 16px; }
.w-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.w-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.w-card .w-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin-bottom: 4px; }
.w-card .w-value { font-size: 1.35rem; font-weight: 700; color: var(--text); line-height: 1.1; }
.w-card .w-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 3px; }
.w-card .w-value.accent { color: var(--accent); }
.w-split { display: flex; gap: 16px; flex: 1; min-height: 380px; }
.w-split > .editor-pane { flex: 1; }
.w-output { flex: 1; min-height: 0; overflow: auto; padding: 15px; font-family: var(--font-mono); font-size: 0.9rem; line-height: 1.6; background: var(--bg-card); color: var(--text); white-space: pre-wrap; word-break: break-word; }
.w-option { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-muted); }
.w-option select, .w-option input[type="range"], .w-option input[type="checkbox"] { accent-color: var(--accent); }
.w-note { font-size: 0.8rem; color: var(--text-dim); }
.w-findings { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.w-finding { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-card); font-size: 0.85rem; }
.w-finding.error { border-left: 3px solid var(--error); }
.w-finding.style { border-left: 3px solid var(--warning); }
.w-finding.suggestion { border-left: 3px solid var(--accent); }
.w-finding .w-f-body { flex: 1; min-width: 0; }
.w-finding .w-f-title { font-weight: 600; margin-bottom: 2px; }
.w-finding .w-f-ctx { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.76rem; margin-top: 3px; word-break: break-word; }
.w-finding .w-f-fix { margin-top: 3px; font-size: 0.78rem; }
.w-finding .w-f-fix code { background: var(--bg-secondary); padding: 1px 6px; border-radius: 4px; font-family: var(--font-mono); }
.w-tag { flex-shrink: 0; display: inline-block; font-size: 0.66rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.04em; }
.w-tag.error { background: rgba(239,68,68,0.15); color: var(--error); }
.w-tag.style { background: rgba(245,158,11,0.15); color: var(--warning); }
.w-tag.suggestion { background: rgba(212,149,18,0.15); color: var(--text); }
.w-badge { font-size: 0.7rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--bg-secondary); color: var(--text-muted); }
.w-empty { color: var(--text-dim); padding: 0; font-size: 0.9rem; }
.w-replace span.orig { color: var(--error); text-decoration: line-through; }
.w-replace span.repl { color: var(--success); }
.w-readability { display: flex; align-items: center; gap: 10px; }
.w-meter { flex: 1; height: 8px; border-radius: 999px; background: var(--bg-secondary); overflow: hidden; }
.w-meter span { display: block; height: 100%; border-radius: 999px; transition: width 0.3s; }
.w-diffmark { background: rgba(212,149,18,0.22); border-bottom: 2px solid var(--accent); border-radius: 2px; }

/* ─── Translator ─── */
.w-langbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 15px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; }
.w-langbar .w-lang-select { flex: 1 1 220px; display: flex; flex-direction: column; gap: 6px; }
.w-langbar .w-lang-select label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
.w-langbar select {
    width: 100%;
    padding: 9px 11px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.w-langbar select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.w-langbar select:disabled { opacity: 0.55; cursor: not-allowed; }
.w-langbar select option { background: var(--bg-card); color: var(--text); }
.w-swap {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-top: 16px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}
.w-swap:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); background: var(--accent-glow); }
.w-swap:disabled { opacity: 0.5; cursor: not-allowed; }
.w-lang-detect { font-size: 0.72rem; font-weight: 600; color: var(--accent); }
.w-notice {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.w-notice.warn { border-color: rgba(245,158,11,0.6); background: rgba(245,158,11,0.08); color: var(--text); }
.w-notice code { background: var(--bg-secondary); padding: 1px 6px; border-radius: 4px; font-family: var(--font-mono); }
.w-notice .w-notice-title { font-weight: 700; color: var(--warning); margin-bottom: 4px; }
.w-output.disabled { opacity: 0.5; }
.w-char-count { color: var(--text-dim); }

.w-badge.warn { background: rgba(245,158,11,0.16); color: var(--warning); border: 1px solid rgba(245,158,11,0.5); }
.w-history { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 15px; }
.w-history-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.w-history-title { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.w-history-list { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.w-history-empty { font-size: 0.82rem; color: var(--text-dim); padding: 6px 2px; }
.w-history-item { display: flex; flex-direction: column; gap: 6px; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-secondary); }
.w-history-item:hover { border-color: var(--accent); }
.w-history-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.7rem; color: var(--text-dim); }
.w-history-pair { font-weight: 700; color: var(--accent); }
.w-history-body { display: flex; flex-direction: column; gap: 3px; font-size: 0.82rem; }
.w-history-src { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.w-history-dst { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.w-history-actions { display: flex; gap: 6px; margin-top: 4px; }
.w-voice { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 15px; }
.w-voice-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.w-voice-title { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.w-voice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; }
.w-voice-grid .w-option { flex-direction: column; align-items: stretch; gap: 6px; }
.w-voice-grid .w-option select { width: 100%; }
.w-voice-grid .w-option select, .w-voice-grid .w-option input[type="range"] { accent-color: var(--accent); }
.w-voice-val { font-size: 0.72rem; font-weight: 700; color: var(--accent); }

.w-main { display: flex; gap: 16px; align-items: stretch; }
.w-main .w-split { flex: 1; min-width: 0; }

.w-side {
    flex: 0 0 320px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 15px;
}
.w-side[hidden] { display: none; }
.w-side-tabs {
    display: flex;
    gap: 6px;
    padding: 3px;
    border-radius: 8px;
    background: var(--bg-secondary);
}
.w-side-tab {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.w-side-tab:hover { color: var(--text); }
.w-side-tab.active { background: var(--bg-card); border-color: var(--border); color: var(--accent); }
.w-side-pane { min-height: 0; }
.w-side-pane[hidden] { display: none; }
.w-side .w-history, .w-side .w-voice { background: none; border: none; padding: 0; }

.w-notice-details { margin-top: 8px; }
.w-notice-details summary { cursor: pointer; color: var(--warning); font-weight: 600; }
.w-notice-diag {
    margin: 8px 0 0;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}
.w-notice-hints {
    margin: 8px 0 0;
    padding-left: 18px;
    font-size: 0.76rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.w-notice-actions { margin-top: 10px; }
.w-notice-msg { margin: 0; font-size: 0.82rem; color: var(--text); }

.w-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.w-modal-overlay[hidden] { display: none; }
.w-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.2);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
.w-modal {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.45);
    animation: settingsFadeIn .28s ease both;
}
.w-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.w-modal-title { font-size: 0.85rem; font-weight: 700; color: var(--warning); }
.w-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-dim);
    padding: 4px;
    border-radius: 4px;
    display: flex;
    flex-shrink: 0;
}
.w-modal-close:hover { color: var(--text); background: var(--bg-hover); }
.w-modal-body {
    padding: 16px 18px;
    overflow-y: auto;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-muted);
}
.w-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.cap-badge { cursor: pointer; }
.cap-badge:hover { border-color: var(--warning); }

.toolbar .btn.active { background: var(--accent-glow); color: var(--accent); border-color: var(--accent); }

@media (max-width: 860px) {
    .w-main { flex-direction: column; }
    .w-side { flex: none; }
}

/* ─── Footer ─── */
.footer {
    margin-top: auto;
    padding: 24px 30px;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-dim);
    text-align: center;
    flex-shrink: 0;
    background: var(--bg-secondary);
}

.footer .privacy-title {
    color: var(--warning);
    font-weight: 600;
    font-size: 0.8rem;
}

.footer p { margin: 2px 0; }

/* ─── Download Section ─── */
.download-section {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px 15px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.download-section span {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-right: auto;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ─── Back Link ─── */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
    cursor: pointer;
}

.back-link:hover { text-decoration: underline; }

/* ─── Hamburger ─── */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 8px;
    background: none;
    border: none;
    margin-left: auto;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-muted);
    border-radius: 2px;
    transition: all 0.2s;
}

.hamburger:hover span {
    background: var(--text);
}

.hamburger.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
    opacity: 0;
}

.hamburger.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .tools-grid { grid-template-columns: 1fr; }
    .editors-row { flex-direction: column; }
    .role-tools-grid { grid-template-columns: 1fr; }
    .landing { padding: 30px 16px; }
    .tool-content { padding: 16px; }
    .topbar { padding: 0 12px; }
    .hamburger {
        display: flex;
        order: 1;
        margin-left: 0;
    }

    .topbar-logo {
        order: 2;
        margin: 0 auto;
        margin-right: auto;
    }

    .theme-toggle {
        order: 3;
        margin-left: 0;
    }

    .topbar-nav {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 300px;
        max-width: 80vw;
        z-index: 250;
        background: var(--bg-card);
        border-right: 1px solid var(--border);
        flex-direction: column;
        height: auto;
        padding: 0;
        box-shadow: 4px 0 24px rgba(0,0,0,0.3);
        transform: translateX(-100%);
        transition: transform .25s;
        overflow-y: auto;
    }

    .topbar-nav.open { transform: translateX(0); }

    .nav-close-wrap { display: flex; }

    .topbar-nav-item {
        height: auto;
        padding: 14px 20px;
        width: 100%;
        font-size: 1rem;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        cursor: pointer;
    }

    .topbar-nav-item.has-mega::after {
        content: '▸';
        margin-left: auto;
        transition: transform 0.2s;
        color: var(--text-dim);
        font-size: 0.9rem;
    }

    .topbar-nav-item.has-mega.open::after {
        transform: rotate(90deg);
    }

    .topbar-nav-item:hover .mega-menu,
    .topbar-nav-item:focus-within .mega-menu {
        display: none;
    }

    .topbar-nav-item.has-mega.open .mega-menu {
        display: flex;
        flex-direction: column;
        position: static;
        box-shadow: none;
        border: none;
        border-radius: 0;
        margin: 0;
        padding: 0;
        background: transparent;
        width: 100%;
        grid-template-columns: none;
        gap: 0;
    }

    .topbar-nav-item.has-mega.open .mega-col {
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .topbar-nav-item.has-mega.open .mega-col h4 {
        display: none;
    }

    .topbar-nav-item.has-mega.open .mega-col a {
        padding: 10px 20px 10px 32px;
        font-size: 0.9rem;
        color: var(--text-muted);
        border-radius: 0;
        border-left: 2px solid transparent;
        margin: 0;
    }

    .topbar-nav-item.has-mega.open .mega-col a:hover {
        color: var(--accent);
        background: var(--bg-hover);
        border-left-color: var(--accent);
    }

    .topbar-nav-item.has-mega.open .mega-col a.active {
        color: var(--accent);
        background: var(--accent-glow);
        border-left-color: var(--accent);
    }

    .mega-menu:hover {
        display: none;
    }

    .topbar-nav-item.has-mega.open .mega-menu:hover {
        display: flex;
    }
}
