/* css/app.css —— 做卡人用的表单页(暖·有温度感)
   基调锚在原微博那张黄色纸条:暖纸底 + 琥珀黄 signature + 万寿菊橙主按钮 */

:root {
  --paper:      #FDF6EE;   /* 暖纸背景 */
  --paper-2:    #FFFDFA;   /* 面板底(更亮的暖白) */
  --ink:        #3A2B26;   /* 暖棕墨字 */
  --muted:      #94826F;   /* 暖灰褐,次要文字 */
  --amber:      #F4B740;   /* signature:黄纸条的琥珀黄 */
  --marigold:   #E8792B;   /* 主按钮:万寿菊橙 */
  --marigold-d: #CE6A1F;   /* 按钮按下 */
  --hair:       rgba(58,43,38,.10);
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  /* 一点暖光晕,别太满 */
  background-image:
    radial-gradient(120% 80% at 50% -10%, #FFF3DE 0%, rgba(255,243,222,0) 55%);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  padding: 28px 18px 60px;
}

.wrap { max-width: 440px; margin: 0 auto; }

/* ---- 页眉 ---- */
.masthead { text-align: center; margin-bottom: 22px; }
.masthead h1 {
  margin: 0;
  font-size: 30px; font-weight: 800; letter-spacing: .01em;
}
.masthead .brand { color: var(--marigold); }      /* 品牌名 TakeCared 用主题橙 */
.masthead .sep { color: var(--muted); margin: 0 8px; font-weight: 600; }
.masthead .hl {                                     /* 琥珀高亮保留在产品名上 */
  background: linear-gradient(transparent 62%, var(--amber) 62% 92%, transparent 92%);
  padding: 0 4px;
}
.masthead .sub {
  margin: 14px auto 0; max-width: 360px;
  font-size: 15px; color: var(--muted); font-weight: 500;
}

/* ---- 便签面板(signature:顶部贴胶带) ---- */
.sheet {
  position: relative;
  background: var(--paper-2);
  border: 1px solid var(--hair);
  border-radius: 16px;
  padding: 26px 22px 24px;
  box-shadow: 0 8px 30px rgba(58,43,38,.07), 0 1px 0 rgba(255,255,255,.6) inset;
  margin-top: 26px;
}
/* 一小片半透明"胶带" */
.sheet::before {
  content: "";
  position: absolute; top: -13px; left: 50%; transform: translateX(-50%) rotate(-2.5deg);
  width: 108px; height: 26px;
  background: rgba(244,183,64,.42);
  border: 1px solid rgba(244,183,64,.5);
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(58,43,38,.08);
}

/* ---- 表单字段 ---- */
.field { margin-bottom: 16px; }
.field > label {
  display: block; font-size: 14px; font-weight: 700; margin-bottom: 7px; color: var(--ink);
}
.field .hint { color: var(--muted); font-weight: 500; }
.field input, .field select {
  width: 100%; font: inherit; font-size: 17px;
  padding: 13px 14px;
  color: var(--ink); background: #fff;
  border: 1.5px solid var(--hair); border-radius: 11px;
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: #C4B4A2; }
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--marigold);
  box-shadow: 0 0 0 3px rgba(232,121,43,.16);
}
.field select {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394826F' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 15px center;
  padding-right: 38px;
}

/* 生成按钮 */
.generate {
  width: 100%; margin-top: 6px;
  font: inherit; font-size: 18px; font-weight: 800; letter-spacing: .02em;
  color: #fff; background: var(--marigold);
  border: none; border-radius: 12px; padding: 15px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(232,121,43,.28);
  transition: transform .08s, background .15s, box-shadow .15s;
}
.generate:hover { background: var(--marigold-d); }
.generate:active { transform: translateY(1px); box-shadow: 0 3px 10px rgba(232,121,43,.28); }
.generate:disabled { background: #E4CDB4; box-shadow: none; cursor: default; }

/* ---- 状态 / 错误 ---- */
.status { text-align: center; margin: 18px 4px 0; font-size: 15px; font-weight: 600; min-height: 22px; }
.status.ok  { color: var(--marigold-d); }
.status.err { color: #C23A30; }
.resolved {
  text-align: center; margin-top: 6px; font-size: 13px; color: var(--muted);
}

/* ---- 结果区:提示+按钮在前,手机框在后(按钮别被一屏高的框顶出视野) ---- */
.result { margin-top: 22px; display: none; }
.result.show { display: flex; flex-direction: column; }
.result .savetip { order: -2; }
.result .download { order: -1; margin: 0 0 16px; }
.placeholder { display: none; }  /* 手机隐藏;桌面在 media 里显示为占位 */
/* 生成图片失败时的兜底:直接显示卡片本尊,缩到与 .card-img 同宽,靠 aspect-ratio 自动出对应高度 */
.result .card { width: 340px; max-width: calc(100vw - 56px); }
.savetip {
  margin: 0 0 12px; font-size: 14px; color: var(--muted); font-weight: 600; text-align: center;
}
.card-img {
  display: block; width: 340px; max-width: calc(100vw - 56px); margin: 0 auto;
  border-radius: 30px;
  aspect-ratio: 540 / 1170; /* 图片加载前就占住高度,滚动定位不被布局跳动打乱 */
}
/* 手机框:两端统一的预览容器——机身是预览语言,不进导出图。
   注意别叫 .phone——卡片里的电话号码 span 已用了这个类名 */
.phone-frame {
  position: relative; width: fit-content; margin: 0 auto;
  background: #2E211B; padding: 9px; border-radius: 38px;
  box-shadow: 0 24px 56px rgba(58,43,38,.30), inset 0 1px 1px rgba(255,255,255,.10);
}
.phone-frame::before { /* 前摄"挖孔",一眼读出这是手机屏 */
  content: ""; position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
  width: 9px; height: 9px; border-radius: 50%; background: #241913; z-index: 2;
  box-shadow: 0 0 0 3px rgba(36,25,19,.25);
}
/* 兜底路径(图片生成失败直接显示卡片)在框里同样裁圆角 */
.result .card { border-radius: 30px; }
/* 手机号填错时的即时提醒(失焦校验) */
.field input.invalid { border-color: #C23A30; box-shadow: 0 0 0 3px rgba(194,58,48,.12); }
/* 离屏渲染舞台,不显示给用户 */
#cardStage { position: absolute; left: -10000px; top: 0; width: 540px; }
.download {
  display: block; width: 100%; margin: 20px auto 0;
  font: inherit; font-size: 16px; font-weight: 800;
  color: var(--marigold-d); background: #fff;
  border: 1.5px solid var(--marigold); border-radius: 12px; padding: 14px;
  cursor: pointer; transition: background .15s;
}
.download:hover { background: #FFF3E6; }
.download:disabled { opacity: .55; cursor: default; }

/* ---- 自定义站名下拉(只出地铁站,不走高德自带浮层) ---- */
.combo { position: relative; }
.combo-list {
  list-style: none; margin: 6px 0 0; padding: 6px;
  position: absolute; left: 0; right: 0; top: 100%; z-index: 20;
  background: #fff; border: 1px solid var(--hair); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(58,43,38,.14);
  max-height: 260px; overflow-y: auto;
  display: none;
}
.combo-list.show { display: block; }
.combo-list li {
  padding: 11px 12px; font-size: 16px; border-radius: 8px; cursor: pointer;
  color: var(--ink);
}
.combo-list li.active, .combo-list li:hover { background: #FFF3E0; }
.combo-list li.empty { color: var(--muted); cursor: default; }
.combo-list li.empty:hover { background: transparent; }

/* ---- 宽屏两栏:左表单 | 右侧输出,两栏顶部对齐;压缩顶部让按钮进首屏 ---- */
@media (min-width: 900px) {
  body { padding-top: 16px; }
  .masthead { margin-bottom: 14px; }
  .masthead h1 { font-size: 26px; }
  .masthead .sub { margin-top: 8px; }
  .wrap { max-width: 920px; }
  .layout { display: flex; gap: 32px; align-items: flex-start; }
  .layout > .sheet { flex: 0 0 400px; margin-top: 14px; }
  .layout > .output { flex: 1; min-width: 0; margin-top: 14px; }
  .sheet .field { margin-bottom: 12px; }
  .sheet .field input, .sheet .field select { padding: 11px 14px; }
  .generate { padding: 13px; }

  /* 右栏:整栏居中成一根轴线,卡片放进"手机"里预览——发到家人手机里就是这个样子 */
  .layout > .output { display: flex; flex-direction: column; align-items: center;
    --phone-w: min(272px, 30vh); }         /* 屏宽,高≈2.167倍,连壳约占 68vh */
  .status, .resolved { text-align: center; }
  .result { margin-top: 12px; align-items: center; }
  .savetip { margin-bottom: 14px; }

  /* 机身样式在基础层(两端统一);这里只管桌面的尺寸档位 */
  .card-img, .result .card { width: var(--phone-w); }
  /* 顺序(提示→按钮→手机框)已在基础层;这里只管桌面按钮宽度 */
  .result .download { width: calc(var(--phone-w) + 18px); padding: 12px; }
  /* 空态:同尺寸的虚线手机剪影,生成前后不跳版 */
  .placeholder {
    display: flex; align-items: center; justify-content: center; margin: 46px 0 0;
    width: calc(var(--phone-w) + 18px); aspect-ratio: 558 / 1188;
    color: var(--muted); font-size: 15px; line-height: 1.7; text-align: center;
    border: 1.5px dashed var(--hair); border-radius: 38px;
    padding: 20px; background: rgba(255,255,255,.35);
  }
}

@media (prefers-reduced-motion: reduce) {
  .generate, .field input { transition: none; }
}
