/* ===== 全局重置与变量 ===== */
:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #dbeafe;
  --secondary: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,.1);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.12);
  --radius: 12px;
  --radius-lg: 20px;
  --transition: all .2s ease;
}

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

html, body { margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; overflow-y: scroll; }

body {
  font-family: 'PingFang SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; outline: none; font-family: inherit; }
input, textarea, select { font-family: inherit; outline: none; }
img { max-width: 100%; }

/* ===== 公共按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 500;
  transition: var(--transition); white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), #60a5fa); color: #fff; }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark), #1d4ed8); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(59,130,246,.4); }
.btn-secondary { background: var(--primary-light); color: var(--primary); }
.btn-secondary:hover { background: #bfdbfe; }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg); color: var(--text-primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-lg { padding: 13px 28px; font-size: 15px; border-radius: 10px; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none !important; }

/* ===== 公共卡片 ===== */
.card {
  background: var(--bg-card); border-radius: var(--radius); padding: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06); border: 1px solid rgba(226,232,240,.6);
}

/* ===== 导航栏 ===== */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.95); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 40px; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
}
.navbar-brand { display: flex; align-items: center; gap: 10px; }
.navbar-logo {
  width: 36px; height: 36px; background: linear-gradient(135deg, var(--primary), #60a5fa);
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
}
.navbar-logo svg { width: 20px; height: 20px; fill: #fff; }
.navbar-title { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.navbar-title span { color: var(--primary); }

.navbar-nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
  padding: 8px 14px; border-radius: 8px; font-size: 14px; font-weight: 500;
  color: var(--text-secondary); transition: var(--transition);
}
.nav-link:hover, .nav-link.active { color: var(--primary); background: var(--primary-light); }

.navbar-right { display: flex; align-items: center; gap: 12px; }
.credits-badge {
  display: flex; align-items: center; gap: 6px; padding: 6px 14px;
  background: linear-gradient(135deg, #fef3c7, #fde68a); border-radius: 20px;
  font-size: 13px; font-weight: 600; color: #92400e;
}
.credits-badge svg { width: 16px; height: 16px; }

.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #60a5fa);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 600; cursor: pointer;
  position: relative;
}
.user-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 220px; background: #fff; border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.06);
  padding: 8px; display: none; z-index: 999;
}
.user-dropdown.show { display: block; animation: ddFadeIn .15s ease; }
@keyframes ddFadeIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }

.dd-user-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px 12px;
  background: linear-gradient(135deg, var(--primary-light), #eff6ff);
  border-radius: 8px; margin-bottom: 6px;
}
.dd-user-ava {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), #60a5fa);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #fff;
}
.dd-user-info { flex: 1; min-width: 0; }
.dropdown-username { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-credits-row { font-size: 11px; color: var(--primary); font-weight: 600; }

.dropdown-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 8px; font-size: 13px; color: var(--text-primary); transition: var(--transition);
  cursor: pointer; text-decoration: none;
}
.dropdown-item:hover { background: var(--bg); color: var(--primary); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ===== 登录/注册页 ===== */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
}
.auth-container {
  width: 100%; max-width: 420px;
  background: #fff; border-radius: var(--radius-lg);
  padding: 40px; box-shadow: var(--shadow-lg);
}
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo .logo-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--primary), #60a5fa);
  border-radius: 16px; display: inline-flex;
  align-items: center; justify-content: center; margin-bottom: 12px;
}
.auth-logo .logo-icon svg { width: 30px; height: 30px; fill: #fff; }
.auth-logo h1 { font-size: 22px; font-weight: 700; }
.auth-logo h1 span { color: var(--primary); }
.auth-logo p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.auth-tabs { display: flex; background: var(--bg); border-radius: 8px; padding: 4px; margin-bottom: 28px; }
.auth-tab {
  flex: 1; padding: 8px; text-align: center; border-radius: 6px;
  font-size: 14px; font-weight: 500; color: var(--text-secondary);
  cursor: pointer; transition: var(--transition);
}
.auth-tab.active { background: #fff; color: var(--primary); box-shadow: var(--shadow-sm); }

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-primary); margin-bottom: 6px; }
.form-input {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 14px; color: var(--text-primary);
  background: var(--bg); transition: var(--transition);
}
.form-input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-light); }
.form-input::placeholder { color: var(--text-muted); }
.form-helper { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.form-footer { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-secondary); }
.form-footer a { color: var(--primary); font-weight: 500; }

.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.divider span { font-size: 12px; color: var(--text-muted); }

.social-btns { display: flex; gap: 12px; }
.social-btn {
  flex: 1; padding: 10px; border-radius: 8px; border: 1.5px solid var(--border);
  background: #fff; display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 13px; font-weight: 500; transition: var(--transition); cursor: pointer;
}
.social-btn:hover { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }

/* ===== 页面内容容器 ===== */
.page-container { max-width: 1280px; margin: 0 auto; padding: 32px 40px; }
.page-header { margin-bottom: 32px; }
.page-header h1 { font-size: 26px; font-weight: 700; }
.page-header p { color: var(--text-secondary); margin-top: 6px; font-size: 14px; }

/* ===== 工作台 ===== */
.workspace-layout { display: grid; grid-template-columns: 360px 1fr; gap: 24px; align-items: start; }

.panel-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.panel-title svg { width: 18px; height: 18px; color: var(--primary); }

.template-section { margin-bottom: 20px; }
.template-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }
.template-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.template-card {
  padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--border);
  background: #fff; cursor: pointer; transition: all .18s; text-align: left;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.template-card:hover {
  border-color: var(--primary); background: var(--primary-light);
  transform: translateY(-2px); box-shadow: 0 4px 12px rgba(59,130,246,.15);
}
.template-card.selected {
  border-color: var(--primary); border-width: 2px;
  background: linear-gradient(135deg, var(--primary-light), rgba(59,130,246,.08));
  box-shadow: 0 4px 16px rgba(59,130,246,.2);
}
.template-card.selected .tpl-name { color: var(--primary); font-weight: 700; }
.template-card.selected .tpl-icon { transform: scale(1.1); }
.tpl-icon { font-size: 20px; margin-bottom: 5px; display: block; transition: transform .18s; }
.tpl-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.tpl-desc { font-size: 10px; color: var(--text-muted); margin-top: 2px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tpl-size-hint {
  display: inline-block; margin-top: 6px;
  font-size: 10px; font-weight: 700; color: var(--primary);
  background: rgba(59,130,246,.1); border-radius: 4px; padding: 2px 6px;
  letter-spacing: .3px;
}

.prompt-wrapper { position: relative; }
.prompt-textarea {
  width: 100%; min-height: 130px; padding: 14px 16px; border: 1.5px solid var(--border);
  border-radius: 10px; font-size: 14px; resize: vertical; background: #fafcff;
  transition: var(--transition); line-height: 1.6;
}
.prompt-textarea:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.prompt-optimize-btn {
  position: absolute; bottom: 10px; right: 10px;
  background: var(--primary); color: #fff; padding: 5px 10px;
  border-radius: 6px; font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 4px;
}

.size-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
  background: linear-gradient(135deg, #fafcff 0%, #f0f5ff 100%); border-radius: 10px; padding: 10px 8px;
  border: 1px solid rgba(59,130,246,.05);
}
.size-group-title {
  font-size: 10px; font-weight: 700; color: var(--text-secondary);
  letter-spacing: .4px; margin-bottom: 5px;
  display: flex; align-items: center; gap: 6px;
}
.size-group-title::before {
  content: ''; display: inline-block; width: 2.5px; height: 10px;
  background: linear-gradient(to bottom, var(--primary), #60a5fa); border-radius: 2px; flex-shrink: 0;
}
.size-group-row { display: flex; gap: 6px; flex-wrap: wrap; }
.size-option {
  flex: 1; min-width: 48px; min-height: 68px; padding: 10px 6px; border-radius: 8px;
  border: 1.5px solid rgba(226,232,240,.8); background: #fff;
  cursor: pointer; transition: all .2s ease; text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.04); position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.size-option:hover {
  border-color: rgba(59,130,246,.4); background: linear-gradient(135deg, #eff6ff, #dbeafe);
  transform: translateY(-2px); box-shadow: 0 6px 16px rgba(59,130,246,.12);
}
.size-option.selected {
  border-width: 1.5px;
  box-shadow: 0 2px 8px rgba(59,130,246,.15);
  border-color: var(--primary);
  background: #fff;
  color: var(--primary);
}
.size-option.selected::after {
  content: ''; position: absolute; top: 5px; right: 7px;
  width: 8px; height: 5px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}
.size-preview { display: none; }
.size-preview-rect {
  background: linear-gradient(135deg, #bfdbfe 0%, #93c5fd 100%); border-radius: 3px; transition: all .2s ease;
  display: flex; align-items: center; justify-content: center;
}
.size-preview-rect span { display: none; }
.size-option:hover .size-preview-rect { background: linear-gradient(135deg, #60a5fa, #3b82f6); }
.size-option.selected .size-preview-rect { background: currentColor; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.size-ratio {
  font-size: 13px; font-weight: 700; color: var(--text-primary);
  line-height: 1.2; margin-bottom: 4px; letter-spacing: 0;
}
.size-option.selected .size-ratio { color: inherit; font-weight: 700; }
.size-name { display: none; }
.size-option.selected .size-name { color: inherit; font-weight: 500; }
.size-px { font-size: 11px; color: var(--text-secondary); line-height: 1.2; letter-spacing: 0; }
.size-option.selected .size-px { color: inherit; font-weight: 600; }

.count-selector { display: flex; align-items: center; gap: 12px; }
.count-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1.5px solid var(--border);
  background: var(--bg); font-size: 18px; display: flex; align-items: center; justify-content: center;
  color: var(--text-primary); transition: var(--transition);
}
.count-btn:hover { border-color: var(--primary); color: var(--primary); }
.count-num { font-size: 20px; font-weight: 700; min-width: 24px; text-align: center; }
.count-hint { font-size: 12px; color: var(--text-muted); }

.generate-area { margin-top: 16px; }
.credit-cost { font-size: 12px; color: var(--text-muted); text-align: center; margin-top: 10px; letter-spacing: .3px; }
.credit-cost span { color: var(--primary); font-weight: 700; }

/* 结果区域 */
.result-panel { }
.result-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 400px; color: var(--text-muted); gap: 12px;
}
.result-empty svg { width: 64px; height: 64px; opacity: .3; }
.result-empty p { font-size: 15px; }

.result-grid { display: grid; gap: 12px; }
.result-grid[data-count="1"] { grid-template-columns: 1fr; }
.result-grid[data-count="2"] { grid-template-columns: repeat(2, 1fr); }
.result-grid[data-count="3"] { grid-template-columns: repeat(3, 1fr); }
.result-grid[data-count="4"] { grid-template-columns: repeat(2, 1fr); }
.result-grid[data-count="5"],
.result-grid[data-count="6"] { grid-template-columns: repeat(3, 1fr); }
.result-grid[data-count="7"],
.result-grid[data-count="8"],
.result-grid[data-count="9"],
.result-grid[data-count="10"] { grid-template-columns: repeat(4, 1fr); }
.result-item { border-radius: var(--radius); overflow: hidden; background: var(--bg); border: 1px solid var(--border); cursor: pointer; transition: var(--transition); }
.result-item:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); transform: translateY(-2px); }
.result-img { width: 100%; object-fit: contain; display: block; margin: 0 auto; }
.result-grid[data-count="1"] .result-img { max-height: 520px; }
.result-grid[data-count="2"] .result-img { max-height: 420px; }
.result-grid[data-count="3"] .result-img,
.result-grid[data-count="4"] .result-img { max-height: 320px; }
.result-grid[data-count="5"] .result-img,
.result-grid[data-count="6"] .result-img { max-height: 260px; }
.result-grid .result-img { max-height: 220px; }

.progress-bar-wrap { width: 100%; height: 4px; background: var(--bg); border-radius: 2px; overflow: hidden; margin: 12px 0; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), #60a5fa); border-radius: 2px; transition: width .3s ease; }
.progress-text { font-size: 13px; color: var(--text-secondary); text-align: center; }

/* ===== 套餐页 ===== */
.pricing-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 40px; }
.pricing-card {
  background: #fff; border-radius: var(--radius-lg); padding: 28px 24px;
  border: 2px solid var(--border); transition: var(--transition); cursor: pointer; position: relative;
  display: flex; flex-direction: column;
}
.pricing-card:hover { border-color: var(--primary); transform: translateY(-4px); box-shadow: var(--shadow-md); }
.pricing-card.popular { border-color: var(--primary); }
.pricing-grid.has-selection .pricing-card.popular:not(.selected) { border-color: var(--border); box-shadow: none; transform: none; }
.popular-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #fff; padding: 4px 16px; border-radius: 20px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pricing-name { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-bottom: 12px; }
.pricing-price { font-size: 40px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.pricing-price sup { font-size: 20px; font-weight: 600; vertical-align: top; margin-top: 8px; }
.pricing-unit { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.pricing-divider { height: 1px; background: var(--border); margin: 20px 0; }
.pricing-credits { text-align: center; margin-bottom: 16px; }
.pricing-credits-num { font-size: 32px; font-weight: 700; color: var(--primary); }
.pricing-credits-label { font-size: 13px; color: var(--text-muted); }
.pricing-features { list-style: none; font-size: 13px; color: var(--text-secondary); flex: 1; }
.pricing-features li { padding: 6px 0; display: flex; align-items: center; gap: 8px; }
.pricing-features li::before { content: '✓'; color: var(--success); font-weight: 700; flex-shrink: 0; }

.pay-methods { display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.pay-method {
  padding: 10px 20px; border-radius: 10px; border: 2px solid var(--border);
  background: var(--bg); display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 500; cursor: pointer; transition: var(--transition);
}
.pay-method:hover, .pay-method.selected { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.pay-icon { width: 24px; height: 24px; object-fit: contain; }

/* ===== 个人中心 ===== */
.profile-layout { display: grid; grid-template-columns: 260px 1fr; gap: 24px; align-items: start; }
.profile-sidebar { }
.profile-card {
  background: linear-gradient(135deg, var(--primary), #60a5fa);
  border-radius: var(--radius-lg); padding: 28px 24px; color: #fff; margin-bottom: 16px;
}
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%; background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; margin: 0 auto 12px;
}
.profile-name { text-align: center; font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.profile-email { text-align: center; font-size: 12px; opacity: .75; margin-bottom: 20px; }
.credits-display { background: rgba(255,255,255,.15); border-radius: 12px; padding: 16px; text-align: center; }
.credits-display-num { font-size: 36px; font-weight: 800; }
.credits-display-label { font-size: 12px; opacity: .8; margin-top: 2px; }
.credits-display-expire { font-size: 11px; opacity: .6; margin-top: 4px; }

.sidebar-menu { background: #fff; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.sidebar-item {
  display: flex; align-items: center; gap: 10px; padding: 13px 16px;
  font-size: 14px; font-weight: 500; color: var(--text-secondary);
  cursor: pointer; transition: var(--transition); border-bottom: 1px solid var(--border);
}
.sidebar-item:last-child { border-bottom: none; }
.sidebar-item:hover, .sidebar-item.active { color: var(--primary); background: var(--primary-light); }
.sidebar-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.profile-main { }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* 订单表格 */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead { background: var(--bg); }
th { padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text-primary); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }

.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: var(--primary-light); color: var(--primary); }

/* 历史生图网格 */
.history-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.history-item { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--bg); border: 1px solid var(--border); cursor: pointer; }
.history-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.history-info { padding: 8px 10px; }
.history-prompt { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-date { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.history-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; opacity: 0; transition: var(--transition); }
.history-item:hover .history-actions { opacity: 1; }
.history-action-btn { width: 28px; height: 28px; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; }

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; visibility: hidden; transition: var(--transition);
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal {
  background: #fff; border-radius: var(--radius-lg); width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg); transform: scale(.95); transition: var(--transition);
}
.modal-overlay.show .modal { transform: scale(1); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { width: 32px; height: 32px; border-radius: 8px; background: var(--bg); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 18px; color: var(--text-muted); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 12px; }

/* ===== Toast ===== */
.toast-container { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 99999; display: flex; flex-direction: column; align-items: center; gap: 12px; pointer-events: none; }
.toast {
  padding: 16px 28px 16px 18px; border-radius: 16px;
  background: rgba(255,255,255,.98); backdrop-filter: blur(24px) saturate(1.8); -webkit-backdrop-filter: blur(24px) saturate(1.8);
  box-shadow: 0 20px 60px rgba(0,0,0,.18), 0 8px 24px rgba(0,0,0,.1), inset 0 1px 0 rgba(255,255,255,.9);
  border: 1px solid rgba(255,255,255,.7);
  font-size: 14px; font-weight: 600; color: #1e293b; letter-spacing: .01em;
  display: flex; align-items: center; gap: 14px; max-width: 420px; min-width: 260px;
  animation: toastIn .45s cubic-bezier(.175,.885,.32,1.275);
  pointer-events: auto;
}
.toast > span:first-child {
  width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; flex-shrink: 0; color: #fff;
  background: linear-gradient(135deg, var(--primary), #818cf8);
  box-shadow: 0 4px 12px rgba(99,102,241,.4);
}
.toast-success > span:first-child { background: linear-gradient(135deg, #22c55e, #16a34a); box-shadow: 0 4px 12px rgba(34,197,94,.4); }
.toast-error > span:first-child { background: linear-gradient(135deg, #ef4444, #dc2626); box-shadow: 0 4px 12px rgba(239,68,68,.4); }
.toast-warning > span:first-child { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 4px 12px rgba(245,158,11,.4); }
.toast-success { border-left: 4px solid #22c55e; }
.toast-error { border-left: 4px solid #ef4444; }
.toast-warning { border-left: 4px solid #f59e0b; }
.toast-info { border-left: 4px solid var(--primary); }
@keyframes toastIn { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes slideOut { from { transform: scale(1); opacity: 1; } to { transform: scale(.9); opacity: 0; } }

/* ===== 加载动画 ===== */
.loading-spinner { width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; }
.loading-spinner.dark { border-color: rgba(59,130,246,.2); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; opacity: .5; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ===== 响应式 ===== */
@media (max-width: 1100px) {
  .pricing-grid { grid-template-columns: repeat(2, 1fr); }
  .workspace-layout { grid-template-columns: 1fr; }
}
/* 汉堡按钮 */
.navbar-toggle {
  display: none; background: none; border: none; cursor: pointer; padding: 6px;
  color: var(--text-secondary); transition: var(--transition);
  align-items: center; gap: 4px; flex-shrink: 0;
}
.navbar-menu-hint {
  display: none; font-size: 11px; color: var(--primary); font-weight: 700;
  pointer-events: none; white-space: nowrap;
}
.navbar-toggle svg { width: 22px; height: 22px; display: block; }
.navbar-toggle:hover { color: var(--primary); }
.navbar-mobile-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.08);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden; transition: var(--transition);
  z-index: 95;
}
.navbar-mobile-backdrop.show { opacity: 1; visibility: visible; }

@media (max-width: 768px) {
  .navbar {
    padding: 0 16px; min-height: 56px; height: auto;
    flex-wrap: nowrap; position: sticky; overflow: visible;
  }
  .navbar-toggle { display: flex; }
  .navbar-menu-hint { display: inline; }
  .navbar-nav {
    display: none; flex-direction: column;
    position: absolute; top: calc(100% + 8px); left: 12px; right: 12px;
    width: auto; padding: 10px; gap: 4px;
    border: 1px solid rgba(226,232,240,.9); border-radius: 16px;
    background: rgba(255,255,255,.98);
    box-shadow: 0 18px 48px rgba(15,23,42,.16);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    z-index: 120;
  }
  .navbar-nav.open { display: flex; animation: mobileNavFadeIn .18s ease; }
  .nav-link { padding: 10px 12px; border-radius: 10px; font-size: 14px; width: 100%; }
  .navbar-right { margin-left: auto; position: relative; z-index: 121; }
  .navbar-brand, .navbar-toggle { position: relative; z-index: 121; }
  .navbar-right .credits-badge { font-size: 11px; padding: 4px 10px; }
  .page-container { padding: 20px; }
  .pricing-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-layout { grid-template-columns: 1fr; }
  .history-grid { grid-template-columns: repeat(2, 1fr); }
  .size-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 540px) {
  .navbar-brand .navbar-title { font-size: 15px; }
  .navbar-right .credits-badge { font-size: 0; gap: 3px; padding: 4px 8px; }
  .navbar-right .credits-badge strong { font-size: 12px; }
  .navbar-right .credits-badge svg { width: 14px; height: 14px; flex-shrink: 0; }
}
/* ecommerce mobile fix - must be in style.css to bypass HTML cache */
body { max-width: 100vw; overflow-x: hidden; }
@media (max-width: 1024px) {
  .ec-grid { grid-template-columns: 1fr !important; }
  .ec-panel { position: static !important; }
}
@media (max-width: 768px) {
  .ec-wrap { padding: 16px !important; }
  .ec-result {
    position: fixed !important; inset: 0 !important; z-index: 90 !important;
    display: flex !important; flex-direction: column !important; justify-content: flex-end !important;
    padding: 0 !important; margin: 0 !important; border: none !important;
    border-radius: 0 !important; min-height: 0 !important; background: transparent !important;
    transform: translateY(110%); transition: transform .35s cubic-bezier(.32,0,.67,0);
    pointer-events: none;
  }
  .ec-result.ec-result-open { transform: translateY(0) !important; pointer-events: auto; }
  .ec-result-backdrop {
    display: block !important; position: absolute; inset: 0;
    background: rgba(15,23,42,.5); cursor: pointer;
    opacity: 0; transition: opacity .35s;
  }
  .ec-result.ec-result-open .ec-result-backdrop { opacity: 1; }
  .ec-result-sheet {
    display: flex !important; flex-direction: column !important;
    background: #fff; border-radius: 22px 22px 0 0;
    padding: 16px 16px 32px; max-height: 85vh; overflow-y: auto;
    position: relative; z-index: 1; width: 100%;
    transform: translateY(100%); transition: transform .35s ease;
  }
  .ec-result.ec-result-open .ec-result-sheet { transform: translateY(0); }
  .ec-result-header {
    display: flex !important; justify-content: space-between; align-items: center;
    margin-bottom: 14px; font-size: 15px; font-weight: 700; color: #0f172a;
    padding-bottom: 12px; border-bottom: 1px solid #e2e8f0;
  }
  .ec-result-close-btn {
    display: flex !important; background: none; border: none; cursor: pointer;
    font-size: 24px; color: #94a3b8; padding: 0 4px; line-height: 1;
  }
}
@media (max-width: 640px) {
  .ec-wrap {
    width: 100% !important; margin: 0 !important;
    padding: 12px !important; max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .ec-grid { gap: 12px !important; }
  .ec-panel-section { padding: 12px 14px !important; }
  .ec-panel { width: 100% !important; min-width: 0 !important; }
  .ec-left { width: 100% !important; min-width: 0 !important; }
  .prompt-textarea { width: 100% !important; min-width: 0 !important; box-sizing: border-box !important; }
  .btn-block { width: 100% !important; box-sizing: border-box !important; }
}
@keyframes mobileNavFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
