/* ==========================================================================
   YY.CDK兑换系统 · 全站样式（浅色主题）
   ========================================================================== */
:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f9fafc;
  --line: #e3e8ef;
  --line-strong: #cdd6e3;
  --text: #1b2733;
  --text-2: #52627a;
  --text-3: #7c8ba1;
  --accent: #1f6feb;
  --accent-weak: #e8f1ff;
  --ok: #1a7f52;
  --ok-weak: #e6f6ee;
  --run: #9a6a00;
  --run-weak: #fdf3dd;
  --err: #c2384a;
  --err-weak: #fdedf0;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 "Inter", system-ui, -apple-system, "Segoe UI", Roboto,
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* hidden 一定优先于任何布局样式 */
[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;
}

h1, h2, h3 { margin: 0; line-height: 1.35; letter-spacing: -.01em; }
p { margin: 0; }
code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .92em; background: var(--accent-weak); color: var(--accent);
  padding: .1em .45em; border-radius: 6px;
}

/* --------------------------------------------------------------- 顶部导航 */
.top-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.nav-inner {
  max-width: 1120px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.logo-badge {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 14px;
}
.top-nav nav { display: flex; gap: 4px; margin-left: auto; }
.top-nav nav a {
  padding: 6px 12px; border-radius: 8px; font-size: 14px;
  color: var(--text-2); text-decoration: none; white-space: nowrap;
}
.top-nav nav a:hover { background: var(--surface-2); color: var(--text); }
.top-nav nav a.on { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.nav-admin {
  font-size: 13px; color: var(--text-3); text-decoration: none;
  border: 1px solid var(--line); padding: 5px 11px; border-radius: 8px;
}
.nav-admin:hover { color: var(--text); border-color: var(--line-strong); }

/* --------------------------------------------------------------- 页面骨架 */
.page { max-width: 1120px; margin: 0 auto; padding: 28px 20px 48px; }

.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px; align-items: start; margin-bottom: 24px;
}
.hero h1 { font-size: 30px; margin-bottom: 8px; }
.hero-sub { color: var(--text-2); font-size: 15px; max-width: 52ch; }

.live-panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow);
}
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat-block {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 12px;
}
.stat-value { display: block; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.stat-label { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; }

.clock-box {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 10px 12px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px;
}
.clock-box time { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.clock-box span { font-size: 12px; color: var(--text-3); }

.feed-box { border-top: 1px solid var(--line); padding-top: 12px; }
.feed-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; font-weight: 600; margin-bottom: 8px;
}
.feed-status { font-size: 11px; font-weight: 400; color: var(--text-3); }
.feed-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.feed-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; padding: 6px 8px; border-radius: 8px; background: var(--surface-2);
}
.feed-item.feed-empty { background: none; color: var(--text-3); justify-content: center; }
.feed-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-time { margin-left: auto; color: var(--text-3); font-size: 11.5px; white-space: nowrap; }
.feed-foot {
  display: flex; justify-content: space-between; margin-top: 8px;
  font-size: 11.5px; color: var(--text-3);
}
.feed-foot b { color: var(--text-2); }

/* 状态标签 */
.status-badge, .feed-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.status-badge.wait, .feed-tag.wait { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
.status-badge.running, .feed-tag.running { background: var(--run-weak); color: var(--run); }
.status-badge.ok, .feed-tag.ok { background: var(--ok-weak); color: var(--ok); }
.status-badge.bad, .feed-tag.bad { background: var(--err-weak); color: var(--err); }

/* 状态实时更新时闪一下，让用户知道「刚刚变了」 */
@keyframes badge-flash {
  0%   { box-shadow: 0 0 0 0 rgba(31, 111, 235, .5); }
  70%  { box-shadow: 0 0 0 9px rgba(31, 111, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(31, 111, 235, 0); }
}
.status-badge.flash { animation: badge-flash 1s ease-out 2; }
@media (prefers-reduced-motion: reduce) {
  .status-badge.flash { animation: none; }
}

/* ------------------------------------------------------------- 步骤指示器 */
.steps-indicator {
  list-style: none; margin: 0 0 18px; padding: 0;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.step-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 13.5px; color: var(--text-3); cursor: pointer; user-select: none;
}
.step-chip + .step-chip::before {
  content: ""; width: 14px; height: 1px; background: var(--line-strong);
  display: inline-block; margin-right: 8px;
}
.step-badge {
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  font-size: 11px; font-weight: 700; color: var(--text-3);
}
.step-chip.active { border-color: var(--accent); color: var(--accent); background: var(--accent-weak); font-weight: 600; }
.step-chip.active .step-badge { background: var(--accent); border-color: var(--accent); color: #fff; }
.step-chip.done { color: var(--text-2); }
.step-chip.done .step-badge { background: var(--ok); border-color: var(--ok); color: #fff; }

/* ------------------------------------------------------------------- 布局 */
.main-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.work-card, .side-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.work-card { padding: 24px; }
.side-card { padding: 18px; }
.side-card h3 { font-size: 13px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }
.side-card hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

.mini-stats { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.mini-stats li { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); }
.mini-stats b { color: var(--text); font-variant-numeric: tabular-nums; }
.side-note { font-size: 12.5px; color: var(--text-3); line-height: 1.7; }
.rule-list { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--text-2); line-height: 1.9; }

/* --------------------------------------------------------------- 步骤面板 */
.step-pane { display: none; }
.step-pane.on { display: block; animation: pane-in .22s ease both; }
@keyframes pane-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.step-pane h2 { font-size: 20px; margin-bottom: 6px; }
.pane-sub { color: var(--text-2); font-size: 14px; margin-bottom: 18px; }

/* ----------------------------------------------------------------- 表单 */
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text-2); margin-bottom: 6px;
}
input[type="text"], input[type="password"], select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 14.5px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 10px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #a8b4c6; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 111, 235, .14);
}
textarea { resize: vertical; min-height: 72px; }
select { cursor: pointer; }

.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.btn {
  padding: 10px 18px; border-radius: 10px; font: inherit; font-size: 14px;
  font-weight: 600; cursor: pointer; border: 1px solid transparent;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #1a5fd0; }
.btn.subtle { background: var(--surface); color: var(--text-2); border-color: var(--line-strong); }
.btn.subtle:hover:not(:disabled) { color: var(--text); border-color: var(--text-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.message {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px;
  font-size: 13.5px; line-height: 1.6; border: 1px solid transparent;
}
.message.info { background: var(--surface-2); color: var(--text-2); border-color: var(--line); }
.message.ok { background: var(--ok-weak); color: var(--ok); border-color: #bfe5d1; }
.message.err { background: var(--err-weak); color: var(--err); border-color: #f4c6ce; }

.hint { margin-top: 8px; font-size: 12.5px; color: var(--text-3); line-height: 1.7; }
.notice-inline {
  margin-top: 8px; font-size: 12.5px; color: var(--run);
  background: var(--run-weak); border: 1px solid #f0dfae;
  padding: 8px 10px; border-radius: 8px;
}

/* --------------------------------------------------------------- 上传区 */
.dropzone {
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--surface-2); padding: 22px; text-align: center;
  transition: border-color .15s, background .15s;
}
.dropzone.is-over { border-color: var(--accent); background: var(--accent-weak); }
.dz-inner { margin-bottom: 12px; }
.dz-icon {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border-radius: 50%; background: var(--accent-weak); color: var(--accent);
  font-size: 20px; margin-bottom: 8px;
}
.dz-title { font-size: 14.5px; font-weight: 600; }
.dz-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }

.file-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.file-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px;
}
.file-main { min-width: 0; flex: 1; }
.file-name {
  display: block; font-size: 13.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-size { display: block; font-size: 11.5px; color: var(--text-3); }
.file-state { font-size: 11.5px; font-weight: 600; }
.file-state.ok { color: var(--ok); }
.file-state.bad { color: var(--err); }
.file-remove {
  border: 0; background: none; color: var(--text-3);
  font: inherit; font-size: 12.5px; cursor: pointer; padding: 4px 6px; border-radius: 6px;
}
.file-remove:hover { color: var(--err); background: var(--err-weak); }

/* --------------------------------------------------------------- 进度条 */
.progress-box { margin: 4px 0 0; }
.progress-track {
  height: 8px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--line); overflow: hidden;
}
.progress-bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), #4d9cff);
  border-radius: 999px; transition: width .18s linear;
}
.progress-text { margin-top: 6px; font-size: 12.5px; color: var(--text-2); }

/* --------------------------------------------------------------- 结果区 */
.ticket-result {
  margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line);
}
.result-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.result-label { display: block; font-size: 12px; color: var(--text-3); }
.result-id {
  display: block; font-size: 18px; font-weight: 700; letter-spacing: .02em;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.result-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 14px; }
.result-meta div {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 11px;
}
.result-meta dt { font-size: 11.5px; color: var(--text-3); }
.result-meta dd { margin: 2px 0 0; font-size: 13.5px; font-weight: 600; }
.result-status-text {
  font-size: 13.5px; color: var(--text-2);
  background: var(--accent-weak); border: 1px solid #cfe1ff;
  padding: 10px 12px; border-radius: 10px; margin-bottom: 16px;
}
.result-files h3, .admin-note h3 { font-size: 13px; color: var(--text-3); margin-bottom: 8px; }
.ticket-file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ticket-file-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
}
.tfi-main { flex: 1; min-width: 0; }
.tfi-name { display: block; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tfi-meta { display: block; font-size: 11.5px; color: var(--text-3); }
.tfi-download {
  font-size: 12.5px; font-weight: 600; color: var(--accent);
  text-decoration: none; padding: 4px 10px; border-radius: 7px;
  border: 1px solid #cfe1ff; background: var(--accent-weak); white-space: nowrap;
}
.tfi-download:hover { background: #d9e8ff; }
.tfi-download.is-disabled {
  color: var(--text-3); background: var(--surface-2);
  border-color: var(--line); cursor: not-allowed;
}
.admin-note { margin-top: 16px; }
.admin-note p {
  font-size: 13.5px; color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 10px 12px; white-space: pre-wrap;
}

/* --------------------------------------------------------------- 页脚 */
.site-foot {
  margin-top: 26px; text-align: center; font-size: 12.5px; color: var(--text-3);
}

/* --------------------------------------------------------------- 响应式 */
@media (max-width: 900px) {
  .hero, .main-grid { grid-template-columns: minmax(0, 1fr); }
  .live-panel { order: 2; }
}
@media (max-width: 560px) {
  .page { padding: 20px 14px 40px; }
  .work-card { padding: 18px; }
  .hero h1 { font-size: 24px; }
  .field-row, .result-meta { grid-template-columns: 1fr; }
  .nav-brand { font-size: 15px; }
  .step-chip + .step-chip::before { display: none; }
}
