:root {
  --bg: #f5f6f8; --panel: #ffffff; --line: #e3e6eb; --text: #1b1f24; --muted: #646d78; --soft: #f0f2f5;
  --accent: #1f5eff; --accent-text: #ffffff; --ok: #0f8a4b; --ok-bg: #e6f6ee; --warn: #9a5b00; --warn-bg: #fff4e0;
  --bad: #c4321f; --bad-bg: #fdecea; --focus: #1f5eff55; --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111418; --panel: #191d23; --line: #2a3038; --text: #e8ebef; --muted: #9aa4b0; --soft: #20252c;
    --accent: #5b8cff; --accent-text: #0b0d10; --ok: #4cc98a; --ok-bg: #12301f; --warn: #f2b14c; --warn-bg: #33270f;
    --bad: #ff7b6b; --bad-bg: #3a1a16; --focus: #5b8cff66; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Segoe UI", sans-serif; }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.hidden { display: none !important; }

header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand small { font-weight: 500; color: var(--muted); }
.brand img { width: 24px; height: 24px; }
.top-actions { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }

main { max-width: 980px; margin: 0 auto; padding: 20px 16px 60px; display: grid; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.card h2 { margin: 0 0 4px; font-size: 16px; }
.card .sub { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }

.status-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.status-main { display: flex; align-items: center; gap: 14px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }
.status-title { font-size: 20px; font-weight: 700; }
.status-meta { color: var(--muted); font-size: 13.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--soft); font-size: 13px; color: var(--muted); }
.chip .dot { width: 8px; height: 8px; }

.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { appearance: none; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 9px 14px; cursor: pointer; font-weight: 600; font-size: 14px; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.link { white-space: nowrap; border: 0; background: none; padding: 4px 6px; color: var(--muted); font-weight: 500; }
.btn.link:hover { color: var(--text); background: none; }
.btn:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

label.field { display: grid; gap: 6px; font-size: 13.5px; color: var(--muted); margin-bottom: 12px; }
label.field span.req { color: var(--text); font-weight: 600; }
input[type=text], input[type=password], input[type=email], textarea {
  width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 10px 12px; color: var(--text);
}
textarea { min-height: 120px; resize: vertical; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.note { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.saved { font-size: 13px; color: var(--muted); margin: 0 0 12px; }

.flow { border-left: 4px solid var(--accent); }
.flow.need { border-left-color: var(--warn); }
.flow.done { border-left-color: var(--ok); }
.flow.bad { border-left-color: var(--bad); }
.flow-msg { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
.flow-hint { color: var(--muted); font-size: 13.5px; margin: 0 0 10px; white-space: pre-wrap; }
.flow-err { background: var(--bad-bg); color: var(--bad); border-radius: 8px; padding: 8px 10px; font-size: 13.5px; margin: 0 0 10px; }
.code-form { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; margin: 6px 0 10px; }
.code-form input { max-width: 220px; font-size: 22px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.methods { display: grid; gap: 8px; margin: 8px 0 12px; }
.methods .btn { text-align: left; font-weight: 500; }
.push-num { font-size: 44px; font-weight: 800; letter-spacing: .05em; margin: 4px 0 8px; }
.timer { font-size: 13px; color: var(--muted); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: -3px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

.steps { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
.steps li { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--soft); font-size: 13.5px; }
.steps .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.steps .what { min-width: 0; }
.steps .what b { font-weight: 600; }
.steps .where { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.steps img { width: 84px; height: 52px; object-fit: cover; object-position: top; border-radius: 6px; border: 1px solid var(--line); cursor: zoom-in; display: block; }
.steps button.shot { padding: 0; border: 0; background: none; cursor: zoom-in; }
details.trace summary { cursor: pointer; color: var(--muted); font-size: 13.5px; margin-top: 10px; }

dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); padding: 20px; max-width: min(96vw, 1100px); }
dialog::backdrop { background: #0008; }
dialog img { max-width: 100%; max-height: 80vh; display: block; border-radius: 8px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 20; max-width: 90vw; }

/* 로그인 화면 */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px 26px; }
.login-card h1 { font-size: 20px; margin: 10px 0 4px; }
.login-card p { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.login-card .btn { width: 100%; padding: 11px; margin-top: 6px; }
.login-err { background: var(--bad-bg); color: var(--bad); border-radius: 8px; padding: 8px 10px; font-size: 13.5px; margin-bottom: 12px; }

@media (max-width: 600px) {
  header.top { padding: 12px 16px; }
  .brand small, #who { display: none; }
  .top-actions { gap: 2px; }
  .status-row .btns { width: 100%; }
}

/* 시도 기록 */
.attempts { display: grid; gap: 6px; }
.att-row { display: grid; grid-template-columns: 120px 76px 1fr auto; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-size: 13.5px; }
.att-row:hover { background: var(--soft); }
.att-row .when { color: var(--muted); font-variant-numeric: tabular-nums; }
.att-row .who { color: var(--muted); font-size: 12.5px; }
.att-row .res { min-width: 0; overflow-wrap: anywhere; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--muted); }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
@media (max-width: 600px) { .att-row { grid-template-columns: 1fr auto; } .att-row .who { display: none; } }
dialog.wide { width: min(96vw, 980px); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 14px; margin: 0 0 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.att-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.att-steps li { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; grid-template-columns: 1fr 200px; gap: 12px; }
@media (max-width: 700px) { .att-steps li { grid-template-columns: 1fr; } }
.att-steps .url { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.att-steps img { width: 100%; border-radius: 6px; border: 1px solid var(--line); cursor: zoom-in; display: block; }
.att-steps pre { white-space: pre-wrap; max-height: 160px; overflow: auto; background: var(--soft); border-radius: 6px; padding: 8px; font-size: 12px; margin: 6px 0 0; }
.events { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; font-size: 13px; }
.events li { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 6px 8px; border-radius: 8px; background: var(--soft); }
.events .t { color: var(--muted); font-variant-numeric: tabular-nums; }
h3.sec { font-size: 14px; margin: 16px 0 8px; }
