:root {
  --bg: #0b1120;
  --surface: #131c31;
  --surface-2: #1b2540;
  --line: #263149;
  --text: #e6ecf7;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #818cf8;
  --ok: #34d399;
  --bad: #f87171;
  --warn: #fbbf24;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.7 "Pretendard", "Malgun Gothic", "맑은 고딕", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1060px; margin: 0 auto; padding: 0 24px; }

a { color: var(--accent); }

code {
  background: var(--surface-2); padding: 2px 6px; border-radius: 5px;
  font-family: "Cascadia Code", Consolas, monospace; font-size: .88em;
  color: #a5d8ff;
}

/* ── 히어로 ───────────────────────────────────────── */
.hero {
  padding: 72px 0 56px;
  background:
    radial-gradient(900px 420px at 12% -10%, rgba(56,189,248,.18), transparent 60%),
    radial-gradient(760px 380px at 88% 0%, rgba(129,140,248,.16), transparent 62%);
  border-bottom: 1px solid var(--line);
}
.kicker {
  margin: 0 0 10px; letter-spacing: .22em; font-size: 12px;
  color: var(--accent); font-weight: 700;
}
.hero h1 {
  margin: 0 0 14px; font-size: clamp(30px, 5.5vw, 46px);
  line-height: 1.2; letter-spacing: -.02em;
}
.lede { margin: 0 0 26px; color: var(--muted); max-width: 60ch; }

/* ── 상태 배지 ────────────────────────────────────── */
.status {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 16px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 14px;
}
.dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.dot.pending { background: var(--muted); animation: pulse 1.4s ease-in-out infinite; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 4px rgba(52,211,153,.16); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 4px rgba(248,113,113,.16); }
@keyframes pulse { 0%,100% { opacity: .35; } 50% { opacity: 1; } }

/* ── 섹션 ─────────────────────────────────────────── */
main { padding: 52px 0 28px; }
section { margin-bottom: 52px; }
section h2 {
  font-size: 15px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 20px; font-weight: 600;
}

/* ── 카드 ─────────────────────────────────────────── */
.cards {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.card {
  display: block; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  background: var(--surface-2);
}
.card-icon { font-size: 30px; line-height: 1; margin-bottom: 14px; }
.card h3 { margin: 0 0 8px; font-size: 18px; }
.card p { margin: 0 0 16px; color: var(--muted); font-size: 14.5px; }
.tag {
  display: inline-block; font-size: 11.5px; letter-spacing: .04em;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(56,189,248,.12); color: var(--accent);
  border: 1px solid rgba(56,189,248,.28);
}

/* ── 설명 블록 ────────────────────────────────────── */
.notes {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px;
}
.notes p { color: var(--muted); font-size: 14.5px; }
.notes ul { margin: 16px 0 0; padding-left: 20px; color: var(--muted); font-size: 14.5px; }
.notes li { margin-bottom: 9px; }
.notes li b { color: var(--text); }
.muted { color: var(--muted); font-size: 13px; }

footer {
  border-top: 1px solid var(--line); padding: 26px 0 40px;
  color: var(--muted); font-size: 13px;
}
footer p { margin: 0; }

/* ── 앱 공통 (하위 페이지에서 사용) ─────────────────── */
.appbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
}
.appbar h1 { font-size: 19px; margin: 0; }
.back { color: var(--muted); text-decoration: none; font-size: 14px; }
.back:hover { color: var(--accent); }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; margin-bottom: 20px;
}

textarea, input[type=text], select {
  width: 100%; padding: 11px 13px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px;
  font: inherit; font-size: 15px;
}
textarea { resize: vertical; line-height: 1.65; }
textarea:focus, input:focus, select:focus {
  outline: 2px solid var(--accent); outline-offset: -1px;
}
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

button {
  font: inherit; font-size: 15px; cursor: pointer;
  padding: 10px 22px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  transition: background .14s ease, border-color .14s ease;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #0b1120; font-weight: 600;
}
button.primary:hover:not(:disabled) { filter: brightness(1.08); }
button:disabled { opacity: .45; cursor: not-allowed; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.msg { font-size: 13.5px; color: var(--muted); }
.msg.bad { color: var(--bad); }
.msg.ok { color: var(--ok); }

.output {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 20px; min-height: 120px;
  white-space: pre-wrap; word-break: break-word; line-height: 1.75;
  font-size: 15px;
}
.output:empty::before { content: "결과가 여기에 표시됩니다."; color: var(--muted); }

.caret::after {
  content: "▌"; color: var(--accent);
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

@media (max-width: 640px) {
  .hero { padding: 52px 0 40px; }
  .wrap { padding: 0 18px; }
  .notes, .panel, .card { padding: 20px; }
}

/* ── 잠금 관리 (첫 화면) ───────────────────────────────── */
.locks { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.lockcard {
  background: #131c31; border: 1px solid #263149; border-radius: 12px; padding: 18px 20px;
}
.lockcard h3 { margin: 0 0 6px; font-size: 15px; color: #e6ecf7; }
.lockcard p { margin: 0 0 12px; font-size: 13px; line-height: 1.6; }

.pwform { display: grid; gap: 8px; }
.pwform input {
  padding: 9px 11px; background: #0b1120; color: #e6ecf7;
  border: 1px solid #263149; border-radius: 8px; font-size: 14px; width: 100%;
}
.pwform input:focus { outline: 2px solid #38bdf8; outline-offset: -1px; }
.pwform .pw-go {
  padding: 9px; border: none; border-radius: 8px; cursor: pointer; font-weight: 600;
  background: linear-gradient(135deg, #38bdf8, #818cf8); color: #0b1120; font-size: 14px;
}
.pwform .pw-go:disabled { opacity: .5; cursor: not-allowed; }
.pw-msg { font-size: 13px; min-height: 18px; line-height: 1.5; }
.pw-msg.ok  { color: #4ade80; }
.pw-msg.bad { color: #f87171; }

#lockstate.warn { color: #fbbf24; }

.linkbtn {
  background: none; border: none; padding: 0; cursor: pointer;
  color: #38bdf8; font-size: 13px; text-decoration: underline;
}

@media (max-width: 720px) { .locks { grid-template-columns: 1fr; } }

/* ── 오늘 사용량 (첫 화면) ─────────────────────────────── */
.usage {
  max-width: 480px; margin: 20px auto 0; padding: 14px 18px;
  background: #131c31; border: 1px solid #263149; border-radius: 12px; text-align: left;
}
.usage.warn { border-color: #a16207; }
.usage.over { border-color: #b91c1c; background: #241014; }
.usage-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.usage-label { font-size: 13px; color: #94a3b8; }
.usage-num { font-size: 14px; font-weight: 600; color: #e6ecf7; font-variant-numeric: tabular-nums; }
.usage.warn .usage-num { color: #fbbf24; }
.usage.over .usage-num { color: #f87171; }
.usage-bar {
  height: 6px; margin: 8px 0 8px; border-radius: 3px;
  background: #0b1120; overflow: hidden;
}
.usage-bar i {
  display: block; height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, #38bdf8, #818cf8); transition: width .4s;
}
.usage.warn .usage-bar i { background: #fbbf24; }
.usage.over .usage-bar i { background: #f87171; }
.usage-note { margin: 0; font-size: 11.5px; color: #94a3b8; line-height: 1.6; }
