:root {
    --memo-bg: #f5f6fb;
    --memo-surface: #ffffff;
    --memo-surface-soft: #f8f9ff;
    --memo-border: #e3e6f0;
    --memo-text: #1c2333;
    --memo-muted: #667085;
    --memo-primary: #4f46e5;
    --memo-primary-hover: #4338ca;
    --memo-primary-soft: #eef2ff;
    --memo-danger: #dc2626;
    --memo-shadow: 0 24px 64px rgba(29, 35, 66, 0.12);
}

html[data-memo-theme="dark"] {
    color-scheme: dark;
    --memo-bg: #11141c;
    --memo-surface: #1b1f2a;
    --memo-surface-soft: #222735;
    --memo-border: #343b4d;
    --memo-text: #f4f5f8;
    --memo-muted: #aeb5c5;
    --memo-primary: #8b87ff;
    --memo-primary-hover: #a29fff;
    --memo-primary-soft: #29284a;
    --memo-danger: #fb7185;
    --memo-shadow: 0 28px 80px rgba(0, 0, 0, 0.35);
}

html[data-memo-theme="dark"] body,
html[data-memo-theme="dark"] .site-header,
html[data-memo-theme="dark"] .site-footer {
    background: var(--memo-bg);
    color: var(--memo-text);
}

html[data-memo-theme="dark"] .site-header,
html[data-memo-theme="dark"] .site-footer {
    border-color: var(--memo-border);
}

html[data-memo-theme="dark"] .pg-header {
    background: var(--memo-surface);
    border-color: var(--memo-border);
}

html[data-memo-theme="dark"] .pg-header__nav-link {
    color: var(--memo-muted);
}

html[data-memo-theme="dark"] .pg-header__nav-link:hover,
html[data-memo-theme="dark"] .pg-header__nav-link--active {
    color: var(--memo-primary-hover);
}

html[data-memo-theme="dark"] .pg-header__nav-link::after {
    background: var(--memo-primary-hover);
}

html[data-memo-theme="dark"] .pg-header__logo-image {
    filter: invert(1) hue-rotate(180deg);
}

html[data-memo-theme="dark"] .site-logo,
html[data-memo-theme="dark"] .site-nav a,
html[data-memo-theme="dark"] .site-footer a,
html[data-memo-theme="dark"] .site-footer__brand {
    color: var(--memo-text);
}

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

.notepad-app {
    background: var(--memo-bg);
    color: var(--memo-text);
    padding: 32px 20px 48px;
}

.notepad-app h1,
.notepad-app h2,
.notepad-app h3 {
    color: var(--memo-text);
}

.notepad-app__frame {
    position: relative;
    width: min(1240px, 100%);
    min-height: 700px;
    margin: 0 auto;
    overflow: hidden;
    background: var(--memo-surface);
    border: 1px solid var(--memo-border);
    border-radius: 22px;
    box-shadow: var(--memo-shadow);
}

.notepad-file-drop {
    position: absolute;
    z-index: 80;
    inset: 10px;
    display: grid;
    place-items: center;
    border: 2px dashed var(--memo-primary);
    border-radius: 16px;
    background: color-mix(in srgb, var(--memo-surface) 92%, transparent);
    color: var(--memo-primary);
    font-size: 1rem;
    font-weight: 900;
    pointer-events: none;
}

.notepad-file-drop[hidden] {
    display: none;
}

.notepad-app__masthead {
    min-height: 94px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--memo-border);
}

.notepad-app__eyebrow {
    margin: 0 0 2px;
    color: var(--memo-primary);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.notepad-app__title {
    margin: 0;
    font-size: clamp(1.5rem, 3vw, 2rem);
    line-height: 1.15;
}

.notepad-app__subtitle {
    margin: 5px 0 0;
    color: var(--memo-muted);
    font-size: 0.9rem;
}

.notepad-app__masthead-actions,
.notepad-editor__actions,
.notepad-editor__counts {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notepad-app__save-status {
    color: var(--memo-muted);
    font-size: 0.82rem;
    white-space: nowrap;
}

.notepad-app__warning {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: #fff7ed;
    border-bottom: 1px solid #fed7aa;
    color: #9a3412;
    font-size: 0.9rem;
}

.notepad-app__warning > span:nth-child(2) {
    flex: 1;
}

.notepad-app__recovery {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #3730a3;
}

.notepad-app__warning[hidden] {
    display: none;
}

.notepad-app__update {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #3730a3;
}

html[data-memo-theme="dark"] .notepad-app__warning {
    background: #3d291d;
    border-color: #6f4528;
    color: #fed7aa;
}

html[data-memo-theme="dark"] .notepad-app__update {
    background: #22243d;
    border-color: #444a78;
    color: #c7d2fe;
}

.notepad-icon {
    min-width: 1em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-style: normal;
    font-weight: 700;
    line-height: 1;
}

.notepad-app__workspace {
    position: relative;
    display: grid;
    grid-template-columns: 310px minmax(0, 1fr);
    min-height: 605px;
}

.notepad-sidebar {
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--memo-surface-soft);
    border-right: 1px solid var(--memo-border);
}

.notepad-sidebar__top {
    padding: 20px 18px 14px;
}

.notepad-sidebar__heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.notepad-sidebar__heading,
.notepad-sidebar__backup-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 800;
}

.notepad-button.notepad-sidebar__close,
.notepad-button.notepad-editor__menu,
.notepad-app__overlay {
    display: none;
}

.notepad-search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    margin-bottom: 12px;
    padding: 0 12px;
    color: var(--memo-muted);
    background: var(--memo-surface);
    border: 1px solid var(--memo-border);
    border-radius: 11px;
}

.notepad-search:focus-within {
    border-color: var(--memo-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--memo-primary) 15%, transparent);
}

.notepad-search .notepad-icon {
    font-size: 20px;
}

.notepad-search input {
    min-width: 0;
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--memo-text);
    font: inherit;
    font-size: 0.88rem;
}

.notepad-search input::placeholder,
.notepad-editor__title::placeholder,
.notepad-editor__body::placeholder {
    color: var(--memo-muted);
    opacity: 0.75;
}

.notepad-button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--memo-text);
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.notepad-button:hover {
    background: var(--memo-primary-soft);
    color: var(--memo-primary);
}

.notepad-button:active {
    transform: translateY(1px);
}

.notepad-button:focus-visible,
.notepad-note:focus-visible,
.notepad-toast button:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--memo-primary) 35%, transparent);
    outline-offset: 2px;
}

.notepad-button .notepad-icon {
    font-size: 20px;
}

.notepad-button--primary {
    background: var(--memo-primary);
    color: #fff;
}

.notepad-button--primary:hover {
    background: var(--memo-primary-hover);
    color: #fff;
}

.notepad-button--icon {
    width: 40px;
    padding: 0;
    border-color: var(--memo-border);
}

.notepad-button--wide {
    width: 100%;
}

.notepad-button--subtle {
    justify-content: flex-start;
    border-color: var(--memo-border);
    background: var(--memo-surface);
}

.notepad-button--danger:hover {
    background: color-mix(in srgb, var(--memo-danger) 10%, transparent);
    border-color: color-mix(in srgb, var(--memo-danger) 30%, transparent);
    color: var(--memo-danger);
}

.notepad-button.is-active {
    border-color: color-mix(in srgb, var(--memo-primary) 45%, var(--memo-border));
    background: var(--memo-primary-soft);
    color: var(--memo-primary);
}

.notepad-sidebar__list {
    min-height: 0;
    flex: 1;
    overflow: auto;
    padding: 2px 10px 14px;
}

.notepad-note {
    position: relative;
    width: 100%;
    height: 72px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 3px 8px;
    padding: 13px 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--memo-text);
    text-align: left;
    cursor: pointer;
}

.notepad-note-group {
    margin: 10px 12px 4px;
    color: var(--memo-muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.notepad-note mark {
    padding: 0;
    background: #fde68a;
    color: #713f12;
}

html[data-memo-theme="dark"] .notepad-note mark {
    background: #854d0e;
    color: #fef3c7;
}

.notepad-note:hover {
    background: color-mix(in srgb, var(--memo-primary) 7%, var(--memo-surface));
}

.notepad-note[aria-selected="true"] {
    background: var(--memo-surface);
    border-color: color-mix(in srgb, var(--memo-primary) 45%, var(--memo-border));
    box-shadow: 0 7px 18px rgba(51, 55, 92, 0.07);
}

.notepad-note__title,
.notepad-note__preview {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notepad-note__title {
    font-weight: 800;
}

.notepad-note__preview,
.notepad-note__time {
    color: var(--memo-muted);
    font-size: 0.75rem;
}

.notepad-note__pin {
    grid-column: 2;
    grid-row: 1;
    padding: 2px 5px;
    border-radius: 999px;
    background: var(--memo-primary-soft);
    color: var(--memo-primary);
    font-size: 0.62rem;
}

.notepad-note__time {
    grid-column: 2;
    grid-row: 2;
    white-space: nowrap;
}

.notepad-sidebar__empty {
    margin: 14px 22px;
    color: var(--memo-muted);
    font-size: 0.84rem;
    text-align: center;
}

.notepad-sidebar__empty p {
    margin: 0 0 12px;
}

.notepad-sidebar__show-all {
    width: calc(100% - 36px);
    margin: 0 18px 14px;
    justify-content: center;
}

.notepad-sidebar__show-all[hidden] {
    display: none;
}

.notepad-sidebar__backup {
    padding: 14px 18px 18px;
    border-top: 1px solid var(--memo-border);
}

.notepad-sidebar__backup-title {
    margin-bottom: 10px;
    color: var(--memo-muted);
    font-size: 0.78rem;
}

.notepad-sidebar__backup-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.notepad-sidebar__backup-actions .notepad-button {
    padding-inline: 8px;
    font-size: 0.74rem;
}

.notepad-editor {
    min-width: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    background: var(--memo-surface);
}

.notepad-editor__toolbar {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 8px 18px;
    border-bottom: 1px solid var(--memo-border);
}

.notepad-editor__paper {
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 34px clamp(24px, 6vw, 74px) 24px;
}

.notepad-editor__title,
.notepad-editor__body {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--memo-text);
    font-family: inherit;
}

.notepad-editor__title {
    padding: 0 0 17px;
    border-bottom: 1px solid var(--memo-border);
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 800;
    line-height: 1.35;
}

.notepad-editor__body {
    min-height: 390px;
    flex: 1;
    resize: none;
    padding: 22px 0;
    font-size: 1rem;
    line-height: 1.9;
    tab-size: var(--memo-tab-size, 4);
}

.notepad-app[data-memo-wrap="off"] .notepad-editor__body {
    overflow-x: auto;
    overflow-wrap: normal;
    white-space: pre;
}

.notepad-app.is-restoring .notepad-editor__paper {
    opacity: 0.72;
}

.notepad-editor__footer {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 22px;
    border-top: 1px solid var(--memo-border);
    color: var(--memo-muted);
    font-size: 0.78rem;
}

.notepad-editor__counts strong {
    color: var(--memo-text);
    font-weight: 700;
}

.notepad-editor__file-meta,
.notepad-editor__footer-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notepad-editor__file-meta {
    margin-top: 3px;
    font-size: 0.68rem;
}

.notepad-editor__file-meta span + span::before {
    content: "·";
    margin-right: 8px;
}

.notepad-editor__footer-status {
    justify-content: flex-end;
    flex-wrap: wrap;
}

.notepad-editor__mobile-action {
    display: none;
}

.notepad-toast {
    position: fixed;
    z-index: 80;
    right: 24px;
    bottom: 24px;
    max-width: min(420px, calc(100vw - 32px));
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px 12px 18px;
    border: 1px solid var(--memo-border);
    border-radius: 12px;
    background: var(--memo-text);
    color: var(--memo-surface);
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.24);
    font-size: 0.86rem;
}

.notepad-toast[hidden] {
    display: none;
}

.notepad-toast button {
    padding: 5px 7px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.notepad-toast button[data-undo-delete] {
    color: #c7d2fe;
    white-space: nowrap;
}

.notepad-toast .notepad-icon {
    font-size: 18px;
}

.notepad-app__noscript {
    width: min(1240px, 100%);
    margin: 16px auto 0;
    padding: 14px;
    border-radius: 10px;
    background: #fee2e2;
    color: #991b1b;
}

.notepad-seo {
    padding: 88px 20px;
    background: #fff;
    color: #1c2333;
}

.notepad-seo h2,
.notepad-seo h3,
.notepad-seo summary {
    color: inherit;
}

html[data-memo-theme="dark"] .notepad-seo {
    background: var(--memo-bg);
    color: var(--memo-text);
}

.notepad-seo--soft {
    background: #f6f7fb;
}

html[data-memo-theme="dark"] .notepad-seo--soft,
html[data-memo-theme="dark"] .notepad-seo--guides {
    background: var(--memo-surface-soft);
}

.notepad-seo__container {
    width: min(1120px, 100%);
    margin: 0 auto;
}

.notepad-seo__container--narrow {
    width: min(820px, 100%);
}

.notepad-seo__heading {
    max-width: 700px;
    margin-bottom: 38px;
}

.notepad-seo__heading h2 {
    margin: 5px 0 14px;
    font-size: clamp(1.8rem, 4vw, 2.7rem);
    line-height: 1.3;
}

.notepad-seo__heading p:not(.notepad-seo__kicker) {
    margin: 0;
    color: #667085;
    line-height: 1.8;
}

html[data-memo-theme="dark"] .notepad-seo__heading p:not(.notepad-seo__kicker),
html[data-memo-theme="dark"] .notepad-seo article p,
html[data-memo-theme="dark"] .notepad-seo__faq p,
html[data-memo-theme="dark"] .notepad-seo__text-block {
    color: var(--memo-muted);
}

.notepad-seo__kicker {
    margin: 0;
    color: #4f46e5;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.15em;
}

.notepad-seo__steps,
.notepad-seo__features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.notepad-seo article {
    padding: 25px;
    border: 1px solid #e4e7ec;
    border-radius: 16px;
    background: #fff;
}

html[data-memo-theme="dark"] .notepad-seo article {
    border-color: var(--memo-border);
    background: var(--memo-surface);
}

.notepad-seo article > span {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    border-radius: 10px;
    background: #eef2ff;
    color: #4f46e5;
    font-weight: 900;
}

.notepad-seo article h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
}

.notepad-seo article p {
    margin: 0;
    color: #667085;
    font-size: 0.92rem;
    line-height: 1.75;
}

.notepad-seo__features {
    grid-template-columns: repeat(3, 1fr);
}

.notepad-seo__features--two-column {
    grid-template-columns: repeat(2, 1fr);
}

.notepad-seo__text-block {
    max-width: 820px;
    color: #667085;
    font-size: 1rem;
    line-height: 1.9;
}

.notepad-seo__text-block p {
    margin: 0 0 18px;
}

.notepad-seo__text-block p:last-child {
    margin-bottom: 0;
}

.notepad-seo__table-wrap {
    overflow-x: auto;
}

.notepad-seo__table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    overflow: hidden;
    border: 1px solid #e4e7ec;
    border-radius: 16px;
    background: #fff;
}

.notepad-seo__table th,
.notepad-seo__table td {
    padding: 18px;
    border-bottom: 1px solid #e4e7ec;
    border-right: 1px solid #e4e7ec;
    text-align: left;
    vertical-align: top;
    line-height: 1.75;
}

.notepad-seo__table th {
    color: #1c2333;
    font-weight: 850;
}

.notepad-seo__table td {
    color: #667085;
}

.notepad-seo__table tr:last-child th,
.notepad-seo__table tr:last-child td {
    border-bottom: 0;
}

.notepad-seo__table th:last-child,
.notepad-seo__table td:last-child {
    border-right: 0;
}

html[data-memo-theme="dark"] .notepad-seo__table {
    border-color: var(--memo-border);
    background: var(--memo-surface);
}

html[data-memo-theme="dark"] .notepad-seo__table th,
html[data-memo-theme="dark"] .notepad-seo__table td {
    border-color: var(--memo-border);
}

html[data-memo-theme="dark"] .notepad-seo__table th {
    color: var(--memo-text);
}

html[data-memo-theme="dark"] .notepad-seo__table td {
    color: var(--memo-muted);
}

.notepad-seo__faq {
    border-top: 1px solid #e4e7ec;
}

.notepad-seo__faq details {
    border-bottom: 1px solid #e4e7ec;
}

html[data-memo-theme="dark"] .notepad-seo__faq,
html[data-memo-theme="dark"] .notepad-seo__faq details {
    border-color: var(--memo-border);
}

.notepad-seo__faq summary {
    padding: 21px 2px;
    font-weight: 800;
    cursor: pointer;
}

.notepad-seo__faq p {
    margin: -4px 0 22px;
    color: #667085;
    line-height: 1.8;
}

.notepad-seo--guides {
    background: #181d2a;
    color: #fff;
}

.notepad-seo--guides .notepad-seo__heading p:not(.notepad-seo__kicker) {
    color: #c3c8d4;
}

.notepad-seo__guide-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.notepad-seo__guide-link {
    display: inline-flex;
    padding: 12px 18px;
    border-radius: 10px;
    background: #fff;
    color: #3730a3;
    font-weight: 800;
    text-decoration: none;
}

.notepad-seo__guide-link--secondary {
    border: 1px solid #6b7280;
    background: transparent;
    color: #fff;
}

@media (max-width: 840px) {
    .notepad-app {
        padding: 16px 12px 30px;
    }

    .notepad-app__frame {
        min-height: 650px;
        border-radius: 16px;
    }

    .notepad-app__masthead {
        min-height: 78px;
        padding: 14px 16px;
    }

    .notepad-app__subtitle {
        display: none;
    }

    .notepad-app__workspace {
        grid-template-columns: 1fr;
        min-height: 570px;
    }

    .notepad-sidebar {
        position: absolute;
        z-index: 40;
        inset: 0 auto 0 0;
        width: min(330px, calc(100vw - 45px));
        border-right: 1px solid var(--memo-border);
        box-shadow: 18px 0 45px rgba(0, 0, 0, 0.18);
        transform: translateX(-105%);
        visibility: hidden;
        transition: transform 180ms ease, visibility 180ms ease;
    }

    .notepad-app.is-sidebar-open .notepad-sidebar {
        transform: translateX(0);
        visibility: visible;
    }

    .notepad-app__overlay {
        position: absolute;
        z-index: 35;
        inset: 0;
        width: 100%;
        border: 0;
        background: rgba(15, 18, 29, 0.48);
    }

    .notepad-app.is-sidebar-open .notepad-app__overlay {
        display: block;
    }

    .notepad-button.notepad-sidebar__close,
    .notepad-button.notepad-editor__menu {
        display: inline-flex;
    }

    .notepad-editor__toolbar {
        justify-content: space-between;
        padding-inline: 12px;
    }

    .notepad-editor__paper {
        padding: 25px 22px 18px;
    }

    .notepad-editor__body {
        min-height: 360px;
        line-height: 1.75;
    }

    .notepad-seo {
        padding: 64px 20px;
    }

    .notepad-seo__steps,
    .notepad-seo__features {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .notepad-app__eyebrow,
    .notepad-app__save-status {
        font-size: 0.7rem;
    }

    .notepad-app__masthead-actions {
        gap: 5px;
    }

    .notepad-editor__paper {
        padding-inline: 18px;
    }

    .notepad-editor__footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .notepad-toast {
        right: 16px;
        bottom: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

/* Editor product controls */
.notepad-app__warning button {
    margin-left: 0;
    padding: 5px 10px;
    border: 1px solid currentColor;
    border-radius: 7px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.notepad-app__warning [data-storage-retry] {
    margin-left: auto;
}

.notepad-app__workspace {
    grid-template-columns: 276px minmax(0, 1fr);
    min-height: max(605px, calc(100dvh - 260px));
}

.notepad-sidebar__filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-top: 10px;
}

.notepad-sidebar__filters select,
.notepad-sidebar__backup-mode select,
.notepad-settings select {
    width: 100%;
    min-height: 36px;
    padding: 6px 28px 6px 9px;
    border: 1px solid var(--memo-border);
    border-radius: 9px;
    background: var(--memo-surface);
    color: var(--memo-text);
    font: inherit;
    font-size: 0.76rem;
}

.notepad-button--compact {
    min-height: 36px;
    padding: 5px 8px;
    border-color: var(--memo-border);
    background: var(--memo-surface);
    font-size: 0.75rem;
}

.notepad-button--compact .notepad-icon {
    font-size: 17px;
}

.notepad-sidebar__trash-count {
    min-width: 19px;
    padding: 1px 5px;
    border-radius: 10px;
    background: var(--memo-primary-soft);
    color: var(--memo-primary);
    font-size: 0.68rem;
}

.notepad-sidebar__storage-note {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px;
    margin: 0 0 3px;
    color: var(--memo-muted);
    font-size: 0.68rem;
    line-height: 1.55;
}

.notepad-sidebar__storage-note .notepad-icon {
    color: var(--memo-primary);
    font-size: 17px;
}

.notepad-button--text {
    min-height: auto;
    justify-content: flex-start;
    margin: 0 0 13px 22px;
    padding: 2px 0;
    border-radius: 0;
    color: var(--memo-primary);
    font-size: 0.7rem;
}

.notepad-button--text:hover {
    background: transparent;
    text-decoration: underline;
}

.notepad-sidebar__backup-mode {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    margin-bottom: 8px;
    color: var(--memo-muted);
    font-size: 0.68rem;
}

.notepad-sidebar__backup-mode select {
    min-height: 32px;
    font-size: 0.68rem;
}

.notepad-editor {
    grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.notepad-editor__mobile-title {
    display: none;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85rem;
    font-weight: 800;
}

.notepad-menu-wrap {
    position: relative;
}

.notepad-menu {
    position: absolute;
    z-index: 30;
    top: calc(100% + 7px);
    right: 0;
    width: 190px;
    overflow: hidden;
    padding: 6px;
    border: 1px solid var(--memo-border);
    border-radius: 12px;
    background: var(--memo-surface);
    box-shadow: 0 18px 45px rgba(19, 25, 44, 0.18);
}

.notepad-menu[hidden],
.notepad-find[hidden] {
    display: none;
}

.notepad-menu button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--memo-text);
    font: inherit;
    font-size: 0.8rem;
    text-align: left;
    cursor: pointer;
}

.notepad-menu button:hover {
    background: var(--memo-primary-soft);
}

.notepad-menu button.notepad-menu__danger {
    color: var(--memo-danger);
}

.notepad-menu .notepad-icon {
    font-size: 18px;
}

.notepad-find {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) auto auto auto auto minmax(130px, 1fr) auto auto auto;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--memo-border);
    background: var(--memo-surface-soft);
}

.notepad-find input[type="text"] {
    width: 100%;
    min-height: 34px;
    padding: 6px 9px;
    border: 1px solid var(--memo-border);
    border-radius: 8px;
    background: var(--memo-surface);
    color: var(--memo-text);
    font: inherit;
    font-size: 0.78rem;
}

.notepad-find button {
    min-height: 34px;
    padding: 5px 8px;
    border: 1px solid var(--memo-border);
    border-radius: 8px;
    background: var(--memo-surface);
    color: var(--memo-text);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
}

.notepad-find button:hover {
    border-color: var(--memo-primary);
    color: var(--memo-primary);
}

.notepad-find .notepad-icon {
    font-size: 17px;
}

.notepad-find__result {
    min-width: 42px;
    color: var(--memo-muted);
    font-size: 0.72rem;
    text-align: center;
}

.notepad-find__case {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--memo-muted);
    font-size: 0.68rem;
    white-space: nowrap;
}

.notepad-find__hint {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--memo-muted);
    font-size: 0.68rem;
    line-height: 1.55;
}

.notepad-editor__body {
    font-family: var(--memo-editor-font-family, inherit);
    font-size: var(--memo-editor-font-size, 16px);
    line-height: 1.82;
    tab-size: var(--memo-tab-size, 4);
    unicode-bidi: plaintext;
}

.notepad-editor__body::selection,
.notepad-editor__title::selection {
    background: #b9c4ff;
    color: #111827;
}

html[data-memo-theme="dark"] .notepad-editor__body::selection,
html[data-memo-theme="dark"] .notepad-editor__title::selection {
    background: #6674d8;
    color: #ffffff;
}

.notepad-app[data-memo-font="sans"] {
    --memo-editor-font-family: system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
}

.notepad-app[data-memo-font="serif"] {
    --memo-editor-font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
}

.notepad-app[data-memo-font="mono"] {
    --memo-editor-font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.notepad-dialog {
    width: min(620px, calc(100vw - 32px));
    max-height: min(760px, calc(100dvh - 32px));
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--memo-border);
    border-radius: 17px;
    background: var(--memo-surface);
    color: var(--memo-text);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.3);
}

.notepad-dialog::backdrop {
    background: rgba(12, 16, 28, 0.62);
    backdrop-filter: blur(3px);
}

.notepad-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px 14px;
    border-bottom: 1px solid var(--memo-border);
}

.notepad-dialog__header h2 {
    margin: 1px 0 0;
    color: var(--memo-text);
    font-size: 1.25rem;
}

.notepad-dialog__header button {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--memo-border);
    border-radius: 9px;
    background: transparent;
    color: var(--memo-text);
    cursor: pointer;
}

.notepad-dialog__kicker {
    margin: 0;
    color: var(--memo-primary);
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.13em;
}

.notepad-dialog__lead {
    margin: 0;
    padding: 15px 22px;
    color: var(--memo-muted);
    font-size: 0.82rem;
    line-height: 1.7;
}

.notepad-dialog__list {
    max-height: min(470px, calc(100dvh - 245px));
    overflow: auto;
    padding: 4px 14px 14px;
}

.notepad-dialog__empty {
    margin: 0;
    padding: 48px 22px;
    color: var(--memo-muted);
    text-align: center;
}

.notepad-dialog__footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 22px max(14px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--memo-border);
}

.notepad-dialog-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 13px 8px;
    border-bottom: 1px solid var(--memo-border);
}

.notepad-dialog-item h3,
.notepad-dialog-item p {
    margin: 0;
}

.notepad-dialog-item--history p {
    display: -webkit-box;
    max-height: 2.8em;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.notepad-dialog-item h3 {
    color: var(--memo-text);
    font-size: 0.9rem;
}

.notepad-dialog-item p {
    max-width: 380px;
    overflow: hidden;
    color: var(--memo-muted);
    font-size: 0.74rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notepad-dialog-item time {
    color: var(--memo-muted);
    font-size: 0.68rem;
}

.notepad-dialog-item__actions {
    display: flex;
    gap: 6px;
}

.notepad-dialog-item__actions button {
    padding: 7px 9px;
    border: 1px solid var(--memo-border);
    border-radius: 8px;
    background: var(--memo-surface-soft);
    color: var(--memo-text);
    font: inherit;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
}

.notepad-dialog-item__actions button.is-danger {
    color: var(--memo-danger);
}

.notepad-settings {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    padding: 22px;
}

.notepad-settings label {
    display: grid;
    gap: 7px;
    color: var(--memo-muted);
    font-size: 0.76rem;
    font-weight: 700;
}

.notepad-settings .notepad-settings__check {
    display: flex;
    align-items: center;
    align-self: end;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--memo-border);
    border-radius: 9px;
    background: var(--memo-surface-soft);
}

.notepad-settings select {
    min-height: 42px;
    font-size: 0.82rem;
}

.notepad-storage-status {
    display: grid;
    gap: 1px;
    margin: 20px 22px 4px;
    overflow: hidden;
    border: 1px solid var(--memo-border);
    border-radius: 12px;
    background: var(--memo-border);
}

.notepad-storage-status p {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 14px;
    margin: 0;
    padding: 11px 13px;
    background: var(--memo-surface-soft);
    font-size: 0.78rem;
}

.notepad-storage-status span {
    color: var(--memo-muted);
}

.notepad-app.is-fullscreen {
    position: fixed;
    z-index: 100;
    inset: 0;
    padding: 0;
    background: var(--memo-bg);
}

.notepad-app.is-fullscreen .notepad-app__frame {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.notepad-app.is-fullscreen .notepad-app__masthead,
.notepad-app.is-fullscreen .notepad-sidebar {
    display: none;
}

.notepad-app.is-fullscreen .notepad-app__workspace {
    grid-template-columns: 1fr;
    min-height: 100dvh;
    height: 100dvh;
}

.notepad-app.is-fullscreen .notepad-editor__body {
    min-height: 0;
}

body.notepad-fullscreen-active {
    overflow: hidden;
}

@media (max-width: 840px) {
    .notepad-app__workspace {
        grid-template-columns: 1fr;
        min-height: max(570px, calc(100dvh - 142px));
    }

    .notepad-editor__mobile-title {
        display: block;
        flex: 1;
        margin: 0 8px;
    }

    .notepad-editor__actions {
        gap: 5px;
    }

    .notepad-editor__actions .notepad-button--icon {
        width: 37px;
        min-height: 37px;
    }

    .notepad-editor__mobile-action {
        display: inline-flex;
    }

    .notepad-editor__actions [data-pin-note],
    .notepad-editor__actions [data-copy-note],
    .notepad-editor__actions [data-fullscreen-toggle] {
        display: none;
    }

    .notepad-find {
        grid-template-columns: minmax(110px, 1fr) auto auto auto;
    }

    .notepad-find__case,
    .notepad-find > label:nth-of-type(2),
    .notepad-find [data-replace-one],
    .notepad-find [data-replace-all] {
        grid-row: 2;
    }

    .notepad-find__case {
        grid-column: 1 / 2;
    }

    .notepad-find > label:nth-of-type(2) {
        grid-column: 2 / 3;
    }

    .notepad-find [data-replace-one] {
        grid-column: 3 / 4;
    }

    .notepad-find [data-replace-all] {
        grid-column: 4 / 5;
    }

    .notepad-app.is-fullscreen .notepad-app__workspace {
        min-height: 100dvh;
        height: 100dvh;
    }

    .notepad-dialog-item {
        grid-template-columns: 1fr;
    }

    .notepad-dialog-item__actions {
        justify-content: flex-end;
    }
}

@media (max-width: 520px) {
    .notepad-app__save-status {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .notepad-toast {
        bottom: max(16px, env(safe-area-inset-bottom));
    }

    .notepad-settings {
        grid-template-columns: 1fr;
    }

    .notepad-dialog__footer {
        flex-wrap: wrap;
    }

    .notepad-editor__actions > [data-copy-note] {
        display: none;
    }

    .notepad-find {
        grid-template-columns: minmax(0, 1fr) auto auto;
        gap: 7px;
    }

    .notepad-find > label:first-child {
        grid-column: 1 / 2;
        grid-row: 1;
    }

    .notepad-find__result {
        grid-column: 1 / 2;
        grid-row: 2;
        text-align: left;
    }

    .notepad-find [data-find-previous] {
        grid-column: 2 / 3;
        grid-row: 1;
    }

    .notepad-find [data-find-next] {
        grid-column: 3 / 4;
        grid-row: 1;
    }

    .notepad-find__case {
        grid-column: 2 / 4;
        grid-row: 2;
        justify-self: end;
    }

    .notepad-find > label:nth-of-type(2) {
        grid-column: 1 / 2;
        grid-row: 3;
    }

    .notepad-find [data-replace-one] {
        grid-column: 2 / 3;
        grid-row: 3;
        white-space: nowrap;
    }

    .notepad-find [data-replace-all] {
        grid-column: 3 / 4;
        grid-row: 3;
        white-space: nowrap;
    }

    .notepad-find [data-find-close] {
        display: none;
    }

    .notepad-find__hint {
        grid-column: 1 / -1;
        grid-row: 4;
    }
}

@media print {
    .pg-header,
    .pg-footer,
    .notepad-app__masthead,
    .notepad-sidebar,
    .notepad-editor__toolbar,
    .notepad-find,
    .notepad-editor__footer,
    .notepad-toast,
    .notepad-seo {
        display: none !important;
    }

    .notepad-app,
    .notepad-app__frame,
    .notepad-app__workspace,
    .notepad-editor {
        display: block;
        min-height: 0;
        padding: 0;
        border: 0;
        box-shadow: none;
    }

    .notepad-editor__paper {
        padding: 0;
    }

    .notepad-editor__body {
        min-height: 0;
        overflow: visible;
    }
}
