/* ==========================================================================
   style.css —— 跳转站点公共样式
   视觉风格参考自 https://sds8.my/setting.html（蓝绿渐变 + 玻璃卡片）
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #eef4ff;
  --card: #fff;
  --text: #172033;
  --muted: #6b7690;
  --line: #dfe6f2;
  --primary: #246bfd;
  --primary-dark: #1554d5;
  --success: #16845b;
  --danger: #d92d20;
  --shadow: 0 24px 70px rgba(28, 57, 112, 0.16);
}

* { box-sizing: border-box; }

/* hidden 属性必须能压过 .actions{display:flex} 之类的作者样式 */
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 28px 18px;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, rgba(36, 107, 253, 0.18), transparent 34%),
    radial-gradient(circle at 90% 90%, rgba(51, 194, 166, 0.15), transparent 30%),
    var(--bg);
}

/* ---------- 卡片外壳 ---------- */

.shell {
  width: min(100%, 680px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
  animation: enter 0.45s ease-out both;
}

.shell.narrow { width: min(100%, 520px); }

header {
  padding: 34px 38px 28px;
  color: #fff;
  background: linear-gradient(135deg, #174ec9, #2875ff 58%, #29a88f);
}

header .eyebrow {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  opacity: 0.78;
}

h1 {
  margin: 0;
  font-size: clamp(27px, 6vw, 38px);
  letter-spacing: -0.04em;
}

header p {
  margin: 10px 0 0;
  line-height: 1.65;
  opacity: 0.86;
}

.content { padding: 32px 38px 36px; }

/* ---------- 当前值展示 ---------- */

.current {
  display: grid;
  /* 第二列用 minmax(0,1fr)，长 URL / 长标签才能在窄屏收缩换行 */
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8faff;
}

.current strong {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

code {
  color: #174ec9;
  font: 14px/1.6 Consolas, "Courier New", monospace;
  overflow-wrap: anywhere;
}

.current code.highlight {
  color: #d92d20;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

/* ---------- 表单 ---------- */

label {
  display: block;
  margin-bottom: 9px;
  font-size: 15px;
  font-weight: 700;
}

.field-label { margin-top: 18px; }

input[type="text"],
input[type="password"],
input[type="number"] {
  width: 100%;
  height: 50px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  color: var(--text);
  background: #fff;
  font: 15px/1.4 Consolas, "Microsoft YaHei", sans-serif;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(36, 107, 253, 0.12);
}

.hint {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.grid-2 {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr 1fr;
}

/* ---------- 状态提示 ---------- */

.status {
  display: none;
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 11px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-all;
}

.status.show { display: block; }
.status.success { color: var(--success); background: #e9f8f1; }
.status.error { color: var(--danger); background: #fff0ee; }
.status.warning { color: #8a5300; background: #fff6e5; }
.status.info { color: #1554d5; background: #edf3ff; }

/* ---------- 按钮 ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

button,
a.button {
  min-height: 48px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 13px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

button.primary {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 10px 24px rgba(36, 107, 253, 0.25);
}

button.primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
button.secondary { color: var(--text); background: #eef2f8; }
button.secondary:hover { transform: translateY(-1px); }
button.ghost { color: var(--muted); background: transparent; border: 1px dashed var(--line); }
button.ghost:hover { color: var(--text); }
button:disabled { opacity: 0.65; cursor: wait; transform: none; }
a.button { color: var(--primary); background: #edf3ff; }
a.button:hover { transform: translateY(-1px); }
.actions .spacer { margin-left: auto; }

/* ---------- 跳转页 ---------- */

.redirect-body { text-align: center; }

.loader {
  position: relative;
  width: 78px;
  height: 78px;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--primary), #39bda6, var(--primary));
  animation: spin 1.1s linear infinite;
}

.loader::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: inherit;
  background: #fff;
}

.countdown {
  margin: 6px 0 2px;
  font-size: 46px;
  font-weight: 900;
  line-height: 1;
  color: var(--primary);
  letter-spacing: -0.04em;
}

.redirect-body h1 { color: var(--text); font-size: clamp(22px, 5.4vw, 30px); }
.redirect-body p { min-height: 24px; margin: 0; color: var(--muted); line-height: 1.7; word-break: break-all; }
.redirect-body .target { margin-top: 6px; font-size: 14px; }
.redirect-body .actions { justify-content: center; }

.is-error .loader,
.is-error .countdown { display: none; }
.is-error h1 { color: var(--danger); }

/* ---------- 二维码页 ---------- */

.qr-frame {
  display: grid;
  place-items: center;
  gap: 20px;
  /* 空态与满态高度接近，避免切换时卡片跳动 */
  min-height: 340px;
  padding: 30px 26px 26px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, #fbfdff, #f2f6ff);
  box-shadow: inset 0 1px 0 #fff, 0 14px 34px rgba(28, 57, 112, 0.08);
}

.qr-code {
  width: min(100%, 300px);
  padding: 14px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(28, 57, 112, 0.12);
}

.qr-code svg { display: block; width: 100%; height: auto; }

.qr-caption {
  margin: 0;
  max-width: 32em;
  color: var(--text);
  font-size: 15px;
  line-height: 1.75;
  text-align: center;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.qr-caption.is-muted { color: var(--muted); font-size: 14px; }

/* 设置页：当前二维码页地址标签 */
.link-chip {
  display: inline-block;
  justify-self: start;
  max-width: 100%;
  padding: 7px 14px;
  border: 1px solid #cfe0ff;
  border-radius: 999px;
  background: #eaf2ff;
  color: var(--primary-dark);
  font: 700 13px/1.5 Consolas, "Courier New", monospace;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.link-chip:hover { background: #dfeaff; border-color: #b7d1ff; }

textarea {
  width: 100%;
  min-height: 96px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  resize: vertical;
  color: var(--text);
  background: #fff;
  font: 15px/1.6 "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(36, 107, 253, 0.12);
}

/* ---------- 图片上传 ---------- */

.upload-zone {
  position: relative;
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 160px;
  padding: 20px;
  border: 2px dashed #c8d8f5;
  border-radius: 18px;
  background: #f8fbff;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.upload-zone:hover,
.upload-zone.is-drag {
  border-color: var(--primary);
  background: #eef4ff;
}

.upload-zone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-hint {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.upload-preview {
  max-width: 100%;
  max-height: 240px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(28, 57, 112, 0.12);
}

.result {
  display: grid;
  gap: 14px;
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8faff;
}

.result-title {
  margin: 0;
  color: var(--success);
  font-size: 15px;
  font-weight: 700;
}

.result-image {
  justify-self: center;
  max-width: 100%;
  max-height: 280px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(28, 57, 112, 0.12);
}

.copy-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.copy-row input {
  flex: 1;
  min-width: 0;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
}

.copy-row button { flex: 0 0 auto; }

/* ---------- 动画 ---------- */

@keyframes enter {
  from { opacity: 0; transform: translateY(12px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 560px) {
  header { padding: 28px 24px 24px; }
  .content { padding: 26px 24px 30px; }
  .grid-2 { grid-template-columns: 1fr; }
  .qr-frame { min-height: 300px; padding: 22px 18px 20px; gap: 16px; }
  .qr-code { width: min(100%, 252px); }
  .actions button,
  .actions a.button { width: 100%; margin-left: 0; }
  .actions .spacer { margin-left: 0; }
}
