/* =========================================================
   Nora Kingdom — หน้าลูกค้า (Mobile First)
   ========================================================= */
body.customer { padding-bottom: calc(86px + var(--safe-b)); }

/* ---------- HUD ด้านบน ---------- */
.hud {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px;
  background: color-mix(in srgb, var(--lav-l) 88%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: var(--bw) solid var(--ink);
  box-shadow: 0 3px 0 rgba(47, 33, 83, .15);
}
.hud-logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); min-width: 0; }
.hud-logo .logo-box { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border: var(--bw) solid var(--ink); border-radius: 10px; background: var(--cream); overflow: hidden; }
.hud-logo .logo-box svg { width: 26px; }
.hud-logo .logo-box img { width: 100%; height: 100%; object-fit: cover; }
.hud-logo b { font-family: var(--font-px); font-size: 1.15rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-right { display: flex; align-items: center; gap: 8px; }
.hud-me {
  display: flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink);
  padding: 2px 10px 2px 2px; border: var(--bw) solid var(--ink); border-radius: 12px; background: var(--white);
  box-shadow: 0 3px 0 var(--ink); font-family: var(--font-px); font-size: .9rem;
}
.hud-me .px-avatar { width: 30px; height: 30px; background: var(--sky-l); border-radius: 8px; }
.hud .btn-icon svg { width: 20px; height: 20px; }
.hud .btn-icon.is-off { opacity: .5; }

/* ---------- เมนูนำทาง (ล่างจอบนมือถือ) ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px;
  padding: 6px 6px calc(8px + var(--safe-b));
  background: var(--lav);
  border-top: var(--bw) solid var(--ink);
  box-shadow: inset 0 3px 0 var(--lav-l);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 58px; padding: 4px 2px;
  border: var(--bw) solid transparent; border-radius: 12px;
  color: var(--ink); text-decoration: none;
  font-family: var(--font-th); font-size: .72rem; line-height: 1.2;
}
.nav-item svg { width: 26px; height: 26px; }
.nav-item.active { background: var(--cream); border-color: var(--ink); box-shadow: inset 0 -3px 0 var(--cream-d); }
.nav-item.active svg { animation: bob .8s steps(2) infinite; }
.nav-item.nav-write { background: var(--pink); border-color: var(--ink); box-shadow: inset 0 -3px 0 var(--pink-d); }
.nav-item.nav-write.active { background: var(--cream); }

/* ---------- พื้นที่เนื้อหา ---------- */
.view { width: min(100%, 560px); margin: 0 auto; padding: 22px 14px 24px; outline: none; }
.page { animation: fade .25s; }
.page > .win + .win, .page > .win + .section, .page > .section + .win { margin-top: 44px; }
.section-title { display: flex; align-items: center; gap: 8px; font-family: var(--font-th); font-size: 1.1rem; margin: 26px 0 10px; }
.section-title svg { width: 24px; height: 24px; }
.section-title .more { margin-left: auto; font-size: .9rem; }
.foot { text-align: center; padding: 6px 14px 18px; font-size: .8rem; color: var(--ink-soft); }
.foot a { color: var(--ink-soft); }

/* ---------- หน้าแรก ---------- */
.title-win { padding: 10px 10px 0; overflow: hidden; }
.banner {
  position: relative; height: 210px;
  border: var(--bw) solid var(--ink); border-radius: 12px;
  background: linear-gradient(180deg, var(--sky) 0%, var(--sky-l) 55%, var(--pink-l) 100%);
  overflow: hidden;
}
.banner .b-cloud { position: absolute; width: 74px; animation: bob 3s steps(3) infinite; }
.banner .b-castle { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: 170px; }
.banner .b-tree { position: absolute; bottom: 0; width: 48px; }
.banner .b-sparkle { position: absolute; width: 12px; animation: twinkle 1.6s infinite steps(2); }
.banner .b-ground { position: absolute; left: 0; right: 0; bottom: 0; height: 16px; background-size: 32px 16px; background-repeat: repeat-x; image-rendering: pixelated; }
.banner img.custom-banner { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: auto; }
.logo-ribbon { position: relative; margin: -30px auto 0; z-index: 2; }
.logo-ribbon > span { font-family: var(--font-px); font-size: 1.7rem; font-weight: 600; padding: 4px 40px 6px; }
.logo-img { display: block; width: 96px; height: 96px; object-fit: contain; margin: -62px auto 4px; position: relative; z-index: 2; border: var(--bw) solid var(--ink); border-radius: 18px; background: var(--white); box-shadow: var(--shadow); }
.ver-tag { display: table; margin: 6px auto 4px; padding: 0 10px; border: 2px solid var(--ink); border-radius: 8px; background: var(--lav-l); font-family: var(--font-px); font-size: .8rem; }
.tagline { text-align: center; font-family: var(--font-th); font-size: 1rem; margin: 6px 6px 2px; }
.welcome { text-align: center; font-size: .92rem; color: var(--ink-soft); margin: 2px 8px 14px; }
.menu { display: grid; gap: 12px; padding: 0 12px; }
.menu .btn { justify-content: flex-start; min-height: 54px; font-size: 1.08rem; padding-left: 20px; }
.menu .btn svg { width: 28px; height: 28px; }
.menu .btn .arrow { margin-left: auto; font-family: var(--font-px); animation: blink 1s steps(1) infinite; visibility: hidden; }
.menu .btn:hover .arrow, .menu .btn:focus-visible .arrow { visibility: visible; }
.ground {
  position: relative; height: 92px; margin: 16px -10px 0;
  border-top: var(--bw) solid var(--ink);
  background-color: #8fcf8b;
  background-size: 64px 32px; background-repeat: repeat-x; background-position: bottom;
  image-rendering: pixelated;
}
.ground .cat { position: absolute; left: 16px; bottom: 10px; width: 56px; background: none; border: 0; padding: 0; cursor: pointer; }
.ground .cat svg { width: 56px; height: auto; animation: bob 1.2s steps(2) infinite; }
.ground .walker { position: absolute; bottom: 12px; width: 40px; animation: patrol 14s linear infinite; }
.ground .walker svg { width: 40px; animation: walk .35s steps(2) infinite; }
.ground .hearts { position: absolute; right: 14px; bottom: 30px; display: flex; gap: 4px; }
.ground .hearts svg { width: 24px; }
.bubble {
  position: absolute; left: 60px; bottom: 64px; max-width: 220px;
  padding: 6px 12px; border: var(--bw) solid var(--ink); border-radius: 12px; background: var(--white);
  font-family: var(--font-th); font-size: .85rem; box-shadow: 0 3px 0 var(--ink);
  animation: popin .2s; z-index: 3;
}
.bubble::after { content: ''; position: absolute; left: 14px; bottom: -9px; width: 12px; height: 12px; background: var(--white); border-right: var(--bw) solid var(--ink); border-bottom: var(--bw) solid var(--ink); transform: rotate(45deg); }
@keyframes patrol { 0% { left: 30%; transform: scaleX(1); } 48% { left: 70%; transform: scaleX(1); } 50% { left: 70%; transform: scaleX(-1); } 98% { left: 30%; transform: scaleX(-1); } 100% { left: 30%; transform: scaleX(1); } }
.no-anim .ground .walker, .no-anim .banner .b-cloud, .no-anim .scene .cloud { animation: none; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
  text-align: center; padding: 10px 6px;
  border: var(--bw) solid var(--ink); border-radius: 12px; background: var(--white); box-shadow: 0 4px 0 var(--ink);
}
.stat b { display: block; font-family: var(--font-px); font-size: 1.5rem; line-height: 1.1; }
.stat span { font-size: .78rem; color: var(--ink-soft); font-family: var(--font-th); }
.quest {
  display: flex; gap: 12px; align-items: center; margin-top: 14px;
  padding: 12px; border: var(--bw) dashed var(--ink); border-radius: 12px; background: var(--cream);
}
.quest svg { width: 36px; flex: none; }

/* ---------- การ์ดรีวิว ---------- */
.review-list { display: grid; gap: 12px; }
.review-card {
  position: relative; display: grid; grid-template-columns: 54px 1fr auto; gap: 10px; align-items: start;
  padding: 10px; text-align: left; width: 100%;
  border: var(--bw) solid var(--ink); border-radius: 14px; background: var(--white);
  box-shadow: inset 0 -4px 0 var(--lav-xl), 0 4px 0 var(--ink);
  cursor: pointer; transition: transform .08s;
}
.review-card:hover { transform: translateY(-2px); }
.review-card:active { transform: translateY(2px); box-shadow: inset 0 -4px 0 var(--lav-xl), 0 1px 0 var(--ink); }
.av-box { width: 54px; height: 54px; display: grid; place-items: center; border: var(--bw) solid var(--ink); border-radius: 12px; background: var(--sky-l); overflow: hidden; }
.av-box svg { width: 40px; height: 40px; }
.rc-main { min-width: 0; }
.rc-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rc-name { font-family: var(--font-th); font-weight: 500; }
.rc-text { margin: 4px 0 6px; font-size: .93rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rc-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .78rem; color: var(--ink-soft); }
.thumb { width: 64px; height: 64px; object-fit: cover; border: var(--bw) solid var(--ink); border-radius: 10px; background: var(--lav-xl); image-rendering: pixelated; }
.thumb-empty { display: grid; place-items: center; }
.thumb-empty svg { width: 30px; opacity: .35; }
.pin { position: absolute; top: -12px; right: 12px; }
.like-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; min-height: 28px;
  border: 2px solid var(--ink); border-radius: 999px; background: var(--white); cursor: pointer;
  font-family: var(--font-px); font-size: .82rem;
}
.like-btn svg { width: 16px; height: 16px; }
.like-btn.liked { background: var(--pink-l); }
.like-btn.liked svg { animation: pop .3s; }

.search-row { display: flex; gap: 8px; margin-bottom: 10px; }
.search-row .input { flex: 1; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; padding: 10px; border: var(--bw) dashed var(--ink); border-radius: 12px; background: var(--lav-xl); }
.filters .check { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-family: var(--font-th); }
.filters .check input { width: 20px; height: 20px; accent-color: var(--pink-d); }
.result-info { font-size: .85rem; color: var(--ink-soft); margin: 0 2px 8px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; font-family: var(--font-px); font-size: 1.1rem; }
.empty { text-align: center; padding: 26px 10px; color: var(--ink-soft); }
.empty svg { width: 56px; display: block; margin: 0 auto 8px; }

/* รายละเอียดรีวิว */
.detail-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.detail-head .av-box { width: 64px; height: 64px; }
.detail-img { width: 100%; max-height: 340px; object-fit: contain; border: var(--bw) solid var(--ink); border-radius: 12px; background: var(--lav-xl); margin: 10px 0; image-rendering: pixelated; }
.detail-text { white-space: pre-wrap; font-size: 1rem; }

/* ---------- เขียนรีวิว ---------- */
.rate-label { text-align: center; font-family: var(--font-th); min-height: 1.6em; margin-top: 4px; }
.drop {
  display: grid; place-items: center; gap: 6px; text-align: center;
  min-height: 130px; padding: 14px;
  border: var(--bw) dashed var(--ink); border-radius: 12px; background: var(--lav-xl);
  cursor: pointer; position: relative;
}
.drop:hover, .drop.drag { background: var(--pink-l); }
.drop svg { width: 40px; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-preview { position: relative; }
.drop-preview img { width: 100%; max-height: 260px; object-fit: contain; border: var(--bw) solid var(--ink); border-radius: 12px; background: var(--lav-xl); }
.drop-preview .btn { position: absolute; top: 8px; right: 8px; }
.counter { text-align: right; font-family: var(--font-px); font-size: .8rem; color: var(--ink-soft); }
.demo-note { margin-top: 14px; padding: 10px 12px; border: 2px dashed var(--lav-d); border-radius: 12px; background: var(--lav-xl); font-size: .86rem; }
.quest-done { text-align: center; }
.quest-done .qd-title { font-family: var(--font-px); font-size: 1.5rem; color: var(--pink-d); letter-spacing: .06em; text-shadow: 2px 2px 0 var(--ink); -webkit-text-stroke: .5px var(--ink); }
.quest-done svg.px-chest { width: 72px; margin: 8px auto; display: block; animation: bob .6s steps(2) infinite; }

/* ---------- อันดับ ---------- */
.podium-stage { position: relative; padding: 18px 6px 0; border: var(--bw) solid var(--ink); border-radius: 12px; overflow: hidden;
  background: linear-gradient(180deg, var(--lav-l), var(--pink-l)); }
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 6px; position: relative; z-index: 1; }
.pod { display: flex; flex-direction: column; align-items: center; cursor: pointer; background: none; border: 0; padding: 0; font: inherit; color: inherit; }
.pod .px-hero { width: 46px; animation: bob 1.4s steps(2) infinite; }
.pod-1 .px-hero { width: 56px; }
.pod .px-crown { width: 34px; margin-bottom: -2px; animation: bob 1s steps(2) infinite; }
.pod-name { font-family: var(--font-th); font-size: .82rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 2px 0; }
.pod-block {
  width: 100%; display: grid; place-items: center;
  border: var(--bw) solid var(--ink); border-bottom: 0; border-radius: 10px 10px 0 0;
  font-family: var(--font-px); font-size: 2rem; font-weight: 700;
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, .55), inset 0 -6px 0 rgba(0, 0, 0, .08);
}
.pod-1 .pod-block { height: 104px; background: var(--gold); }
.pod-2 .pod-block { height: 78px; background: var(--sky); }
.pod-3 .pod-block { height: 62px; background: #ffb38a; }
.pod-likes { font-family: var(--font-px); font-size: .78rem; display: flex; gap: 3px; align-items: center; }
.pod-likes svg { width: 13px; }
.rank-list { display: grid; gap: 8px; margin-top: 14px; }
.rank-row {
  display: grid; grid-template-columns: 44px 44px 1fr auto; gap: 10px; align-items: center;
  padding: 8px 10px; border: var(--bw) solid var(--ink); border-radius: 12px; background: var(--white); cursor: pointer; text-align: left; width: 100%;
  box-shadow: 0 3px 0 var(--ink);
}
.rank-no { font-family: var(--font-px); font-size: 1.1rem; text-align: center; background: var(--lav-l); border: 2px solid var(--ink); border-radius: 8px; padding: 2px 0; }
.rank-row .av-box { width: 44px; height: 44px; }
.rank-row .av-box svg { width: 32px; height: 32px; }
.svc-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 10px 12px; border: var(--bw) solid var(--ink); border-radius: 12px; background: var(--white); }
.svc-row .bar { grid-column: 1 / -1; }
.svc-row b { font-family: var(--font-px); }

/* ---------- โปรไฟล์ ---------- */
.prof-card { display: grid; grid-template-columns: 84px 1fr; gap: 14px; align-items: center; }
.prof-card .av-box { width: 84px; height: 84px; border-radius: 16px; }
.prof-card .av-box svg { width: 64px; height: 64px; }
.prof-name { font-family: var(--font-th); font-size: 1.2rem; }
.lv { font-family: var(--font-px); font-size: 1rem; }
.exp { font-family: var(--font-px); font-size: .8rem; color: var(--ink-soft); margin-top: 2px; }
.prof-menu { display: grid; gap: 10px; margin-top: 16px; }
.prof-menu .btn { justify-content: flex-start; background: var(--white); }
.prof-menu .btn .badge { margin-left: auto; }
.locked { opacity: .75; }
.avatar-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.avatar-pick button { border: var(--bw) solid var(--ink); border-radius: 12px; background: var(--sky-l); padding: 6px; cursor: pointer; }
.avatar-pick button.on { background: var(--pink); box-shadow: inset 0 -3px 0 var(--pink-d); }
.avatar-pick svg { width: 100%; height: auto; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 2px dashed var(--lav-l); font-family: var(--font-th); }
.reward-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.reward { text-align: center; padding: 10px 4px; border: var(--bw) solid var(--ink); border-radius: 12px; background: var(--lav-xl); font-size: .78rem; font-family: var(--font-th); }
.reward svg { width: 34px; display: block; margin: 0 auto 4px; filter: grayscale(1); opacity: .5; }

/* ---------- ข้อมูลร้าน ---------- */
.info-list { display: grid; gap: 10px; }
.info-item { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; padding: 10px; border: var(--bw) solid var(--ink); border-radius: 12px; background: var(--white); }
.info-item svg { width: 30px; }
.info-item b { font-family: var(--font-th); font-weight: 500; display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.steps { counter-reset: s; display: grid; gap: 6px; margin: 4px 0 0; padding: 0; list-style: none; }
.steps li { counter-increment: s; display: flex; gap: 8px; align-items: center; }
.steps li::before { content: counter(s); flex: none; width: 24px; height: 24px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 6px; background: var(--gold); font-family: var(--font-px); font-size: .85rem; }

/* =========================================================
   Tablet ≥ 640px
   ========================================================= */
@media (min-width: 640px) {
  .view { width: min(100%, 760px); padding: 30px 22px; }
  .banner { height: 250px; }
  .banner .b-castle { width: 210px; }
  .menu { grid-template-columns: 1fr 1fr; }
  .review-list { grid-template-columns: 1fr 1fr; }
  .filters { grid-template-columns: 1fr 1fr 1fr; }
  .filters .check { grid-column: auto; }
  .reward-grid { grid-template-columns: repeat(4, 1fr); }
}

/* =========================================================
   Desktop ≥ 980px — เมนูย้ายไปด้านบน
   ========================================================= */
@media (min-width: 980px) {
  body.customer { padding-bottom: 0; }
  .hud { padding: 10px 28px; }
  .nav {
    position: sticky; top: 61px; bottom: auto; z-index: 49;
    display: flex; justify-content: center; gap: 10px;
    padding: 8px; border-top: 0; border-bottom: var(--bw) solid var(--ink);
    box-shadow: inset 0 -3px 0 var(--lav-d);
  }
  .nav-item { flex-direction: row; gap: 8px; min-height: 46px; padding: 4px 18px; font-size: .98rem; border-color: var(--ink); background: var(--lav-l); box-shadow: inset 0 -3px 0 var(--lav-d); }
  .nav-item svg { width: 24px; height: 24px; }
  .view { width: min(100%, 1120px); padding: 40px 28px; }
  .home-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 28px; align-items: start; }
  .home-grid .section-title:first-child { margin-top: 0; }
  .menu { grid-template-columns: 1fr 1fr; }
  .review-list.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .page-narrow { max-width: 720px; margin: 0 auto; }
  .rank-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; align-items: start; }
  .rank-grid > .win + .win { margin-top: 0; }
  .prof-grid { display: grid; grid-template-columns: 360px 1fr; gap: 28px; align-items: start; }
  .prof-grid > .win + .win { margin-top: 0; }
}
