/* ============================================================
 * Cookie 生成器 — 外观对齐 lspd.baimao.wang（服务器委托中心）
 * 令牌与组件写法取自该站点正式构建产物：
 *   :root（暖米底 + 苔绿主色 + Nunito 字体栈）
 *   .button / .button.primary / .button.ghost / .panel / .input / .badge / .modal-card
 * ============================================================ */
:root {
  color-scheme: light;

  /* 页面与面板 */
  --ink: #f6f4e8;
  --ink-2: #efe9d9;
  --panel: #fffdf7;
  --panel-2: #f2ebdd;
  --line: #e6e0d2;
  --line-strong: #a49f94;

  /* 文字 */
  --text: #6b4622;
  --muted: #94886f;
  --muted-2: #bdb198;

  /* 强调色 */
  --moss: #14bfae;
  --moss-deep: #38a89a;
  --copper: #c96f0a;
  --blue: #4887c7;
  --red: #d94f4f;

  /* 与 Prism 控制台同名令牌（保持兼容） */
  --phx-primary: #14bfae;
  --phx-primary-hover: #34cfc0;
  --phx-primary-active: #38a89a;
  --phx-primary-bg: #e2f8f4;
  --phx-success: #6fba2c;
  --phx-warning: #f5c31c;
  --phx-error: #d94f4f;
  --phx-text: var(--text);
  --phx-text-secondary: var(--muted);
  --phx-text-disabled: var(--muted-2);
  --phx-border: var(--line-strong);
  --phx-border-hover: #827157;
  --phx-border-light: var(--line);
  --phx-bg: var(--ink);
  --phx-bg-secondary: var(--ink-2);
  --phx-bg-card: var(--panel);

  --phx-radius-sm: 16px;
  --phx-radius-base: 18px;
  --phx-radius-lg: 24px;

  --shadow: 0 14px 40px rgba(61, 52, 40, .11);
  --phx-shadow-sm: 0 1px 2px rgba(61, 52, 40, .05), 0 2px 6px rgba(61, 52, 40, .05);
  --phx-shadow-base: 0 1px 2px rgba(61, 52, 40, .06), 0 8px 20px rgba(61, 52, 40, .08);
  --phx-shadow-lg: 0 2px 6px rgba(61, 52, 40, .08), 0 20px 44px rgba(61, 52, 40, .13);

  --phx-font: "Nunito", "Noto Sans SC", "Zen Maru Gothic", "HarmonyOS Sans SC", "MiSans",
    -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --phx-font-mono: "Cascadia Code", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--ink); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--ink);
  color: var(--text);
  font-family: var(--phx-font);
  font-size: 1rem;
  line-height: 1.6;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1, "tnum" 0;
}
button, input, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { letter-spacing: -.02em; font-weight: 800; }
.hidden { display: none !important; }

/* 背景：与 lspd 一致的极淡网格（暖色版） */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .5;
  background-image:
    linear-gradient(rgba(121, 79, 39, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(121, 79, 39, .035) 1px, transparent 1px);
  background-size: 48px 48px;
}

.page {
  position: relative;
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 32px 16px calc(32px + env(safe-area-inset-bottom));
}

/* ── 卡片（对标 lspd .panel / .modal-card）── */
.card {
  position: relative;
  width: min(472px, 100%);
  padding: 30px 28px 26px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  border-radius: 10px 10px 0 0;
  background: linear-gradient(90deg, var(--moss), var(--moss-deep) 55%, var(--copper));
}
.card-head {
  display: grid;
  justify-items: center;
  gap: 6px;
  margin-bottom: 24px;
  text-align: center;
}
.brand-mark {
  display: grid;
  width: 50px; height: 50px;
  margin-bottom: 10px;
  place-items: center;
  border-radius: 5px;
  background: var(--moss);
  box-shadow: 0 10px 22px rgba(20, 191, 174, .28);
  clip-path: polygon(12% 0, 88% 0, 100% 12%, 100% 88%, 88% 100%, 12% 100%, 0 88%, 0 12%);
}
.brand-mark::after {
  content: "";
  width: 17px; height: 17px;
  border: 2px solid #0d1710;
  border-radius: 4px;
}
.card-head h1 { font-size: 1.4rem; }
.card-sub { color: var(--muted); font-size: .83rem; }

/* ── 步骤条 ── */
.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}
.step-item {
  display: flex;
  min-width: 0;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
  transition: border-color .15s, background-color .15s, color .15s;
}
.step-dot {
  display: grid;
  width: 20px; height: 20px;
  flex: 0 0 20px;
  place-items: center;
  border-radius: 999px;
  background: #e6ded0;
  color: #8a7a63;
  font-size: .68rem;
  font-weight: 800;
}
.step-name { overflow: hidden; text-overflow: ellipsis; }
.step-item.active { border-color: var(--moss-deep); background: var(--phx-primary-bg); color: #17786e; }
.step-item.active .step-dot { background: var(--moss); color: #0d1710; }
.step-item.complete { border-color: #b9d99a; background: #f2f8e6; color: #4d7a22; }
.step-item.complete .step-dot { background: var(--phx-success); color: #fff; }

/* ── 面板 ── */
.pane-title { font-size: 1rem; }
.pane-desc { margin: 6px 0 18px; color: var(--muted); font-size: .82rem; }
.msg { min-height: 20px; margin-top: 12px; color: var(--muted); font-size: .78rem; }
.msg.error { color: var(--red); }
.hint { margin-top: 12px; color: var(--muted-2); font-size: .75rem; }

/* ── 按钮（对标 lspd .button）── */
.btn {
  display: inline-flex;
  width: 100%;
  min-height: 48px;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  font-weight: 700;
  font-size: .92rem;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color .15s, background-color .15s, transform .15s, box-shadow .15s;
}
.btn + .btn { margin-top: 12px; }
.btn-primary {
  border-color: var(--phx-primary);
  background: var(--phx-primary);
  color: #fff;
  box-shadow: 0 8px 18px rgba(20, 191, 174, .28);
}
.btn-primary:hover:not(:disabled) { border-color: var(--phx-primary-hover); background: var(--phx-primary-hover); box-shadow: 0 10px 22px rgba(20, 191, 174, .34); }
.btn-primary:active:not(:disabled) { background: var(--phx-primary-active); border-color: var(--phx-primary-active); transform: translateY(1px); }
.btn-ghost { border-color: var(--line); background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { border-color: var(--line-strong); background: var(--panel-2); color: var(--text); }
.btn:disabled { cursor: not-allowed; opacity: .6; }

/* ── 滑块验证 ── */
.slider-captcha { width: 100%; }
.slider-track {
  position: relative;
  display: flex;
  width: 100%;
  height: 52px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--phx-bg);
  overflow: hidden;
  user-select: none;
  touch-action: none;
}
.slider-label { color: var(--muted-2); font-size: .84rem; pointer-events: none; }
.slider-handle {
  position: absolute;
  top: 0; left: 0;
  display: grid;
  width: 50px; height: 50px;
  place-items: center;
  border-radius: 4px;
  background: var(--moss);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: grab;
  touch-action: none;
  user-select: none;
  box-shadow: 0 8px 18px rgba(20, 191, 174, .28);
  transition: background-color .15s;
}
.slider-handle.dragging { cursor: grabbing; }
.slider-handle:focus-visible { outline: 3px solid rgba(20, 191, 174, .35); outline-offset: 2px; }
.slider-captcha.passed .slider-track { border-color: #b9d99a; background: #f2f8e6; }
.slider-captcha.passed .slider-handle { background: var(--phx-success); box-shadow: none; }
.slider-captcha.passed .slider-label { color: #4d7a22; font-weight: 800; }

/* ── 短信字段 ── */
.fields {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--phx-bg);
  overflow: hidden;
}
.field {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
}
.field + .field { border-top: 1px solid var(--line); }
.field-label { color: var(--muted); font-size: .78rem; }
.field-value { display: grid; min-width: 0; gap: 2px; padding: 2px 0; border: 0; background: transparent; text-align: left; }
.field-value strong { color: var(--moss-deep); font-family: var(--phx-font-mono); font-size: 1.1rem; letter-spacing: .04em; word-break: break-all; }
.field-hint { color: var(--muted-2); font-size: .7rem; font-style: normal; }
.field-hint::before { content: "点击复制"; }
.field-value.copied .field-hint { color: var(--phx-success); font-weight: 800; }
.field-value.copied .field-hint::before { content: "已复制 ✓"; }
.field-note {
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-family: var(--phx-font-mono);
  font-size: .73rem;
}

/* ── 进度 ── */
.progress-wrap {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--phx-bg);
}
.progress-track { height: 8px; border-radius: 999px; background: var(--ink-2); overflow: hidden; }
.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--moss), var(--moss-deep));
  transition: width .25s ease;
}
.progress-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: .75rem; }
.progress-hint { color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-percent { color: var(--moss-deep); font-weight: 800; font-family: var(--phx-font-mono); }

.foot-note {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: .73rem;
  text-align: center;
}

/* ── 结果弹窗 ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(43, 33, 24, .32);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.modal-card {
  position: relative;
  width: min(460px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.modal-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  margin-bottom: 10px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .1em;
}
.modal-card h2 { font-size: 1.12rem; }
.modal-card > p { margin-top: 6px; color: var(--muted); font-size: .8rem; }
.modal-card label { display: block; margin: 16px 0 6px; color: var(--muted); font-size: .78rem; font-weight: 700; }
#result-cookie {
  width: 100%;
  min-height: 152px;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  outline: 0;
  background: var(--phx-bg);
  color: var(--text);
  font-family: var(--phx-font-mono);
  font-size: .73rem;
  line-height: 1.55;
  resize: vertical;
  word-break: break-all;
}
#result-cookie:focus { border-color: var(--phx-primary-active); box-shadow: 0 0 0 3px rgba(20, 191, 174, .18); }
.modal-actions { display: grid; gap: 10px; margin-top: 16px; }
.modal-actions .btn + .btn { margin-top: 0; }
#reset-result { grid-column: 1 / -1; }
.copy-status { min-height: 18px; margin-top: 10px; color: var(--phx-success); font-size: .76rem; }

/* 窄屏：步骤条只留圆点，避免挤成一团 */
@media (max-width: 380px) {
  .page { padding: 18px 12px; }
  .card { padding: 22px 18px; }
  .step-name { display: none; }
  .step-item { justify-content: center; padding: 0 6px; }
  .field { grid-template-columns: 68px minmax(0, 1fr); }
}
@media (min-width: 520px) {
  .modal-actions { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
