@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css');

:root {
  --bg: #f2f4f8; --surface: #fff; --ink: #151a2d; --muted: #667089; --line: #dfe3ec;
  --accent: #3d5afe; --on-accent: #fff; --up: #e5484d; --down: #3b82f6; --soft: #e8ecfb;
}
[data-theme='dark'] {
  --bg: #0d1120; --surface: #141a2c; --ink: #e8ecf7; --muted: #8d97b3; --line: #232b45;
  --accent: #7f93ff; --on-accent: #0d1120; --up: #ff6b70; --down: #6aa5ff; --soft: #1c2542;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 'Pretendard Variable', Pretendard, system-ui, sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 16px; margin: 28px 0 10px; } h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--muted); } .empty { color: var(--muted); padding: 40px 0; text-align: center; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 10px max(16px, calc(50% - 560px)); background: var(--surface); border-bottom: 1px solid var(--line); }
.logo { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; color: var(--accent); }
#sf { flex: 1; max-width: 360px; } #sf input { width: 100%; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); }
#nav { margin-left: auto; display: flex; gap: 6px; align-items: center; }

.btn { display: inline-block; padding: 7px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; font-weight: 600; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.ghost, .ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn:disabled { opacity: .5; cursor: default; }

.wrap { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 28px; max-width: 1120px; margin: 0 auto; padding: 20px 16px 80px; }
@media (max-width: 860px) { .wrap { grid-template-columns: 1fr; } #side { order: 2; } #sf { display: none; } }

.head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.tabs a { padding: 8px 0; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--ink); border-color: var(--accent); }

.row { display: flex; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.row:hover { background: var(--soft); }
.score { flex: none; width: 34px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }
.score.pos { color: var(--up); } .score.neg { color: var(--down); }
.row .body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag, .best { font-style: normal; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--soft); padding: 1px 7px; border-radius: 6px; margin-right: 6px; }
.best { margin: 0 0 0 6px; color: var(--up); }
.cc { color: var(--up); font-size: 13px; margin-left: 6px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 13px; }
.ip { font-style: normal; font-size: 12px; margin-left: 3px; opacity: .8; }
.more { display: block; margin: 16px auto; }

.post h1 { margin: 6px 0 8px; line-height: 1.35; }
.crumb a { color: var(--accent); font-weight: 600; }
.content { padding: 20px 0; border-top: 1px solid var(--line); margin-top: 12px; overflow-wrap: anywhere; }
.content img { max-width: 100%; border-radius: 8px; display: block; margin: 8px 0; }
.vote { display: flex; gap: 10px; justify-content: center; padding: 14px 0; border-top: 1px solid var(--line); }
.vote button { min-width: 110px; padding: 10px 16px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 700; }
.vote .up { color: var(--up); border-color: var(--up); } .vote .down { color: var(--down); border-color: var(--down); }
.acts { display: flex; gap: 12px; } .acts button { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font-size: 13px; }
.acts button:hover { color: var(--ink); }

.comments ul { list-style: none; padding: 0; margin: 0; }
.cm { padding: 12px 4px; border-bottom: 1px solid var(--line); }
.cm.reply { margin-left: 22px; padding-left: 12px; border-left: 2px solid var(--line); }
.cm-h { display: flex; gap: 10px; font-size: 13px; color: var(--muted); } .cm-h b { color: var(--ink); }
.cm p { margin: 2px 0 6px; overflow-wrap: anywhere; }

.stack, .cform, .wform { display: flex; flex-direction: column; gap: 8px; }
.cform { margin: 10px 0; }
.guest, .grid { display: flex; gap: 8px; } .guest input, .grid select { flex: 1; min-width: 0; }
input, select, textarea { padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); width: 100%; }
.actions { display: flex; justify-content: space-between; align-items: center; }
.auth { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; } @media (max-width: 640px) { .auth { grid-template-columns: 1fr; } }

.box { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.gl { display: flex; justify-content: space-between; padding: 5px 0; } .gl:hover span:first-child { color: var(--accent); }
.ad { display: flex; flex-direction: column; gap: 4px; justify-content: center; min-height: 150px; padding: 16px; margin-bottom: 14px; border: 1.5px dashed var(--line); border-radius: 10px; text-align: center; color: var(--muted); }
.ad b { color: var(--ink); font-size: 16px; }
.nt summary { cursor: pointer; padding: 4px 0; } .nt p { margin: 4px 0 8px; color: var(--muted); font-size: 14px; white-space: pre-wrap; }
.note { display: flex; justify-content: space-between; padding: 8px 4px; border-bottom: 1px solid var(--line); } .note.new { font-weight: 700; }
.rep { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); } .rep a { font-weight: 600; } .rep span { flex: 1; color: var(--muted); }

#ai-btn { position: fixed; right: 18px; bottom: 18px; z-index: 6; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
#ai { position: fixed; right: 18px; bottom: 18px; z-index: 7; width: min(380px, calc(100vw - 24px)); max-height: 70vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.3); }
#ai[hidden] { display: none; }
.ai-h { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
#ai-out { flex: 1; overflow-y: auto; padding: 10px 12px; } #ai-out p { margin: 0 0 10px; overflow-wrap: anywhere; }
#ai-out .me { text-align: right; font-weight: 600; } #ai-out .bot a { color: var(--accent); text-decoration: underline; }
#ai-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
#toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); z-index: 9; background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 8px; }
#toast[hidden] { display: none; }
