:root {
  --bg: #f2f3f4;
  --paper: #fff;
  --ink: #121214;
  --muted: #8b8b92;
  --line: #ececef;
  --soft: #f7f7f8;
  --accent: #ff8a1f;
  --black: #171717;
  --green: #20c45a;
  --danger: #e02a2a;
  --shadow: 0 18px 54px rgba(0, 0, 0, 0.12);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

body[data-theme="dark"] {
  --bg: #0f1012;
  --paper: #18191d;
  --ink: #f4f4f5;
  --muted: #a4a4aa;
  --line: #303238;
  --soft: #24262b;
  --shadow: 0 18px 54px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

.app {
  max-width: 640px;
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: calc(122px + var(--safe-bottom));
  background: var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 20px 12px;
  background: var(--paper);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
}

.logo {
  width: min(205px, 52vw);
  height: 56px;
  object-fit: contain;
  object-position: left center;
  mix-blend-mode: multiply;
}

.logo-button {
  border: 0;
  background: transparent;
  padding: 0;
  transition: transform 150ms ease, opacity 150ms ease;
}

.logo-button:active {
  transform: scale(0.96);
  opacity: 0.82;
}

body[data-theme="dark"] .logo {
  filter: invert(1) contrast(1.05);
  mix-blend-mode: screen;
}

.balance {
  display: grid;
  grid-template-columns: 1fr 40px;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 8px;
  min-width: 126px;
  min-height: 46px;
  padding: 5px 6px 5px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.balance:active {
  transform: scale(0.97);
}

.balance strong {
  grid-column: 1;
  grid-row: 1;
  font-size: 13px;
  letter-spacing: 2px;
}

.balance span {
  grid-column: 1;
  grid-row: 2;
  color: var(--muted);
  font-size: 11px;
}

.balance .avatar {
  grid-column: 2;
  grid-row: 1 / 3;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
}

.hero {
  display: grid;
  gap: 26px;
  padding: 14px 20px 54px;
  background: var(--paper);
}

.hero h1 {
  margin: 0;
  font-size: 29px;
  font-weight: 500;
}

.search {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 52px;
}

.search b {
  font-size: 38px;
  line-height: 1;
  transform: rotate(-16deg);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 25px;
}

.search input::placeholder {
  color: #b9b9bf;
}

.tabs {
  display: flex;
  gap: 14px;
}

.tab {
  min-width: 86px;
  min-height: 58px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 19px;
  transition: transform 150ms ease, background 150ms ease, color 150ms ease;
}

.tab.active {
  border-color: var(--line);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
}

.feed,
.screen {
  display: grid;
  gap: 10px;
  padding: 10px 8px 18px;
}

.shop-card,
.panel,
.product-card,
.review-card {
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

.shop-card {
  overflow: hidden;
}

.shop-card button,
.shop-click {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.shop-inner {
  padding: 22px 24px 20px;
}

.shop-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.shop-title {
  display: flex;
  align-items: center;
  gap: 9px;
}

.shop-title h2,
.profile-title {
  margin: 0;
  font-size: 32px;
  font-weight: 500;
}

.verify {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.desc {
  color: var(--muted);
  font-size: 22px;
  line-height: 1.25;
}

.shop-image,
.profile-cover,
.product-image {
  display: block;
  width: 100%;
  object-fit: cover;
}

.shop-image {
  aspect-ratio: 1 / 1;
  border-radius: 22px;
}

.profile-cover {
  height: 430px;
  background: var(--soft);
}

.profile-body {
  padding: 34px 38px 28px;
}

.breadcrumbs {
  color: var(--muted);
  font-size: 18px;
  margin-bottom: 34px;
}

.read-button {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
  padding: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin: 44px 0;
  padding-top: 36px;
  border-top: 1px solid var(--line);
}

.stat strong {
  display: block;
  font-size: 36px;
  letter-spacing: 1px;
}

.stat span {
  color: var(--muted);
  font-size: 21px;
}

.rating {
  margin-bottom: 34px;
}

.rating strong {
  display: block;
  color: #f6aa2c;
  font-size: 34px;
}

.stars {
  color: #ffbd31;
  font-size: 30px;
  letter-spacing: 2px;
}

.primary {
  min-height: 64px;
  border: 0;
  border-radius: 999px;
  background: #000;
  color: #fff;
  font-size: 22px;
  font-weight: 600;
}

.green-dot {
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-left: 16px;
  border-radius: 50%;
  background: #16c80f;
  box-shadow: 0 0 0 5px rgba(22, 200, 15, 0.16);
}

.store-age {
  margin: 26px 0;
  color: var(--muted);
  text-align: center;
}

.pill-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 18px 0;
}

.pill-tabs button {
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 20px;
}

.pill-tabs button.muted {
  background: var(--soft);
  color: var(--muted);
}

.product-card {
  overflow: hidden;
}

.product-image {
  aspect-ratio: 1 / 1;
}

.product-body {
  padding: 18px 20px 22px;
}

.product-body h3 {
  margin: 0 0 8px;
  font-size: 23px;
  font-weight: 500;
}

.price {
  font-size: 22px;
  font-weight: 800;
}

.review-card {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
}

.review-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.review-body {
  display: grid;
  gap: 4px;
}

.review-head strong {
  font-size: 16px;
  font-weight: 800;
}

.review-stars {
  color: #ffbd31;
  font-size: 17px;
  letter-spacing: 1px;
  white-space: nowrap;
}

.review-body h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.review-body p {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.empty-state {
  color: var(--muted);
  font-size: 18px;
}

.form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 18px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  color: var(--ink);
  padding: 12px 16px;
}

.field textarea {
  min-height: 150px;
  resize: vertical;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.panel {
  padding: 24px;
}

.panel h2 {
  margin: 0 0 18px;
  font-size: 34px;
  font-weight: 500;
}

.notice {
  padding: 14px 16px;
  border-left: 4px solid var(--danger);
  border-radius: 14px;
  background: var(--paper);
  color: var(--danger);
}

.auth-wrap {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 18px;
  background: var(--bg);
}

.auth-card {
  width: min(460px, 100%);
  padding: 24px;
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.auth-card img {
  width: 210px;
  height: 58px;
  object-fit: contain;
  object-position: left center;
  mix-blend-mode: multiply;
}

.auth-card h1 {
  margin: 20px 0;
  font-size: 30px;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
}

.dock {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  width: min(640px, 100vw);
  padding: 10px 12px calc(10px + var(--safe-bottom));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  backdrop-filter: blur(16px);
}

.theme-toggle,
.language {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
}

.theme-toggle {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

.theme-toggle:focus,
.theme-toggle:focus-visible,
.language button:focus,
.language button:focus-visible,
.balance:focus,
.balance:focus-visible,
.logo-button:focus,
.logo-button:focus-visible {
  outline: none;
  box-shadow: none;
}

.switch {
  display: inline-grid;
  width: 58px;
  height: 34px;
  align-items: center;
  padding: 3px;
  border-radius: 999px;
  background: var(--soft);
}

.switch i {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.18);
  transition: transform 160ms ease;
}

.switch.dark i {
  transform: translateX(24px);
}

.language div {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--soft);
}

.language button {
  min-width: 42px;
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.language button.active {
  background: var(--ink);
  color: var(--paper);
}

.menu {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-bottom));
  z-index: 60;
  display: grid;
  width: 56px;
  height: 56px;
  place-content: center;
  gap: 6px;
  border: 0;
  border-radius: 50%;
  background: #171717;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
  transform: translateX(-50%);
}

.menu span {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 999px;
  background: #fff;
}

.nav-pop,
.account-pop,
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  background: rgba(0, 0, 0, 0.18);
}

.nav-pop.open,
.account-pop.open,
.modal-backdrop.open {
  display: block;
}

.nav-card {
  position: absolute;
  left: 50%;
  bottom: calc(150px + var(--safe-bottom));
  display: grid;
  width: min(340px, calc(100vw - 30px));
  gap: 8px;
  padding: 12px;
  border-radius: 24px;
  background: var(--paper);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

.nav-card button {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  background: var(--soft);
  color: var(--ink);
}

.account-card {
  position: absolute;
  top: 82px;
  right: max(10px, calc((100vw - 640px) / 2 + 10px));
  width: min(500px, calc(100vw - 74px));
  padding: 20px 24px;
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.account-row {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 17px;
  align-items: center;
  min-height: 48px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 20px;
}

.divider {
  height: 1px;
  margin: 12px 0;
  background: var(--line);
}

.modal {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 80px);
  overflow: auto;
  padding: 24px;
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
  transform: translate(-50%, -50%);
}

.modal h2 {
  margin-top: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(126px + var(--safe-bottom));
  z-index: 90;
  display: none;
  width: min(540px, calc(100vw - 28px));
  padding: 14px 18px;
  border-radius: 18px;
  background: var(--paper);
  color: var(--danger);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

.toast.show {
  display: block;
}

@media (max-width: 480px) {
  .topbar {
    padding-inline: 18px;
  }

  .logo {
    width: min(178px, 50vw);
    height: 50px;
  }

  .dock {
    grid-template-columns: 1fr;
  }

  .profile-cover {
    height: 390px;
  }

  .profile-body {
    padding-inline: 26px;
  }
}
