/*
 * 천문노트 사이트 디자인 (2026 개편)
 * 옛 구성(밤하늘 배너, 01~05 대메뉴, 좌측 메뉴, 바로 가기)은 유지하고 표현만 현대식으로.
 * 색은 변수로 두고 prefers-color-scheme 으로 라이트/다크를 바꾼다.
 */
:root {
    --bg: #f3f5f8; --card: #fff; --card2: #f7f9fc; --ink: #1c2633; --soft: #66758a; --faint: #97a3b3;
    --line: #e3e8ef; --accent: #3d7ce0; --accent-soft: rgba(61, 124, 224, .10); --ring: rgba(61, 124, 224, .22);
    --brand: #172e40; --green: #7fa83e; --gold: #d9a034; --violet: #8a7cc2; --red: #d9534f;
    --radius: 14px; --radius-s: 9px; --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .05);
    --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
    color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1017; --card: #121a24; --card2: #172130; --ink: #dbe2ea; --soft: #93a1b3; --faint: #6b788a;
        --line: #232e3b; --accent: #8fbcff; --accent-soft: rgba(143, 188, 255, .12); --ring: rgba(143, 188, 255, .25);
        --shadow: 0 1px 2px rgba(0, 0, 0, .3); --green: #a9cf6a; --gold: #edb947; --violet: #a69aca;
    }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.6 var(--font); letter-spacing: -.005em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.ic { width: 1em; height: 1em; vertical-align: -.14em; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------------------------------------------------------- 헤더 */
.hd { position: relative; background: #0a1522 url(/static/topbg.png) center / cover; color: #eef2f8; }
.hd::after { content: ""; position: absolute; inset: auto 0 0 0; height: 1px; background: rgba(255, 255, 255, .08); }
.hd-in { display: flex; align-items: stretch; min-height: 128px; max-width: 1440px; margin: 0 auto; }
.hd-logo { flex: none; display: block; width: 400px; background: url(/static/topleft.jpg) left center / auto 128px no-repeat; }
.nav { flex: 1; display: flex; justify-content: flex-end; }
.nav a { display: flex; flex-direction: column; justify-content: flex-end; width: 112px; padding: 16px 14px 18px;
         color: #eef2f8; border-left: 1px solid rgba(255, 255, 255, .07); text-decoration: none; transition: background .15s; }
.nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; }
.nav a.on { background: linear-gradient(to top, rgba(143, 188, 255, .18), transparent); box-shadow: inset 0 -3px 0 #8fbcff; }
.nav b { display: block; font: 300 30px/1 var(--font); color: rgba(238, 242, 248, .35); letter-spacing: -.02em; }
.nav strong { display: block; margin-top: 8px; font-size: 15px; font-weight: 700; line-height: 1.25; }
.nav small { display: block; margin-top: 3px; font-size: 10.5px; color: rgba(238, 242, 248, .55); line-height: 1.2; }

.bar { background: #070c12; color: #cfd8e3; }
.bar-in { display: flex; align-items: center; gap: 12px; max-width: 1440px; margin: 0 auto; padding: 7px 16px; }
.bar-in .tagline { font-size: 12px; color: #8a97a8; }
.bar form { margin-left: auto; display: flex; gap: 6px; }
.bar input[type=text] { width: 200px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .16);
                        background: rgba(255, 255, 255, .07); color: #eef2f8; font: inherit; font-size: 13px; }
.bar input[type=text]::placeholder { color: rgba(238, 242, 248, .45); }
.bar input[type=text]:focus { outline: none; border-color: #8fbcff; box-shadow: 0 0 0 3px rgba(143, 188, 255, .25); }

/* ---------------------------------------------------------------- 레이아웃 */
.wrap { display: grid; grid-template-columns: 220px minmax(0, 1fr) 220px; gap: 20px; max-width: 1440px; margin: 20px auto; padding: 0 16px; }
.main { min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.main > .card { padding: 22px 24px; }
.side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* 로그인 */
.login { padding: 14px; }
.login form { display: grid; gap: 7px; }
.login input { width: 100%; }
.login .row { display: flex; gap: 6px; }
.login .row > * { flex: 1; justify-content: center; }
.login .hello { display: flex; align-items: center; gap: 10px; }
.login .avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.login .links { display: flex; gap: 10px; font-size: 12px; }

/* 좌측 메뉴 */
.menu-g { padding: 8px; }
.menu-g h3 { display: flex; align-items: center; gap: 8px; margin: 6px 8px 6px; font-size: 12px; font-weight: 700; color: var(--soft); letter-spacing: .02em; }
.menu-g h3::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dot, var(--accent)); }
.menu-g + .menu-g { margin-top: -4px; }
.menu-g ul { list-style: none; margin: 0 0 4px; padding: 0; }
.menu-g a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--ink); font-size: 13.5px; text-decoration: none; }
.menu-g a:hover { background: var(--accent-soft); color: var(--accent); }
.menu-g a.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.social { display: flex; gap: 8px; padding: 2px 4px; }
.social a { color: var(--soft); }

/* 바로 가기 */
.ql2 { padding: 8px; }
.ql2 h3 { margin: 6px 8px 6px; font-size: 12px; font-weight: 700; color: var(--soft); }
.ql2 a { display: grid; grid-template-columns: 34px 1fr; gap: 2px 10px; align-items: center; padding: 8px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.ql2 a:hover { background: var(--accent-soft); }
.ql2 .qi { grid-row: span 2; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: var(--c, var(--accent)); }
.ql2 .qi .ic { width: 18px; height: 18px; }
.ql2 strong { font-size: 13.5px; font-weight: 600; line-height: 1.25; }
.ql2 small { font-size: 11.5px; color: var(--soft); line-height: 1.25; }

/* ---------------------------------------------------------------- 공통 부품 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 14px;
       border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); font: inherit; font-size: 13px;
       cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: border-color .15s, background .15s, color .15s; }
.btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #0b1017; } .btn.primary:hover { color: #0b1017; } }
.btn.ghost { background: transparent; }
.btn.sm { height: 26px; padding: 0 10px; font-size: 12px; }
.btn.danger:hover { border-color: var(--red); color: var(--red); background: rgba(217, 83, 79, .08); }
input[type=text], input[type=password], input[type=email], input[type=search], input[type=date], input[type=time],
input[type=number], input:not([type]), select, textarea {
    height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink);
    font: inherit; font-size: 13.5px; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 10px 12px; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
input[type=button], input[type=submit] { height: 30px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px;
    background: var(--card); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
input[type=button]:hover, input[type=submit]:hover { border-color: var(--accent); color: var(--accent); }

.badge { display: inline-flex; align-items: center; gap: 3px; height: 18px; padding: 0 6px; border-radius: 999px; font-size: 11px;
         font-weight: 600; line-height: 1; color: var(--soft); background: var(--card2); border: 1px solid var(--line); vertical-align: 1px; }
.badge .ic { width: 11px; height: 11px; }
.badge.new { color: #fff; background: var(--accent); border-color: var(--accent); }
@media (prefers-color-scheme: dark) { .badge.new { color: #0b1017; } }
.badge.hot { color: #e8683c; border-color: transparent; background: rgba(232, 104, 60, .12); }
.badge.cm { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.badge.notice { color: #fff; background: var(--violet); border-color: var(--violet); }
.meta { color: var(--soft); font-size: 12.5px; }
.meta .ic { color: var(--faint); }
.note { padding: 10px 14px; border-radius: 10px; background: var(--card2); border: 1px dashed var(--line); color: var(--soft); font-size: 12.5px; }

/* ---------------------------------------------------------------- 홈 */
.home-intro { padding: 18px 22px; }
.home-intro p { margin: 0; }
.home-intro p + p { margin-top: 4px; color: var(--soft); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.blk { padding: 14px 16px 10px; }
.blk-h { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 6px; }
.blk-h h2 { margin: 0; font-size: 15px; font-weight: 700; }
.blk-h h2 a { color: var(--ink); }
.blk-h .more { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: var(--soft); }
.blk-h .more:hover { color: var(--accent); text-decoration: none; }
.lst { list-style: none; margin: 0; padding: 0; }
.lst li { display: flex; align-items: center; gap: 8px; padding: 7px 2px; border-top: 1px solid var(--line); font-size: 13.5px; }
.lst li:first-child { border-top: 0; }
.lst a.t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.lst a.t:hover { color: var(--accent); text-decoration: none; }
.lst time { flex: none; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.lst .empty { color: var(--faint); justify-content: center; padding: 18px; }
.gal { display: grid; grid-template-columns: 1.5fr 1fr; gap: 10px; }
.gal .hero { position: relative; display: block; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: var(--card2); }
.gal .hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gal .hero span { position: absolute; inset: auto 0 0 0; padding: 26px 12px 10px; color: #fff; font-size: 13px; font-weight: 600;
                  background: linear-gradient(transparent, rgba(0, 0, 0, .72)); }
.gal .thumbs { display: grid; gap: 8px; align-content: start; }
.gal .thumbs a { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center; color: var(--ink); font-size: 12.5px; line-height: 1.35; }
.gal .thumbs img, .gal .thumbs .ph { width: 56px; height: 56px; border-radius: 9px; object-fit: cover; background: var(--card2); display: block; }
.gal .thumbs a:hover { color: var(--accent); text-decoration: none; }
.gal .thumbs span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------------------------------------------------------------- 게시판 */
.bd-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.bd-h h1 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.bd-h .meta { margin-top: 2px; }
.bd-tools { display: flex; gap: 8px; }
.rows { border-top: 2px solid var(--ink); }
.rows .r { display: grid; grid-template-columns: 64px minmax(0, 1fr) 110px 64px 60px; align-items: center; gap: 10px;
           padding: 10px 6px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.rows .r.hd2 { color: var(--soft); font-size: 12px; font-weight: 600; padding: 8px 6px; background: var(--card2); }
.rows .r.pin { background: var(--accent-soft); }
.rows .r.cur { box-shadow: inset 3px 0 0 var(--accent); background: var(--card2); }
.rows .n, .rows .d, .rows .h { text-align: center; color: var(--faint); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.rows .s { display: flex; align-items: center; gap: 6px; min-width: 0; }
.rows .s a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 500; }
.rows .s a:hover { color: var(--accent); text-decoration: none; }
.rows .r.lost .s a { color: var(--faint); font-weight: 400; }
.rows .w { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--soft); font-size: 12.5px; }
.pager { display: flex; justify-content: center; gap: 4px; margin: 18px 0 6px; flex-wrap: wrap; }
.pager a, .pager b { min-width: 32px; height: 32px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center;
                     border-radius: 9px; font-size: 13px; color: var(--soft); font-variant-numeric: tabular-nums; }
.pager a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.pager b { background: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .pager b { color: #0b1017; } }
.bd-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.bd-foot form { display: flex; gap: 6px; }

.post-h h1 { margin: 0 0 8px; font-size: 22px; line-height: 1.35; font-weight: 800; letter-spacing: -.02em; word-break: keep-all; }
.post-h .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.post-h .cat { color: var(--accent); font-weight: 600; margin-right: 6px; }
.post-actions { display: flex; justify-content: space-between; gap: 8px; margin: 16px 0; flex-wrap: wrap; }
.post-actions > div { display: flex; gap: 6px; flex-wrap: wrap; }
.post-body { padding: 18px 2px 8px; border-top: 1px solid var(--line); font-size: 15px; line-height: 1.8; word-break: break-word; overflow-wrap: anywhere; }
.post-body img { height: auto; border-radius: 6px; }
.post-body table { max-width: 100%; }
.files { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.files li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--card2); border: 1px solid var(--line); font-size: 12.5px; }
.files .lost { color: var(--faint); text-decoration: line-through; }
.cmts { margin-top: 22px; }
.cmts h2 { font-size: 15px; margin: 0 0 8px; }
.cmt { display: grid; grid-template-columns: 32px 1fr; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.cmt .avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--card2); color: var(--faint); }
.cmt .who { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.cmt .who b { font-weight: 700; }
.cmt .body { margin-top: 2px; font-size: 14px; line-height: 1.65; word-break: break-word; }
.cmt .body p { margin: 0 0 4px; }
.cmt form { display: inline; }
.cmt-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 12px; }
.cmt-form textarea { min-height: 76px; resize: vertical; }

.form-grid { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px 14px; align-items: center; }
.form-grid label.l { color: var(--soft); font-size: 13px; font-weight: 600; }
.form-grid input[type=text], .form-grid textarea, .form-grid select { width: 100%; }
.form-actions { display: flex; justify-content: center; gap: 8px; margin-top: 18px; }

/* ---------------------------------------------------------------- 푸터 */
.ft { border-top: 1px solid var(--line); background: var(--card); }
.ft-in { max-width: 1440px; margin: 0 auto; padding: 22px 16px 28px; color: var(--soft); font-size: 12px; line-height: 1.8; }
.ft-in .brand { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.ft-in .brand svg { width: 22px; height: 22px; }
.ft-in span + span::before { content: "·"; margin: 0 8px; color: var(--faint); }

/* ---------------------------------------------------------------- 옛 도구·회원 화면이 새 틀 안에서 어울리도록 */
.main.tool { padding: 22px 24px; overflow-x: auto; }
.main.tool td[background*="dotline"] { background: none !important; border-top: 1px solid var(--line); height: 0 !important; }
.main.tool img[src*="blank.gif"] { display: none; }
.main.tool h3 { font-size: 14px; }
.main h1 { font-size: 22px; letter-spacing: -.02em; }
.main table { border-color: var(--line); }
.main td, .main th { color: inherit; }
.main .sample { background: var(--card); }

/* ---------------------------------------------------------------- 좁은 화면 */
@media (max-width: 1180px) {
    .wrap { grid-template-columns: 210px minmax(0, 1fr); }
    .side-r { grid-column: 1 / -1; order: 3; }
    .side-r .ql2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
    .side-r .ql2 h3 { grid-column: 1 / -1; }
    .hd-logo { width: 300px; }
    .nav a { width: 96px; padding: 14px 10px 16px; }
}
@media (max-width: 820px) {
    .wrap { grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 14px; }
    .side-l { order: 2; }
    .hd-in { flex-direction: column; min-height: 0; }
    .hd-logo { width: 100%; height: 96px; background-size: auto 96px; }
    .nav { justify-content: stretch; overflow-x: auto; }
    .nav a { flex: none; width: auto; padding: 10px 14px 12px; border-left: 0; border-top: 1px solid rgba(255, 255, 255, .07); }
    .nav strong { white-space: nowrap; font-size: 14px; }
    .nav b { font-size: 20px; }
    .nav small { display: none; }
    .bar-in .tagline { display: none; }
    .bar form { margin-left: 0; flex: 1; }
    .bar input[type=text] { flex: 1; width: auto; }
    .grid2, .gal { grid-template-columns: minmax(0, 1fr); }
    .main > .card { padding: 16px; }
    .rows .r { grid-template-columns: minmax(0, 1fr) 70px; }
    .rows .n, .rows .h, .rows .r.hd2 { display: none; }
    .rows .w { display: none; }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
}
@media print {
    .hd, .bar, .side, .ft, .post-actions, .cmt-form { display: none !important; }
    .wrap { display: block; margin: 0; }
    .card { border: 0; box-shadow: none; }
}
