:root {
  --pi: #6b3fa0;
  --pi-dark: #4b2a75;
  --pi-soft: #f3edfa;
  --gold: #f5a524;
  --ink: #1f1a2b;
  --muted: #6d6680;
  --line: #e6e1ef;
  --bg: #faf8fd;
  --card: #ffffff;
  --ok: #1f8a4c;
  --warn: #b26a00;
  --bad: #c0392b;
  --radius: 14px;
  --tier-local: #2f9e6b;
  --tier-regional: #2d6fd6;
  --tier-global: #c2410c;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--pi); color: #fff;
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; text-decoration: none; }
.logo-mark {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--gold); color: var(--pi-dark); font-size: 15px; font-weight: 900;
}

.view { max-width: 760px; margin: 0 auto; padding: 16px 16px 96px; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: center; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; max-width: 190px; display: flex; flex-direction: column; align-items: center;
  padding: 8px 4px 10px; font-size: 12px; color: var(--muted); text-decoration: none; gap: 2px;
}
.tabbar a span { font-size: 20px; line-height: 1; }
.tabbar a.active { color: var(--pi); font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 12px; padding: 12px 18px; cursor: pointer;
  background: var(--pi); color: #fff; font-weight: 700; text-decoration: none;
}
.btn:hover { background: var(--pi-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-small { padding: 7px 12px; font-size: 14px; border-radius: 10px; background: rgba(255,255,255,.18); }
.btn-small:hover { background: rgba(255,255,255,.3); }
.btn-gold { background: var(--gold); color: var(--pi-dark); }
.btn-gold:hover { background: #e39410; }
.btn-ghost { background: var(--pi-soft); color: var(--pi); }
.btn-ghost:hover { background: #e7dcf5; }
.btn-danger { background: #fdecea; color: var(--bad); }
.btn-block { width: 100%; }

.hero {
  background: linear-gradient(135deg, var(--pi) 0%, #8a5cc4 100%);
  color: #fff; border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.hero h1 { margin: 0 0 4px; font-size: 22px; }
.hero p { margin: 0; opacity: .9; font-size: 14px; }

.search { display: flex; gap: 8px; margin-bottom: 10px; }
.search input { flex: 1; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 6px 12px; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.chip.active { background: var(--pi); color: #fff; border-color: var(--pi); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; text-decoration: none; display: flex; flex-direction: column;
}
.card:hover { border-color: #cdbfe3; box-shadow: 0 4px 14px rgba(75, 42, 117, .08); }
.card-img { aspect-ratio: 16 / 10; background: var(--pi-soft) center / cover no-repeat; display: grid; place-items: center; color: var(--pi); font-size: 34px; }
.card-body { padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.card-brand { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card-title { font-weight: 700; }
.card-discount { color: var(--pi); font-weight: 800; font-size: 18px; }

.tier { font-size: 11px; font-weight: 800; color: #fff; border-radius: 6px; padding: 1px 7px; }
.tier-local { background: var(--tier-local); }
.tier-regional { background: var(--tier-regional); }
.tier-global { background: var(--tier-global); }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.panel h2 { margin: 0 0 12px; font-size: 18px; }
.panel h3 { margin: 16px 0 8px; font-size: 15px; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }

label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
input[type="text"], input[type="url"], input[type="number"], input[type="search"], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #c9b3ea; border-color: var(--pi); }
textarea { min-height: 110px; resize: vertical; }

.choice-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; margin-bottom: 12px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice div {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; background: #fff; cursor: pointer;
}
.choice div b { display: block; }
.choice div small { color: var(--muted); }
.choice input:checked + div { border-color: var(--pi); background: var(--pi-soft); }
.choice input:focus-visible + div { outline: 2px solid #c9b3ea; }
.choice input:disabled + div { background: #f4f2f7; color: var(--muted); cursor: not-allowed; }

.thumbs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 8px; }
.thumbs .slot { aspect-ratio: 1; border: 1.5px dashed var(--line); border-radius: 10px; background: #fff center / cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 12px; }

.price-box {
  position: sticky; bottom: 72px; background: var(--pi-dark); color: #fff; border-radius: var(--radius);
  padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px;
}
.price-box .amount { font-size: 24px; font-weight: 900; color: var(--gold); }
.price-box .breakdown { font-size: 12px; opacity: .85; }

table.fees { width: 100%; border-collapse: collapse; font-size: 14px; }
table.fees th, table.fees td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: center; }
table.fees th:first-child, table.fees td:first-child { text-align: left; }
table.fees input { width: 70px; padding: 6px; text-align: right; }

.detail-gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: var(--radius); margin-bottom: 12px; }
.detail-gallery img { flex: none; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; scroll-snap-align: start; border-radius: var(--radius); }
.video { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; margin: 12px 0; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.coupon {
  border: 2px dashed var(--pi); background: var(--pi-soft); border-radius: var(--radius); padding: 14px; text-align: center; margin: 12px 0;
}
.coupon .code { font-size: 26px; font-weight: 900; letter-spacing: 2px; color: var(--pi-dark); }

.list { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; }
.row .grow { flex: 1; min-width: 0; }
.row .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.badge { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge-pending_payment, .badge-pending, .badge-created, .badge-submitted, .badge-approved-reward { background: #fff4e0; color: var(--warn); }
.badge-review { background: #e8f0fe; color: #1f5fbf; }
.badge-approved, .badge-completed { background: #e3f5ea; color: var(--ok); }
.badge-rejected, .badge-failed { background: #fdecea; color: var(--bad); }

.refbox { display: flex; gap: 8px; align-items: center; background: var(--pi-soft); border-radius: 12px; padding: 12px; }
.refbox .code { font-size: 22px; font-weight: 900; letter-spacing: 2px; color: var(--pi-dark); flex: 1; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat b { display: block; font-size: 20px; }
.stat span { font-size: 12px; color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.empty div { font-size: 38px; }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 90vw;
}
.toast.error { background: var(--bad); }

.notice { background: #fff8e6; border: 1px solid #f3dca3; color: #6b4d00; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }

/* ---- home top banner ---- */
.banner { position: relative; overflow: hidden; border-radius: var(--radius); margin-bottom: 12px; background: var(--pi-dark); }
.banner-track { display: flex; transition: transform .45s ease; }
.banner-slide { flex: 0 0 100%; position: relative; }
/* Same media height for image and video slides so the carousel doesn't jump. */
.banner-img { aspect-ratio: 16 / 7; background: var(--pi-soft) center / cover no-repeat; }
.banner-video { position: relative; aspect-ratio: 16 / 7; background: #000; }
.banner-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.banner-caption {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px 12px; color: #fff; text-decoration: none;
  background: var(--pi-dark); font-size: 14px;
}
.banner-more { margin-left: auto; color: var(--gold); font-weight: 700; }
.banner-dots { position: absolute; top: 8px; right: 10px; display: flex; gap: 5px; }
.banner-dots button { width: 8px; height: 8px; border-radius: 50%; border: 0; padding: 0; background: rgba(255,255,255,.5); cursor: pointer; }
.banner-dots button.on { background: var(--gold); }
.banner-house {
  display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; color: #fff; text-decoration: none;
  background: linear-gradient(135deg, #2a1846 0%, var(--pi-dark) 60%, #7a4bb5 100%);
}
.banner-house b { font-size: 17px; }
.banner-house span { font-size: 13px; opacity: .85; }
.ad-tag { font-size: 10px; font-weight: 900; letter-spacing: .5px; background: var(--gold); color: var(--pi-dark); border-radius: 4px; padding: 1px 5px; }
.hero-slim { padding: 14px 18px; }
.hero-slim h1 { font-size: 18px; }

/* ---- sponsored listings ---- */
.sponsored { background: #fffaf0; border: 1px solid #f3dca3; border-radius: var(--radius); padding: 10px; margin-bottom: 14px; }
.sponsored-head { font-size: 12px; font-weight: 800; color: var(--warn); margin: 0 2px 8px; }
.card-sponsored { border-color: #f3dca3; }
.sponsored .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* ---- ad plans ---- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 14px; }
.plan { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.plans .plan { margin-bottom: 0; }
.plan-off { opacity: .6; }
.plan-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.plan-prices { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.banner-preview { aspect-ratio: 16 / 7; width: 100%; margin-top: 8px; border: 1.5px dashed var(--line); border-radius: 12px; background: #fff center / cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.badge { background: var(--pi-soft); color: var(--pi); }
label.inline { display: inline-flex; align-items: center; gap: 4px; margin: 0 10px 6px 0; font-size: 14px; }
label.inline input[type="number"] { width: 90px; padding: 6px; }
.weekly { display: flex; flex-wrap: wrap; }

/* ---- my page ---- */
.row-wrap { flex-wrap: wrap; }
.sub-box { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; background: var(--pi-soft); border-radius: 10px; padding: 8px 10px; }
.sub-more { flex-basis: 100%; }
.sub-more summary { cursor: pointer; color: var(--pi); }
.sub-more .sub-box { margin-top: 6px; }
.btn-sub { background: var(--pi); }
.btn-sub:hover { background: var(--pi-dark); }
.btn-pay { background: var(--gold); color: var(--pi-dark); }
.btn-adv { background: var(--tier-global); }

@media (min-width: 760px) {
  .hero h1 { font-size: 26px; }
}
