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

:root {
    --bg: #0f0f0f;
    --surface: #181818;
    --surface2: #1f1f1f;
    --border: #2a2a2a;
    --border-h: #3d3d3d;
    --text: #e8e4dc;
    --muted: #666;
    --accent: #c9f565;
    --accent-d: #a8d44a;
    --danger: #ff5a5a;
    --radius: 12px;
}

html,
body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 17px;
    line-height: 1.6;
    overflow: hidden;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 360px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 36px 0 28px;
    z-index: 10;
}

.logo {
    padding: 0 30px 36px;
    font-family: 'Instrument Serif', serif;
    font-size: 30px;
    letter-spacing: -.5px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
}

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

.nav-label {
    padding: 0 30px 10px;
    font-size: 12px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 30px;
    cursor: pointer;
    color: var(--muted);
    transition: color .15s, background .15s;
    font-size: 16px;
}

.nav-item:hover {
    color: var(--text);
    background: rgba(255, 255, 255, .04);
}

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

.nav-item .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

.sidebar-lists {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 8px;
}

.sidebar-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 24px;
    cursor: pointer;
    color: var(--muted);
    font-size: 14px;
    transition: color .15s, background .15s;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-list-item:hover {
    color: var(--text);
    background: rgba(255, 255, 255, .04);
}

.sidebar-list-item.active {
    color: var(--text);
}

.sidebar-list-item .sl-emoji {
    font-size: 17px;
    flex-shrink: 0;
}

.sidebar-list-item .sl-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer {
    padding: 16px 30px 0;
    color: var(--muted);
    font-size: 15px;
    border-top: 1px solid var(--border);
}

.page-wrap {
    margin-left: 360px;
    height: 100vh;
    overflow-y: auto;
    position: relative;
}

#page-home {
    padding: 68px 72px;
    animation: fadeIn .2s ease;
}

#page-home.hidden {
    display: none;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 56px;
}

.page-title {
    font-family: 'Instrument Serif', serif;
    font-size: 57px;
    line-height: 1;
    letter-spacing: -1.2px;
}

.page-title em {
    font-style: italic;
    color: var(--accent);
}

.btn-new {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    background: var(--accent);
    color: #0f0f0f;
    border: none;
    border-radius: var(--radius);
    padding: 14px 28px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, transform .1s;
    flex-shrink: 0;
}

.btn-new:hover {
    background: var(--accent-d);
    transform: translateY(-1px);
}

.btn-new:active {
    transform: translateY(0);
}

.btn-new svg {
    width: 16px;
    height: 16px;
}

.home-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 200px;
    max-width: 420px;
}

.search-icon {
    position: absolute;
    left: 14px;
    width: 15px;
    height: 15px;
    color: var(--muted);
    pointer-events: none;
    flex-shrink: 0;
}

.search-input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 38px 11px 38px;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
}

.search-input:focus {
    border-color: var(--border-h);
}

.search-input::placeholder {
    color: var(--muted);
}

.search-clear {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color .15s;
}

.search-clear svg {
    width: 9px;
    height: 9px;
}

.search-clear:hover {
    color: var(--text);
}

.search-clear.visible {
    display: flex;
}

.filter-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.filter-label {
    font-size: 12px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}

.filter-pills {
    display: flex;
    gap: 6px;
}

.filter-pill {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 20px;
    padding: 6px 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
    white-space: nowrap;
}

.filter-pill:hover {
    border-color: var(--border-h);
    color: var(--text);
}

.filter-pill.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(201, 245, 101, .06);
}

.no-results {
    grid-column: 1/-1;
    text-align: center;
    padding: 64px 0;
    color: var(--muted);
    font-size: 16px;
}

.lists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 20px;
}

.list-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 30px 24px;
    cursor: pointer;
    position: relative;
    transition: border-color .15s, transform .15s, box-shadow .15s;
    animation: fadeUp .3s ease both;
}

.list-card:hover {
    border-color: var(--border-h);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}

.card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 10px;
}

.card-title-row {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    flex: 1;
}

.card-emoji {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}

.btn-delete {
    opacity: 0;
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 14px;
    letter-spacing: .04em;
    font-family: 'JetBrains Mono', monospace;
    transition: opacity .15s, background .15s;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.btn-delete svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.list-card:hover .btn-delete {
    opacity: 1;
}

.btn-delete:hover {
    background: rgba(255, 90, 90, .12);
}

.card-name {
    font-family: 'Instrument Serif', serif;
    font-size: 22px;
    letter-spacing: -.2px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    min-width: 0;
}

.card-info {
    color: var(--muted);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-info .pill {
    background: rgba(201, 245, 101, .08);
    color: var(--accent);
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 12px;
}

.empty-state {
    grid-column: 1/-1;
    text-align: center;
    padding: 84px 0;
    color: var(--muted);
}

.empty-state .big {
    font-family: 'Instrument Serif', serif;
    font-size: 38px;
    color: var(--text);
    margin-bottom: 10px;
}

.empty-state .sub {
    font-size: 16px;
}

#page-list {
    display: none;
    padding: 68px 72px 150px;
    animation: fadeIn .2s ease;
}

#page-list.visible {
    display: block;
}

.list-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 48px;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    padding: 5px 0;
    transition: color .15s;
}

.btn-back:hover {
    color: var(--text);
}

.btn-back svg {
    width: 16px;
    height: 16px;
}

.list-title-wrap {
    display: flex;
    align-items: center;
    gap: 17px;
    margin-bottom: 28px;
}

.list-title-emoji {
    font-size: 36px;
    cursor: pointer;
    transition: transform .15s, opacity .15s;
    line-height: 1;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.list-title-emoji:hover {
    transform: scale(1.1);
}

.list-title-emoji:empty::after {
    content: '+';
    font-size: 16px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--border-h);
    transition: color .15s;
}

.list-title-emoji:empty:hover::after {
    color: var(--muted);
}

.list-title-input {
    font-family: 'Instrument Serif', serif;
    font-size: 38px;
    line-height: 1;
    letter-spacing: -0.8px;
    background: none;
    border: none;
    color: var(--text);
    outline: none;
    width: 100%;
    caret-color: var(--accent);
}

.list-title-input::placeholder {
    color: var(--border-h);
}

.items-container {
    max-width: 880px;
}

.item-row {
    display: flex;
    align-items: flex-start;
    position: relative;
    padding-left: 0;
    transition: padding-left .12s;
}

.item-row[data-level="1"] {
    padding-left: 32px;
}

.item-row[data-level="2"] {
    padding-left: 64px;
}

.item-row[data-level="3"] {
    padding-left: 96px;
}

.item-row[data-level="4"] {
    padding-left: 128px;
}

.item-row[data-level="5"] {
    padding-left: 160px;
}

.item-gutter {
    width: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    padding-top: 5px;
    justify-content: flex-end;
    padding-right: 9px;
    opacity: 0;
    transition: opacity .12s;
}

.item-row:hover .item-gutter,
.item-row:focus-within .item-gutter {
    opacity: 1;
}

.item-gutter-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--muted);
    margin-top: 4px;
}

.item-content {
    flex: 1;
    min-height: 36px;
    outline: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 17px;
    color: var(--text);
    line-height: 1.8;
    word-break: break-word;
    padding: 0;
    caret-color: var(--accent);
}

.item-content:empty::before {
    content: attr(data-placeholder);
    color: #444;
    pointer-events: none;
}

.item-content b,
.item-content strong {
    font-weight: 600;
}

.item-content i,
.item-content em {
    font-style: italic;
}

.item-content u {
    text-decoration: underline;
}

.item-content s,
.item-content strike {
    text-decoration: line-through;
}

.item-row.is-divider {
    align-items: center;
    margin: 10px 0 4px;
}

.item-row.is-divider .item-gutter {
    opacity: 1;
    padding-right: 6px;
    cursor: pointer;
}

.item-row.is-divider .item-gutter-dot {
    display: none;
}

.collapse-toggle {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition: transform .18s, color .15s;
    flex-shrink: 0;
}

.collapse-toggle svg {
    width: 10px;
    height: 10px;
}

.item-row.is-divider:hover .collapse-toggle {
    color: var(--text);
}

.item-row.is-divider.collapsed .collapse-toggle {
    transform: rotate(-90deg);
}

.item-row.is-divider .item-content {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 500;
    min-height: 24px;
    line-height: 24px;
    flex: none;
    width: auto;
    min-width: 40px;
    padding-right: 12px;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: var(--border);
    margin-left: 4px;
    align-self: center;
}

.item-row.is-divider.collapsed .divider-line {
    background: var(--border-h);
}

.item-row.collapse-hidden {
    display: none;
}

.item-row.fr-highlighted .item-content {
    background: rgba(201, 245, 101, .07);
    border-radius: 4px;
    outline: 1px solid rgba(201, 245, 101, .25);
}

.add-item-hint {
    margin-top: 4px;
    padding: 6px 0 6px 32px;
    color: #3a3a3a;
    font-size: 16px;
    cursor: text;
    transition: color .15s;
    display: flex;
    align-items: center;
    gap: 9px;
    max-width: 880px;
}

.add-item-hint:hover {
    color: var(--muted);
}

.format-toolbar {
    position: fixed;
    z-index: 400;
    background: var(--surface2);
    border: 1px solid var(--border-h);
    border-radius: 9px;
    padding: 5px 8px;
    display: none;
    align-items: center;
    gap: 3px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .6);
    transform: translateY(-2px);
    transition: opacity .1s;
}

.format-toolbar.visible {
    display: flex;
    animation: scaleIn .12s ease both;
}

.fmt-btn {
    width: 38px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    border-radius: 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    transition: background .1s, color .1s;
    font-weight: 500;
}

.fmt-btn:hover {
    background: rgba(255, 255, 255, .08);
    color: var(--text);
}

.fmt-btn.active {
    color: var(--accent);
}

.fmt-sep {
    width: 1px;
    height: 18px;
    background: var(--border);
    margin: 0 3px;
    flex-shrink: 0;
}

.fmt-label {
    font-size: 12px;
    color: var(--muted);
    padding: 0 5px;
    letter-spacing: .06em;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border-h);
    border-radius: 14px;
    padding: 32px;
    width: 420px;
    box-sizing: border-box;
    animation: scaleIn .2s ease both;
}

.modal h2 {
    font-family: 'Instrument Serif', serif;
    font-size: 22px;
    margin-bottom: 20px;
    letter-spacing: -.3px;
}

.field-row {
    display: flex;
    gap: 10px;
    margin-bottom: 0;
    align-items: flex-start;
}

.emoji-pick {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s;
}

.emoji-pick:hover {
    background: rgba(255, 255, 255, .1);
}

.input-name-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.input-name {
    width: 100%;
    box-sizing: border-box;
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 17px 14px;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    outline: none;
    transition: border-color .15s;
}

.input-name:focus {
    border-color: var(--accent);
}

.input-name::placeholder {
    color: var(--muted);
}

.input-name-hint {
    font-size: 11px;
    color: var(--muted);
    text-align: right;
    letter-spacing: .02em;
    transition: color .15s;
}

.input-name-hint.near-limit {
    color: var(--accent);
}

.input-name-hint.at-limit {
    color: var(--danger);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.btn-cancel {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 9px;
    padding: 10px 22px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}

.btn-cancel:hover {
    border-color: var(--border-h);
    color: var(--text);
}

.btn-create {
    background: var(--accent);
    border: none;
    color: #0f0f0f;
    border-radius: 9px;
    padding: 10px 22px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
}

.btn-create:hover {
    background: var(--accent-d);
}

.emoji-popup {
    display: none;
    position: absolute;
    background: var(--surface);
    border: 1px solid var(--border-h);
    border-radius: 11px;
    padding: 11px;
    flex-wrap: wrap;
    gap: 5px;
    width: 250px;
    z-index: 200;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
    top: 59px;
    left: 0;
}

.emoji-popup.open {
    display: flex;
}

.emoji-opt {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    cursor: pointer;
    font-size: 20px;
    transition: background .1s;
}

.emoji-opt:hover {
    background: rgba(255, 255, 255, .08);
}

.emoji-opt-none {
    font-size: 14px;
    color: var(--muted);
    font-family: 'JetBrains Mono', monospace;
}

.emoji-opt-none:hover {
    color: var(--text);
}

.confirm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(4px);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.confirm-overlay.open {
    display: flex;
}

.confirm-box {
    background: var(--surface);
    border: 1px solid var(--border-h);
    border-radius: 14px;
    padding: 40px;
    width: 460px;
    box-sizing: border-box;
    animation: scaleIn .15s ease both;
}

.confirm-box p {
    font-size: 16px;
    color: var(--muted);
    margin-top: 10px;
    line-height: 1.5;
    word-break: break-word;
}

.confirm-box h3 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 24px;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    margin-top: 30px;
    justify-content: flex-end;
}

.btn-danger {
    background: var(--danger);
    border: none;
    color: #fff;
    border-radius: 9px;
    padding: 10px 22px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    cursor: pointer;
    transition: opacity .15s;
}

.btn-danger:hover {
    opacity: .85;
}

.fmt-color-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.fmt-color-btn {
    flex-direction: column;
    gap: 2px;
    height: 36px;
    padding: 4px 6px;
    width: auto;
    min-width: 28px;
}

.fmt-color-bar {
    width: 18px;
    height: 3px;
    border-radius: 2px;
    flex-shrink: 0;
}

.fmt-color-popup {
    display: none;
    position: fixed;
    z-index: 500;
    background: var(--surface2);
    border: 1px solid var(--border-h);
    border-radius: 12px;
    padding: 12px;
    width: 196px;
    box-sizing: border-box;
    box-shadow: 0 12px 36px rgba(0, 0, 0, .7);
    flex-direction: column;
    gap: 9px;
}

.fmt-color-popup.open {
    display: flex;
}

.fcp-label {
    font-size: 12px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}

.fcp-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.fcp-swatch {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, .08);
    transition: transform .1s;
    flex-shrink: 0;
}

.fcp-swatch:hover {
    transform: scale(1.2);
}

.fcp-swatch.transparent {
    background: linear-gradient(135deg, #fff 42%, #f00 42%, #f00 58%, #fff 58%) !important;
    border-color: rgba(255, 255, 255, .2);
}

.fcp-inputs {
    display: flex;
    gap: 6px;
    align-items: center;
    width: 100%;
    min-width: 0;
}

.fcp-hex {
    flex: 1;
    min-width: 0;
    width: 0;
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 6px 8px;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    outline: none;
    transition: border-color .15s;
}

.fcp-hex:focus {
    border-color: var(--accent);
}

.fcp-native {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    padding: 0;
    background: none;
    outline: 1px solid var(--border);
}

.fcp-native::-webkit-color-swatch-wrapper {
    padding: 0;
}

.fcp-native::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

.fcp-apply {
    background: var(--accent);
    border: none;
    color: #0f0f0f;
    border-radius: 7px;
    padding: 7px 0;
    width: 100%;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
}

.fcp-apply:hover {
    background: var(--accent-d);
}

.item-img-wrap {
    display: inline-block;
    position: relative;
    cursor: default;
    line-height: 0;
    vertical-align: middle;
    max-width: 100%;
}

.item-img-wrap img {
    display: block;
    max-width: 100%;
    border-radius: 6px;
    user-select: none;
    -webkit-user-drag: none;
}

.item-img-wrap.selected img {
    outline: 2px solid var(--accent);
    border-radius: 6px;
}

.img-resize-handle {
    display: none;
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 3px;
    cursor: se-resize;
    z-index: 10;
}

.item-img-wrap.selected .img-resize-handle {
    display: block;
}

.img-size-label {
    display: none;
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(0, 0, 0, .7);
    color: #fff;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
}

.item-img-wrap.resizing .img-size-label {
    display: block;
}

.fr-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(5px);
    z-index: 600;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
}

.fr-overlay.open {
    display: flex;
    animation: fadeIn .15s ease both;
}

.fr-modal {
    background: var(--surface);
    border: 1px solid var(--border-h);
    border-radius: 16px;
    width: 520px;
    max-width: calc(100vw - 32px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .8);
    animation: scaleIn .18s ease both;
    overflow: hidden;
}

.fr-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px 16px;
    border-bottom: 1px solid var(--border);
}

.fr-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text);
    font-weight: 500;
    flex: 1;
}

.fr-title svg {
    color: var(--accent);
    flex-shrink: 0;
}

.fr-hotkey-hint {
    font-size: 11px;
    color: var(--muted);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 2px 7px;
    letter-spacing: .04em;
}

.fr-close {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color .15s, background .15s;
}

.fr-close svg {
    width: 10px;
    height: 10px;
}

.fr-close:hover {
    color: var(--text);
    background: rgba(255, 255, 255, .07);
}

.fr-fields {
    padding: 18px 20px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fr-field-wrap {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.fr-label {
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}

.fr-input {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 11px 14px;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
    width: 100%;
}

.fr-input:focus {
    border-color: var(--accent);
}

.fr-input::placeholder {
    color: #444;
}

.fr-status {
    padding: 10px 20px 0;
    min-height: 28px;
    display: flex;
    align-items: center;
}

.fr-match-count {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: .04em;
}

.fr-results {
    margin: 0 20px;
    max-height: 210px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface2);
}

.fr-results:empty {
    display: none;
}

.fr-result-item {
    padding: 9px 13px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
    word-break: break-word;
}

.fr-result-item:last-child {
    border-bottom: none;
}

.fr-preview {
    display: block;
    white-space: pre-wrap;
    overflow: hidden;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.fr-mark {
    background: rgba(201, 245, 101, .28);
    color: var(--accent);
    border-radius: 2px;
    padding: 0 1px;
    font-style: normal;
}

.fr-actions {
    display: flex;
    gap: 10px;
    padding: 14px 20px 18px;
}

.fr-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: none;
    border-radius: 9px;
    padding: 10px 18px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, opacity .15s;
    flex: 1;
    justify-content: center;
}

.fr-btn:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.fr-btn-replace {
    background: var(--accent);
    color: #0f0f0f;
}

.fr-btn-replace:hover:not(:disabled) {
    background: var(--accent-d);
}

.fr-btn-remove {
    background: rgba(255, 90, 90, .15);
    color: var(--danger);
    border: 1px solid rgba(255, 90, 90, .25);
}

.fr-btn-remove:hover:not(:disabled) {
    background: rgba(255, 90, 90, .25);
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(.96)
    }

    to {
        opacity: 1;
        transform: scale(1)
    }
}

@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

::-webkit-scrollbar {
    width: 7px
}

::-webkit-scrollbar-track {
    background: transparent
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px
}

#page-login {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 48px;
    background: var(--surface);
    border: 1px solid var(--border-h);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0,0,0,.6);
    animation: scaleIn .2s ease both;
}

.login-logo {
    font-family: 'Instrument Serif', serif;
    font-size: 42px;
    color: var(--accent);
    letter-spacing: -.5px;
}

.login-sub {
    font-size: 15px;
    color: var(--muted);
    margin-top: -12px;
}

.login-note {
    font-size: 12px;
    color: var(--muted);
    opacity: .5;
}

.btn-signout {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 7px;
    padding: 6px 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    margin-top: 10px;
    transition: border-color .15s, color .15s;
    width: calc(100% - 60px);
}

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

.hidden {
    display: none !important;
}