:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --primary: #2563eb;
  --border: rgba(17, 24, 39, 0.12);
  --radius: 14px;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.06);

  --appbar-height: 52px;
  --bottom-nav-height: 56px;
  --max-width: 520px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Helvetica,
    Arial,
    "PingFang SC",
    "Hiragino Sans GB",
    "Noto Sans CJK SC",
    "Microsoft YaHei",
    sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  border: none;
  background: none;
  padding: 0;
  color: inherit;
}

#app {
  min-height: 100%;
  display: flex;
  justify-content: center;
}

.app-shell {
  width: 100%;
  max-width: var(--max-width);
  min-height: 100vh;
  background: var(--bg);
  --overlay-height: 0px;
}

.app-shell.has-bottom-nav .main {
  padding-bottom: calc(
    12px + var(--bottom-nav-height) + env(safe-area-inset-bottom) + var(--overlay-height)
  );
}

.appbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--appbar-height);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.appbar-back {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--text);
}

.appbar-back:active {
  background: rgba(17, 24, 39, 0.06);
}

.appbar-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.appbar-spacer {
  width: 40px;
  height: 40px;
}

.main {
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom) + var(--overlay-height));
}

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: var(--max-width);
  height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}

.nav-item {
  flex: 1;
  padding: 8px 6px 10px;
  display: grid;
  place-items: center;
  gap: 4px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
}

.nav-item[aria-current="page"] {
  color: var(--primary);
  font-weight: 700;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.section-title {
  margin: 16px 4px 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.img-cover {
  width: 100%;
  display: block;
  object-fit: cover;
  background: #e5e7eb;
}

.banner-img {
  aspect-ratio: 16 / 10;
}

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

.product-image-button {
  display: block;
  width: 100%;
  cursor: pointer;
}

.cart-thumb-button {
  display: block;
  width: 100%;
  cursor: pointer;
}

.product-body {
  padding: 10px 10px 12px;
  display: grid;
  gap: 6px;
}

.product-name {
  padding: 0;
  border: none;
  background: none;
  text-align: left;
  color: var(--text);
  font-weight: 700;
  line-height: 1.2;
}

.product-name:active {
  opacity: 0.8;
}

.product-price {
  color: var(--primary);
  font-weight: 800;
}

.muted {
  color: var(--muted);
}

.btn {
  height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:disabled {
  background: #9ca3af;
}

.btn-outline {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.fixed-bottom-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: var(--max-width);
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}

.app-shell.has-bottom-nav .fixed-bottom-bar {
  bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  padding-bottom: 12px;
}

.empty-state {
  padding: 20px 14px;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  color: var(--muted);
  text-align: center;
}
