/* 웹자판기 — 미드나잇 프리미엄 (딥 블루-블랙 + 은은한 블루) */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #06070d;
  --surface: #0c0e17;
  --surface-2: #11131e;
  --surface-3: #171a27;
  --hair: rgba(255, 255, 255, 0.07);
  --hair-2: rgba(255, 255, 255, 0.12);
  --text: #edeff6;
  --muted: #969db4;
  --faint: #5d6479;
  --accent: #5b83f5;
  --accent-hi: #85a4ff;
  --accent-press: #3f61d6;
  --accent-dim: rgba(91, 131, 245, 0.13);
  --accent-line: rgba(91, 131, 245, 0.28);
  --green: #3ecf8e;
  --green-dim: rgba(62, 207, 142, 0.13);
  --amber: #e0b25f;
  --amber-dim: rgba(224, 178, 95, 0.13);
  --red: #ef7a7d;
  --red-dim: rgba(239, 122, 125, 0.13);
  --shadow: 0 20px 50px -28px rgba(0, 0, 0, 0.9);
  --r-lg: 16px;
  --r: 13px;
  --r-sm: 10px;
  --font: 'Pretendard', 'Apple SD Gothic Neo', -apple-system, BlinkMacSystemFont, system-ui, 'Malgun Gothic', sans-serif;
  --mono: 'SFMono-Regular', 'Consolas', 'Menlo', monospace;
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  line-height: 1.6;
  letter-spacing: -0.012em;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  background-color: var(--bg);
  /* 위쪽은 짙은 남색, 아래로 갈수록 검정 — 세로 그라데이션 + 은은한 블루 글로우 */
  background-image:
    radial-gradient(1100px 720px at 80% -6%, rgba(60, 98, 200, 0.30), transparent 56%),
    radial-gradient(820px 560px at 4% 4%, rgba(40, 70, 160, 0.20), transparent 54%),
    radial-gradient(1000px 900px at 50% 116%, rgba(46, 78, 168, 0.16), transparent 58%),
    linear-gradient(178deg, #0c1630 0%, #0a1024 32%, #070a15 62%, #05060c 100%);
  background-attachment: fixed;
}
/* 미세한 그레인 — 디지털 평면감을 없애 사람이 만든 듯한 질감 */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.038; mix-blend-mode: overlay;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 15px; }
svg { display: block; }
::selection { background: var(--accent); color: #fff; }

.wrap { max-width: 1140px; margin: 0 auto; padding: 0 22px 96px; }

/* ---------- 헤더 ---------- */
header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(7, 8, 14, 0.66);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--hair);
}
.header-inner {
  max-width: 1140px; margin: 0 auto; padding: 14px 22px;
  display: flex; align-items: center; gap: 18px;
}
.logo { display: flex; align-items: center; gap: 11px; flex: none; }
.logo .mark {
  width: 38px; height: 38px; border-radius: 11px; flex: none; overflow: hidden;
  background: #fff; border: 1px solid var(--hair-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 5px 16px -6px rgba(40, 70, 150, 0.55);
}
.logo .mark img { width: 100%; height: 100%; object-fit: cover; object-position: center 42%; display: block; }
.logo-txt { font-size: 17px; font-weight: 750; letter-spacing: -0.02em; }

.header-search { flex: 1; max-width: 440px; margin: 0 auto; position: relative; }
.header-search input {
  width: 100%; padding: 10px 14px 10px 40px; font-size: 14px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--hair);
  border-radius: 11px; color: var(--text); outline: none;
  transition: border-color .16s, background .16s;
}
.header-search input::placeholder { color: var(--faint); }
.header-search input:focus { border-color: var(--accent-line); background: rgba(91, 131, 245, 0.05); }
.header-search .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.header-search .ic svg { width: 17px; height: 17px; }

nav { display: flex; align-items: center; gap: 7px; flex: none; margin-left: auto; }
.nav-balance {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, 0.035); color: #cdd6ee;
  padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 700;
  font-variant-numeric: tabular-nums; border: 1px solid var(--hair);
}
.nav-balance .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.nav-balance .won { font-weight: 600; color: var(--muted); margin-left: 1px; }
.nav-link {
  padding: 9px 12px; border-radius: 9px; font-size: 14px; color: var(--muted);
  background: none; border: none; font-weight: 600; transition: color .15s, background .15s;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.nav-cta {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  color: #fff; border: none; padding: 9px 16px; border-radius: 10px;
  font-size: 14px; font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 8px 20px -10px rgba(91, 131, 245, 0.7);
  transition: filter .15s, transform .1s;
}
.nav-cta:hover { filter: brightness(1.08); }
.nav-cta:active { transform: translateY(1px); }

/* ---------- 공통 ---------- */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.022), transparent 30%), var(--surface);
  border: 1px solid var(--hair);
  border-radius: var(--r-lg); padding: 26px; margin-top: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), var(--shadow);
}
.page-title { font-size: 27px; font-weight: 800; margin: 34px 0 5px; letter-spacing: -0.035em; }
.page-sub { color: var(--muted); font-size: 14.5px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent-hi); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: var(--r); padding: 12px 18px; font-size: 15px; font-weight: 700;
  background: linear-gradient(180deg, var(--accent-hi), var(--accent)); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 8px 22px -12px rgba(91, 131, 245, 0.7);
  transition: filter .15s, transform .1s, opacity .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { background: var(--surface-3); color: var(--faint); cursor: not-allowed; box-shadow: none; filter: none; }
.btn-sub { background: rgba(255, 255, 255, 0.05); color: var(--text); border: 1px solid var(--hair-2); box-shadow: none; }
.btn-sub:hover { background: rgba(255, 255, 255, 0.09); filter: none; }
.btn-danger { background: var(--red-dim); color: var(--red); box-shadow: none; }
.btn-danger:hover { background: rgba(239, 122, 125, 0.2); filter: none; }
.btn-sm { padding: 8px 13px; font-size: 13px; border-radius: var(--r-sm); }
.btn-block { width: 100%; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 8px; color: #bcc3d6; }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--hair-2);
  border-radius: var(--r); background: rgba(255, 255, 255, 0.025); color: var(--text); outline: none;
  transition: border-color .16s, background .16s;
}
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent-line); background: rgba(91, 131, 245, 0.04); }
.field select option { background: var(--surface-2); }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 7px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 7px; font-size: 12px; font-weight: 700; letter-spacing: -0.01em; }
.badge-green { background: var(--green-dim); color: var(--green); }
.badge-amber { background: var(--amber-dim); color: var(--amber); }
.badge-gray  { background: rgba(255, 255, 255, 0.06); color: var(--muted); }
.badge-red   { background: var(--red-dim); color: var(--red); }

.msg { padding: 12px 14px; border-radius: var(--r); font-size: 14px; margin-top: 12px; display: none; }
.msg.show { display: block; }
.msg-error { background: var(--red-dim); color: #f4a3a5; border: 1px solid rgba(239, 122, 125, 0.2); }
.msg-ok { background: var(--green-dim); color: #7fe0b4; border: 1px solid rgba(62, 207, 142, 0.2); }

/* ---------- 상점 ---------- */
.store-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 40px 0 6px; }
.store-head .count { color: var(--muted); font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); gap: 20px; margin-top: 22px; }

.product {
  background: var(--surface); border: 1px solid rgba(255, 255, 255, 0.11); border-radius: var(--r-lg);
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform .18s cubic-bezier(.2,.7,.3,1), border-color .18s, box-shadow .18s;
}
.product:hover {
  transform: translateY(-4px); border-color: rgba(120, 150, 240, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 26px 54px -26px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(120, 150, 240, 0.12);
}
.thumb.has-img { padding: 0; background: #0a0c14; }
.thumb.has-img::before, .thumb.has-img::after { display: none; }
/* 이미지를 컨테이너(16:10)에 절대배치로 정확히 채운 뒤 contain으로 letterbox.
   grid+aspect-ratio 조합에서 height:100%가 안 먹어 이미지가 정사각으로 넘쳐 잘리던 문제 해결. */
.thumb.has-img img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; display: block;
}

.thumb {
  position: relative; aspect-ratio: 16 / 10; display: grid; place-items: center;
  overflow: hidden; padding: 22px; isolation: isolate;
  border-bottom: 1px solid var(--hair);
}
.thumb::before { /* 위쪽 광택 */
  content: ''; position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 42%);
}
.thumb::after { /* 아래쪽 블루 글로우 */
  content: ''; position: absolute; left: 50%; bottom: -26%; transform: translateX(-50%); z-index: 0;
  width: 72%; height: 56%; border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(150, 178, 255, 0.24), transparent 70%);
  filter: blur(11px);
}
.thumb .thumb-name {
  position: relative; z-index: 1; text-align: center;
  font-size: 21px; font-weight: 800; letter-spacing: -0.03em; color: #f4f6fc;
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.5); text-wrap: balance;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.thumb .soldout-veil {
  position: absolute; inset: 0; z-index: 2; background: rgba(5, 6, 11, 0.62);
  display: grid; place-items: center; font-weight: 800; font-size: 13px; letter-spacing: 0.08em;
  color: #cfd5e6; backdrop-filter: blur(2px);
}

.product .body { padding: 16px 17px 17px; display: flex; flex-direction: column; gap: 11px; flex: 1; }
.product .desc { font-size: 13px; color: var(--muted); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.product .meta { display: flex; gap: 6px; flex-wrap: wrap; }
.product .price-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 3px;
  padding-top: 13px; border-top: 1px solid var(--hair); }
.product .price-label { font-size: 10px; font-weight: 700; letter-spacing: 0.14em; color: var(--faint); margin-bottom: 1px; }
.product .price { font-size: 21px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.product .price small { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-left: 2px; }

/* ---------- 테이블 ---------- */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: 0.03em;
  padding: 10px 10px; border-bottom: 1px solid var(--hair); white-space: nowrap; }
td { padding: 13px 10px; border-bottom: 1px solid var(--hair); vertical-align: middle; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: none; }

/* ---------- 모달 ---------- */
.modal-back {
  display: none; position: fixed; inset: 0; background: rgba(3, 4, 8, 0.7);
  z-index: 100; padding: 20px; overflow-y: auto; backdrop-filter: blur(6px);
}
.modal-back.show { display: flex; align-items: flex-start; justify-content: center; }
.modal {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 24%), var(--surface);
  border: 1px solid var(--hair-2); border-radius: 18px; padding: 26px; width: 100%; max-width: 440px; margin-top: 7vh;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 40px 90px -34px rgba(0, 0, 0, 0.95);
}
.modal h3 { font-size: 19px; margin-bottom: 16px; letter-spacing: -0.025em; }

.qty-row { display: flex; align-items: center; gap: 12px; }
.qty-btn {
  width: 42px; height: 42px; border-radius: 11px; border: 1px solid var(--hair-2);
  background: rgba(255, 255, 255, 0.04); color: var(--text); font-size: 20px; font-weight: 700;
  transition: background .12s;
}
.qty-btn:hover { background: rgba(255, 255, 255, 0.08); }
.qty-num { font-size: 19px; font-weight: 800; min-width: 42px; text-align: center; font-variant-numeric: tabular-nums; }

.summary-box { background: rgba(255, 255, 255, 0.025); border: 1px solid var(--hair); border-radius: var(--r); padding: 16px; }
.summary-box .row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14.5px; }
.summary-box .row span:first-child { color: var(--muted); }
.summary-box .row b { font-weight: 800; }
.summary-box .row .accent { color: var(--accent-hi); }

/* 발급 결과 */
.deliver-block { margin-top: 15px; }
.deliver-label {
  display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.06em; color: var(--muted); margin-bottom: 8px; text-transform: uppercase;
}
.deliver-label .di { display: inline-flex; color: var(--accent-hi); }
.deliver-label .di svg { width: 15px; height: 15px; }
.code-box {
  background: rgba(255, 255, 255, 0.03); border: 1px dashed var(--hair-2); border-radius: var(--r);
  padding: 13px 14px; font-family: var(--mono); font-size: 14px; letter-spacing: 0.02em;
  color: #cfdaff; word-break: break-all; white-space: pre-wrap;
}
.guide-box {
  background: var(--accent-dim); border: 1px solid var(--accent-line); border-radius: var(--r);
  padding: 14px 16px; font-size: 13.5px; color: #d3ddf7; white-space: pre-wrap; line-height: 1.7;
}

/* 충전 프리셋 */
.preset-row { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 13px; }
.preset {
  border: 1px solid var(--hair-2); background: rgba(255, 255, 255, 0.03); color: var(--text);
  border-radius: var(--r); padding: 10px 15px; font-size: 14px; font-weight: 700;
  font-variant-numeric: tabular-nums; transition: all .13s;
}
.preset:hover { background: rgba(255, 255, 255, 0.06); }
.preset.on { border-color: var(--accent-line); color: var(--accent-hi); background: var(--accent-dim); }

/* 계좌 안내 */
.bank-box { background: rgba(255, 255, 255, 0.025); border: 1px solid var(--hair); border-radius: var(--r); padding: 18px; margin-top: 14px; }
.bank-box .row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; font-size: 14.5px; gap: 10px; }
.bank-box .row + .row { border-top: 1px solid var(--hair); }
.bank-box .row span:first-child { color: var(--muted); }
.bank-box .row b { font-weight: 800; font-variant-numeric: tabular-nums; }

/* 어드민 탭 */
.tabs { display: flex; gap: 6px; margin-top: 24px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--hair); border-radius: 14px; padding: 7px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04); }
.tab { border: none; background: none; padding: 9px 16px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 700; color: var(--muted); transition: all .13s; }
.tab:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.tab.on { background: linear-gradient(180deg, var(--accent-hi), var(--accent)); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 8px 18px -10px rgba(91, 131, 245, 0.7); }

/* 실시간 구매 로그 */
.livelog {
  margin-top: 18px; background: var(--surface); border: 1px solid var(--hair);
  border-radius: 14px; padding: 14px 18px 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.livelog-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 800; letter-spacing: 0.08em; color: var(--muted);
  text-transform: uppercase; padding-bottom: 8px; border-bottom: 1px solid var(--hair);
}
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 8px var(--green); animation: livePulse 1.6s ease-in-out infinite;
}
@keyframes livePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.livelog-row {
  display: flex; align-items: baseline; gap: 10px; padding: 9px 0;
  font-size: 13.5px; border-bottom: 1px solid var(--hair);
}
.livelog-row:last-child { border-bottom: none; }
.livelog-row .who { font-weight: 700; color: var(--accent-hi); flex: none; font-family: var(--mono); font-size: 12.5px; }
.livelog-row .what { color: #c9cede; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.livelog-row .what b { color: var(--text); }
.livelog-row .when { margin-left: auto; flex: none; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }

.empty { text-align: center; color: var(--muted); padding: 48px 0; font-size: 14px; }
.auth-card { max-width: 412px; margin: 52px auto 0; }

.locker-item { border-bottom: 1px solid var(--hair); padding: 17px 0; }
.locker-item:last-child { border-bottom: none; }

@media (max-width: 760px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 13px; }
  .header-search { display: none; }
  .thumb .thumb-name { font-size: 17px; }
  .product .price { font-size: 18px; }
  .logo-txt { display: none; }
}
@media (max-width: 440px) {
  .grid { grid-template-columns: 1fr; }
}
