:root {
  color-scheme: dark;
  --bg: #0c0d0f;
  --panel: #15171a;
  --panel-2: #1c1f23;
  --line: #2b2e33;
  --text: #f3f1eb;
  --muted: #989b9f;
  --accent: #ff5c35;
  --accent-2: #ffb347;
  font-family: Inter, "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at 75% 0%, #282015 0, transparent 32%), var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 52px 0 80px; }
.topbar, .tasks-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.eyebrow { margin: 0 0 9px; color: var(--accent-2); font-size: 12px; letter-spacing: .2em; font-weight: 700; }
h1 { margin: 0; font-size: clamp(34px, 5vw, 66px); letter-spacing: -.055em; line-height: .98; }
h2 { margin: 0; font-size: 25px; }
.subtitle, .form-head p { color: var(--muted); margin: 12px 0 0; }
.status { padding: 10px 16px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; }
.status.connected { color: #89e6ad; border-color: #326948; }
.status.error { color: #ff9a85; border-color: #773d33; }
.credit-badge { color: var(--accent-2); background: #111316; border-color: #4a3822; font-weight: 700; }
.session-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.small { padding: 9px 12px; font-size: 12px; }
.tabs { display: flex; gap: 8px; margin: 48px 0 18px; }
.tab, .secondary { border: 1px solid var(--line); color: var(--muted); background: #111316; border-radius: 10px; padding: 11px 16px; cursor: pointer; }
a.secondary { text-decoration: none; display: inline-flex; align-items: center; }
.tab.active { color: var(--text); background: var(--panel-2); border-color: #545961; }
.workspace { border: 1px solid var(--line); background: rgba(21, 23, 26, .94); border-radius: 18px; overflow: hidden; }
.generator { display: none; padding: clamp(24px, 5vw, 52px); }
.generator.active { display: block; }
.form-head { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 34px; }
.number { color: var(--accent); font: 700 13px monospace; padding-top: 6px; }
label { display: flex; flex-direction: column; gap: 9px; color: #c8c8c5; font-size: 13px; }
textarea, input, select { width: 100%; color: var(--text); background: #0f1113; border: 1px solid var(--line); border-radius: 9px; padding: 13px 14px; outline: none; }
textarea { resize: vertical; min-height: 130px; line-height: 1.65; }
textarea:focus, input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 92, 53, .1); }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 22px 0 28px; }
.check { flex-direction: row; align-items: center; align-self: end; min-height: 44px; }
.check input { width: auto; }
.drop { border: 1px dashed #4b4f56; border-radius: 10px; padding: 22px; margin-bottom: 20px; background: #101214; cursor: pointer; }
.drop input { border: 0; padding: 0; background: none; }
.drop span { color: var(--muted); }
.primary { border: 0; border-radius: 10px; background: linear-gradient(135deg, var(--accent), #e8352e); color: white; padding: 14px 22px; font-weight: 700; cursor: pointer; }
.primary:disabled { opacity: .5; cursor: wait; }
.tasks { margin-top: 54px; }
.tasks-head { margin-bottom: 20px; }
.task-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: stretch; }
.task { height: 430px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow: hidden; display: flex; flex-direction: column; contain: layout paint style; content-visibility: auto; contain-intrinsic-size: 360px 430px; }
.preview { height: 190px; flex: 0 0 190px; background: #08090a; display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.preview img, .preview video { width: 100%; height: 100%; object-fit: cover; }
.task-body { min-height: 0; padding: 16px; display: flex; flex: 1; flex-direction: column; }
.task-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); }
.task-prompt { min-height: 4.5em; max-height: 4.5em; margin: 12px 0 0; line-height: 1.5; overflow: hidden; overflow-wrap: anywhere; }
.task.prompt-expanded .task-prompt { max-height: 8.9em; overflow: auto; scrollbar-width: thin; }
.prompt-toggle { align-self: flex-start; margin-top: 8px; border: 0; background: transparent; color: var(--accent-2); padding: 0; cursor: pointer; font-size: 12px; }
.pill { color: var(--accent-2); }
.task-actions { margin-top: auto; padding-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; max-height: 84px; overflow: auto; scrollbar-width: thin; }
.download { display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; padding: 9px 13px; color: #fff; background: #272b31; border: 1px solid #3a3f47; text-decoration: none; font-size: 13px; }
.download:hover { border-color: var(--accent); color: #fff; }
.message { margin-bottom: 16px; padding: 13px 15px; border-radius: 9px; background: #241713; color: #ffb09d; border: 1px solid #59352d; }
.message.ok { background: #132219; color: #91e5af; border-color: #2f5a3e; }
.hidden { display: none; }
.empty { color: var(--muted); }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(520px, 100%); border: 1px solid var(--line); background: rgba(21, 23, 26, .96); border-radius: 18px; padding: clamp(28px, 6vw, 48px); box-shadow: 0 24px 80px rgba(0,0,0,.3); }
.auth-card h1 { margin-bottom: 8px; }
.auth-tabs { display: flex; gap: 8px; margin: 30px 0 20px; }
.auth-form { display: none; gap: 18px; flex-direction: column; }
.auth-form.active { display: flex; }
.admin-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 42px 0 22px; }
.metric, .panel { border: 1px solid var(--line); background: rgba(21, 23, 26, .94); border-radius: 16px; padding: 22px; }
.metric span { color: var(--muted); font-size: 13px; }
.metric strong { display: block; margin-top: 10px; font-size: 38px; letter-spacing: -.04em; }
.panel { margin-top: 18px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.6; }
.account-form { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 10px; margin: 18px 0 8px; align-items: end; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.danger { border-color: #65372f; color: #ff9a85; }
.table-wrap { overflow-x: auto; margin-top: 18px; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 13px 10px; vertical-align: top; }
th { color: var(--accent-2); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
td { color: #d8d8d5; font-size: 13px; }
td a { color: #fff; }
.credit-form { display: grid; grid-template-columns: 90px minmax(120px, 1fr) auto; gap: 8px; align-items: center; min-width: 360px; }
.credit-form input { padding: 9px 10px; }
@media (max-width: 800px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .session-box { justify-content: flex-start; }
  .grid, .task-list, .admin-grid { grid-template-columns: 1fr; }
  .account-form { grid-template-columns: 1fr; }
  .task { height: 460px; }
  .preview { height: 220px; flex-basis: 220px; }
  .credit-form { grid-template-columns: 1fr; min-width: 0; }
  .tabs { overflow-x: auto; }
}
