:root {
  --color-bg:      #f0f7ff;
  --color-surface: #ffffff;
  --color-border:  #e2e8f0;
  --color-primary: #2563eb;
  --color-primary-h:#1d4ed8;
  --color-accent:  #0ea5e9;
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-danger:  #ef4444;
  --color-text:    #1e3a5f;
  --color-muted:   #6b7280;
  --radius-sm:     8px;
  --radius:        12px;
  --radius-lg:     16px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.08);
  --shadow:        0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.12);
  --transition:    0.2s ease;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; min-height: 100vh; }
body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.fa, .fas, .far, .fa-solid, .fa-regular, .fa-classic {
  font-family: "Font Awesome 6 Free" !important;
  font-weight: 900;
}
.container, .app-shell { width: 100%; max-width: 430px; margin: 0 auto; padding: 0 16px; }
a { color: var(--color-primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-primary-h); }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
.hidden { display: none !important; }

/* ===== 顶部栏 ===== */
.top-bar {
  height: 56px;
  background: #1e3a5f;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.top-bar .bar-title { font-size: 17px; font-weight: 700; }
.top-bar .bar-icon { font-size: 18px; color: rgba(255,255,255,0.85); cursor: pointer; }

/* ===== 页面主体 ===== */
.page-body { padding: 16px 0 90px; }
.section-title {
  font-size: 16px;
  font-weight: 700;
  margin: 20px 0 12px;
}
.section-title.no-margin { margin: 0 0 16px; }
.page-foot {
  text-align: center;
  font-size: 12px;
  color: #9ca3af;
  margin-top: 24px;
  padding-bottom: 8px;
}

/* ===== 底部 Tab ===== */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: 58px;
  background: #ffffff;
  border-top: 1px solid var(--color-border);
  display: flex;
  z-index: 50;
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  color: #9ca3af;
}
.tab-item i { font-size: 18px; }
.tab-item.active { color: var(--color-primary); font-weight: 600; }
.tab-item:active { opacity: 0.7; }

/* ===== 统计卡片 ===== */
.stats-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  flex: 1;
  text-align: center;
  padding: 14px 0;
}
.stat-num { font-size: 26px; font-weight: 700; color: var(--color-primary); line-height: 1.3; }
.stat-label { font-size: 12px; color: var(--color-muted); }

/* ===== 卡片 ===== */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm), 0 8px 24px rgba(0,0,0,0.06);
  padding: 16px;
}

/* ===== 按钮 ===== */
.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
  border: 0;
  border-radius: var(--radius);
  padding: 10px 24px;
  font-size: 16px;
  font-weight: 700;
  transition: all var(--transition);
}
.btn-primary:active { transform: translateY(1px); background: var(--color-primary-h); }
.btn-block { width: 100%; height: 48px; margin-top: 4px; }
.upload-btn { margin-bottom: 4px; }
.upload-btn i { margin-right: 8px; }

/* ===== 表单 ===== */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}
.input-wrap {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0 14px;
  transition: border-color var(--transition);
}
.input-wrap:focus-within { border-color: var(--color-primary); background: #ffffff; }
.input-wrap i { color: #9ca3af; font-size: 15px; margin-right: 10px; }
.input-wrap input, .input-wrap select {
  flex: 1;
  height: 46px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15px;
  color: var(--color-text);
}
.input-wrap input::placeholder { color: #9ca3af; }
.select-input { appearance: none; }
.form-tip { text-align: center; font-size: 13px; color: var(--color-muted); margin-top: 14px; }

/* ===== 文件列表 ===== */
.file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.file-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: #eff6ff;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}
.file-icon.doc { background: #fef2f2; color: #ef4444; }
.file-icon.img { background: #ecfdf5; color: #059669; }
.file-info { flex: 1; min-width: 0; }
.file-name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-meta { font-size: 12px; color: var(--color-muted); }
.file-more {
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: #9ca3af;
  font-size: 16px;
  border-radius: var(--radius-sm);
}
.file-more:active { background: #f3f4f6; color: var(--color-danger); }

/* ===== 卡密生成 ===== */
.duration-group {
  display: flex;
  gap: 8px;
}
.duration-btn {
  flex: 1;
  height: 40px;
  border: 1px solid var(--color-border);
  background: #f8fafc;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
  transition: all var(--transition);
}
.duration-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

/* ===== 卡密列表 ===== */
.code-card { margin-bottom: 12px; }
.code-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.code-file { font-size: 14px; font-weight: 600; }
.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 100px;
}
.badge.ok { background: #ecfdf5; color: #059669; }
.badge.expired { background: #f3f4f6; color: #9ca3af; }
.code-value {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: #f0f7ff;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--color-primary);
  cursor: pointer;
}
.code-value:active { background: #e0ecff; }
.code-value.disabled { color: #9ca3af; background: #f8fafc; }
.code-meta { font-size: 12px; color: var(--color-muted); margin-top: 8px; }

/* ===== 登录页 ===== */
.login-hero {
  text-align: center;
  padding: 48px 0 28px;
}
.redeem-hero { padding: 36px 0 24px; }
.login-hero-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 20px;
  background: #1e3a5f;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  box-shadow: var(--shadow);
}
.login-hero h1 { font-size: 24px; font-weight: 700; line-height: 1.3; }
.login-hero p { font-size: 14px; color: var(--color-muted); margin-top: 4px; }

.login-card { margin-bottom: 24px; }

.tab-switch {
  display: flex;
  background: #eef4fb;
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 20px;
}
.tab-btn {
  flex: 1;
  height: 40px;
  border: 0;
  background: transparent;
  border-radius: 9px;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-muted);
  transition: all var(--transition);
}
.tab-btn.active {
  background: #ffffff;
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.btn-primary:active { transform: translateY(1px); }
.login-foot {
  text-align: center;
  font-size: 12px;
  color: #9ca3af;
  padding-bottom: 32px;
}

/* toast */
.ws-toast {
  position: fixed;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%);
  background: rgba(17, 24, 39, 0.92);
  color: #ffffff;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 100px;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.ws-toast.show { opacity: 1; }

/* 隐藏底栏「兑换」入口，统一走分享链接 + 卡密 */
.tab-item[href*="redeem.php"], .tab-item[data-page="redeem"] { display: none !important; }

/* 卡密页头部 */
.page-header { margin-bottom: 16px; }
.page-header h1 { font-size: 22px; font-weight: 700; line-height: 1.3; }
.page-header p { font-size: 13px; color: var(--color-muted); margin-top: 2px; }

/* 卡密操作按钮 */
.code-actions { display: flex; gap: 8px; margin-top: 10px; }
.code-actions button {
  flex: 1; height: 38px; border: 0; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; transition: all var(--transition);
}
.code-actions .btn-copy { background: #eff6ff; color: var(--color-primary); }
.code-actions .btn-del { background: #fef2f2; color: var(--color-danger); }
.code-actions button:active { opacity: 0.75; }
.tab-item a[href*="redeem.php"], a.tab-item[href*="redeem.php"] { display: none !important; }
