:root {
  --phone-width: 430px;
  --page-bg: #f2f3f7;
  --text-main: #3e4248;
  --text-strong: #30343a;
  --surface: #ffffff;
  --chip-bg: #ffffff;
  --search-surface: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.6) 0%,
    rgba(255, 255, 255, 1) 100%
  );
  --search-border: rgba(255, 255, 255, 0.92);
  --search-outline: rgba(255, 255, 255, 0.96);
  --search-input: #f2f4f7;
  --search-placeholder: #686f78;
  --search-subtitle: #9da4b0;
  --search-focus-ring: rgba(41, 128, 254, 0.72);
  --search-focus-glow: rgba(41, 128, 254, 0.16);
  --search-input-focus: #edf4ff;
  --button-blue: #2980fe;
  --link-pill-bg: #eaf4ff;
  --row-chevron: #9aa0a6;
  --desktop-bg: #dfe7f3;
  --shadow: 0 18px 48px rgba(16, 31, 56, 0.18);
  --safe-top: max(18px, env(safe-area-inset-top));
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --focus-ring: #ffca2f;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", Helvetica, Arial, sans-serif;
  --font-zh: "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", "Source Han Sans SC", "WenQuanYi Micro Hei", var(--font-sans);
  font-family: var(--font-sans);
  font-synthesis-weight: none;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

html:lang(zh-CN),
html:lang(zh) {
  font-family: var(--font-zh);
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: inherit;
  font-synthesis-weight: none;
  letter-spacing: 0;
  color: var(--text-main);
  background: var(--desktop-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a,
button {
  -webkit-tap-highlight-color: transparent;
  font: inherit;
  letter-spacing: inherit;
}

.clip-defs {
  position: absolute;
  overflow: hidden;
}

.desktop-stage {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.phone-shell {
  position: relative;
  width: min(100vw, var(--phone-width));
  min-height: 100vh;
  overflow-x: hidden;
  background-color: var(--page-bg);
  isolation: isolate;
}

@media (min-width: 720px) {
  .desktop-stage {
    padding: 28px 0;
  }

  .phone-shell {
    width: var(--phone-width);
    min-height: 812px;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    scrollbar-width: none;
    border-radius: 28px;
    box-shadow: var(--shadow);
  }

  .phone-shell::-webkit-scrollbar {
    width: 0;
    height: 0;
  }

  .phone-shell[data-page="category"] #view {
    min-height: 812px;
  }
}

.phone-shell[data-theme="dark"] {
  --page-bg: #000000;
  --text-main: #f2f4f8;
  --text-strong: #ffffff;
  --surface: #161718;
  --chip-bg: #171819;
  --search-surface: linear-gradient(
    180deg,
    rgba(22, 23, 24, 0.64) 0%,
    rgba(22, 23, 24, 1) 100%
  );
  --search-border: rgba(255, 255, 255, 0.08);
  --search-outline: rgba(255, 255, 255, 0.14);
  --search-input: #24262a;
  --search-placeholder: #b8bec7;
  --search-subtitle: #b8bec7;
  --search-focus-ring: rgba(141, 194, 255, 0.78);
  --search-focus-glow: rgba(72, 148, 255, 0.22);
  --search-input-focus: #202a38;
  --link-pill-bg: #111d39;
  --row-chevron: #7b838d;
  background-color: #000000;
}

.app-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: url("./assets/icons/light1.png");
  background-repeat: no-repeat;
  background-size: 100% auto;
  background-position: top center;
}

.phone-shell[data-theme="dark"] .app-bg {
  background-image: url("./assets/icons/dark1.png");
}

.phone-shell[data-page="category"] .app-bg {
  background-image: url("./assets/icons/light1.png");
}

.phone-shell[data-theme="dark"][data-page="category"] .app-bg {
  background-image: url("./assets/icons/dark1.png");
}

#view {
  min-height: 100vh;
}

.phone-shell[data-page="category"] #view {
  display: flex;
  flex-direction: column;
}

.utility-controls {
  position: absolute;
  top: calc(var(--safe-top) + 2px);
  right: 16px;
  z-index: 8;
  display: flex;
  gap: 8px;
}

.phone-shell[data-page="home"] .utility-controls {
  top: var(--safe-top);
  right: 16px;
  left: auto;
}

.phone-shell[data-page="home"] .utility-controls button {
  width: 32px;
  height: 32px;
}

.phone-shell[data-page="home"] .utility-controls svg {
  width: 18px;
  height: 18px;
}

.utility-controls button {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(47, 134, 255, 0.18);
  border-radius: 50%;
  color: #2f86ff;
  background: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(47, 134, 255, 0.13);
  backdrop-filter: blur(10px);
}

.utility-controls svg {
  width: 19px;
  height: 19px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle-icon path:first-child,
.theme-toggle-icon circle {
  fill: currentColor;
  stroke: none;
}

.utility-controls button:focus {
  outline: none;
}

.utility-controls button:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.phone-shell[data-theme="dark"] .utility-controls button {
  color: #8dc2ff;
  border-color: rgba(141, 194, 255, 0.2);
  background: rgba(17, 24, 34, 0.88);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}

.back-button {
  position: relative;
  z-index: 2;
  width: 44px;
  height: 44px;
  margin: var(--safe-top) 0 0 3px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-strong);
  cursor: pointer;
}

.back-button::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 11px;
  width: 9.21px;
  height: 16px;
  background: currentColor;
  clip-path: polygon(100% 0, 100% 12%, 24% 50%, 100% 88%, 100% 100%, 0 50%);
}

.home-view {
  padding: calc(var(--safe-top) + 8px) 16px calc(24px + var(--safe-bottom));
}

.home-nav-title {
  position: relative;
  height: 34px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-strong);
  font-size: 17px;
  line-height: 20px;
  font-weight: 600;
  transform: translate(
    var(--layout-title-x, 0px),
    calc(-9px + var(--layout-title-y, 0px))
  );
}

.search-hero {
  position: relative;
  display: flow-root;
  margin: 65px 0 0;
  container-type: inline-size;
}

.search-assistant {
  position: absolute;
  top: var(--layout-assistant-top, calc(17px - 21.08cqw));
  right: var(--layout-assistant-right, 0.63cqw);
  width: var(--layout-assistant-width, 43.49cqw);
  height: var(--layout-assistant-height, auto);
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  transition: filter 180ms ease, opacity 180ms ease;
}

.search-assistant-back {
  z-index: 1;
}

.search-assistant-front {
  z-index: 3;
  clip-path: polygon(0 0, 100% 0, 100% 73%, 38% 73%, 22% 55%, 0 55%);
}

.search-artwork {
  position: absolute;
  top: calc(var(--layout-card-y, 17px) - 22.93cqw);
  right: 0;
  z-index: 1;
  width: 100%;
  height: 80.95cqw;
  object-fit: contain;
  object-position: top right;
  clip-path: inset(
    0 0 max(0px, calc(58.02cqw - 199px)) 0
    round 0 0 12px 12px
  );
  pointer-events: none;
  user-select: none;
}

.phone-shell[data-theme="dark"] .search-assistant {
  opacity: 0.96;
  filter: brightness(0.9) saturate(0.92);
}

.phone-shell[data-theme="light"] .search-assistant,
.phone-shell[data-theme="light"] .search-card-surface,
.phone-shell[data-theme="dark"] .search-artwork {
  display: none;
}

.search-card {
  position: relative;
  left: var(--layout-card-x, 0px);
  top: var(--layout-card-y, 17px);
  z-index: 2;
  min-height: 199px;
  margin: 0 0 var(--layout-card-y, 17px);
  padding: 18px 20px 19px;
  border: 0;
  color: var(--text-main);
  isolation: isolate;
}

.search-card-surface {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1;
  height: 199px;
  border: 1px solid var(--search-border);
  border-radius: 12px;
  background: var(--search-surface);
  filter: drop-shadow(0 0 0.75px var(--search-outline));
  -webkit-clip-path: url("#search-card-clip");
  clip-path: url("#search-card-clip");
}

.search-card.has-results::after {
  content: "";
  position: absolute;
  top: 187px;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 0;
  border-radius: 0 0 12px 12px;
  background: var(--surface);
}

.phone-shell[data-theme="light"] .search-card::before {
  content: "";
  position: absolute;
  top: min(calc(58.02cqw - 12px), 187px);
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 0;
  border-radius: 0 0 12px 12px;
  background: var(--surface);
}

.search-greeting,
.search-subtitle,
.search-input-shell,
.search-submit,
.search-results {
  position: relative;
  z-index: 2;
}

.search-greeting {
  max-width: 238px;
  margin: 0;
  color: var(--text-strong);
  font-size: 18px;
  line-height: 24px;
  font-weight: 600;
  text-wrap: balance;
}

.search-subtitle {
  margin: 1px 0 0;
  color: var(--search-subtitle);
  font-size: 12px;
  line-height: 17px;
  font-weight: 400;
}

.search-input-shell {
  width: 100%;
  height: 44px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--search-input);
}

.search-input {
  --search-input-scale: 0.875;
  width: calc(100% / var(--search-input-scale));
  height: calc(44px / var(--search-input-scale));
  padding: 0 calc(16px / var(--search-input-scale));
  border: 0;
  outline: 0;
  color: var(--text-main);
  background: transparent;
  font-size: 16px;
  line-height: 20px;
  font-weight: 400;
  transform: scale(var(--search-input-scale));
  transform-origin: top left;
  appearance: none;
}

.search-input::placeholder {
  color: var(--search-placeholder);
  opacity: 1;
}

.search-input-shell:focus-within {
  background: var(--search-input-focus);
  box-shadow:
    inset 0 0 0 1px var(--search-focus-ring),
    0 4px 14px var(--search-focus-glow);
}

.search-submit {
  width: 100%;
  height: 44px;
  margin-top: 16px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  background: var(--button-blue);
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.search-submit:focus-visible {
  outline: 0;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.5),
    0 0 0 4px var(--search-focus-glow);
}

.search-results {
  display: none;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(104, 111, 120, 0.18);
}

.search-results.is-visible {
  display: block;
}

.search-results-title,
.search-empty {
  margin: 0;
}

.search-results-title {
  color: var(--text-strong);
  font-size: 14px;
  line-height: 18px;
  font-weight: 600;
}

.search-empty {
  margin-top: 10px;
  color: var(--search-placeholder);
  font-size: 13px;
  line-height: 18px;
}

.search-empty-support {
  color: var(--button-blue);
  font-weight: 600;
  text-underline-offset: 2px;
}

.search-empty-support:focus-visible {
  border-radius: 2px;
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.search-results-list {
  margin-top: 6px;
}

.search-result-link {
  min-height: 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 12px;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
  border-bottom: 1px solid rgba(104, 111, 120, 0.13);
  font-size: 13px;
  line-height: 18px;
  text-decoration: none;
}

.search-result-link:last-child {
  border-bottom: 0;
}

.search-result-link .chevron {
  justify-self: center;
}

.search-hero + .section {
  margin-top: 28px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.section {
  margin-top: 28px;
}

.section-title {
  margin: 0 0 14px;
  color: var(--text-strong);
  font-size: 15px;
  line-height: 18px;
  font-weight: 500;
}

.faq-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 8px;
}

.faq-chip {
  min-height: 41px;
  display: inline-flex;
  align-items: center;
  flex: 0 1 auto;
  max-width: 100%;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--text-main);
  background: var(--chip-bg);
  font-size: 12px;
  line-height: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow-wrap: normal;
  text-decoration: none;
  transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

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

.category-card {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 15px 16px;
  border-radius: 13px;
  color: var(--text-main);
  background: var(--surface);
  text-decoration: none;
  transition: box-shadow 160ms ease, transform 160ms ease, background-color 160ms ease;
}

.category-card-title {
  white-space: pre-line;
  min-width: 0;
  font-size: 13px;
  line-height: 15px;
  font-weight: 500;
}

.category-card img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex: 0 0 auto;
}

.partner-list {
  display: grid;
  gap: 12px;
}

.partner-card {
  width: 100%;
  min-height: 75px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 0;
  border-radius: 12px;
  color: var(--text-main);
  background: var(--surface);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: box-shadow 160ms ease, transform 160ms ease, background-color 160ms ease;
}

.partner-title {
  display: block;
  min-width: 0;
  font-size: 14px;
  line-height: 17px;
  font-weight: 500;
  white-space: nowrap;
}

.partner-pill {
  width: fit-content;
  margin-top: 4px;
  padding: 2px 12px;
  border-radius: 999px;
  color: #2f86ff;
  background: var(--link-pill-bg);
  font-size: 11px;
  line-height: 13px;
  font-weight: 500;
}

.partner-card img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.list-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0 16px calc(36px + var(--safe-bottom));
}

.page-title {
  margin: 20px 0 12px;
  color: var(--text-strong);
  font-size: 24px;
  line-height: 28px;
  font-weight: 600;
}

.question-list {
  display: grid;
  gap: 8px;
}

.question-row {
  min-height: 46px;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 12px 12px;
  border-radius: 8px;
  color: var(--text-main);
  background: var(--surface);
  text-decoration: none;
  transition: box-shadow 160ms ease, transform 160ms ease, background-color 160ms ease;
}

.question-row img {
  width: 15.33px;
  height: 15.33px;
  justify-self: center;
}

.question-title {
  min-width: 0;
  font-size: 14px;
  line-height: 17px;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.chevron {
  width: 8px;
  height: 8px;
  justify-self: end;
  border-right: 1.5px solid var(--row-chevron);
  border-top: 1.5px solid var(--row-chevron);
  transform: rotate(45deg);
}

.support-bar {
  margin-top: auto;
  margin-right: 4px;
  margin-left: 4px;
  padding-top: 24px;
  display: flex;
}

.support-button {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: #ffffff;
  background: #2f86ff;
  font-size: 15px;
  line-height: 18px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.faq-chip:focus-visible,
.category-card:focus-visible,
.partner-card:focus-visible,
.question-row:focus-visible,
.support-button:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
  .faq-chip:hover,
  .category-card:hover,
  .partner-card:hover,
  .question-row:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(47, 134, 255, 0.12);
  }

  .support-button:hover {
    background: #2479f1;
    box-shadow: 0 10px 22px rgba(47, 134, 255, 0.22);
  }

  .search-submit:hover {
    background: #2479f1;
    box-shadow: 0 6px 8px rgba(47, 134, 255, 0.2);
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 48px;
  z-index: 20;
  max-width: 300px;
  padding: 10px 16px;
  border-radius: 999px;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.78);
  font-size: 13px;
  line-height: 18px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.copy-buffer {
  position: fixed;
  top: 0;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.layout-editor-target,
.layout-editor-toolbar {
  display: none;
}

.layout-editing .layout-editor-target {
  position: absolute;
  z-index: 30;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 5px 7px;
  border: 1px dashed #ff3b30;
  border-radius: 6px;
  color: #ffffff;
  background: rgba(255, 59, 48, 0.12);
  box-shadow: none;
  font-size: 11px;
  line-height: 14px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.layout-editing .layout-editor-target.is-dragging {
  cursor: grabbing;
  background: rgba(255, 59, 48, 0.22);
}

.layout-editing .layout-editor-assistant {
  top: var(--layout-assistant-top, -76px);
  right: var(--layout-assistant-right, -4px);
  width: var(--layout-assistant-width, 198px);
  height: var(--layout-assistant-height, 168px);
}

.layout-editing .layout-editor-card {
  top: var(--layout-card-y, 17px);
  left: var(--layout-card-x, 1px);
  width: 100%;
  height: 199px;
}

.layout-editing .layout-editor-title {
  top: 0;
  left: 50%;
  z-index: 31;
  width: 138px;
  height: 34px;
  transform: translateX(-50%);
}

.layout-editing .layout-editor-toolbar {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 100;
  width: min(355px, calc(100vw - 20px));
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: #ffffff;
  background: rgba(24, 27, 32, 0.94);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  transform: translateX(-50%);
  font-size: 12px;
  line-height: 16px;
}

.layout-editor-values {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #c8d0dc;
}

.layout-editor-size {
  display: flex;
  align-items: center;
  gap: 8px;
  grid-column: 1 / -1;
}

.layout-editor-size input {
  min-width: 0;
  flex: 1;
}

.layout-editor-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.layout-editor-actions button {
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

@media (min-width: 720px) {
  .toast {
    position: absolute;
  }
}

@media (max-width: 359px) {
  .search-assistant-front {
    clip-path: polygon(0 0, 100% 0, 100% 73%, 40% 73%, 24% 55%, 0 55%);
  }

  .search-card {
    padding-right: 16px;
    padding-left: 16px;
  }

  .search-greeting {
    max-width: 212px;
    font-size: 18px;
    line-height: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .search-submit,
  .search-assistant,
  .faq-chip,
  .category-card,
  .partner-card,
  .question-row,
  .support-button,
  .toast {
    transition: none;
  }
}
