/* =============================================================
   아이템매니야 — 스타일
   콘셉트: 미드나이트 거래소 + 골드 액센트, 가격은 티커처럼
   ============================================================= */

:root {
  --bg:        #f5f6f9;
  --bg-2:      #ffffff;
  --surface:   #ffffff;
  --surface-2: #f1f3f7;
  --border:    #e4e7ee;
  --border-2:  #d3d8e2;

  --text:      #1b1e27;
  --muted:     #5c6373;
  --faint:     #9298a7;

  --gold:      #c5890c;
  --gold-soft: #c5890c1a;
  --cyan:      #0e97a8;

  --ok:        #1f9d57;
  --warn:      #c5820f;
  --done:      #98a0b0;

  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 12px 28px -14px rgba(20,28,55,.28);

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  --display: "Space Grotesk", "Pretendard Variable", Pretendard, sans-serif;
  --body: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
          "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 500px at 80% -10%, #eef1f8 0%, transparent 60%),
    radial-gradient(900px 480px at -10% 0%, #f4eef9 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- 레이아웃 컨테이너 ---------- */
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }

/* ---------- 헤더 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,.84);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-row {
  display: flex; align-items: center; gap: 18px;
  height: 64px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--display);
  font-weight: 700; font-size: 21px; letter-spacing: -.02em;
  white-space: nowrap;
}
.brand .mark {
  width: 22px; height: 22px; transform: rotate(45deg);
  background: linear-gradient(135deg, var(--gold), #d6911f);
  border-radius: 5px;
  box-shadow: 0 0 18px var(--gold-soft);
}
.brand b { color: var(--gold); font-weight: 700; }

.search {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 0 14px; height: 42px;
  max-width: 460px;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--border-2); box-shadow: 0 0 0 3px var(--gold-soft); }
.search svg { width: 17px; height: 17px; color: var(--faint); flex: none; }
.search input {
  flex: 1; background: none; border: 0; outline: 0;
  color: var(--text); font-size: 14px;
}
.search input::placeholder { color: var(--faint); }

.header-actions { display: flex; align-items: center; gap: 8px; white-space: nowrap; }

/* ---------- 버튼 ---------- */
.btn {
  border: 1px solid var(--border-2); background: var(--surface);
  color: var(--text); border-radius: 10px; padding: 9px 15px;
  font-size: 14px; font-weight: 600; line-height: 1;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: none; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-gold {
  background: linear-gradient(135deg, var(--gold), #e0a126);
  color: #1a1405; border-color: transparent; font-weight: 700;
}
.btn-gold:hover { filter: brightness(1.06); background: linear-gradient(135deg, var(--gold), #e0a126); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.who { display: flex; align-items: center; gap: 8px; }
.who .nick { color: var(--gold); font-weight: 700; font-size: 14px; }

/* ---------- 티커 ---------- */
.ticker {
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  overflow: hidden; height: 38px;
  display: flex; align-items: center;
}
.ticker-label {
  flex: none; padding: 0 14px; height: 100%;
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .12em;
  color: #1a1405; background: var(--gold);
  text-transform: uppercase;
}
.ticker-track {
  display: flex; gap: 34px; white-space: nowrap;
  padding-left: 34px;
  animation: scroll-left 38s linear infinite;
}
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-item { font-size: 13px; color: var(--muted); }
.ticker-item .g { color: var(--text); }
.ticker-item .p { color: var(--gold); font-family: var(--mono); margin-left: 8px; }
@keyframes scroll-left { to { transform: translateX(-50%); } }

/* ---------- 히어로/필터 영역 ---------- */
.toolbar { padding: 26px 0 16px; }
.toolbar h1 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(22px, 3vw, 30px); letter-spacing: -.02em;
  margin: 0 0 4px;
}
.toolbar h1 b { color: var(--gold); }
.toolbar .sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); border-radius: 999px; padding: 8px 15px;
  font-size: 13px; font-weight: 600;
  transition: all .14s;
}
.chip:hover { color: var(--text); border-color: var(--border-2); }
.chip.active {
  background: var(--gold-soft); border-color: var(--gold);
  color: var(--gold);
}

.filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-top: 14px;
}
.filters .grp-label { font-size: 12px; color: var(--faint); margin-right: 2px; }
.select {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; padding: 9px 12px;
  font-size: 13px; outline: none;
}
.select:focus { border-color: var(--gold); }
.filters .spacer { flex: 1; }
.count { font-size: 13px; color: var(--muted); }
.count b { color: var(--text); font-family: var(--mono); }

/* ---------- 매물 그리드 ---------- */
.grid {
  display: grid; gap: 14px; padding: 18px 0 60px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .14s, border-color .14s, box-shadow .14s;
  text-align: left;
}
.card:hover {
  transform: translateY(-3px); border-color: var(--border-2);
  box-shadow: var(--shadow);
}
.card-top {
  height: 120px; position: relative;
  display: flex; align-items: center; justify-content: center;
  background:
    linear-gradient(135deg, var(--surface-2), var(--bg-2));
  overflow: hidden;
}
.card-top img { width: 100%; height: 100%; object-fit: cover; }
.card-top .game-emblem {
  font-family: var(--display); font-weight: 700; font-size: 26px;
  color: var(--border-2); letter-spacing: -.02em;
  user-select: none;
}
.badges {
  position: absolute; top: 10px; left: 10px; right: 10px;
  display: flex; justify-content: space-between; gap: 6px;
}
.badge {
  font-size: 11px; font-weight: 700; padding: 4px 9px;
  border-radius: 999px; backdrop-filter: blur(4px);
  background: rgba(255,255,255,.86); border: 1px solid var(--border);
}
.badge.cat { color: var(--cyan); border-color: #4fd1e055; }
.status { display: inline-flex; align-items: center; gap: 5px; }
.status::before { content:""; width: 6px; height: 6px; border-radius: 50%; }
.status.s-판매중 { color: var(--ok); } .status.s-판매중::before { background: var(--ok); }
.status.s-예약중 { color: var(--warn); } .status.s-예약중::before { background: var(--warn); }
.status.s-판매완료 { color: var(--done); } .status.s-판매완료::before { background: var(--done); }

.card-body { padding: 13px 14px 15px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.card-game { font-size: 12px; color: var(--muted); font-weight: 600; }
.card-title {
  font-size: 15px; font-weight: 600; line-height: 1.35; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-price { font-family: var(--mono); font-size: 19px; font-weight: 700; color: var(--gold); }
.card-price small { color: var(--muted); font-size: 12px; font-weight: 500; }
.card-meta {
  margin-top: auto; padding-top: 9px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--faint);
}
.card-meta .seller { color: var(--muted); }

/* ---------- 상태(빈/로딩/에러) ---------- */
.state {
  grid-column: 1 / -1; text-align: center; padding: 70px 20px; color: var(--muted);
}
.state h3 { color: var(--text); font-family: var(--display); margin: 0 0 6px; }
.skeleton { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); height: 250px; position: relative; overflow: hidden; }
.skeleton-shimmer::after {
  content:""; position:absolute; inset:0;
  background: linear-gradient(90deg, transparent, #00000008, transparent);
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- 모달 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(7,8,12,.66); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 18px; opacity: 0; pointer-events: none; transition: opacity .18s;
}
.overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  width: min(520px, 100%); max-height: 90vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 18px; box-shadow: var(--shadow);
  transform: translateY(8px) scale(.99); transition: transform .18s;
}
.overlay.open .modal { transform: none; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface);
}
.modal-head h2 { font-family: var(--display); font-size: 18px; margin: 0; }
.modal-x { background: none; border: 0; color: var(--muted); font-size: 22px; line-height: 1; padding: 4px; }
.modal-x:hover { color: var(--text); }
.modal-body { padding: 20px; }

/* ---------- 폼 ---------- */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 13px; color: var(--text); font-size: 14px; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.field textarea { resize: vertical; min-height: 84px; }
.field-row { display: flex; gap: 12px; }
.field-row > .field { flex: 1; }
.form-note { font-size: 12px; color: var(--faint); margin-top: -6px; margin-bottom: 14px; }
.form-error { color: #d23b3b; font-size: 13px; margin-bottom: 12px; min-height: 0; }
.auth-switch { text-align: center; font-size: 13px; color: var(--muted); margin-top: 14px; }
.auth-switch button { background: none; border: 0; color: var(--gold); font-weight: 600; }

/* ---------- 매물 상세 ---------- */
.detail-hero {
  height: 150px; border-radius: 12px; margin-bottom: 18px;
  background: linear-gradient(135deg, var(--surface-2), var(--bg-2));
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.detail-hero img { width: 100%; height: 100%; object-fit: cover; }
.detail-hero .game-emblem { font-family: var(--display); font-size: 34px; color: var(--border-2); font-weight: 700; }
.detail-badges { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.detail-title { font-size: 20px; font-weight: 700; margin: 0 0 10px; line-height: 1.35; }
.detail-price { font-family: var(--mono); font-size: 30px; font-weight: 700; color: var(--gold); margin-bottom: 18px; }
.detail-desc { color: var(--muted); white-space: pre-wrap; line-height: 1.65; border-top: 1px solid var(--border); padding-top: 16px; }
.detail-info { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.detail-info .k { font-size: 12px; color: var(--faint); }
.detail-info .v { font-weight: 600; }
.owner-actions { display: flex; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ---------- 토스트 ---------- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--surface-2); border: 1px solid var(--border-2);
  color: var(--text); padding: 11px 18px; border-radius: 12px;
  font-size: 14px; box-shadow: var(--shadow);
  animation: toast-in .2s ease;
}
.toast.err { border-color: #d23b3b44; }
.toast.ok { border-color: #38c17244; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- 푸터 ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 26px 0; color: var(--faint); font-size: 13px; }
.site-footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ---------- 반응형 ---------- */
@media (max-width: 640px) {
  .header-row { gap: 10px; height: 58px; }
  .search { order: 3; flex-basis: 100%; max-width: none; height: 40px; }
  .header-row { flex-wrap: wrap; height: auto; padding: 10px 0; }
  .brand { font-size: 18px; }
  .detail-info { grid-template-columns: 1fr; }
}

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

/* 키보드 포커스 가시성 */
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ---------- 고객센터(1:1 문의) ---------- */
.inq-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.inq-list { display: flex; flex-direction: column; gap: 8px; }
.inq-row {
  width: 100%; text-align: left; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 13px 14px; display: flex; flex-direction: column; gap: 6px;
  transition: border-color .14s;
}
.inq-row:hover { border-color: var(--border-2); }
.inq-row .top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.inq-row .t { font-weight: 600; font-size: 14px; }
.inq-row .meta { display: flex; gap: 8px; font-size: 12px; color: var(--faint); }
.pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill.wait { color: var(--warn); background: #f0a93b1f; }
.pill.done { color: var(--ok); background: #38c1721f; }
.inq-bubble { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 13px 14px; margin-bottom: 10px; }
.inq-bubble .who { display: block; font-size: 12px; color: var(--faint); margin-bottom: 6px; }
.inq-bubble .body { white-space: pre-wrap; line-height: 1.65; }
.inq-bubble.reply { border-color: #f5b63855; background: var(--gold-soft); }
.back-link { background: none; border: 0; color: var(--muted); font-size: 13px; padding: 0; margin-bottom: 12px; cursor: pointer; }
.back-link:hover { color: var(--text); }

/* ---------- 실시간 채팅 ---------- */
.chat-head { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.chat-head .nick { color: var(--gold); font-weight: 700; }
.chat-log {
  height: 360px; max-height: 50vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px; padding: 10px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
}
.chat-row { display: flex; }
.chat-row.me { justify-content: flex-end; }
.chat-row.them { justify-content: flex-start; }
.chat-bubble { max-width: 78%; padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.45; }
.chat-row.me .chat-bubble { background: linear-gradient(135deg, var(--gold), #e0a126); color: #1a1405; border-bottom-right-radius: 4px; }
.chat-row.them .chat-bubble { background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-who { display: block; font-size: 11px; color: var(--cyan); font-weight: 700; margin-bottom: 3px; }
.chat-body { white-space: pre-wrap; word-break: break-word; }
.chat-time { display: block; font-size: 10px; opacity: .55; margin-top: 4px; text-align: right; }
.chat-bar { display: flex; gap: 8px; margin-top: 12px; }
.chat-input {
  flex: 1; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 13px; color: var(--text); font-size: 14px; outline: none;
}
.chat-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }

/* ---------- 마일리지 / 거래 ---------- */
.mileage-pill {
  background: var(--gold-soft); border: 1px solid var(--gold); color: var(--gold);
  border-radius: 999px; padding: 7px 12px;
  font-family: var(--mono); font-weight: 700; font-size: 13px;
}
.mileage-pill:hover { filter: brightness(1.04); }
.mileage-box {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--gold-soft); border: 1px solid var(--gold);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 16px;
}
.mileage-box .k { font-size: 13px; color: var(--muted); }
.mileage-box .v { font-size: 22px; font-weight: 700; color: var(--gold); }
.tx-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px;
}
.tx-title { font-weight: 600; font-size: 14px; }
.tx-amt { font-weight: 700; font-size: 15px; white-space: nowrap; }
