/* bitpiggy — 휴대폰에서 읽고 누르기 편한 것을 최우선으로.
   본문 17px, 보조 15px. 터치 영역 최소 48px. 입력창은 16px 이상이어야
   iOS 사파리가 포커스 시 화면을 확대하지 않는다. */

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

:root {
  --ink: #17202a;
  --muted: #4d5a66;        /* 기존보다 어둡게 — 작은 글씨 대비 확보 */
  --faint: #78848f;
  --paper: #ffffff;
  --field: #e9eef2;
  --rule: #cfd8e0;
  --save: #0b6b4f;
  --rise: #c8372d;         /* 한국 관례: 상승 빨강 */
  --fall: #1b64c4;         /* 하락 파랑 */
  --warn: #7a4e00;
  --warn-bg: #fdf4e0;
  --radius: 10px;
  --tap: 48px;             /* 손가락으로 편히 누를 수 있는 최소 높이 */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--field);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
               "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 520px; margin: 0 auto; padding: 0 16px 96px; }

/* ---------------------------------------------------------------- 머리 */

header.bar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0; margin-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}
header.bar a.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 21px; letter-spacing: -0.02em;
  color: var(--ink); text-decoration: none;
}
header.bar a.brand img { width: 26px; height: 26px; }
header.bar nav {
  margin-left: auto; display: flex; gap: 0; align-items: center;
  white-space: nowrap;   /* 항목이 늘어나도 줄바꿈되지 않게 */
}
header.bar nav a, header.bar nav button {
  display: inline-flex; align-items: center;
  min-height: var(--tap); padding: 0 8px;
  color: var(--muted); font-size: 15px; text-decoration: none;
  background: none; border: 0; cursor: pointer;
  font-family: inherit; white-space: nowrap;
}
@media (max-width: 400px) {
  header.bar a.brand { font-size: 19px; }
  header.bar nav a, header.bar nav button { padding: 0 6px; font-size: 14px; }
}
header.bar nav a:active, header.bar nav button:active { color: var(--ink); }

h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 8px; }
h2 { font-size: 19px; font-weight: 700; margin: 32px 0 12px; }
p.lead { color: var(--muted); font-size: 16px; margin: 0 0 22px; }

/* ---------------------------------------------------------------- 카드 */

.card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
}
.card.flat { padding: 0; overflow: hidden; }

a.card { display: block; color: inherit; text-decoration: none; }
a.card:active { background: #fbfcfd; }

/* 대문 패널 — 폰을 열었을 때 가장 먼저 읽히는 곳 */
.total {
  background: var(--ink); color: #fff;
  border-radius: var(--radius); padding: 24px 22px; margin-bottom: 16px;
}
.total .label { color: #a8b8c4; font-size: 16px; }
.total .amount {
  font-size: 40px; font-weight: 800; letter-spacing: -0.03em;
  line-height: 1.1; margin: 4px 0 6px;
}
.total .sub { color: #dbe4eb; font-size: 17px; font-weight: 600; }
.total .delta { font-size: 17px; font-weight: 700; margin-top: 6px; }
.total .delta.up { color: #ff9186; }
.total .delta.down { color: #96c0f8; }

/* 저금통 한 칸 */
.piggy { display: flex; align-items: center; gap: 14px; }
.piggy .coin { font-weight: 800; font-size: 20px; letter-spacing: -0.01em; }
.piggy .meta { color: var(--muted); font-size: 15px; }
.piggy .right { margin-left: auto; text-align: right; }
.piggy .money { font-weight: 800; font-size: 20px; }
.piggy .pct { font-size: 16px; font-weight: 700; }

.up { color: var(--rise); }
.down { color: var(--fall); }

.badge {
  display: inline-block; font-size: 14px; font-weight: 700;
  padding: 2px 9px; border-radius: 999px; margin-left: 6px;
  background: var(--field); color: var(--muted);
}
.badge.stop { background: #fdeeed; color: var(--rise); }

/* ---------------------------------------------------------------- 기록 */

table.ledger { width: 100%; border-collapse: collapse; font-size: 16px; }
table.ledger th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 15px;
  padding: 12px 16px; border-bottom: 1px solid var(--rule); background: #f6f8fa;
}
table.ledger td { padding: 14px 16px; border-bottom: 1px solid #eef2f5; vertical-align: top; }
table.ledger tr:last-child td { border-bottom: 0; }
table.ledger td.num { text-align: right; white-space: nowrap; }
table.ledger .sub { color: var(--faint); font-size: 14px; display: block; }

.state { font-size: 14px; font-weight: 700; }
.state.done { color: var(--save); }
.state.bad { color: var(--rise); }
.state.wait { color: var(--muted); }

/* ---------------------------------------------------------------- 폼 */

label { display: block; font-weight: 700; font-size: 17px; margin: 22px 0 8px; }
label:first-child { margin-top: 0; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 15px; margin-top: 2px; }

input[type=text], input[type=email], input[type=password], input[type=number], select {
  width: 100%; min-height: var(--tap); padding: 12px 14px;
  font-family: inherit; font-size: 17px;   /* 16px 미만이면 iOS 가 확대한다 */
  color: var(--ink); background: #fff;
  border: 1.5px solid var(--rule); border-radius: var(--radius);
}
select { appearance: none; background-image:
  url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%234d5a66' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; padding-right: 42px; }
input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--ink); outline-offset: 1px; border-color: var(--ink);
}
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

button.go, a.go {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 56px; margin-top: 26px; padding: 14px 18px;
  background: var(--ink); color: #fff; border: 0; border-radius: var(--radius);
  font-family: inherit; font-size: 18px; font-weight: 700;
  cursor: pointer; text-decoration: none;
}
button.go:active, a.go:active { background: #2b3a49; }

button.quiet, a.quiet {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); padding: 10px 18px;
  background: #fff; border: 1.5px solid var(--rule); color: var(--muted);
  border-radius: var(--radius); font-family: inherit; font-size: 16px;
  cursor: pointer; text-decoration: none;
}
button.quiet:active { border-color: var(--muted); color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

/* ---------------------------------------------------------------- 알림 */

.msg {
  padding: 15px 17px; border-radius: var(--radius); margin-bottom: 18px; font-size: 17px;
  border: 1.5px solid var(--save); color: var(--save); background: #edf7f3;
}
.msg.error { border-color: var(--rise); color: var(--rise); background: #fdefee; }

.notice {
  background: var(--warn-bg); border: 1.5px solid #e3cf9e; color: var(--warn);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; font-size: 16px;
}
.notice strong { display: block; margin-bottom: 6px; font-size: 17px; }
.notice ul { margin: 10px 0 0; padding-left: 20px; }
.notice li { margin-bottom: 6px; }

/* 번호가 붙은 안내 — 순서대로 따라 하는 내용에만 쓴다 */
ol.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }
ol.steps > li {
  counter-increment: step; position: relative;
  padding: 0 0 22px 46px; margin: 0;
}
ol.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 1px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--ink); color: #fff;
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
ol.steps > li:not(:last-child)::after {
  content: ""; position: absolute; left: 15.5px; top: 38px; bottom: 6px;
  width: 1.5px; background: var(--rule);
}
ol.steps b { display: block; font-size: 17px; margin-bottom: 3px; }
ol.steps .say { color: var(--muted); font-size: 16px; }

code.ip {
  display: inline-block; background: #fff; border: 1.5px solid #e3cf9e;
  padding: 4px 10px; border-radius: 6px; font-size: 17px; font-weight: 700;
  color: var(--ink); letter-spacing: .02em;
}

.empty { text-align: center; color: var(--muted); padding: 44px 20px; font-size: 17px; }
.empty p { margin: 0 0 22px; }

.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tabs a {
  flex: 1; min-height: var(--tap);
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--rule); border-radius: var(--radius);
  text-decoration: none; color: var(--muted); background: #fff;
  font-size: 17px; font-weight: 600;
}
.tabs a.on { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 700; }

dl.facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 14px 18px; }
dl.facts dt { color: var(--muted); font-size: 16px; }
dl.facts dd { margin: 0; text-align: right; font-weight: 700; font-size: 17px; }

footer.fine {
  margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--rule);
  color: var(--faint); font-size: 14px; line-height: 1.7;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------------------------------------------------------------- 관리 화면
   실행 내역은 열이 많아 표로 만들면 좁은 화면에서 잘린다.
   좌(누가·언제) / 우(얼마·상태) 두 덩어리로 쌓는다. */

.logrow {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-bottom: 1px solid #eef2f5;
}
.logrow:last-child { border-bottom: 0; }
.logrow .who { font-weight: 700; font-size: 16px; }
.logrow .when { color: var(--muted); font-size: 14px; }
.logrow .why { color: var(--faint); font-size: 13px; margin-top: 2px; }
.logrow .right { margin-left: auto; text-align: right; flex-shrink: 0; }
.logrow .amt { font-weight: 700; font-size: 16px; white-space: nowrap; }
.logrow .amt.plan { font-weight: 400; color: var(--faint); font-size: 14px; }

/* 대문 패널의 코인별 보유량.
   BTC 와 ETH 는 더할 수 없으므로 종류별로 한 줄씩 나열한다. */
.total .holdings {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.18);
}
.total .hold {
  display: flex; align-items: baseline; gap: 10px;
  padding: 3px 0;
}
.total .hold .hname { color: #a8b8c4; font-size: 15px; }
.total .hold .hqty {
  margin-left: auto; font-size: 17px; font-weight: 700; color: #fff;
}
