/* Stalker 구속 앱 공통 스타일 (2026-10-14 새 디자인)
   원칙: 큰 글씨 · 큰 버튼 · 한 화면에 할 일 하나 · 쉬운 말. PC·태블릿·휴대폰 모두 한 파일로.
   휴대폰(640px 이하)에서는 메뉴가 화면 아래 탭으로 내려간다 (엄지로 누르기 쉽게). */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");

:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --fg: #121722;
  --dim: #5b6474;
  --line: #e1e6ee;
  --accent: #ff9500;     /* 채우기 (버튼·표시) */
  --accent-fg: #1f1300;  /* 채우기 위 글자 */
  --accent-ink: #b45309; /* 바탕 위 글자·링크·큰 숫자 (흰 바탕 대비 4.5:1 이상) */
  --accent-soft: #fff4e5;
  --ok: #16a34a;
  --ok-soft: #e8f7ee;
  --warn: #d97706;
  --bad: #dc2626;
  --bad-soft: #fdecec;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
  --tabbar: 0px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0f14;
    --surface: #151a22;
    --surface-2: #1d232d;
    --fg: #eef1f6;
    --dim: #97a0b0;
    --line: #2a313d;
    --accent: #ff9f1a;
    --accent-fg: #17120a;
    --accent-ink: #ffad3a;
    --accent-soft: #2a1f0f;
    --ok: #34c77b;
    --ok-soft: #12291d;
    --warn: #f5b041;
    --bad: #ff6b6b;
    --bad-soft: #2d1414;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  letter-spacing: -.1px;
  padding-bottom: var(--tabbar);
}
a { color: var(--accent-ink); }
code { background: var(--surface-2); border-radius: 6px; padding: 1px 6px; font-size: .92em; }
.num { font-variant-numeric: tabular-nums; }
.dim { color: var(--dim); }
.small { font-size: 14px; }
.err { color: var(--bad) !important; }
[hidden] { display: none !important; }

/* ---------- 상단 바 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 6px 18px;
  padding: 10px 20px; padding-top: calc(10px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 18px; letter-spacing: -.4px; margin-right: auto; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand::before { content: ""; width: 22px; height: 26px; background: url(brand/diego-symbol.png) center / contain no-repeat; }
.nav { display: flex; gap: 2px; }
.nav a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--dim); text-decoration: none; padding: 8px 12px; border-radius: 10px; font-size: 15px; font-weight: 600;
}
.nav a .ni { font-size: 16px; }
.nav a:hover { background: var(--surface-2); color: var(--fg); }
.nav a[aria-current="page"] { color: var(--fg); background: var(--surface-2); }
.acct { gap: 6px; }
.acct svg { flex: none; opacity: .8; }
.acct.on { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }

/* 휴대폰: 메뉴는 화면 아래 탭 (아이콘 + 짧은 글) */
@media (max-width: 640px) {
  :root { --tabbar: calc(64px + env(safe-area-inset-bottom)); }
  /* 흐림 효과(backdrop-filter)가 있으면 안의 고정 탭이 화면 아래가 아니라 상단 바에 붙는다 → 폰에서는 끈다 */
  .topbar { padding: 8px 14px; padding-top: calc(8px + env(safe-area-inset-top)); gap: 8px; backdrop-filter: none; background: var(--surface); }
  .brand { font-size: 17px; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0;
    background: var(--surface); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -4px 16px rgba(16, 24, 40, .06);
  }
  .nav a { flex-direction: column; gap: 1px; justify-content: center; min-height: 62px; border-radius: 0; font-size: 12px; padding: 6px 2px; }
  .nav a .ni { font-size: 22px; line-height: 1; }
  .nav a[aria-current="page"] { background: transparent; color: var(--accent-ink); }
  .nav a[aria-current="page"] .ni { transform: scale(1.08); }
  .acct .acct-name { display: none; }
  .acct { padding: 6px 10px; }
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 20px; }
@media (max-width: 640px) { .wrap { padding: 14px; } }

/* ---------- 카드 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.card h2 { font-size: 18px; font-weight: 800; letter-spacing: -.3px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card h2 .step {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--accent-fg); font-size: 14px;
}
.card p { margin: 6px 0; }
@media (max-width: 640px) { .card { padding: 16px; border-radius: 16px; } }

/* ---------- 버튼 · 입력 ---------- */
button, .btn, select, input, textarea { font: inherit; color: inherit; }
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  cursor: pointer; text-decoration: none; color: var(--fg); white-space: nowrap; font-weight: 600;
  transition: transform .06s, background .15s, border-color .15s;
}
button:hover:not(:disabled), .btn:hover { border-color: var(--dim); }
button:active:not(:disabled), .btn:active { transform: scale(.98); }
button:disabled { opacity: .45; cursor: default; }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; font-weight: 800; }
button.primary:hover:not(:disabled), .btn.primary:hover { filter: brightness(1.05); border-color: transparent; }
button.danger { color: var(--bad); }
button.ghost { background: transparent; }
button.sm, .btn.sm { min-height: 38px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
/* 방송 자막 주소: 버튼 + QR + 설명 (사용자 2026-10-19) */
.cap-note { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--accent-soft); border: 1px solid var(--line); }
.cap-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cap-list li { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.cap-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.cap-list p { margin: 4px 0 0; }
input[type=text], input[type=number], input[type=search], input[type=password], input[type=time], input:not([type]), select, textarea {
  min-height: 48px; padding: 10px 12px; width: 100%; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
input:focus, select:focus, textarea:focus, button:focus-visible, .btn:focus-visible, tr:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 14px; color: var(--dim); font-weight: 600; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.check { display: flex; gap: 10px; align-items: center; color: var(--dim); }
.check input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }

/* ---------- 상태 표시 ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px;
  background: var(--surface-2); color: var(--dim); font-size: 14px; font-weight: 600; white-space: nowrap;
}
.pill::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--dim); }
.pill.ok { color: var(--ok); background: var(--ok-soft); }
.pill.ok::before { background: var(--ok); }
.pill.busy { color: var(--warn); background: var(--accent-soft); }
.pill.busy::before { background: var(--warn); }
.pill.bad { color: var(--bad); background: var(--bad-soft); }
.pill.bad::before { background: var(--bad); }

/* ---------- 표 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--dim); font-weight: 600; font-size: 13px; }
td.r, th.r { text-align: right; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }
tbody tr.active { background: var(--accent-soft); }
.empty { color: var(--dim); text-align: center; padding: 28px 8px; white-space: normal; }

/* ---------- 대화상자 ---------- */
dialog {
  border: 1px solid var(--line); border-radius: 20px; padding: 0; width: min(560px, calc(100vw - 32px));
  background: var(--surface); color: var(--fg); box-shadow: 0 24px 64px rgba(0, 0, 0, .25);
}
dialog::backdrop { background: rgba(10, 14, 20, .5); }
dialog header { padding: 16px 18px; border-bottom: 1px solid var(--line); font-weight: 800; font-size: 17px; display: flex; align-items: center; gap: 8px; }
dialog header .x { margin-left: auto; }
dialog .body { padding: 18px; display: grid; gap: 12px; max-height: 70vh; overflow: auto; }
dialog footer { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* 맨 아래 버전 줄 · 앱 업데이트 창 (app-update.js — 처음 화면·현장 기록 공통) */
.app-ver { text-align: center; margin: 18px 0 8px; }
.upd-dlg .upd-ver { font-size: 1.35rem; margin: 4px 0 6px; }
.upd-dlg .upd-notes { margin: 0; font-weight: 700; }
.upd-dlg ol { padding-left: 1.2em; margin: 8px 0; line-height: 1.6; }

/* ---------- 알림 ---------- */
.notice { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 12px 14px; color: var(--fg); }
.notice.warn { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); background: var(--accent-soft); }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--tabbar) + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--fg); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-size: 15px; font-weight: 600;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 100; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

details.more > summary { cursor: pointer; color: var(--fg); font-weight: 800; font-size: 18px; list-style: none; display: flex; align-items: center; gap: 8px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "펼치기 ▾"; margin-left: auto; font-size: 14px; font-weight: 600; color: var(--dim); }
details.more[open] > summary::after { content: "접기 ▴"; }
details.more[open] > summary { margin-bottom: 12px; }

/* 메뉴 글자는 절대 세로로 쪼개지지 않게. 중간 폭(PC 창을 줄였을 때 · 태블릿)은 짧은 이름, 더 좁으면 아이콘도 뺌 (2026-10-21 '처음' 탭 추가 뒤) */
.nav a, .topbar .btn { white-space: nowrap; }
@media (min-width: 641px) and (max-width: 1000px) {
  .topbar { gap: 6px 10px; }
  .nav a { padding: 8px 9px; }
  .nav a .nl { font-size: 0; }
  .nav a .nl::after { content: attr(data-short); font-size: 15px; }
}
@media (min-width: 641px) and (max-width: 820px) {
  .nav a .ni { display: none; }
  .acct .acct-name { display: none; }
}

/* 휴대폰 아래 탭에서는 짧은 이름 (기록 · 영상 · 클립 · 도움말) */
@media (max-width: 640px) {
  .nav a .nl { font-size: 0; }
  .nav a .nl::after { content: attr(data-short); font-size: 12px; }
}
