@font-face { font-family: 'Google Sans'; src: url('../fonts/GoogleSans-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Google Sans'; src: url('../fonts/GoogleSans-Italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Google Sans'; src: url('../fonts/GoogleSans-Medium.woff2') format('woff2'); font-weight: 500 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Google Sans'; src: url('../fonts/GoogleSans-MediumItalic.woff2') format('woff2'); font-weight: 500 600; font-style: italic; font-display: swap; }
@font-face { font-family: 'Google Sans'; src: url('../fonts/GoogleSans-Bold.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Google Sans'; src: url('../fonts/GoogleSans-BoldItalic.woff2') format('woff2'); font-weight: 700; font-style: italic; font-display: swap; }

:root {
    --font: 'Google Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
    --bg: #eef2fb;
    --blob-1: rgba(96, 140, 255, .55);
    --blob-2: rgba(255, 120, 170, .38);
    --blob-3: rgba(80, 210, 200, .40);
    --blob-4: rgba(170, 130, 255, .35);
    --text: #111827;
    --text-2: #4b5563;
    --text-3: #8a93a6;
    --glass: rgba(255, 255, 255, .58);
    --glass-strong: rgba(255, 255, 255, .78);
    --glass-soft: rgba(255, 255, 255, .45);
    --glass-border: rgba(255, 255, 255, .85);
    --glass-edge: rgba(15, 23, 42, .06);
    --glass-shine: inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 -1px 0 rgba(255, 255, 255, .25);
    --shadow: 0 10px 40px -12px rgba(30, 50, 110, .22), 0 2px 6px rgba(30, 50, 110, .05);
    --shadow-sm: 0 2px 8px rgba(30, 50, 110, .08);
    --field: rgba(255, 255, 255, .72);
    --field-border: rgba(15, 23, 42, .08);
    --accent: #3d6fe0;
    --accent-2: #5b8def;
    --accent-ring: rgba(61, 111, 224, .22);
    --hover: rgba(255, 255, 255, .7);
    --highlight-bg: rgba(255, 214, 10, .45);
    --highlight-border: rgba(230, 170, 0, .55);
    --overlay: rgba(238, 242, 251, .82);
    --scroll-thumb: rgba(15, 23, 42, .18);
    --blur: 22px;
    --radius-xl: 26px;
    --radius-lg: 20px;
    --radius: 14px;
    --tab-h: 64px;
    color-scheme: light;
}

html.pre-dark body,
body.dark-mode {
    --bg: #0b0f1a;
    --blob-1: rgba(64, 104, 230, .42);
    --blob-2: rgba(200, 60, 140, .26);
    --blob-3: rgba(30, 160, 150, .28);
    --blob-4: rgba(120, 80, 220, .30);
    --text: #f3f5fa;
    --text-2: #b4bccb;
    --text-3: #7c869a;
    --glass: rgba(28, 32, 46, .55);
    --glass-strong: rgba(36, 41, 58, .82);
    --glass-soft: rgba(40, 46, 64, .45);
    --glass-border: rgba(255, 255, 255, .10);
    --glass-edge: rgba(0, 0, 0, .3);
    --glass-shine: inset 0 1px 0 rgba(255, 255, 255, .10), inset 0 -1px 0 rgba(255, 255, 255, .02);
    --shadow: 0 14px 44px -12px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .25);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, .3);
    --field: rgba(14, 17, 27, .55);
    --field-border: rgba(255, 255, 255, .08);
    --accent: #5b8def;
    --accent-2: #7aa5ff;
    --accent-ring: rgba(91, 141, 239, .3);
    --hover: rgba(255, 255, 255, .08);
    --highlight-bg: rgba(255, 196, 0, .32);
    --highlight-border: rgba(255, 196, 0, .5);
    --overlay: rgba(6, 8, 14, .85);
    --scroll-thumb: rgba(255, 255, 255, .18);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    transition: background-color .3s ease, color .3s ease;
}

.bg-scene {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(42vmax 42vmax at 8% 6%, var(--blob-1), transparent 62%),
        radial-gradient(36vmax 36vmax at 96% 12%, var(--blob-2), transparent 62%),
        radial-gradient(40vmax 40vmax at 82% 96%, var(--blob-3), transparent 62%),
        radial-gradient(34vmax 34vmax at 12% 92%, var(--blob-4), transparent 62%),
        var(--bg);
    transform: translateZ(0);
}

h1, h2, h3, p { margin: 0; }

button, input { font: inherit; color: inherit; }

button { cursor: pointer; border: 0; background: none; }

.i {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.glass {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shine), var(--shadow);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
    backdrop-filter: blur(var(--blur)) saturate(180%);
}

.ic {
    --c1: #6c9bff;
    --c2: #3a63d6;
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    color: #fff;
    background: linear-gradient(145deg, var(--c1), var(--c2));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -2px 4px rgba(0, 0, 0, .10), 0 4px 10px -3px var(--c2);
    flex-shrink: 0;
    overflow: hidden;
}
.ic::after {
    content: '';
    position: absolute;
    inset: 0 0 50% 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0));
    pointer-events: none;
}
.ic .i { width: 20px; height: 20px; stroke-width: 2.1; position: relative; z-index: 1; }
.ic.sm { width: 30px; height: 30px; border-radius: 9px; }
.ic.sm .i { width: 16px; height: 16px; }
.c-blue { --c1: #6c9bff; --c2: #3a63d6; }
.c-indigo { --c1: #8a8dff; --c2: #5149d8; }
.c-purple { --c1: #c08bff; --c2: #8446dd; }
.c-pink { --c1: #ff87b6; --c2: #e0457f; }
.c-red { --c1: #ff7d74; --c2: #e0362c; }
.c-orange { --c1: #ffb35c; --c2: #f07a1a; }
.c-yellow { --c1: #ffd45e; --c2: #f0a400; }
.c-green { --c1: #5ee08a; --c2: #23a554; }
.c-teal { --c1: #5edcd6; --c2: #1597a8; }

.container {
    max-width: 1680px;
    margin: 0 auto;
    padding: 20px 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.top-bar {
    position: sticky;
    top: 12px;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px 12px 14px;
    border-radius: var(--radius-xl);
    transition: opacity .3s ease;
}

.app-header { display: flex; align-items: center; gap: 12px; min-width: 0; }

.app-logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    object-fit: cover;
    background: #fff;
    box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--glass-edge);
    flex-shrink: 0;
}

.app-titles { min-width: 0; }
.app-titles h2 {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-titles h1 {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-bar-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.segmented {
    display: flex;
    padding: 3px;
    border-radius: 999px;
    background: var(--glass-soft);
    box-shadow: inset 0 0 0 1px var(--glass-edge);
}
.segmented button {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    font-weight: 700;
    color: var(--text-2);
    transition: background-color .2s ease, color .2s ease, transform .15s ease;
}
.segmented button .i { width: 14px; height: 14px; stroke-width: 2.6; }
.segmented button:hover { background: var(--glass-strong); color: var(--text); }
.segmented button:active { transform: scale(.94); }
#increaseFont span { font-size: 17px; }
#decreaseFont span { font-size: 13px; }

.toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 6px 0 12px;
    border-radius: 999px;
    background: var(--glass-soft);
    box-shadow: inset 0 0 0 1px var(--glass-edge);
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: background-color .2s ease, color .2s ease;
}
.toggle:hover { color: var(--text); }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.toggle .slider {
    position: relative;
    width: 44px;
    height: 28px;
    border-radius: 999px;
    background: rgba(120, 128, 150, .28);
    transition: background-color .25s ease;
    flex-shrink: 0;
}
.toggle .slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .2), 0 0 0 .5px rgba(0, 0, 0, .04);
    transition: transform .3s cubic-bezier(.3, 1.4, .5, 1);
}
.toggle input:checked + .slider { background: linear-gradient(135deg, #5ee08a, #2fbf62); }
.toggle input:checked + .slider::before { transform: translateX(16px); }
.toggle input:focus-visible + .slider { box-shadow: 0 0 0 3px var(--accent-ring); }

.main-content-grid {
    display: grid;
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.controls-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: opacity .3s ease;
}

.controls-group {
    padding: 16px;
    border-radius: var(--radius-xl);
}
.controls-group h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 4px 12px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-3);
}
.controls-group h3 .i { width: 16px; height: 16px; }

.controls-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.controls-group .field + .controls-grid { margin-top: 14px; }

.tool {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    padding: 8px 10px 8px 8px;
    border-radius: var(--radius);
    text-align: left;
    background: var(--glass-soft);
    box-shadow: inset 0 0 0 1px var(--glass-edge);
    transition: background-color .2s ease, transform .15s ease, box-shadow .2s ease;
}
.tool-label { font-size: 13.5px; font-weight: 500; line-height: 1.25; }
.tool:hover { background: var(--glass-strong); box-shadow: inset 0 0 0 1px var(--glass-edge), var(--shadow-sm); }
.tool:active { transform: scale(.96); }
.tool:focus-visible, .btn:focus-visible, .segmented button:focus-visible, .fullscreen-btn:focus-visible, .tab-bar button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 12px; }
.field label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-left: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
}
.field label .i { width: 15px; height: 15px; }
.field-row { display: flex; gap: 8px; }
.field-row input { flex: 1; min-width: 0; }

.field input {
    height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--field-border);
    background: var(--field);
    outline: none;
    font-size: 15px;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.field input::placeholder { color: var(--text-3); }
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }

.density-result { font-size: 13.5px; color: var(--text-2); padding-left: 4px; }
.density-result:empty { display: none; }
.density-result p { padding: 2px 0; }
.density-result strong { color: var(--accent); }
.density-result .density-total { margin-top: 2px; font-size: 12.5px; color: var(--text-3); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    background: var(--glass-strong);
    box-shadow: inset 0 0 0 1px var(--glass-edge), var(--shadow-sm);
    transition: transform .15s ease, filter .2s ease, background-color .2s ease;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: scale(.96); }
.btn-primary {
    color: #fff;
    background: linear-gradient(145deg, var(--accent-2), var(--accent));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 6px 16px -6px var(--accent);
}

.input-column, .output-column {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    border-radius: var(--radius-xl);
    height: calc(100vh - 140px);
    height: calc(100dvh - 140px);
    min-height: 520px;
    position: sticky;
    top: 104px;
    transition: opacity .3s ease;
}

.column-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.column-header h2 { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; }

.header-actions { display: flex; gap: 6px; }

.chip-check { position: relative; display: inline-flex; flex-shrink: 0; cursor: pointer; user-select: none; }
.chip-check input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.chip-check span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 44px;
    padding: 0 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    background: var(--glass-soft);
    box-shadow: inset 0 0 0 1px var(--glass-edge);
    white-space: nowrap;
    transition: background-color .2s ease, color .2s ease;
}
.chip-check span .i { width: 16px; height: 16px; }
.chip-check input:checked + span { color: var(--accent); background: var(--glass-strong); box-shadow: inset 0 0 0 1.5px var(--accent); }
.chip-check input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-ring); }

.editable-content.drag-over { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); background: var(--glass-strong); }

.fullscreen-btn {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--text-2);
    background: var(--glass-soft);
    box-shadow: inset 0 0 0 1px var(--glass-edge);
    transition: background-color .2s ease, color .2s ease, transform .15s ease;
}
.fullscreen-btn .i { width: 16px; height: 16px; }
.fullscreen-btn:hover { background: var(--glass-strong); color: var(--text); }
.fullscreen-btn:active { transform: scale(.92); }

.steps {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: -4px;
    min-width: 0;
}
.steps[hidden] { display: none; }
.steps-title { display: grid; place-items: center; color: var(--text-3); flex-shrink: 0; }
.steps-title .i { width: 16px; height: 16px; }
.steps-list {
    display: flex;
    gap: 6px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 14px);
    mask-image: linear-gradient(90deg, transparent, #000 14px);
    padding-left: 6px;
}
.steps-list::-webkit-scrollbar { display: none; }
.step-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    height: 28px;
    padding: 0 10px 0 4px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-2);
    background: var(--glass-soft);
    box-shadow: inset 0 0 0 1px var(--glass-edge);
    white-space: nowrap;
    animation: chip-in .25s ease;
}
.step-chip b {
    display: grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    font-size: 11px;
    color: var(--text-2);
    background: var(--glass-strong);
}
.step-chip.is-last { color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.step-chip.is-last b { color: #fff; background: linear-gradient(145deg, var(--accent-2), var(--accent)); }
.steps-reset {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-2);
    background: var(--glass-soft);
    box-shadow: inset 0 0 0 1px var(--glass-edge);
    transition: color .2s ease, background-color .2s ease, transform .15s ease;
}
.steps-reset .i { width: 14px; height: 14px; }
.steps-reset:hover { color: var(--text); background: var(--glass-strong); }
.steps-reset:active { transform: scale(.94); }
@keyframes chip-in { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }

.btn:disabled { opacity: .45; cursor: default; transform: none; filter: none; }

.toast-notification.has-action { cursor: pointer; pointer-events: auto; }

.tab-icon { position: relative; display: inline-flex; }
.tab-badge {
    position: absolute;
    top: -5px;
    right: -10px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    font-size: 10.5px;
    font-style: normal;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    color: #fff;
    background: linear-gradient(145deg, #ff7d74, #e0362c);
    box-shadow: 0 2px 6px -1px rgba(224, 54, 44, .6);
}
.tab-badge[hidden] { display: none; }

.editable-content {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    padding: 18px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--field-border);
    background: var(--field);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.65;
    outline: none;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.editable-content:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.editable-content.output-placeholder-active::before {
    content: attr(placeholder);
    position: absolute;
    top: 18px;
    left: 18px;
    right: 18px;
    color: var(--text-3);
    pointer-events: none;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}
.editable-content:not(.output-placeholder-active)::before { content: none; }

.stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.stats p {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border-radius: 999px;
    font-size: 12.5px;
    color: var(--text-2);
    background: var(--glass-soft);
    box-shadow: inset 0 0 0 1px var(--glass-edge);
    white-space: nowrap;
}
.stats p .i { width: 14px; height: 14px; color: var(--accent); }
.stats span { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

.output-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.output-actions .btn { flex: 1 1 auto; }

.highlight-keyword {
    background-color: var(--highlight-bg);
    padding: 1px 3px;
    border-radius: 4px;
    font-weight: 600;
    color: var(--text);
    box-shadow: 0 0 0 1px var(--highlight-border);
}

.tab-bar { display: none; }

.focus-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: var(--overlay);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .3s ease, visibility .3s ease;
}
body.focus-mode .focus-overlay { opacity: 1; visibility: visible; }
body.focus-mode .top-bar { z-index: 60; }
body.focus-mode .input-column,
body.focus-mode .output-column { z-index: 45; }
body.focus-mode .controls-column { opacity: .15; pointer-events: none; }

body.fullscreen-active { overflow: hidden; }
.main-content-grid.fullscreen-active .input-column:not(.fullscreen-mode),
.main-content-grid.fullscreen-active .output-column:not(.fullscreen-mode),
.main-content-grid.fullscreen-active .controls-column { opacity: 0 !important; pointer-events: none; }
body.fullscreen-active .top-bar { opacity: .1; pointer-events: none; }
body.fullscreen-active .tab-bar { opacity: 0; pointer-events: none; }

.input-column.fullscreen-mode,
.output-column.fullscreen-mode {
    position: fixed;
    inset: 0;
    top: 0;
    z-index: 1005;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
    border-radius: 0;
    border: 0;
    background: var(--glass-strong);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    backdrop-filter: blur(40px) saturate(180%);
    opacity: 1 !important;
    pointer-events: auto !important;
}
.input-column.fullscreen-mode .column-header,
.output-column.fullscreen-mode .column-header {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--field-border);
}

.toast-notification {
    position: fixed;
    left: 50%;
    bottom: 32px;
    z-index: 1010;
    max-width: calc(100vw - 32px);
    padding: 12px 20px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    color: var(--text);
    background: var(--glass-strong);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shine), var(--shadow);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 16px) scale(.96);
    transition: opacity .3s ease, transform .35s cubic-bezier(.3, 1.3, .5, 1), visibility .3s ease;
}
.toast-notification:empty { display: none; }
.toast-notification.show { opacity: 1; visibility: visible; transform: translate(-50%, 0) scale(1); }

#loadingIndicator {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 1011;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: var(--glass-strong);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shine), var(--shadow);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(.94);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}
#loadingIndicator.show { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }

.spinner {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 3px solid var(--accent-ring);
    border-top-color: var(--accent);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }

@media (max-width: 1280px) {
    .main-content-grid { grid-template-columns: 300px minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
    .controls-grid { grid-template-columns: minmax(0, 1fr); }
    .container { padding: 16px 16px 24px; }
}

@media (max-width: 1024px) {
    .main-content-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .controls-column { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
    .input-column, .output-column { position: relative; top: 0; height: 70vh; min-height: 420px; }
    .top-bar .toggle-text { display: none; }
}

@media (max-width: 860px) and (min-width: 769px) {
    .controls-column { grid-template-columns: minmax(0, 1fr); }
    .controls-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    :root { --blur: 18px; }
    body { font-size: 15px; overscroll-behavior-y: none; }

    .container {
        padding: calc(env(safe-area-inset-top) + 8px) 12px calc(var(--tab-h) + env(safe-area-inset-bottom) + 20px);
        gap: 12px;
    }

    .top-bar {
        top: calc(env(safe-area-inset-top) + 8px);
        padding: 8px 8px 8px 10px;
        border-radius: 22px;
        gap: 8px;
    }
    .app-logo { width: 36px; height: 36px; border-radius: 10px; }
    .app-header { gap: 10px; }
    .app-titles h2 { display: none; }
    .app-titles h1 {
        font-size: 14px;
        line-height: 1.25;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    .top-bar-controls { gap: 4px; }
    .segmented { padding: 2px; }
    .segmented button { height: 32px; padding: 0 7px; }
    .toggle {
        width: 36px;
        height: 36px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
    }
    .toggle .i { width: 17px; height: 17px; }
    .toggle .slider, .toggle .toggle-text { display: none; }
    .toggle:has(input:checked) { color: #fff; background: linear-gradient(145deg, var(--accent-2), var(--accent)); box-shadow: 0 4px 12px -4px var(--accent); }

    .main-content-grid { display: block; }
    .controls-column, .input-column, .output-column { display: none; }
    body[data-tab="tools"] .controls-column { display: flex; }
    body[data-tab="input"] .input-column,
    body[data-tab="output"] .output-column { display: flex; }

    .controls-column { gap: 12px; animation: pane-in .28s ease; }
    .controls-group { padding: 14px 12px; border-radius: 22px; }
    .controls-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .tool {
        flex-direction: column;
        justify-content: flex-start;
        gap: 7px;
        min-height: 0;
        padding: 10px 4px 9px;
        text-align: center;
        background: transparent;
        box-shadow: none;
    }
    .tool:hover { background: transparent; box-shadow: none; }
    .tool:active { background: var(--glass-soft); }
    .tool .ic { width: 52px; height: 52px; border-radius: 15px; }
    .tool .ic .i { width: 25px; height: 25px; stroke-width: 2; }
    .tool-label { font-size: 11.5px; line-height: 1.25; font-weight: 500; }

    .field input { font-size: 16px; }
    .field-row { flex-direction: column; }
    .field-row input { flex: none; }
    .field-row .btn { width: 100%; }
    .field-row .chip-check span { width: 100%; justify-content: center; }

    .input-column, .output-column {
        position: relative;
        top: 0;
        height: calc(100dvh - var(--tab-h) - env(safe-area-inset-bottom) - env(safe-area-inset-top) - 104px);
        min-height: 360px;
        padding: 12px;
        gap: 10px;
        border-radius: 22px;
        animation: pane-in .28s ease;
    }
    .column-header h2 { font-size: 16px; }
    .editable-content { padding: 14px; font-size: 16px; border-radius: 16px; overflow-wrap: anywhere; }
    .editable-content.output-placeholder-active::before { top: 14px; left: 14px; right: 14px; }

    .stats {
        flex-wrap: nowrap;
        overflow-x: auto;
        margin: 0 -12px;
        padding: 0 12px;
        scrollbar-width: none;
        -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
        mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
    }
    .stats::-webkit-scrollbar { display: none; }
    .stats p { font-size: 12px; padding: 5px 10px; }

    .output-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .output-actions .btn {
        flex-direction: column;
        height: 56px;
        padding: 6px 4px;
        gap: 3px;
        font-size: 11.5px;
        line-height: 1.2;
        white-space: normal;
        text-align: center;
    }

    .tab-bar {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(env(safe-area-inset-bottom) + 10px);
        z-index: 70;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
        height: var(--tab-h);
        padding: 6px;
        border-radius: 999px;
        transition: transform .3s ease, opacity .3s ease;
    }
    .tab-bar button {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        border-radius: 999px;
        font-size: 11px;
        font-weight: 600;
        color: var(--text-3);
        transition: background-color .25s ease, color .25s ease, transform .15s ease;
    }
    .tab-bar button .i { width: 22px; height: 22px; }
    .tab-bar button:active { transform: scale(.94); }
    body[data-tab="tools"] .tab-bar [data-tab="tools"],
    body[data-tab="input"] .tab-bar [data-tab="input"],
    body[data-tab="output"] .tab-bar [data-tab="output"] {
        color: var(--accent);
        background: var(--glass-strong);
        box-shadow: inset 0 0 0 1px var(--glass-edge), var(--shadow-sm);
    }
    body.kb-open .tab-bar { transform: translateY(140%); opacity: 0; pointer-events: none; }
    body.kb-open .container { padding-bottom: 16px; }
    body.kb-open .input-column, body.kb-open .output-column { height: var(--kb-col-h, 50vh); min-height: 180px; animation: none; }
    body.kb-open .output-actions { display: none; }

    body.focus-mode .controls-column { display: none; }

    .input-column.fullscreen-mode,
    .output-column.fullscreen-mode { display: flex; padding: calc(env(safe-area-inset-top) + 14px) 14px calc(env(safe-area-inset-bottom) + 14px); }

    .toast-notification {
        top: calc(env(safe-area-inset-top) + 74px);
        bottom: auto;
        font-size: 13.5px;
        transform: translate(-50%, -12px) scale(.96);
    }
}

@media (max-width: 380px) {
    .segmented button { padding: 0 6px; }
    .tool .ic { width: 48px; height: 48px; }
}

@keyframes pane-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .glass, .toast-notification, #loadingIndicator { background: var(--glass-strong); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
