:root {
    --text-main: #1f2937;
    --text-gray: #6b7280;
    --bg: #f9fafb;
    --card-bg: #ffffff;
    --accent: #3b82f6;
    --line: #e5e7eb;
    --w: 92%;
    --max-w: 900px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    border: 0;
    font: inherit;
    background: transparent;
}

.container {
    width: var(--w);
    max-width: var(--max-w);
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 16px 0 10px;
    background: rgba(249, 250, 251, 0.94);
    border-bottom: 1px solid rgba(229, 231, 235, 0.72);
    backdrop-filter: blur(8px);
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.toolbar__title h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.toolbar__title p {
    margin: 6px 0 0;
    color: var(--text-gray);
    font-size: 14px;
}

.toolbar__search {
    width: min(280px, 100%);
}

.toolbar__search input {
    width: 100%;
    height: 40px;
    padding: 0 14px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-main);
    font: inherit;
    outline: none;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.toolbar__search input:focus {
    border-color: #cbd5e1;
    background: #fff;
    box-shadow: none;
}

.nav-groups {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sub-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
}

.sub-nav__label {
    color: #9ca3af;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.nav-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.group-label {
    min-width: 36px;
    margin-top: 2px;
    padding: 1px 8px 1px 0;
    color: #111827;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-align: left;
    flex-shrink: 0;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
    align-items: center;
}

.tag-list::-webkit-scrollbar {
    display: none;
}

.tag-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--text-gray);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.tag-item:hover {
    background: #ffffff;
    border-color: #e5e7eb;
    color: #1f2937;
}

.tag-item.active {
    color: var(--accent);
    background: #ffffff;
    border-color: #dbeafe;
    font-weight: 500;
}

.tag-item__count {
    color: #9ca3af;
    font-size: 12px;
}

.memo-list-wrap {
    padding-top: 24px;
    padding-bottom: 48px;
}

.memo-meta {
    color: #9ca3af;
    font-size: 12px;
    letter-spacing: 0.02em;
}

.memo-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.memo-card,
.empty-state {
    background: var(--card-bg);
    border: 1px solid #f1f5f9;
    border-radius: 10px;
    box-shadow: none;
}

.memo-card {
    padding: 18px 20px;
    animation: fade-up 0.4s ease;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.markdown-lite {
    font-size: 14px;
    line-height: 1.75;
    word-break: break-word;
    color: #374151;
}

.markdown-lite strong {
    display: block;
    color: #111827;
    font-weight: 600;
}

.memo-card__head {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.memo-card__title {
    line-height: 1.35;
}

.memo-card__desc {
    position: relative;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.55;
}

.memo-card__desc:not(:empty)::before {
    content: "#";
    display: inline-block;
    margin-right: 5px;
    color: #818cf8;
    font-size: 12px;
    font-weight: 700;
}

.memo-card__links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #e5e7eb;
}

.markdown-lite.capsule a {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 4px 10px;
    border: 1px solid #eef2f7;
    border-radius: 999px;
    background: #fafbfc;
    font-size: 13px;
    line-height: 1.35;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.markdown-lite.capsule a:hover {
    background: #ffffff;
    border-color: #dbe3ee;
    transform: translateY(-1px);
    opacity: 0.9;
}

.empty-state {
    margin-top: 12px;
    padding: 40px 24px;
    text-align: center;
}

.empty-state h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.empty-state p {
    margin: 0;
    color: var(--text-gray);
}

.is-hidden {
    display: none;
}

@media (max-width: 720px) {
    .site-header {
        position: static;
        padding: 10px 0 8px;
    }

    .toolbar {
        align-items: center;
        gap: 10px;
        margin-bottom: 8px;
    }

    .toolbar__search {
        width: min(140px, 42vw);
        flex-shrink: 0;
    }

    .toolbar__title {
        min-width: 0;
    }

    .toolbar__title h1 {
        font-size: 20px;
    }

    .toolbar__title p {
        display: none;
    }

    .toolbar__search input {
        height: 34px;
        padding: 0 12px;
        font-size: 13px;
    }

    .nav-row {
        align-items: center;
        gap: 8px;
    }

    .sub-nav {
        gap: 8px;
        margin-top: 8px;
        padding-top: 8px;
    }

    .group-label {
        min-width: 28px;
        margin-top: 0;
        padding-right: 0;
        font-size: 12px;
    }

    .nav-groups {
        gap: 4px;
    }

    .tag-list {
        flex: 1;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 6px;
        padding-bottom: 2px;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .tag-item {
        flex: 0 0 auto;
        padding: 3px 8px;
        font-size: 12px;
        white-space: nowrap;
    }

    .sub-nav__label {
        font-size: 11px;
    }

    .memo-list-wrap {
        padding-top: 16px;
    }

    .memo-card {
        padding: 14px 16px;
    }

    .memo-meta {
        font-size: 11px;
    }

    .markdown-lite {
        font-size: 13px;
        line-height: 1.7;
    }

    .markdown-lite.capsule a {
        min-height: 28px;
        padding: 4px 9px;
        font-size: 12px;
    }
}
