/* Tea AI — 科技感视觉系统 */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg-0: #060a0f;
  --bg-1: #0b1219;
  --bg-2: #101a24;
  --bg-3: #162231;
  --line: rgba(80, 220, 200, 0.14);
  --line-strong: rgba(80, 220, 200, 0.28);
  --text: #e7f3ef;
  --muted: #8aa39a;
  --tea: #2dd4a8;
  --tea-dim: rgba(45, 212, 168, 0.15);
  --cyan: #00c2e0;
  --blue: #5b8cff;
  --danger: #ff6b7a;
  --warn: #ffc857;
  --ok: #2dd4a8;
  --radius: 14px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --font: 'Outfit', 'Segoe UI', sans-serif;
  --display: 'Orbitron', 'Outfit', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cyan); text-decoration: none; }
img, video { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
::selection { background: var(--tea); color: #04110c; }

/* 背景氛围 */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(45,212,168,.18), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 0%, rgba(0,194,224,.12), transparent 50%),
    radial-gradient(ellipse 50% 40% at 70% 100%, rgba(91,140,255,.08), transparent 55%),
    linear-gradient(180deg, #070c12 0%, #0a121a 100%);
}
.app-shell::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(45,212,168,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45,212,168,.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 75%);
  z-index: 0;
}

/* 侧栏 */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 16px;
  border-right: 1px solid var(--line);
  background: rgba(8, 14, 20, 0.82);
  backdrop-filter: blur(16px);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 24px;
}
.brand img { width: 42px; height: 42px; border-radius: 12px; }
.brand-text { display: flex; flex-direction: column; }
.brand-text strong {
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  background: linear-gradient(90deg, var(--tea), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-text small { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.08em; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--muted);
  transition: .2s ease;
  border: 1px solid transparent;
}
.nav-item img { width: 22px; height: 22px; opacity: .85; }
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.03); }
.nav-item.active {
  color: var(--text);
  background: linear-gradient(90deg, var(--tea-dim), rgba(0,194,224,.08));
  border-color: var(--line-strong);
  box-shadow: inset 0 0 0 1px rgba(45,212,168,.08);
}

.sidebar-foot {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--line);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: var(--bg-2);
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--tea), var(--blue));
  display: grid; place-items: center;
  font-weight: 700; font-size: .85rem; color: #04110c;
}
.credit-pill {
  margin-top: 10px;
  font-size: .8rem;
  color: var(--muted);
  display: flex; justify-content: space-between; gap: 8px;
}
.credit-pill b { color: var(--tea); font-family: var(--display); font-weight: 500; }

/* 主区 */
.main {
  position: relative;
  z-index: 1;
  min-width: 0;
  padding: 28px 32px 48px;
}
.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.topbar h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.55rem;
  letter-spacing: .04em;
  font-weight: 700;
}
.topbar p { margin: 6px 0 0; color: var(--muted); font-size: .92rem; }

.panel { display: none; animation: fadeUp .35s ease; }
.panel.active { display: block; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* 首页 Hero */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid var(--line);
  min-height: 360px;
  display: grid;
  align-items: end;
  padding: 40px;
  background:
    linear-gradient(120deg, rgba(6,10,15,.92) 15%, rgba(6,10,15,.55) 55%, rgba(6,10,15,.35)),
    url('../images/hero-bg.jpg') center/cover;
  box-shadow: var(--shadow);
}
.hero::after {
  content: '';
  position: absolute;
  inset: auto -20% -40% 40%;
  height: 60%;
  background: radial-gradient(circle, rgba(45,212,168,.35), transparent 65%);
  pointer-events: none;
  animation: pulseGlow 6s ease-in-out infinite;
}
@keyframes pulseGlow {
  0%,100% { opacity: .45; transform: scale(1); }
  50% { opacity: .85; transform: scale(1.08); }
}
.hero-brand {
  font-family: var(--display);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  letter-spacing: .08em;
  margin: 0 0 10px;
  background: linear-gradient(90deg, #fff, var(--tea), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  position: relative;
  z-index: 1;
}
.hero p {
  max-width: 480px;
  color: rgba(231,243,239,.82);
  margin: 0 0 22px;
  position: relative;
  z-index: 1;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; position: relative; z-index: 1; }

.feature-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 22px;
}
.feature {
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(22,34,49,.75), rgba(11,18,25,.75));
  transition: transform .25s ease, border-color .25s ease;
}
.feature:hover { transform: translateY(-4px); border-color: var(--line-strong); }
.feature img { width: 36px; height: 36px; margin-bottom: 12px; }
.feature h3 { margin: 0 0 6px; font-size: 1rem; }
.feature p { margin: 0; color: var(--muted); font-size: .85rem; }

/* 表单与控件 */
.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 420px) 1fr;
  gap: 20px;
  align-items: start;
}
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 26, 36, 0.78);
  backdrop-filter: blur(10px);
  padding: 20px;
}
.card h2 {
  margin: 0 0 16px;
  font-size: 1rem;
  font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.card h2::before {
  content: '';
  width: 6px; height: 16px; border-radius: 3px;
  background: linear-gradient(180deg, var(--tea), var(--cyan));
}

.tabs {
  display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
}
.tab {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  transition: .2s;
}
.tab.active, .tab:hover {
  color: var(--text);
  border-color: var(--tea);
  background: var(--tea-dim);
}

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-1);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--tea);
  box-shadow: 0 0 0 3px var(--tea-dim);
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px;
  border-radius: 11px;
  border: 1px solid var(--line);
  transition: .2s ease;
  font-weight: 500;
}
.btn-primary {
  background: linear-gradient(135deg, var(--tea), #1bb892 40%, var(--cyan));
  color: #04110c;
  border: none;
  box-shadow: 0 8px 24px rgba(45,212,168,.25);
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { border-color: var(--tea); color: var(--tea); }
.btn-danger { border-color: rgba(255,107,122,.4); color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: .85rem; border-radius: 8px; }

.upload-zone {
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  padding: 22px;
  text-align: center;
  color: var(--muted);
  background: rgba(0,0,0,.18);
  cursor: pointer;
  transition: .2s;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--tea);
  background: var(--tea-dim);
  color: var(--text);
}
.upload-preview {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px;
}
.upload-preview .thumb {
  width: 72px; height: 72px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--line);
}

/* 结果区 */
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.result-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-1);
  aspect-ratio: 1;
}
.result-item img, .result-item video {
  width: 100%; height: 100%; object-fit: cover;
}
.result-item .actions {
  position: absolute; inset: auto 0 0 0;
  display: flex; gap: 6px; justify-content: center;
  padding: 8px;
  background: linear-gradient(transparent, rgba(0,0,0,.75));
  opacity: 0; transition: .2s;
}
.result-item:hover .actions { opacity: 1; }

.empty-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty-state img { width: 48px; margin: 0 auto 12px; opacity: .7; }

/* 短剧 */
.drama-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.drama-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-2);
  cursor: pointer;
  transition: .25s;
}
.drama-card:hover { border-color: var(--tea); transform: translateY(-3px); }
.drama-cover {
  aspect-ratio: 9/12;
  background: linear-gradient(145deg, #12202c, #0b1520);
  display: grid; place-items: center;
  overflow: hidden;
}
.drama-cover img { width: 100%; height: 100%; object-fit: cover; }
.drama-meta { padding: 14px; }
.drama-meta h3 { margin: 0 0 4px; font-size: 1rem; }
.drama-meta p { margin: 0; color: var(--muted); font-size: .8rem; }

.scene-list { display: flex; flex-direction: column; gap: 14px; }
.scene-item {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0,0,0,.15);
}
.scene-media {
  width: 120px; aspect-ratio: 9/16;
  border-radius: 8px; overflow: hidden;
  background: var(--bg-1);
  display: grid; place-items: center;
  color: var(--muted); font-size: .75rem;
}
.scene-media img, .scene-media video { width: 100%; height: 100%; object-fit: cover; }
.scene-body h4 { margin: 0 0 6px; }
.scene-body p { margin: 0 0 8px; color: var(--muted); font-size: .85rem; }
.scene-actions { display: flex; flex-direction: column; gap: 8px; }

.status-dot {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .75rem; color: var(--muted);
}
.status-dot i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted);
}
.status-dot.ok i { background: var(--ok); }
.status-dot.warn i { background: var(--warn); }
.status-dot.err i { background: var(--danger); }

/* 资产库 */
.asset-toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center;
}
.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.asset-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  aspect-ratio: 1;
  background: var(--bg-1);
}
.asset-item .fav {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,.55);
  display: grid; place-items: center;
  color: #fff;
}
.asset-item .fav.on { color: #ffc857; }

/* 设置 */
.settings-form { max-width: 560px; }

/* Toast / Loading */
.toast-wrap {
  position: fixed; right: 20px; bottom: 20px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  min-width: 240px; max-width: 360px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: fadeUp .25s ease;
}
.toast.error { border-color: rgba(255,107,122,.5); }
.toast.success { border-color: rgba(45,212,168,.5); }

.loading-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(4,8,12,.62);
  display: none; place-items: center;
  backdrop-filter: blur(4px);
}
.loading-overlay.show { display: grid; }
.loader {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 3px solid rgba(45,212,168,.2);
  border-top-color: var(--tea);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  margin-top: 16px; text-align: center; color: var(--muted);
  font-family: var(--display); font-size: .8rem; letter-spacing: .12em;
}

/* Auth / Install */
.auth-page {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(45,212,168,.15), transparent 45%),
    radial-gradient(ellipse at 80% 10%, rgba(0,194,224,.12), transparent 40%),
    var(--bg-0);
}
.auth-card {
  width: min(440px, 100%);
  padding: 32px 28px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(12, 18, 26, 0.9);
  box-shadow: var(--shadow);
}
.install-card { width: min(520px, 100%); }
.brand-mark {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.brand-mark img { width: 40px; height: 40px; }
.brand-mark span {
  font-family: var(--display);
  background: linear-gradient(90deg, var(--tea), var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: .06em;
}
.auth-card h1 { margin: 0 0 18px; font-size: 1.4rem; }
.auth-card .muted, .muted { color: var(--muted); font-size: .9rem; }
.form-grid label { display: block; margin-bottom: 12px; font-size: .85rem; color: var(--muted); }
.form-grid input {
  display: block; width: 100%; margin-top: 6px;
  padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-1);
}
.form-grid h3 {
  margin: 18px 0 10px;
  font-size: .95rem;
  color: var(--tea);
  font-family: var(--display);
  letter-spacing: .04em;
}
.alert {
  padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; font-size: .9rem;
}
.alert-error { background: rgba(255,107,122,.12); border: 1px solid rgba(255,107,122,.35); color: #ffb3bb; }
.auth-switch { margin-top: 16px; text-align: center; color: var(--muted); font-size: .9rem; }

.modal-back {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,.6);
  display: none; place-items: center; padding: 20px;
}
.modal-back.show { display: grid; }
.modal {
  width: min(720px, 100%);
  max-height: 90vh; overflow: auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;
}
.modal-head h3 { margin: 0; }

.char-row {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 10px;
  align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line);
}
.char-row img {
  width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--bg-1);
}

@media (max-width: 1100px) {
  .feature-row { grid-template-columns: repeat(2, 1fr); }
  .workspace { grid-template-columns: 1fr; }
  .scene-item { grid-template-columns: 90px 1fr; }
  .scene-actions { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 800px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: auto;
    flex-direction: row; overflow-x: auto; padding: 8px;
    border-right: none; border-top: 1px solid var(--line);
  }
  .brand, .sidebar-foot { display: none; }
  .nav-item { flex-direction: column; font-size: .7rem; gap: 4px; padding: 8px 10px; white-space: nowrap; }
  .nav-item img { width: 20px; height: 20px; }
  .main { padding: 20px 16px 100px; }
  .feature-row { grid-template-columns: 1fr; }
  .hero { padding: 28px 20px; min-height: 300px; }
}
