/* CDK 兑换中心 · 浅色极简（Apple / OpenAI 风格参考） */

:root {
  --bg: #ffffff;
  --bg-soft: #f7f7f8;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.12);
  --text: #0d0d0d;
  --text-secondary: #353740;
  --muted: #6e6e80;
  --accent: #10a37f;
  --accent-hover: #0e8f70;
  --accent-soft: rgba(16, 163, 127, 0.08);
  --ok: #0f7b4c;
  --ok-bg: #e8f7ef;
  --warn: #9a6700;
  --warn-bg: #fff7e0;
  --err: #c41c1c;
  --err-bg: #fdecec;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.04);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --max: 680px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.page {
  width: min(var(--max), 100% - 2.5rem);
  margin: 0 auto;
  padding: 4.5rem 0 5rem;
}

/* —— Brand —— */

.brand {
  text-align: center;
  margin-bottom: 2.75rem;
}

.brand-kicker {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand h1 {
  margin: 0 0 0.85rem;
  font-size: clamp(2.25rem, 5.5vw, 3.25rem);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.1;
  color: var(--text);
}

.tagline {
  margin: 0 auto;
  max-width: 28rem;
  color: var(--muted);
  font-size: 1.125rem;
  line-height: 1.45;
  font-weight: 400;
}

/* —— Cards —— */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.4rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}

.eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.muted {
  color: var(--muted);
  font-size: 0.875rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* —— Stock —— */

.stock-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}

.stock-nums {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 0 0 1.1rem;
}

.stat {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.95rem 0.75rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stat strong {
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.15;
}

.stat .muted {
  font-size: 0.8125rem;
}

.progress {
  height: 6px;
  background: #ececf1;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  min-width: 0;
}

.progress-bar.empty {
  background: #d0d0d7;
}

.progress-bar.warn {
  background: #e3a008;
}

.stock-foot {
  margin-top: 0.95rem;
  display: grid;
  gap: 0.25rem;
}

.stock-status {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.valid-hours {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

/* —— Steps —— */

.steps {
  padding: 1.15rem 1.25rem;
  background: var(--bg-soft);
  border-color: transparent;
  box-shadow: none;
}

.steps-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.steps-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.35rem 0.15rem;
}

.step-no {
  flex: 0 0 auto;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.8125rem;
  font-weight: 650;
  color: var(--accent);
  background: #fff;
  border: 1px solid rgba(16, 163, 127, 0.22);
}

.step-title {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 0.1rem;
}

.step-desc {
  display: block;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* —— Form —— */

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.field-label {
  display: block;
  margin: 0;
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--text-secondary);
}

.field-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.btn-ghost {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 550;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.btn-ghost:hover {
  background: var(--bg-soft);
  border-color: rgba(0, 0, 0, 0.18);
  color: var(--text);
}

.btn-ghost:active {
  transform: scale(0.98);
}

.textarea-wrap {
  position: relative;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 9rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.875rem;
  line-height: 1.5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea::placeholder {
  color: #9b9bab;
}

textarea:focus {
  outline: none;
  border-color: rgba(16, 163, 127, 0.55);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--bg-soft);
}

.form-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.65rem 0 1rem;
  align-items: center;
}

.mode-hint:not(:empty) {
  color: var(--accent);
  font-weight: 550;
}

.error {
  color: var(--err);
  font-size: 0.875rem;
  margin: 0 0 0.85rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: var(--err-bg);
  border: 1px solid rgba(196, 28, 28, 0.12);
}

button[type="submit"],
.btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.9rem 1.1rem;
  border: none;
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  font-weight: 600;
  font-size: 0.98rem;
  font-family: inherit;
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.12s ease;
}

button[type="submit"]:hover:not(:disabled),
.btn-link:hover {
  background: #2f2f2f;
}

button[type="submit"]:active:not(:disabled),
.btn-link:active {
  transform: scale(0.99);
}

button[type="submit"]:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

button[type="submit"][aria-busy="true"] {
  opacity: 0.7;
  cursor: wait;
}

.feature-row {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.feature-row li {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted);
  padding: 0.55rem 0.35rem;
  border-radius: 10px;
  background: var(--bg-soft);
}

/* —— Queue —— */

.empty-state {
  margin: 0;
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9375rem;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  background: var(--bg-soft);
}

.queue-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.queue-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.75rem;
  padding: 0.9rem 1rem;
  margin-bottom: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  font-size: 0.875rem;
}

.queue-list li:last-child {
  margin-bottom: 0;
}

.queue-code {
  font-family: var(--mono);
  word-break: break-all;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.queue-msg {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.8125rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  height: fit-content;
}

.badge-pending {
  background: #f0f0f3;
  color: var(--muted);
}

.badge-running {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.badge-err {
  background: var(--err-bg);
  color: var(--err);
}

.batch-panel {
  margin-top: 0.9rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--border);
}

.batch-status {
  margin: 0 0 0.55rem;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.batch-progress {
  margin-bottom: 0.9rem;
}

/* —— Rules —— */

.rules {
  background: var(--bg-soft);
  border-color: transparent;
  box-shadow: none;
}

.rules ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.rules li {
  position: relative;
  padding: 0.15rem 0 0.15rem 1.1rem;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.rules li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #c5c5d0;
}

/* —— Footer —— */

.footer {
  text-align: center;
  margin-top: 2.5rem;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.8125rem;
}

.mock-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 0.75rem;
  font-weight: 600;
}

/* Author `display` must not override the HTML hidden attribute */
.mock-badge[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 600px) {
  .page {
    width: min(100% - 1.5rem, var(--max));
    padding: 2.5rem 0 3.5rem;
  }

  .brand {
    margin-bottom: 2rem;
  }

  .brand h1 {
    font-size: 2rem;
  }

  .tagline {
    font-size: 1rem;
  }

  .steps-list,
  .feature-row {
    grid-template-columns: 1fr;
  }

  .stock-nums {
    gap: 0.5rem;
  }

  .stat {
    padding: 0.75rem 0.5rem;
  }

  .stat strong {
    font-size: 1.25rem;
  }

  .card {
    padding: 1.2rem 1.15rem 1.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
