:root {
  color-scheme: light;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --red: #cf171f;
  --red-dark: #a90d16;
  --ink: #171719;
  --muted: #67676d;
  --line: #e8e5e3;
  --paper: #fff;
  --wash: #f5f3f1;
  --shadow: 0 24px 70px rgba(72, 20, 20, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--wash);
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(207, 23, 31, 0.035) 1px, transparent 1px) 0 0 / 96px 96px,
    linear-gradient(rgba(207, 23, 31, 0.035) 1px, transparent 1px) 0 0 / 96px 96px,
    var(--wash);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.page-shell {
  display: grid;
  grid-template-columns: minmax(0, 440px) 260px;
  align-items: center;
  justify-content: center;
  gap: 72px;
  min-height: 100vh;
  min-height: 100svh;
  padding: 56px 32px;
}

.install-panel {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding: 34px 32px 26px;
  background: var(--paper);
  border: 1px solid rgba(63, 29, 29, 0.08);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.install-panel::before {
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: var(--red);
  content: "";
}

.brand-block {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.app-icon {
  display: block;
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: 0 10px 28px rgba(174, 12, 22, 0.22);
}

.eyebrow,
.platform-label,
.qr-kicker {
  margin: 0;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 3px 0 4px;
  font-size: 29px;
  line-height: 1.15;
  letter-spacing: 0;
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.platform-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 30px 0 26px;
  padding: 4px;
  background: #f1efed;
  border-radius: 8px;
}

.platform-tab {
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  color: #68666a;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.platform-tab:hover {
  color: var(--ink);
}

.platform-tab[aria-selected="true"] {
  color: var(--red-dark);
  background: #fff;
  box-shadow: 0 2px 8px rgba(32, 26, 26, 0.08);
}

.platform-tab:focus-visible,
.primary-action:focus-visible,
.copy-button:focus-visible,
.guide-copy:focus-visible,
.guide-dismiss:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(207, 23, 31, 0.24);
  outline-offset: 2px;
}

.platform-panel {
  animation: panel-in 220ms ease both;
}

.platform-panel[hidden] {
  display: none;
}

.platform-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.platform-heading h2 {
  max-width: 290px;
  margin: 4px 0 0;
  font-size: 20px;
  line-height: 1.35;
  letter-spacing: 0;
}

.device-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--red);
  background: #fff1f1;
  border: 1px solid #f4cccc;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 800;
}

.device-mark-wide {
  font-size: 11px;
}

.primary-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  margin-top: 22px;
  padding: 12px 18px;
  color: #fff;
  text-decoration: none;
  background: var(--red);
  border-radius: 7px;
  box-shadow: 0 10px 24px rgba(207, 23, 31, 0.22);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.primary-action:hover {
  background: var(--red-dark);
  box-shadow: 0 12px 28px rgba(169, 13, 22, 0.28);
  transform: translateY(-1px);
}

.primary-action:active {
  transform: translateY(0);
}

.primary-action span {
  min-width: 0;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
}

.primary-action small {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  line-height: 1.35;
  text-align: right;
}

.primary-action.is-loading,
.primary-action.is-disabled {
  color: #7a7779;
  background: #e9e6e5;
  box-shadow: none;
  cursor: default;
  pointer-events: none;
}

.primary-action.is-loading small,
.primary-action.is-disabled small {
  color: #918e90;
}

.manifest-status {
  min-height: 38px;
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.manifest-status.is-warning {
  color: #8a5013;
}

.manifest-status.is-error {
  color: var(--red-dark);
}

/* iOS / 鸿蒙加桌面的关键前提提示。
   这些平台"加桌面失败"绝大多数是操作前提没满足（Safari vs 其他浏览器、
   无痕模式），所以必须做成醒目块而不是塞进小字里。 */
.device-note {
  margin: 10px 2px 0;
  padding: 11px 13px;
  border-radius: 8px;
  background: #fff6f5;
  border: 1px solid #ffdfdc;
  color: #8a2420;
  font-size: 12px;
  line-height: 1.55;
}

.device-note b {
  color: var(--red-dark);
  font-weight: 700;
}

/* 底部合规与落款 */
.compliance-line {
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: center;
  color: #918e90;
  font-size: 11px;
  line-height: 1.7;
}

.compliance-line b {
  color: #76737a;
  font-weight: 600;
}

.compliance-sign {
  margin: 4px 0 0;
  text-align: center;
  color: #a9a6a8;
  font-size: 11px;
}

.steps {
  margin-top: 20px;
  border-top: 1px solid var(--line);
}

.steps summary {
  position: relative;
  padding: 17px 28px 13px 0;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  font-weight: 700;
}

.steps summary::-webkit-details-marker {
  display: none;
}

.steps summary::after {
  position: absolute;
  top: 17px;
  right: 4px;
  color: var(--red);
  content: "+";
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  transition: transform 180ms ease;
}

.steps[open] summary::after {
  transform: rotate(45deg);
}

.steps ol {
  display: grid;
  gap: 14px;
  margin: 4px 0 2px;
  padding: 0;
  list-style: none;
}

.steps li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 11px;
}

.steps li > span {
  padding-top: 2px;
  color: var(--red);
  font-size: 11px;
  font-weight: 800;
}

.steps li p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.steps li strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 13px;
}

.utility-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.copy-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 0;
  color: var(--red-dark);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.copy-button:hover {
  color: var(--red);
}

/* 复制图标已改为 SVG（品牌规范禁 emoji/符号字），这里保留尺寸微调 */
.copy-symbol {
  flex: 0 0 auto;
}

.utility-row p {
  margin: 0;
  color: #999598;
  font-size: 11px;
  line-height: 1.5;
  text-align: right;
}

/* 2026-11-06 删除：原来的「扫码继续」面板。
   这一页本身就是在手机上打开的，让用户再扫一次自己所在的页面没有意义；
   而且它引用的 ./qr.png 从来没被放进来，始终是「二维码准备中」占位。
   真要发二维码，由店主端生成带邀请码的那张，不走这里。 */

.wechat-guide {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: none;
  /* 竖向排列 + 水平靠右（呼应右上角的箭头），比 row + justify-content:flex-end 稳：
     后者会让子项在放不下时直接向右溢出，按钮被裁到屏幕外（实测 390 宽手机上
     「我知道了」点不到）—— 真实踩过，别改回 row。 */
  flex-direction: column;
  align-items: flex-end;
  padding: calc(22px + env(safe-area-inset-top)) 18px 24px;
  color: #fff;
  background: rgba(25, 20, 20, 0.9);
  backdrop-filter: blur(8px);
  overflow-y: auto;
}

.wechat-guide.is-visible {
  display: flex;
  animation: guide-in 180ms ease both;
}

.guide-arrow {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: 25px;
  width: 56px;
  height: 38px;
  border-top: 3px solid #fff;
  border-right: 3px solid #fff;
  border-radius: 0 17px 0 0;
  transform: rotate(-13deg);
}

.guide-arrow::after {
  position: absolute;
  top: -8px;
  right: -5px;
  width: 13px;
  height: 13px;
  border-top: 3px solid #fff;
  border-right: 3px solid #fff;
  content: "";
  transform: rotate(3deg);
}

.guide-content {
  /* width:100% 相对父级内容盒（已扣掉左右 padding），max-width 限宽；
     两者配合可保证**任何视口宽度下都不会溢出**（min() 的百分比解析在 flex 下不可靠） */
  width: 100%;
  max-width: 360px;
  margin-top: 76px;
}

.guide-kicker {
  display: block;
  margin-bottom: 7px;
  color: #ffb8bc;
  font-size: 13px;
  font-weight: 700;
}

.guide-content > strong {
  display: block;
  font-size: 26px;
  line-height: 1.25;
}

.guide-content ol {
  display: grid;
  gap: 14px;
  margin: 26px 0;
  padding: 0;
  list-style: none;
}

.guide-content li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 15px;
}

.guide-content li span {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 30px;
  height: 30px;
  color: #fff;
  background: var(--red);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
}

.guide-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.guide-copy,
.guide-dismiss {
  width: 100%;
  min-height: 48px;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 7px;
  cursor: pointer;
  font-weight: 700;
}

.guide-copy {
  color: #2b1113;
  background: #fff;
  border-color: #fff;
}

.toast {
  position: fixed;
  z-index: 30;
  bottom: calc(22px + env(safe-area-inset-bottom));
  left: 50%;
  max-width: calc(100vw - 32px);
  padding: 11px 16px;
  color: #fff;
  background: rgba(23, 23, 25, 0.92);
  border-radius: 6px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
  font-size: 13px;
  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);
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes guide-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 799px) {
  body {
    background: #fff;
  }

  .page-shell {
    display: block;
    min-height: 100vh;
    min-height: 100svh;
    padding: 0;
  }

  .install-panel {
    width: min(100%, 400px);
    min-height: 100vh;
    min-height: 100svh;
    margin: 0 auto;
    padding: calc(30px + env(safe-area-inset-top)) 22px calc(22px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .brand-block {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 15px;
  }

  .app-icon {
    width: 72px;
    height: 72px;
    border-radius: 17px;
  }

  h1 {
    font-size: 27px;
  }

  .platform-tabs {
    margin-top: 26px;
  }
}

@media (max-width: 360px) {
  .install-panel {
    padding-right: 18px;
    padding-left: 18px;
  }

  .primary-action {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .primary-action small {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
