:root {
  color: #2f2927;
  background: #fff7f8;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  overscroll-behavior-y: none;
  background:
    radial-gradient(circle at 8% 4%, rgba(255, 184, 207, .38), transparent 28%),
    radial-gradient(circle at 92% 12%, rgba(255, 229, 236, .78), transparent 32%),
    linear-gradient(180deg, #fff7f8 0%, #fffdfc 48%, #fff4f7 100%);
}

button,
input {
  font: inherit;
}

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

button:disabled {
  cursor: not-allowed;
  opacity: .68;
}

.primary:active,
.secondary:active,
.tabbar button:active,
.ghost:active {
  transform: translateY(1px);
}

.app-page {
  position: relative;
  width: min(100%, 430px);
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 14px calc(92px + env(safe-area-inset-bottom));
}

.has-bottom-action {
  padding-bottom: calc(168px + env(safe-area-inset-bottom));
}

.app-section {
  margin-top: 14px;
}

.app-card {
  background: rgba(255, 255, 255, .9);
  border: 1px solid rgba(235, 92, 130, .12);
  border-radius: 20px;
  box-shadow: 0 14px 36px rgba(216, 72, 112, .09);
}

.hero {
  min-height: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 10px 0 12px;
}

.home-showcase {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 136px;
  gap: 14px;
  align-items: center;
  min-height: 142px;
  margin-bottom: 18px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid rgba(231, 85, 130, .13);
  border-radius: 26px;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 122, 168, .22), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, .86), rgba(255, 240, 246, .9));
  box-shadow: 0 18px 42px rgba(216, 72, 112, .1);
}

.showcase-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.showcase-copy span {
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  color: #d83f73;
  background: #fff;
  font-size: 12px;
  font-weight: 900;
}

.showcase-copy strong {
  max-width: 10em;
  font-size: 23px;
  line-height: 1.18;
}

.mini-pattern {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  padding: 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, .72);
  box-shadow: inset 0 0 0 1px rgba(231, 85, 130, .08);
}

.mini-pattern i {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .45);
}

.showcase-stats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.showcase-stats b {
  min-width: 0;
  padding: 7px 8px;
  border-radius: 12px;
  color: #89505f;
  background: rgba(255, 255, 255, .74);
  text-align: center;
  font-size: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  padding: 7px 12px;
  border: 1px solid rgba(231, 85, 130, .18);
  border-radius: 999px;
  color: #d83f73;
  background: rgba(255, 255, 255, .82);
  font-size: 14px;
  font-weight: 700;
}

.site-logo {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  flex: 0 0 auto;
  object-fit: contain;
}

.site-logo.large {
  width: 38px;
  height: 38px;
  border-radius: 12px;
}

h1 {
  margin: 18px 0 10px;
  font-size: clamp(32px, 9vw, 42px);
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin: 22px 0 12px;
  font-size: 20px;
  letter-spacing: 0;
}

p {
  margin: 0;
  color: #78635d;
}

.primary,
.secondary,
.sticky-action,
.download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 14px 18px;
  border-radius: 14px;
  font-weight: 800;
  text-decoration: none;
}

.primary,
.sticky-action {
  margin-top: 20px;
  color: #fff;
  background: linear-gradient(135deg, #ff4f88, #ff8eb0);
  box-shadow: 0 14px 30px rgba(255, 79, 136, .24);
}

.demo-btn {
  margin-top: 10px;
}

.secondary {
  color: #7a3f54;
  background: rgba(255, 255, 255, .9);
  border: 1px solid rgba(231, 85, 130, .16);
}

.bottom-action,
.sticky-action {
  position: fixed;
  left: max(0px, calc((100vw - 430px) / 2));
  right: max(0px, calc((100vw - 430px) / 2));
  bottom: calc(62px + env(safe-area-inset-bottom));
  width: auto;
  padding: 10px 14px;
  background: rgba(255, 248, 244, .92);
  border-top: 1px solid rgba(231, 85, 130, .1);
  backdrop-filter: blur(18px);
  z-index: 10;
}

.tabbar {
  position: fixed;
  left: max(0px, calc((100vw - 430px) / 2));
  right: max(0px, calc((100vw - 430px) / 2));
  bottom: 0;
  z-index: 11;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 7px 12px calc(7px + env(safe-area-inset-bottom));
  background: rgba(255, 250, 251, .96);
  border-top: 1px solid rgba(231, 85, 130, .12);
  backdrop-filter: blur(18px);
}

.tabbar button {
  display: grid;
  gap: 2px;
  place-items: center;
  min-height: 48px;
  min-width: 0;
  border-radius: 14px;
  color: #8b746e;
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.tabbar span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabbar i {
  display: grid;
  place-items: center;
  width: 24px;
  height: 22px;
  color: inherit;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
}

.tabbar button.active {
  color: #e73675;
  background: #fff0f5;
}

/* ── 中间发布按钮（FAB 样式） ─────────────────────────────────────────── */
.tabbar-fab {
  background: transparent !important;
  color: #8b746e !important;
  position: relative;
}
.tabbar-fab i {
  width: 50px !important;
  height: 50px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #e73675, #ff6ba8) !important;
  color: #fff !important;
  font-size: 26px !important;
  font-style: normal;
  margin-top: -18px;
  box-shadow: 0 4px 18px rgba(231, 54, 117, .40);
  transition: transform .15s, box-shadow .15s;
}
.tabbar-fab:active i {
  transform: scale(.93);
  box-shadow: 0 2px 8px rgba(231, 54, 117, .30);
}
.tabbar-fab span { font-size: 11px; margin-top: 2px; }

.bottom-action .primary,
.bottom-action .secondary {
  margin-top: 0;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr .8fr .72fr;
  gap: 8px;
}

.result-actions .primary,
.result-actions .secondary {
  min-height: 48px;
  padding: 10px 8px;
  border-radius: 13px;
  font-size: 14px;
}

.sticky-action:disabled {
  opacity: .72;
}

.comparison,
.steps,
.notice,
.soft-entry,
.editor-panel,
.settings,
.result-hero,
.image-frame,
.summary-grid,
.materials,
.group-card,
.poster-box,
.compare-large {}

.comparison {
  display: grid;
  grid-template-columns: 1fr 32px 1fr;
  align-items: center;
  gap: 8px;
  padding: 14px;
}

.sample {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  color: #8e6d65;
  font-weight: 800;
}

.sample.photo {
  background:
    linear-gradient(140deg, rgba(255,255,255,.55), transparent),
    linear-gradient(135deg, #ffc2d1, #bfe8ff 52%, #fff0bc);
}

.sample.beads {
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 8px;
  background: #fffdf9;
}

.sample.beads i {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.38);
}

.arrow {
  text-align: center;
  color: #9a8179;
  font-weight: 900;
}

.steps {
  margin-top: 16px;
  padding: 16px;
}

.steps div {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 11px 0;
}

.steps b {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: #ffe0eb;
  color: #c94d72;
}

.notice,
.soft-entry {
  margin-top: 14px;
  padding: 15px;
  color: #745f58;
}

.soft-entry {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: 70px 1fr 70px;
  align-items: center;
  margin: calc(-14px - env(safe-area-inset-top)) -14px 14px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: rgba(255, 247, 248, .9);
  backdrop-filter: blur(14px);
}

.topbar strong {
  text-align: center;
}

.ghost {
  min-height: 40px;
  border-radius: 12px;
  color: #745f58;
  background: rgba(255,255,255,.64);
}

.editor-panel,
.settings {
  padding: 16px;
}

.crop-canvas {
  display: block;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 16px;
  touch-action: none;
  background: #fff;
}

.hint,
.tip {
  margin-top: 12px;
  font-size: 14px;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: #6f5a54;
  font-weight: 700;
}

.select-field {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: #6f5a54;
  font-weight: 800;
}

.select-field select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(129, 94, 86, .16);
  border-radius: 13px;
  color: #4d3e3a;
  background: rgba(255,255,255,.86);
  font: inherit;
  font-weight: 800;
}

input[type="range"] {
  width: 100%;
  accent-color: #ff7fa4;
}

.settings {
  margin-top: 14px;
}

.chips {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}

.chips.compact {
  grid-template-columns: repeat(3, 1fr);
}

.chip,
.disabled-choice {
  min-height: 48px;
  padding: 10px;
  border-radius: 13px;
  color: #5a4742;
  background: rgba(255,255,255,.76);
  border: 1px solid rgba(129, 94, 86, .14);
  font-weight: 800;
}

.chip.active {
  color: #fff;
  background: linear-gradient(135deg, #ff5f93, #ffa3bd);
  border-color: transparent;
}

.disabled-choice {
  display: flex;
  align-items: center;
  opacity: .85;
}

.quick-settings {
  padding: 14px;
}

.quick-settings h2,
.pattern-editor h2 {
  margin-top: 0;
}

.setting-row {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.setting-row > span {
  color: #78635d;
  font-size: 13px;
  font-weight: 800;
}

.mini-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.mini-chips .chip {
  min-height: 38px;
  padding: 6px;
  border-radius: 11px;
  font-size: 12px;
}

#regenBead {
  grid-template-columns: repeat(2, 1fr);
}

.mini-chips.two {
  grid-template-columns: repeat(2, 1fr);
}

.inline-btn {
  margin-top: 12px;
}

.result-hero {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 14px;
  align-items: center;
  margin-top: 6px;
  padding: 12px;
}

.result-hero img {
  width: 112px;
  border-radius: 16px;
}

.result-hero h1 {
  margin: 0 0 6px;
  font-size: 24px;
}

.image-frame {
  padding: 10px;
  overflow: auto;
}

.pattern-editor {
  padding: 14px;
}

.edit-palette {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin: 12px 0;
}

.paint {
  width: 100%;
  aspect-ratio: 1;
  min-height: 34px;
  border: 2px solid rgba(255,255,255,.92);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(85,65,55,.16), inset 2px 2px 0 rgba(255,255,255,.24);
}

.paint.active {
  box-shadow: 0 0 0 3px #ff7fa4, inset 2px 2px 0 rgba(255,255,255,.24);
}

.empty-paint {
  position: relative;
  background:
    linear-gradient(135deg, transparent 46%, #9a8179 48%, #9a8179 52%, transparent 54%),
    #fffdf9;
}

.edit-canvas {
  display: block;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 14px;
  background: #fffdf9;
  touch-action: none;
}

.image-frame img,
.poster-box img {
  width: 100%;
  display: block;
  border-radius: 12px;
}

.color-list {
  display: grid;
  gap: 8px;
  padding: 4px 12px;
}

.color-row,
.material-row {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 2px;
  border-bottom: 1px solid rgba(129, 94, 86, .1);
}

.color-row.rich {
  grid-template-columns: 24px 24px 1fr auto;
}

.color-row small {
  display: block;
  color: #8a756a;
  font-size: 11px;
  font-weight: 600;
}

.symbol {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  color: #4d3e3a;
  background: #fff0f5;
  font-weight: 900;
  font-size: 12px;
}

.swatch {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(60,45,40,.16);
  border-radius: 50%;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
}

.summary-grid div {
  display: grid;
  gap: 4px;
  min-height: 74px;
  place-items: center;
  border-radius: 14px;
  background: rgba(255, 245, 248, .78);
}

.summary-grid b {
  font-size: 22px;
}

.summary-grid span {
  color: #7b6760;
  font-size: 13px;
}

.materials {
  padding: 4px 14px;
}

.material-row {
  grid-template-columns: 1fr auto;
}

.material-row span {
  display: block;
  color: #7b6760;
  font-size: 13px;
}

.material-row em {
  color: #c75c7d;
  font-style: normal;
  font-weight: 800;
}

.actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.actions .primary {
  margin-top: 0;
}

.poster-box {
  margin-top: 16px;
  padding: 14px;
}

.download-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.download-list .primary,
.download-list .secondary {
  margin-top: 0;
}

.export-preview {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(129, 94, 86, .12);
}

.export-preview h3 {
  margin: 0 0 8px;
}

.export-preview img {
  display: block;
  width: 100%;
  margin: 10px 0;
  border-radius: 12px;
  border: 1px solid rgba(129, 94, 86, .12);
}

.export-preview textarea {
  width: 100%;
  min-height: 180px;
  margin: 10px 0;
  padding: 12px;
  border: 1px solid rgba(129, 94, 86, .16);
  border-radius: 12px;
  background: #fffdf9;
  color: #4d3e3a;
  font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.compare-large {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px;
}

.compare-large img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
}

.share-cover {
  min-height: 30svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.share-cover h1 {
  max-width: 9em;
}

.share-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
}

.share-stats div {
  display: grid;
  gap: 4px;
  min-height: 64px;
  place-items: center;
  border-radius: 14px;
  background: rgba(255, 245, 248, .78);
  text-align: center;
}

.share-stats b {
  font-size: 15px;
}

.share-stats span {
  color: #7b6760;
  font-size: 12px;
}

.group-card {
  display: grid;
  gap: 14px;
  justify-items: center;
  margin-top: 20px;
  padding: 26px 18px;
  text-align: center;
}

.guide-hero,
.guide-note {
  padding: 18px;
}

.guide-hero h1 {
  margin: 0 0 8px;
  font-size: 32px;
}

.guide-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.guide-card {
  padding: 16px;
}

.guide-card span {
  color: #e75582;
  font-size: 12px;
  font-weight: 900;
}

.guide-card h2 {
  margin: 4px 0 10px;
}

.guide-card p {
  position: relative;
  padding-left: 14px;
  margin-top: 8px;
  font-size: 14px;
}

.guide-card p::before {
  content: "";
  position: absolute;
  left: 0;
  top: .75em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ff8db3;
}

.group-card h1 {
  margin-bottom: 0;
  font-size: 34px;
}

.qr-placeholder {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 5px;
  width: 220px;
  aspect-ratio: 1;
  padding: 18px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(129, 94, 86, .14);
}

.qr-placeholder i {
  border-radius: 3px;
  background: #f0e7e2;
}

.qr-placeholder i.on {
  background: #3d312f;
}

.empty {
  display: grid;
  place-content: center;
}

@media (min-width: 700px) {
  body {
    background-color: #fff0f4;
  }

  .app-page {
    min-height: 100vh;
    box-shadow: 0 0 0 1px rgba(129, 94, 86, .08), 0 22px 80px rgba(116, 85, 75, .12);
    background:
      linear-gradient(135deg, rgba(255, 214, 226, .42), transparent 32%),
      linear-gradient(210deg, rgba(255, 232, 238, .74), transparent 38%),
      #fff7f8;
  }
}
