/* ---------- 基础 ---------- */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f6f8;
  color: #2c2c2a;
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

/* ---------- 顶栏 ---------- */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 28px;
  border-bottom: 1px solid #e6e6e3;
  margin-bottom: 32px;
}

.logo {
  font-size: 18px;
  font-weight: 500;
  color: #2c2c2a;
  text-decoration: none;
}

.nav-link {
  color: #5f5e5a;
  text-decoration: none;
  font-size: 14px;
}
.nav-link:hover { color: #2c2c2a; }

.site-footer {
  text-align: center;
  margin-top: 60px;
  color: #888780;
  font-size: 13px;
}

/* ---------- 卡片容器 ---------- */
.card-box {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e6e6e3;
  padding: 40px 32px;
  max-width: 460px;
  margin: 20px auto;
  text-align: center;
}

.card-box.wide { max-width: 720px; }

.card-box h1 {
  font-size: 22px;
  font-weight: 500;
  margin: 0 0 8px;
}

.card-box .subtitle {
  color: #5f5e5a;
  margin: 0 0 28px;
}

/* ---------- 表单 ---------- */
.redeem-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.code-input {
  padding: 14px 16px;
  font-size: 16px;
  border: 1px solid #d3d1c7;
  border-radius: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 1.5px;
  text-align: center;
  outline: none;
  transition: border-color .15s;
}
.code-input:focus { border-color: #534ab7; }

.btn {
  padding: 12px 20px;
  font-size: 15px;
  border: 1px solid #d3d1c7;
  border-radius: 8px;
  background: #fff;
  color: #2c2c2a;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  font-family: inherit;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #f5f5f3; }

.btn-primary {
  background: #2c2c2a;
  color: #fff;
  border-color: #2c2c2a;
}
.btn-primary:hover { background: #444441; }

.btn-block { display: block; width: 100%; }

.btn-link {
  background: none;
  border: none;
  color: #d4543a;
  cursor: pointer;
  font-size: 13px;
  padding: 4px 6px;
  font-family: inherit;
}
.btn-link:hover { text-decoration: underline; }

/* ---------- 提示与状态 ---------- */
.tips {
  font-size: 13px;
  color: #888780;
  text-align: left;
  border-top: 1px solid #f0f0ed;
  padding-top: 16px;
  margin-top: 24px;
}
.tips p { margin: 4px 0; }

.tips.warning {
  color: #854f0b;
  background: #faeeda;
  border: 1px solid #fac775;
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 20px;
}
.tips.warning p { margin: 0; }

.flash-area { max-width: 460px; margin: 0 auto 16px; }
.flash {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 14px;
}
.flash-error { background: #fceaea; color: #791f1f; border: 1px solid #f7c1c1; }
.flash-success { background: #eaf3de; color: #27500a; border: 1px solid #c0dd97; }

/* ---------- 下载页 ---------- */
.success-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #eaf3de;
  color: #27500a;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.error-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #fceaea;
  color: #a32d2d;
  font-size: 28px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #f5f5f3;
  border-radius: 8px;
  padding: 14px 16px;
  margin: 20px 0;
  text-align: left;
}
.file-icon { font-size: 32px; }
.file-name { font-weight: 500; word-break: break-all; }
.file-status { color: #5f5e5a; font-size: 13px; margin-top: 2px; }
#countdown { font-family: ui-monospace, monospace; color: #534ab7; }

/* ---------- 管理后台 ---------- */
.admin-grid { display: flex; flex-direction: column; gap: 20px; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.stat-card {
  background: #fff;
  border: 1px solid #e6e6e3;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.stat-num { font-size: 28px; font-weight: 500; }
.stat-label { color: #888780; font-size: 13px; margin-top: 4px; }

.panel {
  background: #fff;
  border: 1px solid #e6e6e3;
  border-radius: 12px;
  padding: 20px 24px;
}
.panel h2 {
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 16px;
}

.row-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.row-form input[type="file"] { flex: 1; min-width: 200px; }

.generate-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.generate-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #5f5e5a;
}
.generate-form label.full { grid-column: 1 / -1; }
.generate-form input,
.generate-form select {
  padding: 8px 10px;
  border: 1px solid #d3d1c7;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.generate-form input:focus,
.generate-form select:focus { border-color: #534ab7; }
.generate-form button { grid-column: 1 / -1; margin-top: 4px; }

.hint { color: #888780; font-size: 13px; margin-top: 8px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.cards-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.cards-table th,
.cards-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #f0f0ed;
}
.cards-table th {
  font-weight: 500;
  color: #5f5e5a;
  background: #fafaf8;
}
.cards-table code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
}
.row-used { opacity: 0.55; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}
.badge-used { background: #f1efe8; color: #5f5e5a; }
.badge-unused { background: #eaf3de; color: #27500a; }

/* ---------- 卡密结果页 ---------- */
.codes-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 8px;
}
.codes-area {
  width: 100%;
  height: 280px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  padding: 12px;
  border: 1px solid #d3d1c7;
  border-radius: 8px;
  resize: vertical;
  margin-bottom: 16px;
  background: #fafaf8;
}

/* ---------- 移动端 ---------- */
@media (max-width: 600px) {
  .card-box { padding: 28px 20px; }
  .stats-row { grid-template-columns: repeat(3, 1fr); }
  .generate-form { grid-template-columns: 1fr; }
  .panel { padding: 16px; }
}
