/* Shim for WXML custom elements. Browsers render unknown tags but without
   default display properties, so we establish them here to mirror WeChat's
   rendering of <view> (block), <text> (inline), <image> (block), <scroll-view> (block scroll). */
view { display: block; }
text { display: inline; }
/* <image> is parsed as <img> by the HTML parser (legacy alias), so the
   selector below targets `img` and we emit `<img>` in preview HTML. */
img {
  display: block;
  max-width: 100%;
  object-fit: cover;
}
img[mode="aspectFill"] { object-fit: cover; }
img[mode="aspectFit"] { object-fit: contain; }

scroll-view {
  display: block;
  overflow: hidden;
}
scroll-view[scroll-y] { overflow-y: auto; overflow-x: hidden; }
scroll-view[scroll-x] { overflow-x: auto; overflow-y: hidden; white-space: nowrap; scrollbar-width: none; }
scroll-view[scroll-x]::-webkit-scrollbar { display: none; }
scroll-view[scroll-y] { scrollbar-width: none; }
scroll-view[scroll-y]::-webkit-scrollbar { display: none; }

/* --- Phone frame (used only by index.html host; unscoped pages ignore it) --- */
.phone-stage {
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 20%, rgba(214, 231, 161, 0.25), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(167, 98, 80, 0.18), transparent 55%),
    #efe7d9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  box-sizing: border-box;
  font-family: "Manrope", sans-serif;
}

.phone-wrap {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}

.phone-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 24px;
}

.phone-nav-title {
  font-family: "Noto Serif", serif;
  font-size: 20px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #53433f;
  margin-bottom: 18px;
}

.phone-nav button {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 10px 16px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #53433f;
  cursor: pointer;
  text-align: left;
}
.phone-nav button.active {
  background: #8a4b39;
  color: #fff8ef;
}
.phone-nav-hint {
  font-size: 10px;
  color: #86736e;
  letter-spacing: 0.1em;
  max-width: 160px;
  line-height: 1.5;
  margin-top: 18px;
}

.phone {
  position: relative;
  width: 390px;
  height: 844px;
  border-radius: 48px;
  background: #1e1b13;
  padding: 12px;
  box-sizing: border-box;
  box-shadow:
    0 1px 2px 0 rgba(0, 0, 0, 0.05),
    0 0 0 1px rgba(0, 0, 0, 0.05);
}

.phone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 38px;
  overflow: hidden;
  background: var(--color-surface, #fff8ef);
}

.phone-notch {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 108px;
  height: 32px;
  background: #1e1b13;
  border-radius: 9999px;
  z-index: 30;
}

.phone-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--color-surface, #fff8ef);
}

/* --- Shared in-page chrome (top bar + custom tab bar) --- */
/* Each page.html includes these classes for the fixed top bar and bottom tab bar. */

.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  padding-top: 0;
  background: rgba(255, 248, 239, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.top-bar-inner {
  height: 44px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.top-bar-btn {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.6);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}
.top-bar-btn img { width: 18px; height: 18px; }
.top-bar-brand {
  font-family: "Noto Serif", serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.35em;
  color: var(--color-on-surface);
}

/* Custom tab bar */
.tab-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 20;
  height: 60px;
  background: var(--color-surface-container-lowest);
  border-radius: 28px;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: stretch;
  padding: 6px;
  gap: 0;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--color-outline);
  text-decoration: none;
  font-family: "Manrope", sans-serif;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding-top: 4px;
  cursor: pointer;
}
.tab img { width: 20px; height: 20px; }
.tab.active {
  color: var(--color-primary);
}

/* Toast (stubs wx.showToast) */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(30, 27, 19, 0.85);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 12px;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; }
