@font-face {
    font-family: "Bricolage Grotesque";
    src: url("https://cdn.jsdelivr.net/npm/@fontsource-variable/bricolage-grotesque/files/bricolage-grotesque-latin-opsz-normal.woff2") format("woff2-variations");
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Bricolage Grotesque";
    src: url("https://cdn.jsdelivr.net/npm/@fontsource-variable/bricolage-grotesque/files/bricolage-grotesque-latin-ext-opsz-normal.woff2") format("woff2-variations");
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Bookk Gothic";
    src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2302@1.0/BookkGothic-Lt.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
    unicode-range: U+1100-11FF, U+3130-318F, U+A960-A97F, U+AC00-D7A3, U+D7B0-D7FF;
}
@font-face {
    font-family: "Bookk Gothic";
    src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2302@1.0/BookkGothic-Bd.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
    unicode-range: U+1100-11FF, U+3130-318F, U+A960-A97F, U+AC00-D7A3, U+D7B0-D7FF;
}

:root {
    color-scheme: light dark;

    --color-bg: #fdfcf9;
    --color-bg-alt: #f3f0e8;
    --color-text: #1c1b18;
    --color-accent: #639c59;          /* 草綠 하나로 統一: 글자·채움·點·테두리·루비 */
    --color-accent-ink: #639c59;      /* 글자·흰 글자 버튼用 草綠 (=accent. 對比를 올린 #4a7c41 은 되돌림) */
    --color-on-accent: #fff;

    --color-border: #e9e5db;          /* 가는 줄 */
    --color-border-strong: #d5cfc1;   /* 입력欄·表 테두리 */
    --color-rule: #bdb6a6;            /* 머리글 겹줄 */

    --color-muted: #625e56;
    --color-muted-2: #736e65;         /* 메타·날짜 */
    --color-muted-3: #78736a;         /* 個數처럼 가장 옅은 것 */
    --color-muted-4: #a19b90;
    --color-muted-5: #4a4740;         /* 메뉴 글자 */

    --color-danger: #a61b29;
    --color-danger-bg: #a61b29;
    --color-success: #2e7d32;

    --color-discord: #5865f2;
    --color-discord-hover: #4752c4;

    --shadow-color: rgba(0, 0, 0, 0.08);

    --font-title: "Newsreader", serif;
    --font-latin: "Newsreader";
    --font-body: var(--font-latin), "Bookk Gothic", "Zen Old Mincho", "Shippori Mincho B1", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
    --font-hanja: var(--font-latin), "Zen Old Mincho", "Shippori Mincho B1", var(--font-body);
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --weight-regular: 350;
    --weight-bold: 650;

    --fs-caption: 0.8125rem;   /* 13 — 날짜, 個數, 메타 */
    --fs-ui: 0.82rem;         /* 14 — 버튼, 메뉴, 칩, 링크, 表 */
    --fs-body: 0.926rem;      /* 15 — 本文 */
    --fs-lead: 0.94rem;           /* 16 — 글 目錄 題目 */
    --fs-h3: 1.0925rem;        /* 17 */
    --fs-h2: 1.2175rem;        /* 19 — 本文 小題目, 목록 페이지 題目 */
    --fs-h1: 1.625rem;         /* 26 — 글 題目 */

    --control-h: 2.125rem;     /* 34 — 입력欄·버튼 */
    --chip-h: 1.875rem;        /* 30 — 分類 칩, 表記 切替 */
    --pill: 999px;             /* 누르는 것 */
    --radius: 10px;            /* 담는 것: 글상자, 코드 */
    --radius-sm: 4px;          /* 그림, 인라인 코드 */

    --max-width: 640px;        /* 本文 한 줄 한글 約 40字 */
    --gutter: 1.5rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #16161a;
        --color-bg-alt: #201f24;
        --color-text: #e7e5e0;
        --color-accent: #9cbb5e;
        --color-accent-ink: #9cbb5e;
        --color-on-accent: #16161a;

        --color-border: #2c2c30;
        --color-border-strong: #3d3c41;
        --color-rule: #4a494e;

        --color-muted: #b7b5b0;
        --color-muted-2: #9a9994;
        --color-muted-3: #85837e;
        --color-muted-4: #706e69;
        --color-muted-5: #c9c7c2;

        --color-danger: #ff7b7b;
        --color-danger-bg: #b00020;
        --color-success: #6fcf76;

        --color-discord: #5865f2;
        --color-discord-hover: #6f79f5;

        --shadow-color: rgba(0, 0, 0, 0.35);
    }
}

* {
    box-sizing: border-box;
    user-select: none;
}

input, textarea { user-select: text; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: var(--fs-body);
    font-weight: var(--weight-regular);
    font-optical-sizing: auto;
    line-height: 1.7;
    color: var(--color-text);
    background: var(--color-bg);
    word-break: keep-all;
    overflow-wrap: break-word;
    transition: background-color 0.2s ease, color 0.2s ease;
}

b, strong, th { font-weight: var(--weight-bold); }

input, button, textarea, select {
    font-family: var(--font-body);
    font-weight: var(--weight-regular);
    color: inherit;
}

a, .return-link {
    color: var(--color-accent-ink);
    text-decoration: none;
    text-underline-offset: 0.25em;
    text-decoration-thickness: 1px;
}
a:hover { text-decoration: underline; }

:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.search-form button,
.comment-form button, .reply-form button, .edit-form button,
.delete-form button, .admin-form button,
.discord-login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45em;
    height: 1.86rem;
    padding: 0 1rem;
    border: 1px solid transparent;
    border-radius: var(--pill);
    font-size: var(--fs-ui);
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, filter 0.15s ease;
}

.search-form button,
.comment-form button, .reply-form button, .edit-form button, .admin-form button {
    border-color: var(--color-accent-ink);
    background: var(--color-accent-ink);
    color: var(--color-on-accent);
}
.search-form button:hover,
.comment-form button:hover, .reply-form button:hover, .edit-form button:hover, .admin-form button:hover {
    filter: brightness(1.1);
}
.search-form button:active,
.comment-form button:active, .reply-form button:active, .edit-form button:active, .admin-form button:active {
    filter: brightness(0.95);
}

.delete-form button {
    border-color: var(--color-danger-bg);
    background: var(--color-danger-bg);
    color: #fff;
}
.reply-form input[type="text"], .reply-form input[type="password"],
.delete-form input[type="password"], .admin-form input,
.comment-form textarea, .reply-form textarea, .edit-form textarea, .delete-form textarea,
.post-body-input {
    border: 1px solid var(--color-border-strong);
    background: var(--color-bg);
    color: var(--color-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
:is(input, textarea)::placeholder { color: var(--color-muted-3); }
:is(.comment-form, .reply-form, .edit-form, .delete-form, .admin-form, .post-form) :is(input, textarea):focus {
    outline: 0;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 18%, transparent);
}

.site-header {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2.25rem var(--gutter) 0;
}

.site-header-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
}

.site-title {
    margin-right: auto;
    font-family: var(--font-title);
    font-size: 2rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.01em;
    font-style: italic;
    color: var(--color-text);
}
.site-title:hover { text-decoration: none; color: var(--color-accent-ink); }

.header-account { display: flex; align-items: center; }

.search-form {
    display: flex;
    align-items: center;
    height: var(--control-h);
    padding: 3px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--pill);
    background: var(--color-bg);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-form:focus-within {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 18%, transparent);
}
.search-form input[type="text"] {
    width: 9rem;
    height: 100%;
    padding: 0 0.5rem 0 0.75rem;
    border: 0;
    background: transparent;
    color: var(--color-text);
    font-size: var(--fs-ui);
}
.search-form input[type="text"]:focus { outline: 0; }
.search-form button {
    height: 100%;
    padding: 0 0.85rem;
}

.user-badge,
.login-link {
    font-size: var(--fs-ui);
    color: var(--color-muted);
    white-space: nowrap;
}
.user-badge a { color: var(--color-accent-ink); }
.login-link {
    display: inline-flex;
    align-items: center;
    height: var(--control-h);
    padding: 0 0.25rem;
}
.login-link:hover { color: var(--color-accent-ink); }

.discord-login-btn {
    background: var(--color-discord);
    color: #fff !important;
    text-decoration: none !important;
}
.discord-login-btn:hover { background: var(--color-discord-hover); }

.category-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 1.25rem;
    font-size: var(--fs-ui);
    line-height: 1.5;
}
.category-nav a {
    display: inline-flex;
    align-items: baseline;
    gap: 0.25em;
    color: var(--color-muted-5);
}
.category-nav .count {
    font-size: var(--fs-caption);
    color: var(--color-muted-3);
    font-variant-numeric: tabular-nums;
    padding-top: 0.15em;
}

.site-header .category-nav {
    margin-top: 1.5rem;
    padding-bottom: 0.85rem;
    border-bottom: 3px double var(--color-rule);
}
.site-header .category-nav a { padding-block: 0.2rem; }
.site-header .category-nav a:hover { color: var(--color-accent-ink); text-decoration: none; }

.site-main > .category-nav {
    gap: 0.5rem;
    margin: 0 0 1.5rem;
}
.site-main > .category-nav a {
    align-items: center;
    height: var(--chip-h);
    padding: 0 0.8rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--pill);
    line-height: 1;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.site-main > .category-nav a:hover {
    border-color: var(--color-accent);
    color: var(--color-accent-ink);
    text-decoration: none;
}
.site-main > .category-nav a.is-active {
    border-color: var(--color-accent-ink);
    background: var(--color-accent-ink);
    color: var(--color-on-accent);
}
.site-main > .category-nav a.is-active .count {
    color: inherit;
    opacity: 0.75;
}

.site-main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2.25rem var(--gutter) 4rem;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: var(--weight-bold);
    color: var(--color-text);
    text-wrap: balance;
}

h1 a { color: var(--color-text); }
h1 a:hover { text-decoration: none; color: var(--color-accent-ink); }

.site-main > h1 {
    margin: 0 0 1rem;
    font-size: var(--fs-h1);
    line-height: 1.4;
}
.site-main > h1:has(+ .category-nav) { margin-bottom: 1.5rem; }

.post-list-subcategory-current { color: var(--color-accent-ink); }

.post-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.post-list-item {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.25rem 1.5rem;
    padding: 0.7rem 0 0.5rem;
    border-bottom: 1px solid var(--color-border);
    line-height: 1.5;
}
.post-list-item > a {
    flex: 1 1 15rem;
    font-size: var(--fs-lead);
    color: var(--color-text);
    text-wrap: pretty;
}
.post-list-item > a:hover { color: var(--color-accent-ink); text-decoration: none; }

.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.92rem;
    font-size: var(--fs-caption);
    color: var(--color-muted-2);
}
.post-list-item .post-meta { white-space: nowrap; }

.post-category { color: var(--color-accent-ink) !important; }
.post-category:hover { text-decoration: underline !important; }

.post-date {
    font-size: var(--fs-caption);
    color: var(--color-muted-2);
    font-variant-numeric: tabular-nums;
}

.search-result-count {
    margin: 0 0 1rem;
    font-size: var(--fs-ui);
    color: var(--color-muted-2);
}

.return-button a,
.return-link {
    display: inline-flex;
    align-items: center;
    height: var(--chip-h);
    padding: 0 0.9rem 0 0.75rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--pill);
    color: var(--color-muted-5);
    font-size: var(--fs-ui);
    line-height: 1;
    text-decoration: none !important;
    transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.return-button a:hover,
.return-link:hover {
    border-color: var(--color-accent);
    color: var(--color-accent-ink);
    transform: translateX(-2px);
}
.post > p:has(> .return-link) { margin: 2rem 0 0; }


.post h1 {
    margin: 0 0 0.75rem;
    font-size: var(--fs-h1);
    line-height: 1.45;
}

.post > .post-meta {
    align-items: center;
    margin: 0 0 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.post-body { line-height: 2; }
.post-body > p { margin: 0 0 1.1em; }
.post-body > :first-child { margin-top: 0; }

.post-body h2 {
    font-size: var(--fs-h2);
    line-height: 1.5;
}
.post-body h3 {
    font-size: var(--fs-h3);
    line-height: 1.55;
}
.post-body h4, .post-body h5, .post-body h6 {
    font-size: var(--fs-body);
    line-height: 1.6;
}

.post-body img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1.5rem 0;
    border-radius: var(--radius-sm);
}

.post-body hr {
    width: 4rem;
    margin: 2.5rem auto;
    border: 0;
    border-top: 1px solid var(--color-rule);
}

/* 장면 나눔: ⁂ (애스터리즘), * * * (딩커스) */
.post-body .asterism,
.post-body .dinkus {
    margin: 1.75rem 0;
    text-align: center;
    text-indent: 0;
    line-height: 1;
    color: var(--color-muted-2);
}
.post-body .asterism { font-size: 1.25em; }
.post-body .dinkus { letter-spacing: 1em; margin-right: -1em; }

ol, ul { padding-inline-start: 20px; }
li::marker { color: var(--color-muted-3); }

blockquote {
    margin: 1.5rem 0;
    padding: 0.1rem 0 0.1rem 1.1rem;
    border-left: 2px solid var(--color-accent);
    color: var(--color-muted-5);
    word-break: break-all;
}
blockquote > :first-child { margin-top: 0; }
blockquote > :last-child { margin-bottom: 0; }

code, pre { font-family: var(--font-mono); font-size: 0.875em; }
code { padding: 0.1em 0.35em; border-radius: var(--radius-sm); background: var(--color-bg-alt); }
pre { padding: 1rem 1.25rem; border-radius: var(--radius); background: var(--color-bg-alt); overflow-x: auto; line-height: 1.6; }
pre code { padding: 0; background: none; }

.accented { color: var(--color-accent-ink); }

.katex {
    font: normal 1.1em KaTeX_Main, "Times New Roman", serif !important;
}
/* 數式 속 한글·漢字·가나: 本文과 같은 글꼴·크기로 (layout.php 의 mathCjkFonts 가 감싼다) */
.katex .math-ko { font-family: var(--font-body); }
.katex :is(.hj, .math-ko) { font-style: normal; font-size: calc(1em / 1.1); }
/* 한글 글꼴(Bookk Gothic)은 글자가 기준선 아래로 처져 있다. 數式 안에서는 漢字를 내리지 않고 한글을 올려 맞춘다 */
.katex .hj { top: 0; }
.katex .math-ko { position: relative; top: -0.08em; }

.tw {
    width: 100%;
    margin-block: 1.5em;
    overflow-x: scroll;
    scrollbar-width: none;
}
table {
    border-collapse: collapse;
    width: max-content;
    margin-block: 0;
    line-height: 1.5;
    border-top: 1.5px solid var(--color-text);
    border-bottom: 1.5px solid var(--color-text);
}
th, td {
    padding: 0.52rem 0.75rem 0.38rem;
    border-top: 1px solid var(--color-border-strong);
    font-size: 0.92rem;
    word-break: break-all;
}
body.mode-ruby th, body.mode-ruby td {
    padding: 0.45rem 0.75rem 0.5rem;
}
tr:first-child > :is(th, td) { border-top: 0; }
tr:last-child > :is(th, td) { border-bottom: 0; }
th {
    background: var(--color-bg-alt);
    border-bottom-color: var(--color-rule);
}

.gloss {
    width: max-content;
    margin-block: .5em;
    overflow-x: scroll;
    scrollbar-width: none;
    line-height: 1.75;
}
.gloss-line { display: flex; flex-direction: row; gap: 0.8rem; }
.gloss-word { display: inline-flex; flex-direction: column; }
.gloss-translation { margin: 0.25rem 0 0; color: var(--color-muted); }

ruby {
    font-size: 1.12em;
    font-family: var(--font-hanja);
}

body.mode-ruby ruby {
    vertical-align: 1.04em;
    display: inline-flex;
    justify-content: center;
    flex-direction: column-reverse;
    line-height: 1;
}

body.mode-ruby rt {
    color: var(--color-accent-ink);
    text-align: center;
    display: block;
    display: ruby-text;
    line-height: 2.1;
    font-weight: normal;
    position: relative;
    top: -0.14em;
}

body.reading-mode .post-body {
    font-size: calc(var(--fs-body) * 1.05);   /* 原來 12pt → 12.6pt 比率 維持 */
}

body.reading-mode ruby {
    display: inline;
    font-size: inherit;
    vertical-align: baseline;
}

body.mode-mixed rt {
    display: none !important;
}

body.mode-mixed ruby {
    vertical-align: -0.07em;
}

/* 國漢文混用에서 누른 漢字는 그 자리에서 讀音으로 */
@media (hover: hover) { body.mode-mixed .post :is(h1, .post-body) ruby:not(a ruby) { cursor: pointer; } }
body.mode-mixed ruby { -webkit-tap-highlight-color: transparent; }
html body.mode-mixed ruby.show-reading { font-size: inherit; font-family: inherit; vertical-align: baseline !important; }
body.mode-mixed ruby.show-reading > .rb { display: none; }
body.mode-mixed ruby.show-reading > rt { display: inline !important; color: var(--color-accent-ink); font-weight: inherit; line-height: inherit; font-size: inherit; animation: reading-in 0.25s ease; }
body.mode-mixed ruby.back > .rb { animation: reading-in 0.4s ease; }
@keyframes reading-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { body.mode-mixed ruby.show-reading > rt, body.mode-mixed ruby.back > .rb { animation: none; } }

body.reading-mode .rb {
    display: none;
}

body.reading-mode rt {
    display: inline;
    color: inherit;
    font-weight: inherit;
    line-height: inherit;
    font-size: inherit;
}

.hj { font-family: var(--font-hanja); font-size: 1.1em; line-height: 1; position: relative; top: 0.08em; display: inline-block; }

.reading-toggle-btn {
    position: fixed;
    right: max(1.25rem, env(safe-area-inset-right));
    bottom: max(1.25rem, env(safe-area-inset-bottom));
    z-index: 10;
    display: inline-flex;
    align-items: center;
    height: var(--chip-h);
    padding: 0.05rem 0.9rem 0 0.75rem;   /* return-link 과 같게 */
    border: 1px solid var(--color-border-strong);
    border-radius: var(--pill);
    background: color-mix(in srgb, var(--color-bg) 90%, transparent);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    color: var(--color-text);
    font-size: var(--fs-ui);
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.reading-toggle-btn:active { transform: scale(0.97); }
.reading-toggle-btn:hover { border-color: var(--color-accent); color: var(--color-accent-ink); }

@property --dot-1 { syntax: "<color>"; inherits: false; initial-value: transparent; }
@property --dot-2 { syntax: "<color>"; inherits: false; initial-value: transparent; }
@property --dot-3 { syntax: "<color>"; inherits: false; initial-value: transparent; }

.reading-toggle-btn::after {
    --dot-off: var(--color-border-strong);
    --dot-1: var(--color-accent);
    --dot-2: var(--dot-off);
    --dot-3: var(--dot-off);
    content: "";
    flex: none;
    width: 0.8125rem;           /* 點 5px × 2 + 間隔 3px */
    height: 0.3125rem;
    margin-left: 0.7em;
    background:
        radial-gradient(circle closest-side, var(--dot-1) 96%, transparent) 0 0 / 0.3125rem 100% no-repeat,
        radial-gradient(circle closest-side, var(--dot-2) 96%, transparent) 100% 0 / 0.3125rem 100% no-repeat;
    transition: --dot-1 0.25s ease, --dot-2 0.25s ease, --dot-3 0.25s ease;
}
body.reading-mode .reading-toggle-btn::after { --dot-1: var(--dot-off); --dot-2: var(--color-accent); }


.comments-section {
    margin-top: 1.75rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--color-border);
}
.comments-section h2 { margin: 0 0 1rem; font-size: var(--fs-h3); }
.comments-section h3 { margin: 2.5rem 0 0.5rem; font-size: var(--fs-body); }

.comment-list,
.comment-children {
    list-style: none;
    margin: 0;
    padding-left: 0;
}
.comment-list { margin-top: 1.5rem; }
.comment-children {
    margin-top: 1rem;
    padding-left: 1.25rem;
    border-left: 1px solid var(--color-border-strong);
}

.comment { margin-bottom: 1.25rem; }
.comment-author { font-weight: var(--weight-bold); }
.comment-avatar {
    width: 20px;
    height: 20px;
    margin-right: 0.35rem;
    border-radius: 50%;
    vertical-align: middle;
}
.comment-date,
.comment-edited {
    padding-left: 0.4rem;
    font-size: var(--fs-caption);
    color: var(--color-muted-3);
    font-variant-numeric: tabular-nums;
}
.comment-message { margin: 0.3rem 0 0.4rem; }
.no-comments { color: var(--color-muted-2); }

.commenting-as {
    margin: 0 0 0.25rem;
    font-size: var(--fs-ui);
    color: var(--color-muted-2);
}
.login-to-comment { margin-top: 1rem; }

.comment-actions {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-top: 0.2rem;
}
.reply-link, .edit-link, .reply-cancel, .delete-link,
.delete-form-inline button {
    font-size: var(--fs-ui);
    color: var(--color-accent-ink);
    text-decoration: none;
}
.delete-link { color: var(--color-danger); }
.reply-link:hover, .reply-cancel:hover, .delete-link:hover, .edit-link:hover,
.delete-form-inline button:hover { text-decoration: underline; }

.delete-form-inline { display: inline; margin: 0; }
/* 관리자 목록의 削除 단추 (form 안의 button) 를 修正 링크와 같은 높이에 세운다 */
.inline-delete-form { display: inline-flex; vertical-align: middle; margin: 0; }
.delete-form-inline button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-danger);
    font-family: inherit;
    cursor: pointer;
}

.comment-form, .reply-form, .edit-form, .delete-form, .admin-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-width: 480px;
    margin-top: 0.8rem;
}
.delete-form { max-width: 320px; }
.reply-form, .edit-form { margin: 0.6rem 0; }

.comment-form input[type="text"], .comment-form input[type="password"],
.reply-form input[type="text"], .reply-form input[type="password"],
.delete-form input[type="password"], .admin-form input {
    height: var(--control-h);
    padding: 0.3rem 0.9rem;
    border-radius: var(--pill);
    font-size: var(--fs-body);
}
.comment-form textarea, .reply-form textarea, .edit-form textarea, .delete-form textarea {
    min-height: 5.5rem;
    padding: 0.55rem 0.9rem;
    border-radius: var(--radius);
    font-size: var(--fs-body);
    line-height: 1.6;
    resize: vertical;
}

.comment-form button, .reply-form button, .edit-form button, .delete-form button, .admin-form button {
    align-self: flex-start;
}

.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.admin-nav { font-size: var(--fs-ui); color: var(--color-muted); }

.admin-post-list,
.admin-comment-list { list-style: none; padding: 0; }
.admin-post-list li,
.admin-comment-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;   /* 제목·닉네임·날짜·단추를 글자 기준선에 맞춘다 (글꼴마다 상자 높이가 달라 center 로는 들쭉날쭉) */
    gap: 0rem 0.75rem;
    padding: 0.55rem 0 0.45rem;
    border-bottom: 1px solid var(--color-border);
    line-height: 1.8;
}

.admin-page-title {
    color: var(--color-text);
}

.post-meta-inline { color: var(--color-muted-3); font-size: var(--fs-caption); }

.inline-delete-form button,
.inline-fix-form {
    display: inline-flex;
    align-items: center;
    height: 1.625rem;
    padding: 0 0.7rem;
    border: 1px solid;
    border-radius: var(--pill);
    background: transparent;
    font-size: var(--fs-caption);
    line-height: 1;
    cursor: pointer;
    text-decoration: none !important;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.inline-delete-form button { border-color: var(--color-danger); color: var(--color-danger); }
.inline-delete-form button:hover { border-color: var(--color-danger-bg); background: var(--color-danger-bg); color: #fff; }
.inline-fix-form { border-color: var(--color-accent-ink); color: var(--color-accent-ink); vertical-align: middle; }
.inline-fix-form:hover { background: var(--color-accent-ink); color: var(--color-on-accent); }

.post-form { max-width: 720px; }
.post-form-label { display: flex; align-items: center; gap: 0.75rem; }
.post-body-input {
    width: 100%;
    min-height: 380px;
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: var(--fs-ui);
    line-height: 1.6;
    resize: vertical;
}

.form-error { color: var(--color-danger); font-size: var(--fs-ui); }
.form-success { color: var(--color-success); font-size: var(--fs-ui); }

.upload-snippet {
    padding: 0.8rem 1rem;
    border-radius: var(--radius);
    background: var(--color-bg-alt);
    font-size: var(--fs-ui);
    overflow-x: auto;
}
.upload-preview { max-width: 300px; margin-top: 0.5rem; border-radius: var(--radius-sm); }

/* ───────── 꼬리글 ───────── */

.site-footer {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.5rem var(--gutter) 2.5rem;
    font-size: var(--fs-caption);
    color: var(--color-muted-3);
}
.site-footer p { margin: 0; }

@media (max-width: 560px) {
    :root { --gutter: 1.25rem; --fs-h1: 1.4375rem; }
    .site-header { padding-top: 1.75rem; }
    .search-form { order: 3; flex: 1 1 100%; }
    .search-form input[type="text"] { flex: 1; width: auto; min-width: 0; }
    .site-main { padding-top: 1.75rem; }
    .post-list-item > a { flex-basis: 100%; }
    .post > .post-meta { margin-bottom: 1.75rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

body:has(.reading-toggle-btn) .site-footer { padding-bottom: 5.5rem; }

.admin-post-list li .inline-fix-form {
    margin-right: -0.4rem;   /* 修正·削除를 한 쌍으로: 목록의 간격(0.75rem)보다 좁게, 겹치지 않게 */
}

/* Post 확장 문법 — 제공된 기존 CSS 뒤에 추가.
   style-integrated.css에는 이 내용이 이미 포함되어 있습니다. */
:root {
    --font-ipa: "Lucida Grande", "Charis SIL", "Doulos SIL", "Noto Serif", serif;
    --fs-code: 0.86rem;
    --fs-footnote: 0.9rem;
}
/* 기존 margin-right: auto;/ 뒤에서 무시될 수 있는 선언 복구. */
.site-title { font-family: var(--font-title); }

.post-body pre.code-block {
    max-width: 100%;
    margin-block: .5rem;
    font-family: var(--font-mono);
    font-size: var(--fs-code);
    font-weight: 400;
    line-height: 1.6;
    white-space: pre;
    overflow-wrap: normal;
    word-break: normal;
    tab-size: 4;
}
/* 기존 pre와 code의 0.875em이 중복 곱해지지 않게 함. */
.post-body pre code {
    font-family: inherit;
    font-size: 1em;
    font-weight: inherit;
    padding: 0;
    border-radius: 0;
    background: none;
    white-space: inherit;
    overflow-wrap: normal;
    word-break: normal;
}
.post-body :not(pre) > code {
    font-family: var(--font-mono);
    font-size: var(--fs-code);
    font-weight: 400;
    overflow-wrap: anywhere;
}
.post-body kbd {
    display: inline-block;
    padding: .02em .38em;
    border: 1px solid var(--color-border-strong);
    border-bottom-width: 2px;
    border-radius: var(--radius-sm);
    background: var(--color-bg-alt);
    color: var(--color-text);
    font-family: var(--font-mono);
    font-size: var(--fs-code);
    font-weight: 400;
    line-height: 1.5;
    vertical-align: baseline;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
/* IPA는 일반 라틴 글꼴과 분리. 웹폰트 파일은 포함하지 않음. */
.post-body .ipa {
    font-family: var(--font-ipa);
    font-size: 1em;
    font-weight: 400;
    font-style: normal;
    font-variant: normal;
    font-optical-sizing: auto;
    text-transform: none;
    letter-spacing: normal;
    word-break: normal;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    line-height: 1.8;
}
/* 기존 전역 선택 방지 규칙 중 복사가 필요한 새 표기만 예외 처리. */
.post-body pre, .post-body pre *,
.post-body code, .post-body code *,
.post-body kbd, .post-body kbd *,
.post-body .ipa, .post-body .ipa * {
    -webkit-user-select: text;
    user-select: text;
}
.post-body .emphasis-dot {
    font-style: normal;
    -webkit-text-emphasis: filled dot;
    text-emphasis: filled dot;
    -webkit-text-emphasis-position: over right;
    text-emphasis-position: over right;
    text-emphasis-color: currentColor;
}
.post-body .emphasis-dot:has(ruby) {
    -webkit-text-emphasis-position: under right;
    text-emphasis-position: under right;
}
.post-body .emphasis-dot rt {
    -webkit-text-emphasis: none;
    text-emphasis: none;
}
.post-body mark {
    color: var(--color-text);
    background: var(--color-bg-alt);
    background: color-mix(in srgb, var(--color-accent) 22%, var(--color-bg));
    padding-inline: .08em;
}
.post-body del { text-decoration-thickness: .08em; }
/* 일반 수평선은 원래의 중앙 4rem 규칙 유지. */
.post-body .task-item { list-style: none; }
.post-body .task-item label { display: flex; align-items: baseline; gap: .45em; }
.post-body .task-item input {
    flex: 0 0 auto;
    width: 1em;
    height: 1em;
    margin: 0;
    accent-color: var(--color-accent);
}
.post-body .task-item input:disabled { opacity: 1; }
.post-body .task-item label > span { min-width: 0; }
.post-body .definitions { margin-block: .5em; }
.post-body .definitions dt { font-weight: var(--weight-bold); }
.post-body .definitions dd { margin: .3em 0 .75em 1.25em; }
.post-body .callout {
    margin-block: .5rem;
    padding: .8rem 1rem;
    border: 1px solid var(--color-border);
    border-inline-start: 3px solid var(--color-accent);
    border-radius: var(--radius-sm);
    background: var(--color-bg-alt);
    color: var(--color-text);
}
.post-body .callout-title {
    margin: 0 0 .5em;
    font-weight: var(--weight-bold);
}
.post-body .callout > :last-child { margin-bottom: 0; }
/* 접는 콜아웃 ([!type]- / [!type]+) */
.post-body details.callout > summary { cursor: pointer; list-style-position: inside; }
.post-body details.callout:not([open]) > summary { margin-bottom: 0; }
/* 캡션 달린 그림 ![설명](주소 "캡션") */
.post-body figure { margin: 1.5rem 0; }
.post-body figure img { margin: 0 auto; }
.post-body figcaption {
    margin-top: .6rem;
    font-size: var(--fs-caption);
    color: var(--color-muted-3);
    text-align: center;
}
/* 중첩 목록 */
.post-body li > :is(ul, ol) { margin-block: .25em; }
.post-body li > p { margin-block: .4em; }
.post-body .footnotes {
    margin-top: 2.5rem;
    font-size: var(--fs-footnote);
    line-height: 1.8;
    color: var(--color-muted-5);
}
.post-body .footnotes > hr {
    width: 100%;
    margin: 0 0 1rem;
    border-color: var(--color-border-strong);
}
.post-body .footnotes li { margin-block: .6em; scroll-margin-block-start: 4rem; }
.post-body .footnote-ref { scroll-margin-block-start: 4rem; font-variant-numeric: tabular-nums; }
.post-body .footnote-backref { display: inline-block; padding: .15em .3em; }
.post-body .math-display { max-width: 100%; overflow-x: auto; margin-block: .5rem; }
.post-body .tw { max-width: 100%; overflow-x: auto; }
.post-body .align-left { text-align: left; }
.post-body .align-center { text-align: center; }
.post-body .align-right { text-align: right; }
.post-body .gloss-word { flex-shrink: 0; }
.post-body .gloss-tier { white-space: nowrap; }
/* 기존 tw와 gloss의 이중 여백·이중 스크롤은 바깥 tw 한 곳으로 정리. */
.post-body .tw > .gloss { margin-block: 0; overflow: visible; }

/* 題目 첫머리의 여는 全角 괄호 (redesign.css 를 안 쓸 때도) */
.opn { margin-left: -0.5em; }
