:root {
  --bg: #070b14;
  --bg-2: #0b1220;
  --panel: #101827;
  --panel-2: #131d2e;
  --ink: #f7f8ff;
  --muted: #8f9bb3;
  --line: rgba(148, 163, 184, .16);
  --accent: #7c5cff;
  --accent-2: #3b82f6;
  --accent-3: #22d3ee;
  --success: #34d399;
  --danger: #fb7185;
  --soft: rgba(124, 92, 255, .16);
  --shadow: 0 24px 80px rgba(0, 0, 0, .38);
  --glow: 0 0 0 1px rgba(124, 92, 255, .42), 0 0 34px rgba(124, 92, 255, .18);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 5%, rgba(124, 92, 255, .22), transparent 28%),
    radial-gradient(circle at 88% 8%, rgba(34, 211, 238, .13), transparent 30%),
    linear-gradient(180deg, #070b14 0%, #0a101c 46%, #060914 100%);
  font-family: "Microsoft YaHei UI", "PingFang SC", Arial, sans-serif;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
button, .tool-panel, .nav-link, .points-pill, .ghost, .primary {
  transition: transform .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  width: 260px;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(8, 13, 24, .96), rgba(9, 14, 25, .92));
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  color: var(--ink);
  font-weight: 900;
  font-size: 20px;
  text-decoration: none;
}
.sidebar-brand { margin: 2px 8px 28px; }
.brand-mark {
  display: block;
  width: 30px;
  height: 30px;
  border-radius: 10px 14px 14px 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  clip-path: polygon(15% 8%, 92% 50%, 15% 92%);
  box-shadow: 0 0 24px rgba(124, 92, 255, .45);
}
.side-nav { display: grid; gap: 8px; }
.side-label {
  margin: 18px 10px 6px;
  color: #64748b;
  font-size: 12px;
  letter-spacing: .08em;
}
.nav-link {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 14px 16px;
  color: #b9c2d4;
  background: transparent;
  text-align: left;
  font-weight: 800;
}
.nav-link:hover { background: rgba(124, 92, 255, .1); color: #fff; }
.nav-link:hover,
.points-pill:hover,
.ghost:hover {
  transform: translateY(-1px);
}
.nav-link.active {
  color: #fff;
  border-color: rgba(124, 92, 255, .56);
  background: linear-gradient(135deg, rgba(124, 92, 255, .22), rgba(59, 130, 246, .12));
  box-shadow: var(--glow);
}
.plan-card {
  margin-top: auto;
  border: 1px solid rgba(124, 92, 255, .28);
  border-radius: 18px;
  padding: 18px;
  background:
    radial-gradient(circle at 95% 0%, rgba(124,92,255,.28), transparent 34%),
    linear-gradient(180deg, rgba(19, 29, 46, .9), rgba(13, 20, 34, .94));
  box-shadow: var(--shadow);
}
.plan-card span { color: #d9ddff; font-weight: 900; }
.plan-card strong { display: block; margin-top: 16px; font-size: 24px; letter-spacing: -.04em; }
.plan-card small { display: block; margin: 6px 0 16px; color: var(--muted); }
.nav-topup { width: 100%; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  height: 52px;
  margin-left: 260px;
  padding: 0 28px 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 11, 20, .76);
  backdrop-filter: blur(18px);
}
.search-box {
  width: min(440px, 45vw);
  height: 34px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(15, 23, 42, .72);
  color: #77839a;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}
.top-actions { display: flex; gap: 12px; align-items: center; }
.points-pill {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 10px 8px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #f8fafc;
  background: rgba(15, 23, 42, .74);
}
.points-pill b {
  border-radius: 10px;
  padding: 7px 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-size: 13px;
}
.chip {
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(148, 163, 184, .12);
  color: #dbeafe;
  font-size: 14px;
}
.page {
  max-width: none;
  margin-left: 260px;
  min-height: calc(100vh - 52px);
  padding: 0 28px 0;
  overflow: hidden;
}
.workspace {
  min-height: calc(100vh - 52px);
}

.auth-grid {
  min-height: calc(100vh - 112px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  align-items: center;
  gap: 60px;
}
.eyebrow {
  color: #a78bfa;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .16em;
  margin: 0 0 18px;
}
.hero h1 {
  max-width: 720px;
  margin: 0 0 22px;
  font-size: clamp(42px, 5vw, 64px);
  line-height: 1.08;
  letter-spacing: -.06em;
}
.subhead {
  max-width: 560px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
  margin: 0 0 34px;
}
.feature-row { display: flex; gap: 10px; flex-wrap: wrap; }
.feature-row span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  background: rgba(15, 23, 42, .72);
  color: #cbd5e1;
}
.card,
.tool-panel,
.stat,
.wallet-state,
.chat-messages,
.result {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(19, 29, 46, .92), rgba(12, 19, 32, .94));
  box-shadow: var(--shadow);
}
.card {
  border-radius: 22px;
  padding: 30px;
}
.auth-card h2 { margin: 0 0 26px; font-size: 25px; }
label {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 19px;
  color: var(--muted);
  font-size: 14px;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 13px 14px;
  background: rgba(8, 13, 24, .86);
  color: var(--ink);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(124, 92, 255, .78);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, .14);
}
textarea { resize: vertical; line-height: 1.65; }
.primary {
  border: 0;
  border-radius: 13px;
  background: linear-gradient(135deg, #5965ff, #8b5cf6);
  color: white;
  font-weight: 900;
  padding: 13px 22px;
  box-shadow: 0 14px 32px rgba(124, 92, 255, .28);
}
.primary:hover { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.primary:hover { transform: translateY(-1px); }
.primary:disabled { cursor: not-allowed; opacity: .68; }
.auth-card .primary { width: 100%; margin-top: 5px; }
.auth-toggle {
  width: 100%;
  margin-top: 10px;
  text-align: center;
}
.inline-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.inline-field .ghost {
  white-space: nowrap;
  min-height: 46px;
}
.ghost {
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, .68);
  border-radius: 12px;
  padding: 9px 15px;
  color: #cbd5e1;
}
.hint, .error { font-size: 13px; line-height: 1.6; margin: 18px 0 0; }
.hint { color: var(--muted); }
.error { color: var(--danger); }

.workspace-layout {
  display: grid;
  grid-template-columns: minmax(720px, 1fr) 340px;
  gap: 16px;
  align-items: start;
  min-height: calc(100vh - 52px);
}
.main-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 52px);
}
.preview-column {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 36px;
  align-self: start;
  margin-top: -22px;
}

.workspace-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: stretch;
  margin: 10px 0 8px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    radial-gradient(circle at 100% 0%, rgba(124, 92, 255, .22), transparent 30%),
    linear-gradient(180deg, rgba(17, 25, 40, .92), rgba(12, 19, 32, .94));
  box-shadow: var(--shadow);
}
.workspace-head h1 {
  max-width: 820px;
  margin: 0 0 4px;
  font-size: clamp(23px, 2.25vw, 32px);
  line-height: 1.08;
  letter-spacing: -.05em;
}
.workspace-head p:not(.eyebrow) {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}
.head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.head-stat {
  min-width: 128px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 13px;
  background: rgba(8, 13, 24, .52);
}
.head-stat span {
  display: block;
  color: #9aa8c4;
  font-size: 12px;
  margin-bottom: 6px;
}
.head-stat strong {
  display: block;
  font-size: 21px;
  letter-spacing: -.04em;
}

.wallet-balance {
  color: #c4b5fd;
  font-size: 32px;
  letter-spacing: -.04em;
}
.wallet-state {
  padding: 18px 20px;
  border-radius: 16px;
  color: #dbeafe;
  line-height: 1.7;
  margin-bottom: 18px;
}
.wallet-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.recharge-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  max-width: 760px;
  margin-top: 6px;
}
.qr-topup-button {
  min-width: 160px;
  padding: 13px 24px;
  font-size: 16px;
  flex: 0 0 auto;
}
.link-btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.redemption-form {
  display: flex;
  gap: 12px;
  align-items: end;
  max-width: 540px;
  margin-top: 0;
  flex: 1;
}
.redemption-form label { flex: 1; margin-bottom: 0; }
.wallet-hint {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.account-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.account-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  background: rgba(8, 13, 24, .5);
}
.account-card span {
  display: block;
  color: #9aa8c4;
  font-size: 12px;
  margin-bottom: 10px;
}
.account-card strong {
  display: block;
  color: #f8fafc;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.side-stat-card,
.side-note {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(19, 29, 46, .92), rgba(12, 19, 32, .94));
  box-shadow: var(--shadow);
}
.side-stat-card span,
.side-note p {
  color: var(--muted);
  font-size: 13px;
}
.side-stat-card strong {
  display: block;
  margin-top: 14px;
  font-size: 30px;
  letter-spacing: -.04em;
}
.side-note strong {
  display: block;
  margin-bottom: 10px;
  color: #f8fafc;
}
.side-note p {
  margin: 0;
  line-height: 1.7;
}
.side-note small {
  display: block;
  margin-top: 10px;
  color: #c7d2fe;
  font-size: 12px;
  line-height: 1.6;
}
#side-model-select {
  margin-top: 6px;
  min-height: 44px;
  background: rgba(8, 13, 24, .96);
  border-color: rgba(124, 92, 255, .28);
}
.side-options label {
  margin: 14px 0 0;
  gap: 8px;
  color: #cbd5e1;
}
.side-options select,
.side-options input,
.side-options textarea {
  min-height: 44px;
  background: rgba(8, 13, 24, .96);
  border-color: rgba(124, 92, 255, .24);
}
.side-options textarea {
  min-height: 210px;
}
.side-generator-form {
  display: grid;
  gap: 12px;
}
.side-submit {
  width: 100%;
  margin-top: 4px;
}
.generation-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.generation-actions .side-submit {
  margin-top: 0;
}
.secondary-submit {
  background: linear-gradient(135deg, #7c5cff, #fb7185);
}
.run-count-field {
  display: grid;
  gap: 8px;
}
.run-count-field input {
  width: 100%;
  border: 1px solid rgba(124, 92, 255, .42);
  border-radius: 13px;
  padding: 12px 14px;
  color: #f8fafc;
  background: rgba(8, 13, 24, .76);
  outline: none;
}
.run-count-field input:focus {
  border-color: rgba(139, 92, 246, .86);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, .14);
}
.custom-submit {
  width: 100%;
  min-height: 42px;
  border-color: rgba(124, 92, 255, .38);
  color: #dbeafe;
  text-align: center;
}
.upload-zone {
  position: relative;
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 12px;
  border: 1px dashed rgba(124, 92, 255, .34);
  border-radius: 16px;
  padding: 12px;
  background:
    radial-gradient(circle at 15% 20%, rgba(124, 92, 255, .2), transparent 36%),
    rgba(8, 13, 24, .68);
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.upload-zone:hover,
.upload-zone.drag-over,
.upload-zone:focus-visible {
  border-color: rgba(139, 92, 246, .82);
  background: rgba(36, 24, 82, .38);
  box-shadow: 0 14px 34px rgba(91, 68, 255, .18);
  outline: none;
}
.upload-zone.drag-over {
  transform: translateY(-1px);
}
.upload-zone .upload-title {
  display: block;
  color: #f8fafc;
  font-weight: 700;
}
.upload-zone small {
  display: block;
  margin-top: 4px;
  color: #94a3b8;
  line-height: 1.45;
}
.upload-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, #5b6cff, #8b5cf6);
  box-shadow: 0 10px 24px rgba(91, 108, 255, .32);
}
.upload-copy {
  min-width: 0;
}
.upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  background: linear-gradient(135deg, #5b6cff, #8b5cf6);
  box-shadow: 0 10px 24px rgba(91, 108, 255, .24);
}
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.upload-status-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.upload-status {
  min-height: 34px;
  border: 1px solid rgba(124, 92, 255, .18);
  border-radius: 12px;
  padding: 9px 12px;
  color: #9ca3af;
  background: rgba(8, 13, 24, .58);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.upload-status.busy {
  color: #c7d2fe;
  border-color: rgba(124, 92, 255, .38);
}
.upload-clear {
  min-height: 34px;
  border: 1px solid rgba(248, 113, 113, .28);
  border-radius: 12px;
  padding: 0 12px;
  color: #fecaca;
  background: rgba(127, 29, 29, .18);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}
.upload-clear:hover {
  color: #fff;
  border-color: rgba(248, 113, 113, .48);
  background: rgba(127, 29, 29, .32);
}
.reference-preview {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: rgba(8, 13, 24, .72);
}
.reference-preview img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
}
.reference-preview button {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  color: #cbd5e1;
  background: rgba(15, 23, 42, .84);
}

.tool-stack { margin-top: 0; }
.hidden-model-controls { display: none; }
.tool-panel {
  display: none;
  border-radius: 18px;
  padding: 16px 18px 18px;
  flex: 1;
  min-height: 0;
}
.tool-panel.active { display: block; }
.tool-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.tool-panel > .tool-head { display: none; }
.tool-head h2 { font-size: 22px; margin: 0 0 7px; letter-spacing: -.03em; }
.tool-head p { margin: 0; color: var(--muted); font-size: 14px; }
.tool-head select { width: min(360px, 45vw); }
.select-stack { min-width: min(360px, 45vw); }
.select-stack select { width: 100%; }
.price { display: block; color: #a5b4fc; font-size: 13px; margin-top: 7px; text-align: right; }
.media-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 0 0 12px;
}
.media-action {
  min-width: 78px;
  padding: 10px 14px;
}
.media-action.danger {
  color: #fecaca;
  border-color: rgba(248, 113, 113, .28);
  background: rgba(127, 29, 29, .12);
}
.chat-messages {
  min-height: 430px;
  height: calc(100vh - 390px);
  max-height: none;
  overflow-y: auto;
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 14px;
}
.bubble {
  max-width: 78%;
  padding: 12px 15px;
  border-radius: 14px;
  line-height: 1.65;
  margin-bottom: 12px;
  white-space: pre-wrap;
}
.bubble.assistant {
  background: rgba(15, 23, 42, .88);
  border: 1px solid var(--line);
  color: #e5e7eb;
}
.bubble.user {
  margin-left: auto;
  background: linear-gradient(135deg, #6d5dfc, #7c3aed);
  color: #fff;
}
.compose { display: flex; gap: 12px; align-items: end; }
.compose textarea { min-height: 54px; }
.generator-form { display: grid; gap: 14px; }
.action-submit {
  justify-self: end;
  min-width: 136px;
}
.field-row { display: flex; gap: 11px; justify-content: flex-end; }
.field-row select { max-width: 215px; }
.result {
  min-height: calc(100vh - 308px);
  margin-top: 0;
  border-radius: 16px;
  padding: 16px;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.result img, .result video { max-width: 100%; max-height: 520px; border-radius: 12px; }
.result.has-media { display: block; color: var(--ink); }
.result .status { padding-bottom: 14px; color: var(--muted); }
.video-board {
  place-items: start;
  align-content: start;
  grid-template-columns: repeat(auto-fill, 156px);
  gap: 16px;
  overflow-y: auto;
}
.image-board {
  place-items: start;
  align-content: start;
  grid-template-columns: repeat(auto-fill, 156px);
  gap: 16px;
  overflow-y: auto;
}
.video-task-card {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  border: 1px solid rgba(124, 92, 255, .32);
  border-radius: 14px;
  padding: 10px;
  overflow: hidden;
  color: #e5e7eb;
  cursor: pointer;
  text-align: left;
  background: linear-gradient(180deg, rgba(22, 33, 53, .98), rgba(9, 15, 27, .98));
  box-shadow: 0 18px 44px rgba(0, 0, 0, .28);
}
.image-task-card {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  border: 1px solid rgba(124, 92, 255, .32);
  border-radius: 16px;
  padding: 10px;
  overflow: hidden;
  color: #e5e7eb;
  cursor: pointer;
  text-align: left;
  background: linear-gradient(180deg, rgba(22, 33, 53, .98), rgba(9, 15, 27, .98));
  box-shadow: 0 18px 44px rgba(0, 0, 0, .28);
}
.video-task-card video,
.video-task-card span,
.image-task-card img,
.image-task-card span {
  pointer-events: none;
}
.media-select {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  width: 18px;
  height: 18px;
  accent-color: #7c5cff;
  pointer-events: auto;
}
.video-task-card.is-ready,
.image-task-card.is-ready {
  cursor: pointer;
  border-color: rgba(139, 92, 246, .72);
}
.video-task-card.is-failed,
.image-task-card.is-failed {
  border-color: rgba(248, 113, 113, .38);
}
.video-task-card.is-selected,
.image-task-card.is-selected {
  border-color: rgba(34, 211, 238, .88);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, .18), 0 22px 54px rgba(34, 211, 238, .12);
}
.video-task-card.is-ready:hover,
.video-task-card.is-ready:focus-visible,
.image-task-card.is-ready:hover,
.image-task-card.is-ready:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 22px 54px rgba(91, 68, 255, .26);
  outline: none;
}
.video-task-card video,
.image-task-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  border-radius: 0;
}
.video-task-ratio {
  position: absolute;
  left: 9px;
  top: 9px;
  z-index: 2;
  border-radius: 999px;
  padding: 3px 7px;
  color: #c7d2fe;
  background: rgba(15, 23, 42, .86);
  font-size: 11px;
  font-weight: 800;
}
.video-task-shimmer {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(110deg, transparent 25%, rgba(124, 92, 255, .22) 44%, transparent 62%),
    radial-gradient(circle at 50% 18%, rgba(91, 108, 255, .25), transparent 38%);
  animation: task-shimmer 1.6s linear infinite;
}
.video-task-info {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  display: grid;
  gap: 5px;
}
.video-task-info strong {
  color: #fff;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.video-task-info small,
.video-task-info em {
  color: #a5b4fc;
  font-size: 11px;
  font-style: normal;
  line-height: 1.35;
}
.video-task-progress {
  height: 5px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, .22);
}
.video-task-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5b6cff, #8b5cf6);
}
.video-task-play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  padding: 8px 12px;
  color: #fff;
  background: rgba(15, 23, 42, .72);
  backdrop-filter: blur(8px);
  font-size: 12px;
  font-weight: 900;
}
.media-preview {
  border: 1px solid rgba(255, 255, 255, .14);
  pointer-events: auto;
  cursor: pointer;
}
.media-preview:hover,
.media-preview:focus-visible {
  border-color: rgba(167, 139, 250, .8);
  background: rgba(91, 68, 255, .86);
  outline: none;
}
.card-preview-button {
  top: auto;
  bottom: 14px;
  min-width: 92px;
  min-height: 44px;
  padding: 12px 22px;
  font-size: 15px;
}
.video-task-info.compact {
  padding: 8px;
  border-radius: 10px;
  background: linear-gradient(180deg, transparent, rgba(2, 6, 23, .82));
}
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 6, 23, .78);
  backdrop-filter: blur(10px);
}
.video-modal video {
  width: min(420px, 82vw);
  max-height: 86vh;
  aspect-ratio: 9 / 16;
  border-radius: 20px;
  background: #020617;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .62);
}
.video-modal-close {
  position: fixed;
  right: 24px;
  top: 20px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  padding: 10px 15px;
  color: #fff;
  background: rgba(15, 23, 42, .82);
  cursor: pointer;
}
.image-modal img {
  max-width: min(82vw, 980px);
  max-height: 86vh;
  border-radius: 20px;
  object-fit: contain;
  background: #020617;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .62);
}
.qr-topup-card {
  width: min(560px, calc(100vw - 36px));
  border: 1px solid rgba(124, 92, 255, .32);
  border-radius: 26px;
  padding: 28px;
  text-align: center;
  background: linear-gradient(180deg, rgba(19, 29, 46, .98), rgba(8, 13, 24, .98));
  box-shadow: 0 34px 100px rgba(0, 0, 0, .62);
}
.qr-topup-card h2 {
  margin: 0 0 10px;
  font-size: 32px;
  letter-spacing: -.04em;
}
.qr-topup-copy {
  max-width: 420px;
  margin: 0 auto 20px;
  color: var(--muted);
  line-height: 1.7;
}
.qr-topup-card img {
  display: block;
  width: min(380px, 76vw);
  height: min(380px, 76vw);
  margin: 0 auto;
  border: 12px solid #fff;
  border-radius: 24px;
  object-fit: contain;
  background: #fff;
}
.qr-topup-fallback {
  margin: 18px 0 0;
  color: #fecaca;
}
@keyframes task-shimmer {
  from { background-position: -160px 0, 0 0; }
  to { background-position: 160px 0, 0 0; }
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 13px 9px; font-size: 14px; }
th { color: var(--muted); font-weight: 700; }
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  background: #111827;
  color: white;
  padding: 13px 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 1000;
}
.toast.urgent,
.toast.success {
  left: 50%;
  top: 50%;
  right: auto;
  bottom: auto;
  width: min(460px, calc(100vw - 36px));
  max-width: none;
  transform: translate(-50%, -50%);
  padding: 24px 28px;
  border: 1px solid rgba(251, 146, 60, .55);
  border-radius: 22px;
  color: #fff7ed;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.55;
  text-align: center;
  animation: urgent-pop .18s ease-out;
}
.toast.urgent {
  border-color: rgba(251, 146, 60, .55);
  color: #fff7ed;
  background:
    radial-gradient(circle at 18% 0%, rgba(251, 146, 60, .34), transparent 42%),
    linear-gradient(135deg, rgba(127, 29, 29, .98), rgba(88, 28, 135, .98));
  box-shadow: 0 30px 90px rgba(0, 0, 0, .58), 0 0 0 9999px rgba(2, 6, 23, .45);
}
.toast.success {
  border-color: rgba(52, 211, 153, .62);
  color: #ecfdf5;
  background:
    radial-gradient(circle at 18% 0%, rgba(52, 211, 153, .34), transparent 42%),
    linear-gradient(135deg, rgba(6, 78, 59, .98), rgba(30, 64, 175, .96));
  box-shadow: 0 30px 90px rgba(0, 0, 0, .58), 0 0 0 9999px rgba(2, 6, 23, .42), 0 0 44px rgba(52, 211, 153, .22);
}
.toast.urgent::before {
  content: attr(data-title);
  display: block;
  margin-bottom: 8px;
  color: #fed7aa;
  font-size: 13px;
  letter-spacing: .18em;
}
.toast.success::before {
  content: attr(data-title);
  display: block;
  margin-bottom: 8px;
  color: #bbf7d0;
  font-size: 13px;
  letter-spacing: .18em;
}
@keyframes urgent-pop {
  from { transform: translate(-50%, -48%) scale(.96); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@media (max-width: 1080px) {
  .sidebar { width: 220px; }
  .topbar, .page { margin-left: 220px; }
  .workspace-layout { grid-template-columns: 1fr; }
  .preview-column { position: static; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tool-panel { max-width: none; }
}
@media (max-width: 820px) {
  body {
    background:
      radial-gradient(circle at 50% 0%, rgba(124, 92, 255, .22), transparent 34%),
      #070b14;
  }
  .sidebar {
    position: static;
    width: auto;
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 14px;
  }
  .sidebar-brand { margin: 0 4px 14px; }
  .plan-card { display: none; }
  .side-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-label { display: none; }
  .nav-link {
    flex: 0 0 auto;
    width: auto;
    min-width: 104px;
    padding: 11px 13px;
    text-align: center;
    white-space: nowrap;
  }
  .topbar, .page { margin-left: 0; }
  .topbar {
    position: static;
    height: auto;
    padding: 12px 14px;
  }
  .search-box { display: none; }
  .top-actions {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }
  .points-pill { flex: 1; justify-content: space-between; }
  .chip { max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page {
    min-height: auto;
    padding: 14px;
  }
  .auth-grid { grid-template-columns: 1fr; gap: 35px; min-height: 0; }
  .workspace, .workspace-layout, .main-column { min-height: auto; }
  .workspace-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .preview-column {
    order: -1;
    position: static;
    margin-top: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .side-stat-card,
  .preview-column .side-note:nth-of-type(4) {
    display: none;
  }
  .account-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tool-head { flex-direction: column; }
  .tool-head select, .select-stack { min-width: 100%; width: 100%; }
}
@media (max-width: 580px) {
  .brand { font-size: 18px; }
  .brand-mark { width: 26px; height: 26px; }
  .page { padding: 12px; }
  .hero h1 { font-size: 34px; }
  .workspace-head {
    padding: 14px;
    grid-template-columns: 1fr;
    margin-bottom: 8px;
  }
  .workspace-head h1 { font-size: 28px; }
  .head-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .account-grid {
    grid-template-columns: 1fr;
  }
  .tool-panel { padding: 16px; }
  .chat-messages, .result {
    min-height: 46vh;
    height: auto;
  }
  .bubble { max-width: 92%; }
  .compose, .field-row { flex-direction: column; }
  .compose textarea { min-height: 92px; }
  .wallet-actions, .redemption-form, .recharge-row { flex-direction: column; align-items: stretch; }
  .qr-topup-button { width: 100%; }
  .compose .primary, .field-row .primary, .field-row select, .action-submit { max-width: none; width: 100%; }
  .side-options textarea { min-height: 110px; }
}
