:root {
  --bg: #f6f5f1; --card: #ffffff; --ink: #1f1f1d; --muted: #6c6b66; --line: #e4e2dc;
  --accent: #03a94d; --accent-ink: #ffffff; --accent-soft: #e5f6ec;
  --danger: #c8443a; --danger-soft: #fdecea; --warn: #8a6d00; --warn-soft: #fff6d6;
  --blog-bg: #ffffff; --blog-ink: #222222;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161615; --card: #21211f; --ink: #ecebe6; --muted: #a3a29b; --line: #383835;
    --accent: #1fc46a; --accent-ink: #0b0b0a; --accent-soft: #17311f;
    --danger: #f0776c; --danger-soft: #3a1d1a; --warn: #f0cf6a; --warn-soft: #332b12;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
       font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif; }
a { color: var(--accent); }
main { max-width: 720px; margin: 0 auto; padding: 16px 16px 120px; }
h1, h2 { line-height: 1.35; word-break: keep-all; }
h2 { font-size: 17px; margin: 0 0 8px; }
small { color: var(--muted); font-weight: 400; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
       padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; color: var(--ink); text-decoration: none; font-size: 17px; }
.top nav { display: flex; align-items: center; gap: 12px; }
.top form { margin: 0; }
.new-btn { font-weight: 700; text-decoration: none; }

.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 0 0 12px; color: inherit; }
.card.narrow { max-width: 380px; margin: 40px auto; }
.card.center, .center { text-align: center; }
.card.done { border-color: var(--accent); background: var(--accent-soft); }
.cta { text-decoration: none; border: 2px dashed var(--accent); text-align: center; padding: 20px 16px; }
.cta b { display: block; font-size: 18px; color: var(--accent); }
.cta span { color: var(--muted); font-size: 14px; }
.section { margin: 20px 4px 8px; font-size: 15px; color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 10px; }
.alert { background: var(--danger-soft); color: var(--danger); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.notice { background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.crumb { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; font-size: 14px; }
.crumb a { text-decoration: none; }
.stack > * + * { margin-top: 0; }

label { display: block; font-size: 14px; font-weight: 600; margin: 0 0 10px; }
input, textarea, select { display: block; width: 100%; margin-top: 6px; font: inherit; font-size: 16px; color: var(--ink); background: var(--bg);
                  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
textarea { resize: vertical; line-height: 1.6; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
@media (max-width: 480px) { .row { grid-template-columns: 1fr; gap: 0; } }

button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px;
                  font: inherit; font-weight: 700; font-size: 15px; border-radius: 12px; padding: 10px 16px; cursor: pointer;
                  border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.wide, .button.wide { width: 100%; }
button.link { border: 0; background: none; color: var(--muted); font-weight: 500; min-height: 0; padding: 8px; text-decoration: underline; }
button.link.danger { color: var(--danger); }
button:disabled { opacity: .5; cursor: default; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions form { margin: 0; flex: 1; }
.actions > * { flex: 1; }
.actions button { width: 100%; }
form.inline { display: flex; gap: 8px; margin-top: 12px; }
form.inline input { margin: 0; flex: 1; min-width: 0; }

.sticky-bar { position: sticky; bottom: 0; z-index: 4; padding: 10px 0; padding-bottom: max(10px, env(safe-area-inset-bottom));
              background: linear-gradient(transparent, var(--bg) 30%); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: inline-block; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); font-weight: 600; font-size: 15px; cursor: pointer; }
.choice input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice { margin: 0; }
.choice input:disabled + span { opacity: .45; cursor: default; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 0 0 10px; }
.thumbs figure { position: relative; margin: 0; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--line); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs .num { position: absolute; left: 6px; top: 4px; color: #fff; font-weight: 800; text-shadow: 0 0 4px #000; }
.thumbs .tools { position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between; background: rgba(0,0,0,.45); }
.thumbs .tools button { min-height: 32px; padding: 0 8px; border: 0; background: none; color: #fff; font-size: 14px; border-radius: 0; }
.pick { display: block; margin: 0; }
.pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pick span { display: block; text-align: center; padding: 14px; border: 1px dashed var(--accent); border-radius: 12px; color: var(--accent); font-weight: 700; cursor: pointer; }
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin: 0 0 8px; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.posts { list-style: none; margin: 0; padding: 0; }
.posts li { margin: 0 0 8px; }
.posts a { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; text-decoration: none; color: inherit; }
.posts img, .posts .noimg { flex: 0 0 64px; width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--line); }
.posts .meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.posts .meta b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.posts .meta span { color: var(--muted); font-size: 13px; }

.chip { font-style: normal; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--line); color: var(--ink); margin-right: 4px; white-space: nowrap; }
.chip.drafting, .chip.saving, .chip.publishing { background: var(--warn-soft); color: var(--warn); }
.chip.drafted { background: var(--accent-soft); color: var(--accent); }
.chip.approved, .chip.published { background: var(--accent); color: var(--accent-ink); }
.chip.failed { background: var(--danger-soft); color: var(--danger); }
.chip.deleted, .chip.cancelled { background: var(--line); color: var(--muted); }

.spinner { width: 36px; height: 36px; margin: 8px auto 12px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 4s; } }

/* 블로그에 올라갈 모습: 실제 블로그처럼 흰 바탕 */
.blog { background: var(--blog-bg); color: var(--blog-ink); border: 1px solid var(--line); border-radius: 14px; padding: 20px 18px; margin: 0 0 12px; }
.blog h1 { font-size: 20px; margin: 0 0 16px; padding-bottom: 12px; border-bottom: 1px solid #eee; }
.blog-body p { margin: 0; min-height: 1em; line-height: 1.8; }
.blog-body img { display: block; width: 100%; height: auto; margin: 6px 0; border-radius: 4px; }
.blog-body .photo-row { gap: 4px; margin: 6px 0; }
.blog-body .photo-row img { flex: 1 1 0; min-width: 0; margin: 0; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 4px; }
.blog-body blockquote { margin: 10px 0; padding: 8px 14px; border-left: 3px solid #bbb; color: #444; }
.blog-body .place { margin: 14px 0 0; padding: 12px; border: 1px solid #e5e5e5; border-radius: 8px; display: flex; flex-direction: column; font-size: 14px; }
.blog-body .place span { color: #777; }

details.card summary { cursor: pointer; font-weight: 700; }
details.card[open] summary { margin-bottom: 10px; }
.memo { white-space: pre-wrap; font: inherit; font-size: 14px; margin: 0; color: var(--muted); }

.photo-row { display: flex; gap: 8px; margin: 4px 0 12px; }
.photo-row figure { margin: 0; flex: 1; max-width: 50%; }
.photo-row img { width: 100%; border-radius: 10px; display: block; }
.photo-row figcaption { font-size: 12px; color: var(--muted); text-align: center; }
.side-choice { display: flex; align-items: center; gap: 8px; margin: -6px 0 10px; font-size: 14px; color: var(--muted); }
.side-choice input { width: 20px; height: 20px; margin: 0; }
textarea.grow { margin: 0 0 12px; background: var(--card); }

.step b { display: block; margin: 0 0 6px; }
.step pre { white-space: pre-wrap; font: inherit; font-size: 15px; background: var(--bg); border-radius: 10px; padding: 10px 12px; margin: 0 0 8px; }
.step button.copied { background: var(--accent-soft); color: var(--accent); }

.nav-link { color: var(--muted); text-decoration: none; font-size: 15px; }
.login { font-size: 12px; font-weight: 600; }
.login.ok { color: var(--accent); }
.login.off { color: var(--danger); }
a.choice { text-decoration: none; color: inherit; }
.choice span.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
h3.sub { font-size: 15px; margin: 16px 0 6px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 7px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; white-space: normal; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
.posts .meta span + span { font-variant-numeric: tabular-nums; }
.runs { list-style: none; margin: 0; padding: 0; }
.runs li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.runs li:last-child { border-bottom: 0; }
.runs small { color: var(--muted); font-size: 13px; }
.runs .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.runs .fail { color: var(--danger); }
