/* ==========================================================
   AI 创作云 · 样式表
   设计语言参考阿里云百炼控制台：浅色底、卡片分区、橙色主色、克制阴影
   ========================================================== */
:root {
  --primary: #ff6a00;
  --primary-dark: #e05500;
  --primary-soft: #fff2e8;
  --primary-line: #ffd8bf;
  --text: #1d2129;
  --text-2: #4e5969;
  --text-3: #86909c;
  --border: #e5e6eb;
  --bg: #f5f6f8;
  --white: #ffffff;
  --green: #00b42a;
  --red: #f53f3f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(29, 33, 41, .04), 0 4px 16px rgba(29, 33, 41, .04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --font-ug: "ALKATIP Basma", "ALKATIP Tor", "UKIJ Tuz", "Noto Naskh Arabic", "Scheherazade New", serif;
}

/* ALKATIP Basma web 字体（本机无该字体时自动下载） */
@font-face { font-family: 'ALKATIP Basma'; src: local('ALKATIP Basma'), url('/studio/fonts/alkatip-basma.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'ALKATIP Basma'; src: local('ALKATIP Basma Tom'), url('/studio/fonts/alkatip-basma-tom.ttf') format('truetype'); font-weight: 500 700; font-display: swap; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 14px; color: var(--text); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d6d8dd; border-radius: 4px; }

/* 维吾尔语：整页 RTL + 专用字体 */
body.lang-ug { direction: rtl; font-family: var(--font-ug); font-size: 15px; }
body.lang-ug .logo-text, body.lang-ug .num { font-family: var(--font-ug); }
body.lang-ug input[type=tel], body.lang-ug input[type=text] { direction: rtl; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  height: 58px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
  gap: 28px;
}
.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, #ff8a3d, #ff6a00);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; letter-spacing: -.5px;
  box-shadow: 0 4px 10px rgba(255, 106, 0, .25);
}
.logo-text { font-weight: 600; font-size: 16px; letter-spacing: .3px; }
.logo-sub { font-size: 12px; color: var(--text-3); margin-inline-start: 8px; }

.nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav a {
  padding: 7px 12px; border-radius: 6px; color: var(--text-2); font-size: 14px;
  transition: .15s; white-space: nowrap;
}
.nav a:hover { background: #f2f3f5; color: var(--text); }
.nav a.active { color: var(--primary); background: var(--primary-soft); font-weight: 500; }

.topbar-right { display: flex; align-items: center; gap: 12px; margin-inline-start: auto; }
.quota-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-soft); border: 1px solid var(--primary-line);
  color: var(--primary-dark); padding: 5px 10px; border-radius: 20px; font-size: 12px;
  white-space: nowrap;
}
.lang-switch {
  display: flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
}
.lang-switch button {
  border: 0; background: #fff; padding: 5px 10px; font-size: 12px; color: var(--text-2);
}
.lang-switch button.on { background: var(--primary); color: #fff; }
.btn-ghost {
  border: 1px solid var(--border); background: #fff; padding: 6px 12px;
  border-radius: 6px; color: var(--text-2); font-size: 13px;
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--primary-soft);
  color: var(--primary-dark); display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; border: 1px solid var(--primary-line);
}
.user-menu { position: relative; }
.user-dropdown {
  position: absolute; inset-inline-end: 0; top: 42px; background: #fff; border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.08); min-width: 180px; padding: 6px; display: none;
  z-index: 30;
}
.user-dropdown.show { display: block; }
.user-dropdown a, .user-dropdown button {
  display: block; width: 100%; text-align: start; padding: 8px 10px; border: 0; background: none;
  border-radius: 6px; font-size: 13px; color: var(--text-2);
}
.user-dropdown a:hover, .user-dropdown button:hover { background: #f2f3f5; color: var(--text); }

/* ---------------- 布局 ---------------- */
.container { max-width: 1180px; margin: 0 auto; padding: 20px 24px 60px; }
.page-title { font-size: 22px; font-weight: 600; margin: 6px 0 4px; }
.page-desc { color: var(--text-3); font-size: 13px; margin-bottom: 18px; }

.card {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px 22px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card-title .dot { width: 3px; height: 14px; background: var(--primary); border-radius: 2px; }
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) {
  .grid-3, .grid-4, .grid-2 { grid-template-columns: 1fr; }
  .nav { display: none; }
  .topbar { gap: 12px; padding: 0 14px; }
}

/* ---------------- 多模态平台嵌入 ---------------- */
.mm-wrap { height: calc(100vh - 58px); overflow: hidden; }
.mm-frame { width: 100%; height: 100%; border: none; display: block; }

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: calc(100vh - 58px);
  display: flex; align-items: center; justify-content: center;
  padding: 30px 20px;
  background:
    radial-gradient(900px 400px at 12% 0%, #fff4ec 0%, rgba(255,255,255,0) 60%),
    radial-gradient(700px 380px at 88% 100%, #f3f7ff 0%, rgba(255,255,255,0) 60%),
    var(--bg);
}
.login-card {
  width: 400px; max-width: 100%; background: #fff; border-radius: 14px;
  box-shadow: 0 12px 40px rgba(29,33,41,.1); border: 1px solid var(--border);
  padding: 30px 30px 24px;
}
.login-card h1 { font-size: 20px; margin: 0 0 6px; }
.login-card .sub { color: var(--text-3); font-size: 13px; margin-bottom: 22px; }
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tabs button {
  border: 0; background: none; padding: 9px 2px; font-size: 14px; color: var(--text-3);
  position: relative;
}
.tabs button.on { color: var(--text); font-weight: 600; }
.tabs button.on::after {
  content: ""; position: absolute; inset-inline-start: 0; right: 0; bottom: -1px; height: 2px; background: var(--primary);
}
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.input {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; outline: none; transition: .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,106,0,.1); }
.input-row { display: flex; gap: 10px; }
.btn-primary {
  width: 100%; height: 42px; border: 0; border-radius: 8px; color: #fff; font-size: 14px; font-weight: 500;
  background: linear-gradient(135deg, #ff8534, #ff6a00);
  box-shadow: 0 6px 16px rgba(255,106,0,.22);
  transition: .15s;
}
.btn-primary:hover { filter: brightness(.96); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; box-shadow: none; }
.btn-secondary {
  border: 1px solid var(--border); background: #fff; height: 42px; padding: 0 14px;
  border-radius: 8px; color: var(--text-2); white-space: nowrap;
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-mini {
  border: 1px solid var(--border); background: #fff; padding: 4px 10px; border-radius: 6px;
  font-size: 12px; color: var(--text-2);
}
.btn-mini:hover { border-color: var(--primary); color: var(--primary); }
.btn-mini.danger:hover { border-color: var(--red); color: var(--red); }
.btn-mini.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-mini.primary:hover { background: var(--primary-dark); color: #fff; }
.agree { font-size: 12px; color: var(--text-3); margin-top: 14px; text-align: center; }
.agree a { color: var(--text-2); }

.qr-box { text-align: center; padding: 6px 0 0; }
.qr-canvas {
  width: 196px; height: 196px; margin: 0 auto 12px; padding: 10px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
  display: flex; align-items: center; justify-content: center; position: relative;
}
.qr-canvas svg, .qr-canvas img { width: 100%; height: 100%; }
.qr-canvas .mask {
  position: absolute; inset: 0; background: rgba(255,255,255,.94); border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  font-size: 13px; color: var(--text-2);
}
.qr-status { font-size: 13px; color: var(--text-2); min-height: 20px; }
.qr-status.ok { color: var(--green); }
.qr-status.err { color: var(--red); }
.qr-hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* ---------------- 首页 ---------------- */
.hero {
  background: linear-gradient(120deg, #fff6ef 0%, #ffffff 55%, #f5f8ff 100%);
  border: 1px solid var(--border); border-radius: 14px; padding: 26px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.hero h2 { font-size: 20px; margin: 0 0 8px; }
.hero p { margin: 0; color: var(--text-2); font-size: 13px; }
.hero-actions { display: flex; gap: 10px; }

.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.stat-value { font-size: 24px; font-weight: 600; letter-spacing: -.5px; }
.stat-value small { font-size: 12px; color: var(--text-3); font-weight: 400; margin-inline-start: 6px; }
.progress { height: 6px; border-radius: 3px; background: #f2f3f5; margin-top: 12px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #ffb27a, #ff6a00); width: 0; transition: width .4s; }

.scene-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 900px) { .scene-grid { grid-template-columns: repeat(2, 1fr); } }
.scene-item {
  border: 1px solid var(--border); border-radius: 9px; padding: 14px 14px; background: #fff;
  cursor: pointer; transition: .15s; display: flex; gap: 10px; align-items: flex-start;
}
.scene-item:hover { border-color: var(--primary-line); background: #fffaf6; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(255,106,0,.08); }
.scene-icon {
  width: 30px; height: 30px; border-radius: 8px; background: var(--primary-soft); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0;
}
.scene-name { font-size: 13px; font-weight: 500; }
.scene-tip { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ---------------- 创作台 ---------------- */
.studio-layout { display: grid; grid-template-columns: 216px 1fr; gap: 16px; align-items: start; }
@media (max-width: 960px) { .studio-layout { grid-template-columns: 1fr; } }
.side-card { position: sticky; top: 74px; }
.scene-list { display: flex; flex-direction: column; gap: 2px; }
.scene-list button {
  display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none;
  padding: 9px 10px; border-radius: 7px; font-size: 13px; color: var(--text-2); text-align: start;
}
.scene-list button:hover { background: #f7f8fa; }
.scene-list button.on { background: var(--primary-soft); color: var(--primary-dark); font-weight: 500; }
.scene-list .mini-icon { width: 20px; text-align: center; font-size: 12px; color: var(--primary); }

.panel { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel-head .t { font-weight: 600; font-size: 14px; }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 16px 18px; }

.prompt-area { width: 100%; min-height: 108px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 9px; resize: vertical; outline: none; line-height: 1.7; }
.prompt-area:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,106,0,.08); }
.toolbar { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.select {
  height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: 7px; background: #fff;
  outline: none; font-size: 13px;
}
.select:focus { border-color: var(--primary); }
.range-wrap { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.range-wrap input[type=range] { width: 90px; accent-color: var(--primary); }

.output {
  min-height: 320px; max-height: 560px; overflow: auto; padding: 18px;
  font-size: 14px; line-height: 1.85; color: var(--text); white-space: normal;
  background: #fff; border-radius: 0 0 var(--radius) var(--radius);
}
.output h3, .output h4 { margin: 14px 0 6px; font-size: 15px; color: var(--primary-dark); }
.output p { margin: 0 0 8px; }
.output ul { margin: 6px 0 10px; padding-inline-start: 20px; }
.output code { background: #f5f6f8; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.output .placeholder { color: var(--text-3); font-size: 13px; }
.caret::after { content: "▍"; color: var(--primary); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.content-list { display: flex; flex-direction: column; }
.content-item { padding: 11px 12px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.content-item:hover { background: #f7f8fa; }
.content-item.on { background: var(--primary-soft); border-color: var(--primary-line); }
.content-item .t { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content-item .m { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ---------------- 套餐 ---------------- */
.plans { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; align-items: stretch; }
@media (max-width: 1000px) { .plans { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .plans { grid-template-columns: 1fr; } }
.plan {
  background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 22px 20px;
  position: relative; display: flex; flex-direction: column; transition: .18s;
}
.plan:hover { box-shadow: 0 10px 28px rgba(29,33,41,.09); transform: translateY(-2px); }
.plan.featured { border: 1.5px solid var(--primary); box-shadow: 0 10px 28px rgba(255,106,0,.12); }
.plan-badge {
  position: absolute; top: -11px; inset-inline-start: 20px; background: var(--primary); color: #fff;
  font-size: 11px; padding: 2px 10px; border-radius: 10px;
}
.plan-name { font-size: 16px; font-weight: 600; }
.plan-price { margin: 12px 0 2px; }
.plan-price .cny { font-size: 13px; color: var(--text-2); }
.plan-price .num { font-size: 30px; font-weight: 700; color: var(--primary); letter-spacing: -1px; }
.plan-price .unit { font-size: 12px; color: var(--text-3); margin-inline-start: 4px; }
.plan-features { list-style: none; padding: 0; margin: 16px 0 20px; flex: 1; }
.plan-features li { display: flex; gap: 8px; font-size: 13px; color: var(--text-2); padding: 5px 0; }
.plan-features li::before { content: "✓"; color: var(--primary); font-weight: 700; }
.plan .btn-primary, .plan .btn-secondary { width: 100%; }
.plan.current .btn-secondary { color: var(--green); border-color: #b7ebc6; background: #f3fdf6; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 12px; text-align: start; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-3); font-weight: 500; background: #fafbfc; font-size: 12px; }
tbody tr:hover { background: #fafbfc; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 11px; line-height: 18px; }
.tag.green { background: #e8f8ec; color: #009a29; }
.tag.orange { background: var(--primary-soft); color: var(--primary-dark); }
.tag.gray { background: #f2f3f5; color: var(--text-3); }
.tag.red { background: #ffece8; color: #cb2634; }
.empty { padding: 40px; text-align: center; color: var(--text-3); font-size: 13px; }

/* ---------------- 弹窗 / 提示 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.42); display: flex; align-items: center; justify-content: center;
  z-index: 60; padding: 20px;
}
.modal {
  width: 440px; max-width: 100%; background: #fff; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.18);
  overflow: hidden;
}
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head .t { font-weight: 600; }
.modal-head .x { border: 0; background: none; font-size: 18px; color: var(--text-3); line-height: 1; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.toast-wrap { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #fff; border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 10px 16px; border-radius: 8px; font-size: 13px; min-width: 200px; text-align: center;
  animation: toastIn .2s ease;
}
.toast.ok { border-color: #b7ebc6; color: #007c1c; background: #f4fdf7; }
.toast.err { border-color: #ffccc7; color: #c0271f; background: #fff5f4; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }

.notice-bar {
  background: #fffbe6; border: 1px solid #ffe58f; color: #874d00; border-radius: 8px;
  padding: 9px 14px; font-size: 12px; margin-bottom: 16px;
}
.crumb { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.hint { font-size: 12px; color: var(--text-3); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; }
