﻿/* 各页面专属样式 */
/* ---------- 工具页 ---------- */
.tools-page-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tool-big-card {
  display: block; padding: 22px; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg); transition: all .2s;
}
.tool-big-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.tool-big-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.tool-icon.lg { width: 46px; height: 46px; border-radius: 12px; }
.tool-big-card h3 { margin: 0 0 6px; font-size: 16px; color: var(--text-strong); }
.tool-big-card p { margin: 0 0 12px; font-size: 12.5px; color: var(--text-muted); line-height: 1.65; min-height: 0; }
.tool-big-cta { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--primary-600); }
.tool-big-cta .icon { width: 13px; height: 13px; }

/* ---------- 创作页 ---------- */
.create-layout .hero-composer { margin-bottom: 8px; justify-content: center; }
.create-layout .composer { width: 100%; }
.history-masonry { column-count: 4; }
.list-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 20px 0; flex-wrap: wrap; }
.list-pager span { color: var(--text-muted); font-size: 13px; }
.history-tile { cursor: auto; overflow-wrap: anywhere; }
.history-thumb a { display: block; }
.history-thumb img, .history-thumb video { display: block; width: 100%; height: auto; }
.history-thumb video { min-height: 110px; background: var(--bg-muted); }
.history-empty { text-align: center; padding: 28px 16px; }
.history-empty > .icon { color: var(--primary); }
.history-empty .muted { margin: 6px 0 10px; }
.history-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); padding: 12px; }
.history-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 10px; justify-content: space-between; }
.history-prompt { font-size: 13px; color: var(--text-strong); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.history-meta { margin-top: 5px; font-size: 11.5px; color: var(--text-dim); }
.history-progress { display: block; width: 100%; height: 8px; margin-top: 10px; accent-color: var(--primary); }
@media (max-width: 900px) { .history-masonry { column-count: 3; } }
@media (max-width: 640px) { .history-masonry { column-count: 2; column-gap: 10px; } }
.history-error { margin: 8px 0 0; font-size: 12px; color: var(--danger); }
.status-pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11px; background: var(--bg-elevated-solid); color: var(--text-muted); white-space: nowrap; }
.status-pill.succeeded, .status-pill.active, .status-pill.paid { background: #dcfce7; color: #15803d; }
.status-pill.failed, .status-pill.banned, .status-pill.rejected { background: #fee2e2; color: #b91c1c; }
.status-pill.running, .status-pill.queued, .status-pill.pending { background: #dbeafe; color: #1d4ed8; }

/* ---------- 定价页 ---------- */
.pricing-layout { padding-bottom: 20px; }
.balance-card {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding: 26px 30px; border-radius: var(--radius-xl); color: #fff;
  background:
    radial-gradient(60% 120% at 88% 10%, rgba(96, 165, 250, .55), transparent 62%),
    linear-gradient(120deg, #0b1b3a 0%, #123065 60%, #17408a 100%);
  box-shadow: 0 24px 50px -30px rgba(8, 20, 52, .8);
}
.balance-label { font-size: 12.5px; color: rgba(219, 234, 254, .75); }
.balance-num { display: flex; align-items: baseline; gap: 6px; margin: 6px 0 4px; }
.balance-num b { font-size: 40px; line-height: 1; font-weight: 750; letter-spacing: -1px; }
.balance-num span { font-size: 13px; opacity: .75; }
.balance-tip { margin: 0; font-size: 12px; color: rgba(203, 225, 255, .7); }
.balance-side { display: flex; gap: 10px; }
.payment-status { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; border-radius: 999px; background: var(--bg-muted); border: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }
.payment-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--text-dim); }
.payment-status[data-state="ok"]::before { background: var(--success); }
.payment-status[data-state="demo"]::before { background: var(--brand); }
.package-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.package-card {
  position: relative; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg);
  padding: 20px; transition: all .2s; display: flex; flex-direction: column;
}
.package-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.package-card.hot { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); box-shadow: 0 10px 30px -22px rgba(37, 99, 235, .8); }
.pkg-badge { position: absolute; top: -9px; right: 16px; background: var(--primary); color: #fff; font-size: 10.5px; padding: 3px 9px; border-radius: 999px; }
.package-card h3 { margin: 0; font-size: 15px; color: var(--text-strong); }
.pkg-tag { margin: 3px 0 12px; font-size: 11.5px; color: var(--text-dim); }
.pkg-price { display: flex; align-items: baseline; gap: 2px; color: var(--text-strong); }
.pkg-price span { font-size: 14px; }
.pkg-price b { font-size: 30px; font-weight: 750; letter-spacing: -0.5px; }
.pkg-credits { list-style: none; margin: 10px 0 16px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pkg-credits li { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.pkg-credits .icon { width: 14px; height: 14px; color: var(--primary); }
.package-card .btn { margin-top: auto; }
.package-card .btn[disabled] { background: var(--bg-muted); border: 1px dashed var(--border-strong); color: var(--text-dim); opacity: 1; box-shadow: none; }
.pricing-columns { display: grid; grid-template-columns: 1fr 1.2fr; gap: 16px; margin-top: 22px; }
.redeem-panel, .order-panel { padding: 20px 22px; }
.redeem-panel h2, .order-panel h2 { margin: 0; font-size: 15px; color: var(--text-strong); }
.redeem-panel > p { margin: 4px 0 12px; font-size: 12px; color: var(--text-muted); }
.redeem-form { display: flex; gap: 8px; }
.redeem-form input { flex: 1; height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--bg); outline: none; font-size: 13px; letter-spacing: .4px; }
.redeem-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.order-list { display: flex; flex-direction: column; }
.order-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--border); }
.order-row:last-child { border-bottom: 0; }
.order-row > div:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.order-row b { font-size: 13px; color: var(--text-strong); }
.order-row span { font-size: 11px; color: var(--text-dim); }
.order-right { display: flex; align-items: center; gap: 10px; }
.order-right b { font-size: 14px; }

/* ---------- 个人中心 ---------- */
.me-layout { padding-bottom: 20px; }
.profile-card { display: flex; align-items: center; gap: 18px; padding: 24px 26px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg); flex-wrap: wrap; }
.profile-avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.profile-avatar .icon { width: 28px; height: 28px; }
.profile-info { flex: 1; min-width: 200px; }
.profile-info h2 { margin: 0; font-size: 19px; color: var(--text-strong); }
.profile-info > p { margin: 2px 0 10px; font-size: 12px; color: var(--text-dim); }
.profile-stats { display: flex; gap: 26px; }
.profile-stats div { display: flex; flex-direction: column; }
.profile-stats b { font-size: 18px; color: var(--text-strong); }
.profile-stats span { font-size: 11px; color: var(--text-dim); }
.me-tabs { display: flex; gap: 4px; margin: 22px 0 14px; padding: 4px; border-radius: 10px; background: var(--bg-elevated-solid); width: fit-content; max-width: 100%; overflow-x: auto; }
.me-tabs .seg { height: 32px; padding: 0 16px; background: transparent; color: var(--text-muted); white-space: nowrap; }
.me-tabs .seg.active { background: var(--bg); color: var(--text-strong); box-shadow: var(--shadow-xs); }
.credit-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.credit-row:hover { background: color-mix(in srgb, var(--bg-muted) 60%, transparent); }
.credit-row > div:first-child { min-width: 0; }
.credit-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.credit-row:last-child { border-bottom: 0; }
.credit-row > div { display: flex; flex-direction: column; gap: 2px; }
.credit-row b { font-size: 13px; color: var(--text-strong); }
.credit-row span { font-size: 11px; color: var(--text-dim); }
.credit-right { align-items: flex-end !important; }
.credit-right b { font-size: 15px; }
.credit-right b.plus { color: var(--success); }
.credit-right b.minus { color: var(--text-muted); }

/* ---------- API 密钥 ---------- */
.me-api { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.me-api-panel { min-width: 0; padding: 20px; }
.me-api-panel .panel-head { padding: 0 0 14px; border-bottom: 1px solid var(--border); }
.me-api-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-bottom: 16px; }
.me-api-form label { grid-column: 1 / -1; font-size: 13px; color: var(--text-muted); }
.me-api .input { width: 100%; min-width: 0; height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg); }
.me-api .input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.me-api-key { overflow-wrap: anywhere; }
.me-api-secret { margin-bottom: 14px; padding: 12px; border-radius: var(--radius-sm); background: var(--primary-soft); }
.me-api-secret p { margin-top: 0; }
.me-api-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.me-api-guide summary { font-size: 16px; font-weight: 650; color: var(--text-strong); cursor: pointer; }
.me-api-guide pre { overflow-x: auto; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-muted); font-size: 12px; }
@media (max-width: 900px) { .me-api { grid-template-columns: minmax(0, 1fr); } }

/* ---------- 作品详情页 ---------- */
.work-page { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 26px; padding-bottom: 40px; }
.work-page-media { border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border); background: var(--bg-muted); align-self: start; }
.work-page-media img { width: 100%; display: block; }
.work-page-side { min-width: 0; }
.work-author { display: flex; align-items: center; gap: 10px; }
.work-author .avatar { width: 38px; height: 38px; }
.work-author > div { display: flex; flex-direction: column; }
.work-author b { font-size: 13.5px; color: var(--text-strong); }
.work-author span { font-size: 11.5px; color: var(--text-dim); }
.work-prompt { margin: 14px 0; padding: 14px 16px; border-radius: var(--radius); background: var(--bg-muted); font-size: 13px; line-height: 1.75; color: var(--text); white-space: pre-wrap; }
.work-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.work-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.related-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.related-item { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.related-item img { width: 100%; aspect-ratio: 1/1; object-fit: cover; }
.related-item span { display: block; padding: 7px 9px; font-size: 11.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--text-muted); font-size: 12.5px; }

/* ---------- 作品详情弹窗 ---------- */
.work-modal {
  position: relative; background: var(--bg); border-radius: 18px; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  width: 980px; max-width: 100%; max-height: 90vh; box-shadow: var(--shadow-lg);
  animation: popIn .22s cubic-bezier(.22, 1, .36, 1);
}
.work-modal .work-media { background: #0b1220; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.work-modal .work-media img { max-height: 90vh; width: 100%; object-fit: contain; }
.work-modal .work-side { padding: 26px 24px; overflow-y: auto; }
.work-modal .work-actions { position: sticky; bottom: 0; padding-top: 10px; background: linear-gradient(180deg, transparent, var(--bg) 40%); }
.work-modal h2 { margin: 14px 0 8px; font-size: 18px; color: var(--text-strong); }

/* ---------- Agent ---------- */
.main-flush { padding: 0; }
.agent-page { display: grid; grid-template-columns: 250px minmax(0, 1fr); height: calc(100vh - var(--header-h)); }
.agent-side { border-right: 1px solid var(--border); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.conv-list { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.conv-item { text-align: left; padding: 9px 10px; border-radius: 8px; display: flex; flex-direction: column; gap: 2px; }
.conv-item:hover { background: var(--bg-elevated-solid); }
.conv-item.active { background: var(--primary-soft); }
.conv-item b { font-size: 12.5px; color: var(--text-strong); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item span { font-size: 10.5px; color: var(--text-dim); }
.agent-main { display: flex; flex-direction: column; min-height: 0; }
.agent-head { display: flex; align-items: center; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--border); }
.agent-avatar { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, #0b1b3a, #1d4ed8); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.agent-avatar img { width: 30px; height: 30px; }
.agent-head h1 { margin: 0; font-size: 16px; color: var(--text-strong); }
.agent-head p { margin: 1px 0 0; font-size: 11.5px; color: var(--text-muted); }
.agent-messages { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.msg { max-width: 760px; }
.msg.user { align-self: flex-end; }
.msg-role { font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
.msg.user .msg-role { text-align: right; }
.msg .bubble { padding: 11px 14px; border-radius: 12px; background: var(--bg-muted); font-size: 13px; line-height: 1.7; color: var(--text); }
.msg-body { display: flex; align-items: flex-start; gap: 10px; }
.msg-avatar {
  flex: 0 0 30px; width: 30px; height: 30px; border-radius: 9px; overflow: hidden;
  background: linear-gradient(135deg, #0b1b3a, #1d4ed8);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px -6px rgba(29, 78, 216, .7);
}
.msg-avatar img { width: 24px; height: 24px; }
.msg.assistant .bubble { border-top-left-radius: 4px; }
.msg.user .msg-body { justify-content: flex-end; }
.msg.user .bubble { max-width: 78%; border-top-right-radius: 4px; }
.msg.assistant > .plan-list { margin-left: 40px; }
.msg.user .bubble { background: var(--primary); color: #fff; }
.plan-list { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.plan-step { display: flex; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.plan-index { width: 22px; height: 22px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-600); font-size: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.plan-body b { font-size: 12.5px; color: var(--text-strong); }
.plan-body p { margin: 3px 0 8px; font-size: 12px; color: var(--text-muted); line-height: 1.65; }
.plan-body .btn { height: 30px; font-size: 11.5px; }
.agent-composer { position: relative; display: flex; align-items: flex-end; gap: 12px; padding: 14px 24px 16px; border-top: 1px solid var(--border); }
.agent-send-action { display: flex; align-items: center; gap: 10px; flex-shrink: 0; padding-bottom: 2px; }
.agent-send-action small { order: -1; font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.agent-composer textarea { flex: 1; min-height: 44px; max-height: 180px; resize: none; border: 1px solid var(--border-strong); border-radius: 12px; padding: 11px 13px; font-size: 13px; outline: none; background: var(--bg); }
.agent-composer textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.agent-nav-toggle, .agent-side-head { display: none; }
.agent-main, .agent-composer textarea, .plan-body { min-width: 0; }
.agent-main .bubble, .plan-body { overflow-wrap: anywhere; }

/* ---------- 悬浮创作条 ---------- */
.floating-composer {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; z-index: 45;
  width: 848px; max-width: calc(100vw - 40px); filter: drop-shadow(0 24px 40px rgba(15, 23, 42, .22));
  animation: toastIn .22s ease-out;
}
.floating-composer .composer { width: 100%; padding: 12px 14px 10px; border-radius: 16px; }
.floating-composer .composer textarea { min-height: 56px; padding: 8px 4px 4px; }
.floating-composer .cost-sub { display: none; }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .package-grid { grid-template-columns: repeat(2, 1fr); }
  .pricing-columns { grid-template-columns: 1fr; }
  .tools-page-grid { grid-template-columns: repeat(2, 1fr); }
  .work-page { grid-template-columns: 1fr; }
  .work-modal { grid-template-columns: 1fr; }
  .work-modal .work-media img { max-height: 46vh; }
}
@media (max-width: 760px) {
  .main.main-flush:has(.agent-page) { padding-inline: 0; }
  .agent-page { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: calc(100dvh - var(--header-h)); }
  .agent-side { display: none; border: 0; }
  .agent-page.show-convs .agent-side { display: flex; }
  .agent-page.show-convs .agent-main { display: none; }
  .agent-side-head { display: flex; align-items: center; justify-content: space-between; }
  .agent-side-head h2 { font-size: 16px; margin: 0; }
  .agent-nav-toggle { display: inline-flex; flex-shrink: 0; }
  .agent-head { padding: 10px 14px; gap: 8px; }
  .agent-avatar { flex-shrink: 0; width: 34px; height: 34px; }
  .agent-messages { padding: 16px; }
  .msg.user { max-width: 90%; }
  .agent-composer { padding: 10px 14px max(12px, env(safe-area-inset-bottom)); }
  .agent-composer textarea { font-size: 16px; }
  .conv-item { min-height: 44px; }
  .package-grid { grid-template-columns: 1fr; }
  .tools-page-grid { grid-template-columns: 1fr; }
  .me-tabs { width: 100%; flex-wrap: wrap; overflow: visible; }
  .balance-card { padding: 20px; }
  .balance-num b { font-size: 32px; }
  .profile-card { padding: 18px; }
  .floating-composer { bottom: 10px; }
  .work-page { gap: 16px; }
}

/* ---------- 移动端：弹层全屏、操作吸底 ---------- */
@media (max-width: 768px) {
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .auth-card { border-radius: 18px 18px 0 0; max-height: 92dvh; overflow-y: auto; padding: 22px 20px calc(18px + env(safe-area-inset-bottom)); }
  .work-modal { border-radius: 18px 18px 0 0; max-height: 94dvh; overflow-y: auto; }
  .work-modal .modal-close { top: 10px; right: 10px; z-index: 3; background: rgba(15, 23, 42, .55); color: #fff; }
  .work-modal .work-side { padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); }
  .work-modal .work-actions { flex-wrap: wrap; gap: 8px; padding-bottom: 4px; }
  .work-modal .work-actions .btn { flex: 1 1 calc(50% - 4px); justify-content: center; }
  .toast-wrap { bottom: calc(18px + env(safe-area-inset-bottom)); }
}

/* ---------- 公告弹窗 ---------- */
.notice-card { max-width: 460px; }
.notice-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding-right: 28px; }
.notice-head h2 { margin: 0; font-size: 17px; font-weight: 700; color: var(--text-strong); }
.notice-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notice-icon .icon { width: 18px; height: 18px; }
.notice-body { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 52vh; overflow-y: auto; font-size: 13.5px; line-height: 1.75; color: var(--text); background: var(--bg-muted); border-radius: var(--radius-sm); padding: 12px 14px; }
.notice-actions { margin-top: 14px; }

.profile-group { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-600); font-size: 11.5px; margin-bottom: 8px; }
