/* sik2.net 스타일. 빌드 도구 없이 이 파일 하나만 쓴다.
   색·로고·캐릭터 기준: dev\pc-tools\디자인가이드.md (식이_디자인 세션, 2026-10-29)
   - 아이덴티티는 연보라 #b7a2f0, 짝꿍 진보라 #3d2a66. 화면 대부분은 흰·검·회색, 연보라는 포인트.
   - 연보라는 흰 바탕 대비 약 2.0이라 라이트에서 글자·얇은 선으로 쓰지 않는다(바탕 채움만).
   - 색은 아래 이름으로만 쓴다(본문에 hex 직접 쓰지 않기). */
:root {
    color-scheme: light dark;

    /* 연보라 단계 */
    --violet-50: #f6f1ff;
    --violet-100: #ede3fc;
    --violet-200: #d3bcf0;
    --violet-300: #b7a2f0;   /* 메인 */
    --violet-400: #a38ac9;
    --violet-500: #8568b1;   /* 리본 */
    --violet-600: #6e5a9e;
    --violet-800: #3d2a66;   /* 진보라 짝꿍 */

    /* 라이트 */
    --bg: #ffffff;
    --surface: #f6f1ff;
    --border: #e2d9f6;
    --text: #1b1b22;
    --text-sub: #6e6a80;
    --primary: #b7a2f0;
    --on-primary: #3d2a66;
    --primary-hover: #c8b8f6;
    --primary-pressed: #ab95eb;
    --disabled-bg: #ede3fc;
    --disabled-text: #6e6a80;
    --focus: #8568b1;
    --accent-text: #6e5a9e;
    --select: #ede3fc;
    --logo: #3d2a66;          /* 따옴표 로고 = 진보라(가이드). 다크는 진보라가 안 보여 연보라 */
    --ok: #1f7a55;
    --warn: #8a6100;
    --warn-bg: #fff4cc;
    --danger: #d12f46;
    --danger-on: #ffffff;
    --serif: "Nanum Myeongjo", "나눔명조", AppleMyungjo, "Noto Serif KR", "Noto Serif CJK KR", Batang, "바탕", serif;
    /* 깊이와 곡선(웹 가이드 4장): 바탕 빛 < 종이 < 떠 있는 것. 안쪽 모서리가 바깥보다 작아야 곡선이 맞는다 */
    --r-paper: 14px;
    --r-inner: 10px;
    --shadow: 0 1px 2px rgba(61, 42, 102, .05), 0 8px 24px rgba(61, 42, 102, .07);
    --shadow-hover: 0 2px 4px rgba(61, 42, 102, .07), 0 14px 32px rgba(61, 42, 102, .12);
    --shadow-float: 0 4px 8px rgba(61, 42, 102, .08), 0 20px 48px rgba(61, 42, 102, .18);
    --btn-top: #c3b0f4;
    --btn-bot: #ae98ec;
    --btn-hover-top: #d0c0f7;
    --btn-hover-bot: #bda9f1;
    --btn-light: rgba(255, 255, 255, .35);
    --btn-shadow: 0 1px 2px rgba(61, 42, 102, .2), 0 3px 8px rgba(61, 42, 102, .14);
    --paper-edge: rgba(61, 42, 102, .08);
    --wash: #f3edfe;
}
@media (prefers-color-scheme: dark) {
    :root {
        --shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
        --shadow-hover: inset 0 1px 0 rgba(255, 255, 255, .07), 0 2px 4px rgba(0, 0, 0, .45), 0 14px 32px rgba(0, 0, 0, .5);
        --shadow-float: inset 0 1px 0 rgba(255, 255, 255, .08), 0 4px 8px rgba(0, 0, 0, .5), 0 20px 48px rgba(0, 0, 0, .6);
        --btn-light: rgba(255, 255, 255, .3);
        --btn-shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 3px 8px rgba(0, 0, 0, .35);
        --paper-edge: rgba(255, 255, 255, .06);
        --wash: #211a33;
        /* 웹 다크는 종이가 바탕보다 밝아야 떠 보인다(유틸과 맞바꿈, 가이드 2장) */
        --bg: #1c1a24;
        --surface: #121116;
        --border: #34304a;
        --text: #f2effa;
        --text-sub: #9c98b0;
        --primary: #b7a2f0;
        --on-primary: #3d2a66;
        --primary-hover: #c8b8f6;
        --primary-pressed: #ab95eb;
        --disabled-bg: #2a2736;
        --disabled-text: #6e6a80;
        --focus: #b7a2f0;
        --accent-text: #b7a2f0;
        --select: #34294f;
        --logo: #b7a2f0;
        --ok: #5fd3a0;
        --warn: #f2c94c;
        --warn-bg: #3a3115;
        --danger: #ff6b7a;
        --danger-on: #1b1b22;
    }
}

/* 기본 */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 17px/1.75 system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", sans-serif;
    word-break: keep-all;
    overflow-wrap: anywhere;
}
a { color: var(--accent-text); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--select); color: var(--text); }
h1, h2, h3 { line-height: 1.35; letter-spacing: -0.01em; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }
body.admin .wrap { max-width: 960px; }

/* 따옴표 로고 (직접 그린 물방울 모양, 색은 currentColor) */
.quote-mark { display: inline-block; width: 1.25em; height: 1em; color: var(--logo); vertical-align: -0.1em; }

/* 머리글·바닥글 */
.site-header { border-bottom: 1px solid var(--border); margin-bottom: 40px; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.brand img { width: 32px; height: 32px; display: block; }   /* 말풍선 따옴표 로고(C안), 28~36px */
.site-header nav { display: flex; align-items: center; gap: 18px; font-size: .95rem; flex-wrap: wrap; }
.site-header nav a { color: var(--text-sub); text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--primary); }
.site-footer { border-top: 1px solid var(--border); margin-top: 72px; padding: 28px 0 40px; color: var(--text-sub); font-size: .85rem; }
.site-footer .wrap { display: flex; align-items: center; gap: 10px; }
.site-footer .quote-mark { width: 1.6em; height: 1.3em; }

/* 일기장 틀: 왼쪽 기둥(이름·메뉴) + 오른쪽 내용. 연보라 바탕 위에 흰 종이 */
body.site { background: radial-gradient(1100px 520px at 18% -80px, var(--wash), transparent 70%) no-repeat, var(--surface); }
.shell { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px 56px; max-width: 1040px; margin: 0 auto; padding: 56px 24px 72px; }
.rail { grid-row: 1 / span 2; position: sticky; top: 40px; align-self: start; text-align: center; }
.rail-brand { display: block; color: var(--logo); text-decoration: none; }
.rail-owl { display: block; width: 72px; height: 72px; margin: 0 auto 10px; }
.rail-name { display: inline-flex; align-items: center; gap: 9px; font-family: var(--serif); font-size: 1.35rem; font-weight: 700; }
.rail-name img { width: 28px; height: 28px; display: block; }
.rail-tagline { margin: 4px 0 0; font-family: var(--serif); font-size: .85rem; color: var(--accent-text); }
.rail-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 28px; }
.rail-nav a { display: block; padding: 6px 12px; border-radius: var(--r-inner); color: var(--text-sub); text-decoration: none; font-size: .95rem; }
.rail-nav a:hover { background: var(--select); color: var(--text); }
.rail-nav a[aria-current="page"] { background: var(--select); color: var(--accent-text); font-weight: 700; }
.site-foot { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0 8px; color: var(--text-sub); font-size: .78rem; }
.site-foot > * { white-space: nowrap; }
.site-foot a { display: inline-flex; align-items: center; min-height: 36px; color: var(--text-sub); text-decoration: underline; }
.site-foot a:hover { color: var(--text); }

.main { min-width: 0; }
.paper { background: var(--bg); border: 1px solid var(--paper-edge); border-radius: var(--r-paper); box-shadow: var(--shadow); }
body.admin .paper { box-shadow: none; }
.paper-body { padding: 36px 40px; margin-bottom: 16px; }
.page-title { margin: 0 0 20px; font-family: var(--serif); font-size: 1.6rem; color: var(--logo); }
.page-lead { margin: -12px 0 24px; color: var(--text-sub); }

/* 글 목록: 왼쪽 큰 날짜 + 제목·요약 + (있으면) 첫 사진 */
.entry { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 20px; padding: 22px 24px; margin-bottom: 12px; transition: transform .15s, box-shadow .15s; }
.entry:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.entry-date { display: block; text-align: center; color: var(--accent-text); }
.entry-date .day { display: block; font-size: 1.9rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.entry-date .month { display: block; font-size: .75rem; font-variant-numeric: tabular-nums; }
.entry-main { min-width: 0; }
.entry h2 { margin: 0; font-family: var(--serif); font-size: 1.2rem; }
.entry h2 a { color: var(--text); text-decoration: none; }
.entry h2 a:hover { color: var(--accent-text); }
.entry p { margin: 6px 0 8px; color: var(--text-sub); font-size: .95rem; }
.entry .poem-lines { font-family: var(--serif); color: var(--text); line-height: 1.95; white-space: pre-line; }
.entry-thumb { display: block; width: 132px; height: 96px; border-radius: 6px; overflow: hidden; background: var(--surface); }
.entry-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cat { display: inline-block; padding: 0 10px; border-radius: 999px; background: var(--select); color: var(--accent-text); font-size: .76rem; font-weight: 700; line-height: 1.75; text-decoration: none; }
.cat:hover { text-decoration: underline; }
.meta { display: flex; align-items: center; gap: 8px; color: var(--text-sub); font-size: .85rem; }

/* 자료실 목록 */
.post-item { position: relative; padding: 20px 24px; margin-bottom: 12px; }
.post-item h2 { margin: 0; font-size: 1.15rem; }
.post-item h2 a { color: var(--text); text-decoration: none; }
.post-item h2 a:hover { color: var(--accent-text); }
.post-item time, .post time { color: var(--text-sub); font-size: .85rem; }
.post-item p { margin: 8px 0 0; color: var(--text-sub); }
.empty { color: var(--text-sub); }
.empty-state { text-align: center; padding: 40px 0; color: var(--text-sub); }
.pager { display: flex; justify-content: space-between; margin: 24px 0; }

/* 글 본문 */
.post h1 { font-family: var(--serif); font-size: 1.8rem; margin: 0 0 8px; }
.post-body figure { margin: 1.8em 0; }
.post-body figure img { display: block; width: 100%; }
.post-body figcaption { margin-top: 8px; text-align: center; color: var(--text-sub); font-size: .85rem; }
.post-body { margin-top: 28px; }
.post-body img { max-width: 100%; height: auto; border-radius: var(--r-inner); }
.post-body h2 { margin-top: 2em; font-size: 1.35rem; }
.post-body h3 { margin-top: 1.6em; font-size: 1.15rem; }
.post-body pre { background: var(--surface); border: 1px solid var(--border); padding: 12px 16px; overflow-x: auto; border-radius: var(--r-inner); }
.post-body code { background: var(--surface); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.post-body pre code { padding: 0; background: none; }
.post-body blockquote {
    position: relative; margin: 1.5em 0; padding: 14px 18px 14px 52px;
    background: var(--surface); border-radius: 12px; color: var(--text);
}
.post-body blockquote::before {
    content: ""; position: absolute; left: 16px; top: 16px; width: 26px; height: 21px;
    background: var(--logo);
    -webkit-mask: url("/brand/quote.svg") no-repeat center / contain;
    mask: url("/brand/quote.svg") no-repeat center / contain;
}
.post-body blockquote p { margin: 0; }
.post-body hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }

/* 카드·폼 */
.card { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 20px 24px; margin-bottom: 24px; }
.card.narrow { max-width: 420px; margin: 40px auto; }
.card h1, .card h2 { margin-top: 0; }
label { display: block; margin-bottom: 16px; font-weight: 600; font-size: .95rem; }
label small { font-weight: 400; color: var(--text-sub); }
label.check { font-weight: 400; display: flex; gap: 8px; align-items: center; }
input[type=checkbox] { accent-color: var(--violet-500); width: 16px; height: 16px; }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=datetime-local], input[type=date], input[type=file], select, textarea {
    display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
    font: inherit; font-weight: 400; color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--r-inner);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 2px var(--focus); }
textarea { font-family: ui-monospace, Consolas, monospace; font-size: .95rem; line-height: 1.6; }

/* 버튼 4상태 (가이드 4장): 주 버튼 = 연보라 바탕 + 진보라 글자 */
button, .button {
    display: inline-block; padding: 9px 18px; font: inherit; font-size: .95rem; font-weight: 700;
    color: var(--on-primary); background: linear-gradient(var(--btn-top), var(--btn-bot)); border: 0; border-radius: var(--r-inner);
    box-shadow: inset 0 1px 0 var(--btn-light), var(--btn-shadow);
    cursor: pointer; text-decoration: none; transition: transform .15s, box-shadow .15s;
}
button:hover, .button:hover { background: linear-gradient(var(--btn-hover-top), var(--btn-hover-bot)); transform: translateY(-1px); }
button:active, .button:active { background: var(--primary-pressed); box-shadow: inset 0 1px 2px rgba(61, 42, 102, .25); transform: none; }
button:disabled { background: var(--disabled-bg); color: var(--disabled-text); box-shadow: none; transform: none; cursor: default; }
/* 입체는 주 버튼에만. 한 화면에서 하나만 도드라지게 */
button.secondary, button.danger, button.link { box-shadow: none; }
button.secondary:hover, button.danger:hover, button.link:hover { transform: none; }
button.secondary { background: transparent; color: var(--accent-text); border: 1px solid var(--focus); }
button.secondary:hover { background: var(--select); }
button.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
button.danger:hover { background: var(--danger); color: var(--danger-on); }
button.link { background: none; color: var(--text-sub); padding: 0; font-weight: 400; text-decoration: underline; text-underline-offset: 3px; }
button.link:hover { color: var(--text); background: none; }
form.inline { display: inline; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row label { flex: 1 1 220px; }
.actions { display: flex; gap: 16px; align-items: center; }
.toolbar { display: flex; justify-content: space-between; align-items: center; }
.danger-zone { text-align: right; }

/* 알림·상태 */
.notice { background: var(--select); border-radius: var(--r-inner); padding: 10px 14px; }
.error { color: var(--danger); }
.muted { color: var(--text-sub); font-size: .9rem; }
.small { font-size: .8rem; }
.qr svg { background: #fff; padding: 8px; border-radius: var(--r-inner); }
.codes { background: var(--surface); padding: 12px 16px; border-radius: var(--r-inner); }
code.big { font-size: 1.2rem; letter-spacing: .05em; }
details { margin-bottom: 16px; }

/* 표 */
table.list { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.list th, table.list td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
table.list th { color: var(--text-sub); font-weight: 600; }
table.list tbody tr:hover { background: var(--surface); }
@media (max-width: 600px) {
    table.list th:nth-child(4), table.list td:nth-child(4) { display: none; }
}

/* 일기 사진 */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 24px 0; }
.photos img { width: 100%; height: auto; border-radius: var(--r-inner); display: block; }
.photos figure { margin: 0; }
.photos figure form { margin-top: 6px; }

/* 댓글 */
.comments h2 { margin-top: 0; }
.comments .comments-head { display: flex; align-items: center; gap: 6px; margin-bottom: 16px; font-size: 1rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.comments-head svg { flex: none; color: var(--accent-text); }
.comments-head + .tool-contact { margin: -12px 0 16px; font-size: .85rem; color: var(--text-sub); text-wrap: balance; }
.comments-head + .tool-contact a { display: inline-block; padding: 8px 0; margin: -8px 0; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 50; transform: translateX(-50%); width: max-content; max-width: min(480px, calc(100vw - 32px)); padding: 10px 16px; background: var(--select); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-inner); font-size: .9rem; box-shadow: var(--shadow-float); pointer-events: none; opacity: 0; transition: opacity .15s; }
.toast.on { opacity: 1; }
.toast:empty { padding: 0; border: 0; box-shadow: none; }
@media (max-width: 800px) { .toast { bottom: calc(16px + env(safe-area-inset-bottom)); } }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
@media (forced-colors: active) { .toast { border-color: CanvasText; } }
.comment { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; padding: 14px 0; }
.comment-avatar { display: block; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--surface); box-shadow: 0 0 0 1px var(--border); }
.comment-main { min-width: 0; }
.comment-thread { border-bottom: 1px solid var(--border); padding: 6px 0; }
.comments textarea { font-family: inherit; }
.comment-write { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; margin-top: 20px; padding: 16px; background: var(--surface); border-radius: var(--r-inner); }
.comment-write textarea { background: var(--bg); }
.comment-who { display: block; margin-bottom: 6px; font-size: .9rem; font-weight: 400; color: var(--text-sub); overflow-wrap: anywhere; }
.comment-who strong { color: var(--text); }
.comment-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 8px; }
.comment-acts .inline { display: flex; }
.comment-acts button.link { min-height: 36px; font-size: .9rem; line-height: 36px; }
.comment-send { margin-left: auto; }
.comment-guest label { margin-bottom: 8px; }
.comment-send[hidden] { display: none; }
.comment-login-note { flex: 1 1 220px; min-width: 0; margin: 0; font-size: .85rem; text-wrap: balance; }
.comment-guest ::placeholder { color: var(--text-sub); opacity: 1; }
.comment-login-link { display: inline-block; min-height: 36px; line-height: 36px; font-size: .9rem; color: var(--text-sub); }
.comment p { margin: 4px 0; }
.comment-meta { margin: 4px 0; font-size: .9rem; color: var(--text-sub); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.comment-meta strong { color: var(--text); }
.comment-meta form.inline { display: flex; margin: -8px 0 -8px auto; width: auto; }
.comment-meta button.link { min-height: 36px; }
.comment-owner { padding: 1px 8px; border-radius: 999px; background: var(--select); color: var(--accent-text); font-size: .75rem; font-weight: 700; }
.comment.hidden, tr.hidden { opacity: .5; }
.comment-form { margin-top: 16px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; }

/* 시 보기: 제목은 가운데, 본문은 왼쪽 정렬로 좁게 */
.post.poem { text-align: center; }
.post.poem .meta { justify-content: center; }
.post.poem .post-body { display: inline-block; max-width: 30em; margin-top: 40px; text-align: left; font-family: var(--serif); font-size: 1.1rem; line-height: 2.1; }
.post.poem .post-body p { margin: 0 0 1.9em; }
.post.poem > p { text-align: left; }

/* 이전 글·다음 글 */
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.post-nav a { display: block; padding: 14px 18px; color: var(--text); text-decoration: none; }
.post-nav a:hover { background: var(--select); }
.post-nav small { display: block; color: var(--text-sub); font-size: .8rem; }
.post-nav span { font-weight: 600; }
.post-nav .next { grid-column: 2; text-align: right; }

/* 글쓰기: 사진 넣기 */
.post-images { margin-bottom: 16px; }
.editor-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.editor-bar [data-status] { flex: 1 1 280px; font-size: .85rem; }
.uploaded { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 12px; }
.uploaded:empty { display: none; }
.uploaded figure { margin: 0; border: 1px solid var(--border); border-radius: var(--r-inner); overflow: hidden; }
.uploaded img { display: block; width: 100%; height: 90px; object-fit: cover; }
.uploaded figcaption { display: flex; justify-content: space-between; padding: 4px 8px; }
.uploaded button.link { font-size: .82rem; }
.uploaded button.del, table.list button.del { color: var(--danger); }

/* 유틸 */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.tool-grid .empty-state { grid-column: 1 / -1; }
.tool-card { display: flex; gap: 16px; align-items: center; padding: 18px 20px; color: var(--text); text-decoration: none; }
.tool-card { transition: transform .15s, box-shadow .15s, background .15s; }
.tool-card:hover { background: var(--select); transform: translateY(-2px); box-shadow: var(--shadow-hover); }
@media (prefers-reduced-motion: reduce) {
    .entry, .tool-card, button, .button { transition: none; }
    .entry:hover, .tool-card:hover, button:hover, .button:hover { transform: none; }
}
.tool-card-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tool-summary { color: var(--text-sub); font-size: .92rem; text-wrap: balance; }
/* 올림 바탕 select 위에서 text-sub는 라이트 대비 4.2로 모자란다 */
.tool-card:hover .tool-summary, .tool-card:hover .muted { color: var(--text); }
.tool-icon { flex: none; display: block; border-radius: 14px; }
.tool-icon-empty { display: flex; align-items: center; justify-content: center; background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: 1.4rem; }
/* 날짜 입력칸이 아주 좁은 폰에서 칸 밖으로 나가지 않게 */
input[type="datetime-local"], input[type="date"] { min-width: 0; max-width: 100%; box-sizing: border-box; }

input[type=file][hidden] { display: none; }
.row > label { min-width: 0; }

/* 사진 크게 보기 */
.can-zoom { cursor: zoom-in; }
.lightbox-open { overflow: hidden; }
.lightbox { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; overflow: hidden; background: rgba(0, 0, 0, .9); touch-action: none; user-select: none; -webkit-user-select: none; }
.lightbox[hidden] { display: none; }
/* 사진이 화면을 꽉 채우면 눌러서 닫을 빈 곳이 없어지므로 항상 여백을 남긴다 */
.lightbox-picture { display: block; max-width: calc(100vw - 48px); max-height: calc(100vh - 96px); max-height: calc(100dvh - 96px); cursor: zoom-in; transform-origin: center; will-change: transform; }
.lightbox.is-zoomed .lightbox-picture { cursor: grab; }
.lightbox-foot { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; margin: 0; padding: 12px 16px; color: #fff; font-size: .9rem; text-align: center; text-shadow: 0 1px 3px #000; pointer-events: none; }
.lightbox-count { opacity: .8; }
.lightbox-closer { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); border: 0; }

/* 공유 */
.share-box { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.share-button { display: inline-flex; align-items: center; gap: 6px; }
.share-button[hidden] { display: none; }
.share-copy { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; }
.meta .share-box { margin-left: auto; }
.meta .share-button { height: 36px; min-height: 36px; padding: 0 12px; }

/* 도구 화면 사진 */
.tool-shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 16px; margin: 24px 0; }
.tool-shots figure { margin: 0; min-width: 0; }
.tool-shots img { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--r-inner); }
.tool-shots figcaption { margin-top: 6px; color: var(--text-sub); font-size: .85rem; }
.tool-contact { margin-top: 24px; }

/* 답글 */
.comment-replies { margin-left: 19px; padding-left: 21px; border-left: 2px solid var(--border); }
.comment-replies .comment { grid-template-columns: 32px minmax(0, 1fr); column-gap: 10px; }
.comment-replies .comment-avatar { width: 32px; height: 32px; }
.comment-removed { margin: 8px 0; font-size: .92rem; }
.comment-reply { margin-top: 4px; }
.comment-reply summary { display: inline-block; min-height: 36px; line-height: 36px; color: var(--text-sub); font-size: .9rem; cursor: pointer; list-style: none; }
.comment-reply summary::-webkit-details-marker { display: none; }
.comment-reply summary:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.comment-reply[open] summary { color: var(--accent-text); font-weight: 700; }
.comment-reply label { color: var(--text-sub); font-size: .9rem; }
.comment-reply textarea { margin-top: 4px; color: var(--text); }
[data-reply-cancel] { min-height: 36px; }
[data-reply-cancel][hidden] { display: none; }
.comment-nickname { margin: 0; }
.comment-nickname summary { display: block; width: fit-content; min-height: 36px; line-height: 36px; color: var(--text-sub); font-size: .9rem; cursor: pointer; list-style: none; text-decoration: underline; text-underline-offset: 3px; }
.comment-nickname summary::-webkit-details-marker { display: none; }
.comment-nickname summary:hover { color: var(--text); }
.comment-nickname[open] { order: 3; flex: 1 0 100%; }
.comment-nickname[open] summary { color: var(--accent-text); font-weight: 700; }
.comment-nickname label { color: var(--text-sub); font-size: .9rem; }
.comment-nickname input { margin-top: 4px; color: var(--text); background: var(--bg); max-width: 320px; }
.comment-nickname .small { margin: 8px 0; }

/* 임시 저장·이전 판 */
.autosave-offer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 16px; }
.autosave-offer span { flex: 1 1 200px; }
.revision { border-top: 1px solid var(--border); padding: 8px 0; }
.revision summary { cursor: pointer; overflow-wrap: anywhere; }
.revision-body { max-height: 320px; margin: 8px 0; padding: 12px; overflow: auto; background: var(--surface); border-radius: var(--r-inner); font-size: .9rem; white-space: pre-wrap; overflow-wrap: anywhere; }

/* 검색 */
.rail-nav a.rail-nav-search { display: flex; align-items: center; justify-content: center; gap: 6px; }
.rail-nav-search svg { flex: none; }
.rail-nav a.is-open { background: var(--select); color: var(--accent-text); font-weight: 700; }
.rail-search { display: grid; grid-template-rows: 0fr; margin-top: 0; opacity: 0; visibility: hidden; transition: grid-template-rows .22s ease, margin-top .22s ease, opacity .18s ease, visibility .22s; }
/* 펼칠 때는 바로 보이게 해야 입력칸에 커서를 넣을 수 있다 */
.rail-search.is-open { grid-template-rows: 1fr; margin-top: 8px; opacity: 1; visibility: visible; transition: grid-template-rows .22s ease, margin-top .22s ease, opacity .18s ease, visibility 0s; }
.rail-search-inner { display: flex; flex-direction: column; gap: 6px; min-height: 0; overflow: hidden; }
.rail-search.is-open .rail-search-inner { padding: 2px; }
.rail-search input { min-width: 0; margin: 0; font-size: .9rem; }
.rail-search button { font-size: .9rem; }
@media (max-width: 800px) {
    .rail-search-inner { flex-direction: row; }
    .rail-search input { flex: 1; }
    .rail-search button { flex: none; }
}
@media (prefers-reduced-motion: reduce) { .rail-search { transition: none; } }
.search-form { display: flex; gap: 8px; margin-bottom: 24px; }
.search-form input { flex: 1; min-width: 0; margin: 0; }
.search-form button { flex: none; }
.search-heading { margin: 24px 0 12px; font-size: 1.1rem; }

/* 통계 */
.stats-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin-bottom: 16px; }
.stats-head h1 { margin: 0; }
.stats-periods { display: flex; flex-wrap: wrap; gap: 0 16px; margin: 0; }
.stats-periods a { display: inline-flex; align-items: center; min-height: 36px; }
.stats-periods a[aria-current] { font-weight: 700; color: var(--logo); }
.stats-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stats-card { display: flex; flex-direction: column; min-width: 0; padding: 12px 16px; background: var(--surface); border-radius: var(--r-inner); }
.stats-card-name { color: var(--text-sub); font-size: .85rem; }
.stats-card strong { color: var(--text); font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats-card-change { color: var(--text-sub); font-size: .8rem; word-break: keep-all; }
.stats-plot { display: grid; grid-template-columns: 36px minmax(0, 1fr); column-gap: 8px; }
.stats-ticks { display: block; width: 100%; height: 160px; overflow: visible; }
.stats-ticks text { fill: var(--text-sub); font-size: .75rem; text-anchor: end; }
.stats-chart { display: block; width: 100%; height: 160px; }
.stats-bar { fill: var(--focus); }
.stats-hit { fill: transparent; }
.stats-axis { stroke: var(--border); }
.stats-dates { grid-column: 2; display: flex; justify-content: space-between; gap: 8px; margin: 6px 0 0; color: var(--text-sub); font-size: .75rem; }
.stats-tip { grid-column: 2; min-height: 1.4em; margin: 4px 0 0; }
.stats-numbers { margin: 8px 0 0; }
.stats-numbers > summary, .stats-fold > summary, .stats-more > summary { display: list-item; min-height: 36px; padding: 6px 0; cursor: pointer; }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 16px 0; }
.stats-table { margin: 0; min-width: 0; }
.stats-table h2 { margin: 0 0 8px; font-size: 1rem; font-weight: 700; }
.stats-table .empty { margin: 0; color: var(--text-sub); }
.stats-rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin: 0; padding: 0; list-style: none; }
.stats-rows li { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; padding: 0 8px; font-size: .9rem; }
.stats-row-bar { position: absolute; inset: 0; width: 100%; height: 100%; }
.stats-row-bar rect { fill: var(--select); }
.stats-row-name { position: relative; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-row-value { position: relative; flex: none; font-variant-numeric: tabular-nums; }
.stats-more { margin: 4px 0 0; }
.stats-more > summary { list-style: none; color: var(--accent-text); font-size: .85rem; }
.stats-more > summary::-webkit-details-marker { display: none; }
.stats-more-open, .stats-more[open] .stats-more-closed { display: none; }
.stats-more[open] .stats-more-open { display: inline; }
.stats-fold { margin: 16px 0; }
.stats-name { overflow-wrap: anywhere; }
@media (forced-colors: active) { .stats-row-bar { display: none; } }
@media (max-width: 720px) { .stats-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
    .stats-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stats-chart, .stats-ticks { height: 120px; }
}
.tool-icon-64 { width: 64px; height: 64px; }
.tool-icon-96 { width: 96px; height: 96px; }
.tool-head { display: flex; gap: 20px; align-items: center; }
.tool-head h1 { margin: 0; font-family: var(--serif); font-size: 1.7rem; }
.tool-head .tool-summary { margin: 4px 0 0; }
.tool-download { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 24px 0; padding: 16px 18px; background: var(--surface); border-radius: var(--r-inner); }
.tool-download .button { padding: 11px 26px; }
.tool-download .muted { min-width: 0; }
.tool-download details { flex-basis: 100%; margin: 0; }
.tool-download .tool-install > summary { display: list-item; min-height: 36px; }
.tool-install-note { flex-basis: 100%; margin: -6px 0 0; color: var(--text-sub); font-size: .85rem; }
.tool-install { min-width: 0; font-size: .85rem; }
.tool-install > summary { color: var(--text-sub); }
.tool-install h3 { margin: 12px 0 2px; font-size: .85rem; font-weight: 700; }
.tool-install p { margin: 0 0 6px; }
.tool-install ul { margin: 0; padding-left: 18px; }
.tool-install li { min-height: 36px; }
.tool-install a { display: inline-flex; align-items: center; min-height: 36px; }
.tool-install-value, .tool-install-command { display: block; font-size: .8rem; overflow-wrap: anywhere; word-break: break-all; }
.tool-install-command { margin: 0 0 6px; padding: 6px 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; }
.tool-page { position: relative; }
.tool-facts { margin-top: -12px; padding: 16px; background: var(--surface); border-radius: var(--r-inner); }
.tool-facts h2 { margin: 0 0 12px; color: var(--text); font-size: 1rem; font-weight: 700; }
.tool-facts dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin: 0; }
.tool-facts dt { color: var(--text-sub); font-size: .8rem; }
.tool-facts dd { margin: 2px 0 0; color: var(--text); font-size: .95rem; font-weight: 700; word-break: keep-all; }
@media (max-width: 319.98px) { .tool-facts dl { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 1600px) {
    .tool-facts-wrap { position: absolute; top: 0; bottom: 0; left: calc(100% + 25px); width: 240px; }
    .tool-facts { position: sticky; top: 40px; margin-top: 0; background: var(--bg); border: 1px solid var(--paper-edge); border-radius: var(--r-paper); box-shadow: var(--shadow); }
    .tool-facts dl { grid-template-columns: minmax(0, 1fr); }
}
.tool-intro { margin-top: 24px; }
.tool-intro figure { margin: 0 0 24px; }
.tool-intro figure img { margin: 0 auto; width: auto; max-width: 100%; max-height: 560px; height: auto; border: 1px solid var(--border); cursor: zoom-in; }
.tool-intro figcaption { word-break: keep-all; }
.tool-sources { display: inline-flex; align-items: center; min-height: 36px; }
.oss-list { list-style: none; margin: 0; padding: 0; }
.oss-list li { padding: 8px 0; border-top: 1px solid var(--border); }
.oss-list .muted { display: block; overflow-wrap: anywhere; }
.oss-list details { margin: 0; }
.tool-versions { margin-top: 32px; }
.tool-versions h2 { font-size: 1.15rem; margin-bottom: 8px; }
.tool-version { padding: 0; margin: 0; border-top: 1px solid var(--border); }
.tool-page details > summary { display: list-item; min-height: 36px; padding: 6px 0; cursor: pointer; }
.tool-version summary strong { margin-right: 8px; }
.tool-version > .notice { margin: 0 0 8px; }
.tool-version > .post-body { margin: 0 0 12px; }
.tool-previous { margin: 16px 0; border-top: 1px solid var(--border); padding-top: 8px; }
.tool-previous > .notice { margin: 4px 0 10px; color: var(--text); }
.tool-previous > a { margin-right: 8px; }
.tool-version .post-body { margin-top: 6px; font-size: .95rem; }
.tool-version .post-body p:first-child { margin-top: 0; }
.tool-version .post-body p:last-child { margin-bottom: 0; }
.tool-version details { margin: 6px 0 0; }
.sha { display: block; overflow-wrap: anywhere; word-break: break-all; }

/* 관리: 유틸 버전 */
.inbox-item { padding: 12px 0; border-top: 1px solid var(--border); }
.release-row { padding: 12px 0; border-top: 1px solid var(--border); }
.release-row p { margin: 0 0 6px; }
.release-row details { margin-bottom: 6px; }
.loose-files { margin: 16px 0 0; }
.check-row { align-self: end; }

/* 폰: 첫 화면이 아니면 머리를 한 줄로(왼쪽 로고와 이름, 오른쪽 메뉴) */
@media (max-width: 800px) {
    .rail-compact { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; text-align: left; }
    .rail-compact .rail-owl, .rail-compact .rail-tagline { display: none; }
    .rail-compact .rail-nav { margin-top: 0; }
    .rail-compact .rail-search { flex-basis: 100%; }
    .rail-compact .rail-search:not(.is-open) { height: 0; }
}

/* 오류 화면 */
.error-page { text-align: center; }
.error-page img { display: block; width: 96px; height: 96px; margin: 0 auto 12px; }
.error-page h1 { margin: 0 0 8px; font-family: var(--serif); font-size: 1.6rem; }
.error-page p { margin: 0 0 20px; color: var(--text-sub); }

/* 고대비 모드: 시스템 색을 쓰게 두고 지금 메뉴·주 버튼·테두리만 정한다 */
@media (forced-colors: active) {
    .rail-nav a[aria-current="page"], button, .button { background: Highlight; color: HighlightText; forced-color-adjust: none; }
    body.site, button:hover, .button:hover { background-image: none; }
    .paper, input, select, textarea { border: 1px solid CanvasText; }
    .comment-write { border: 1px solid CanvasText; }
}

/* 좁은 화면: 기둥이 위로 올라오고 메뉴는 가로로 */
@media (max-width: 800px) {
    .shell { grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 24px 16px 48px; }
    .rail { position: static; }
    .rail-owl { width: 64px; height: 64px; }
    .rail-nav { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 16px; }
    .rail-nav a { padding: 6px 11px; font-size: .9rem; }
    .rail { grid-row: auto; }
    .site-foot { grid-column: 1; }
    .paper-body { padding: 24px 20px; }
    .comment { grid-template-columns: 32px minmax(0, 1fr); column-gap: 10px; }
    .comment-avatar { width: 32px; height: 32px; }
    .comment-replies { margin-left: 15px; padding-left: 12px; }
    .comment-replies .comment { grid-template-columns: 28px minmax(0, 1fr); column-gap: 8px; }
    .comment-replies .comment-avatar { width: 28px; height: 28px; }
    .comment-write { grid-template-columns: minmax(0, 1fr); padding: 12px; }
    .comment-write > .comment-avatar { display: none; }
    .entry { grid-template-columns: 46px minmax(0, 1fr); gap: 12px; padding: 18px 16px; }
    .entry-date .day { font-size: 1.5rem; }
    .entry-thumb { grid-column: 2; width: 100%; height: 150px; }
    .post-nav { grid-template-columns: 1fr; }
    .post-nav .next { grid-column: 1; }
    .tool-grid { grid-template-columns: minmax(0, 1fr); }
    .tool-head { flex-direction: column; text-align: center; }
    .tool-head img, .tool-head .tool-icon { width: 80px; height: 80px; }
}


/* 아주 좁거나 크게 확대해 꼬리말이 두 줄로 꺾일 때 가운데 점을 숨긴다 */
@media (max-width: 220px) {
    .site-foot-dot { display: none; }
}

/* 좁은 화면: 손가락으로 누르기 쉽게 혼자 있는 링크·글자 버튼은 높이 36 이상 */
@media (max-width: 800px) {
    button.link, .entry h2 a, .post-item h2 a, details > a, .admin main a,
    main p > a:only-child:not(.post-body a) { display: inline-flex; align-items: center; min-height: 36px; }
    .cat { position: relative; }
    .cat::after { content: ""; position: absolute; inset: -8px 0; }
}

/* 좁은 화면 관리 화면: 머리글은 두 줄, 표는 줄마다 카드처럼 쌓아 칸 제목을 앞에 붙인다(칸 제목은 layouts/admin의 스크립트가 넣음) */
@media (max-width: 800px) {
    .brand { flex-shrink: 0; min-height: 36px; white-space: nowrap; }
    .site-header .wrap { flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
    .site-header nav { gap: 2px 14px; }
    .site-header nav a { display: inline-flex; align-items: center; min-height: 36px; }
    summary { display: list-item; min-height: 36px; line-height: 36px; }
    table.list a { display: inline-block; max-width: 100%; padding: 6px 0; min-height: 36px; }
    table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
    table.list thead { display: none; }
    table.list tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
    table.list tr:last-child { border-bottom: 0; }
    table.list td, table.list th:nth-child(4), table.list td:nth-child(4) { display: block; padding: 2px 0; border: 0; text-align: left; }
    table.list td[data-label]:not([data-label=""])::before { content: attr(data-label); margin-right: 8px; color: var(--text-sub); font-size: .85rem; }
}
