/* 수상한 전당포 웹 — 회색 뼈대.
   나중에 디자인을 입힐 때는 아래 :root 의 값(색·글꼴·둥글기)부터 바꾼다. 구조(배치)는 그 아래. */
:root {
  --bg: #f2f2f2;
  --surface: #ffffff;
  --box: #dcdcdc;          /* 그림 자리 */
  --line: #c4c4c4;
  --text: #1c1c1c;
  --text-sub: #5c5c5c;
  --accent: #1c1c1c;       /* 버튼·선택된 탭 */
  --on-accent: #ffffff;
  --font: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-title: var(--font);
  --radius: 8px;
  --gap: 16px;
  --top-h: 48px;
  --tabs-h: 56px;
  --max-w: 560px;          /* 데스크탑에서도 폰 폭으로 가운데 */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.55;
}
a { color: inherit; }
img { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---- 틀 ---- */
.top {
  position: sticky; top: 0; z-index: 10; height: var(--top-h);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 var(--gap); background: var(--surface); border-bottom: 1px solid var(--line);
}
.top-title { font-family: var(--font-title); font-weight: 700; text-decoration: none; }
.sample-badge { font-size: 12px; color: var(--text-sub); border: 1px dashed var(--line); padding: 2px 8px; border-radius: 99px; }

.view {
  max-width: var(--max-w); margin: 0 auto; outline: none;
  padding: 0 0 calc(var(--tabs-h) + env(safe-area-inset-bottom) + 24px);
  min-height: calc(100vh - var(--top-h));
}
.page { padding: var(--gap); }
.page-title { font-family: var(--font-title); font-size: 22px; margin: 4px 0 var(--gap); }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; height: var(--tabs-h); display: flex; align-items: center; justify-content: center;
  text-decoration: none; color: var(--text-sub); border-top: 3px solid transparent;
}
.tab[aria-current="page"] { color: var(--text); font-weight: 700; border-top-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px;
  border: 1px solid var(--accent); border-radius: var(--radius); background: var(--surface);
  text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.wide { display: flex; width: 100%; }

.note { color: var(--text-sub); text-align: center; padding: 40px var(--gap); }
.todo { color: var(--text-sub); border: 1px dashed var(--line); border-radius: var(--radius); padding: 12px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 16px); transform: translateX(-50%);
  background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 99px; font-size: 14px; z-index: 20;
  max-width: 90vw;
}

/* ---- 웹툰 ---- */
.webtoon { padding: 0; }
.cut { width: 100%; background: var(--box); border-bottom: 1px solid var(--bg); position: relative; }
.cut img { width: 100%; height: 100%; object-fit: cover; }
.cut-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-sub); }
.webtoon-end { padding: 32px var(--gap); }

/* ---- 진열장 ---- */
.ledger { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: var(--gap); }
.ledger div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 8px; text-align: center; }
.ledger dt { font-size: 12px; color: var(--text-sub); }
.ledger dd { margin: 2px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }

.controls { display: flex; gap: 8px; margin-bottom: var(--gap); }
.sort { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; flex: none; }
.sort button { min-height: 44px; padding: 0 12px; border: 0; background: var(--surface); color: var(--text-sub); cursor: pointer; }
.sort button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.find { flex: 1; min-width: 0; }
.find input {
  width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface);
}

.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rank-item a {
  display: grid; grid-template-columns: 36px 64px 1fr auto; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 12px 8px 8px; text-decoration: none; min-height: 80px;
}
.rank-no { text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.thumb { width: 64px; height: 64px; background: var(--box); border-radius: calc(var(--radius) / 2); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.rank-name { font-weight: 700; overflow-wrap: anywhere; }
.rank-sub { font-size: 12px; color: var(--text-sub); }
.rank-price { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- 물건 상세 ---- */
.back { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; color: var(--text-sub); }
.item-img { aspect-ratio: 1; background: var(--box); border-radius: var(--radius); overflow: hidden; margin-bottom: var(--gap); }
.item-img img { width: 100%; height: 100%; object-fit: contain; }
.item-name { font-family: var(--font-title); font-size: 26px; line-height: 1.25; margin: 0; overflow-wrap: anywhere; }
.item-en { margin: 2px 0 0; color: var(--text-sub); letter-spacing: .08em; text-transform: uppercase; }
.item-price { font-size: 30px; font-weight: 700; margin: 12px 0 0; font-variant-numeric: tabular-nums; }
.item-rank { color: var(--text-sub); margin: 0 0 var(--gap); }

.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.block h2 { font-size: 13px; color: var(--text-sub); font-weight: 400; margin: 0 0 6px; }
.block p { margin: 0 0 8px; }
.block p:last-child { margin-bottom: 0; }
.grade { font-weight: 700; font-size: 18px; }
.keywords { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.keywords li { border: 1px solid var(--line); border-radius: 99px; padding: 2px 10px; font-size: 14px; }
.steps { margin: 0; padding-left: 20px; }

.xray { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -14px; padding: 0 14px 4px; }
.xray figure { flex: 0 0 78%; margin: 0; scroll-snap-align: center; }
.xray .pic { aspect-ratio: 1; background: var(--box); border-radius: calc(var(--radius) / 2); overflow: hidden; }
.xray img { width: 100%; height: 100%; object-fit: contain; }
.xray figcaption { font-size: 13px; color: var(--text-sub); text-align: center; margin-top: 4px; }

.meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.meta dt { color: var(--text-sub); }
.meta dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: var(--gap); }

.waiting { text-align: center; padding: 64px var(--gap); }
.waiting h1 { font-size: 20px; }
.dots::after { content: "…"; animation: blink 1.4s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .dots::after { animation: none; } }
