*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  background: #121212;
  color: #e0e0e0;
}

#app {
  display: flex;
  flex-direction: row;
  height: 100%;
  min-height: 0;
}

.app-nav-sidebar {
  flex-shrink: 0;
  width: 72px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: #090909;
  border-right: 1px solid #242424;
}

.app-nav-brand {
  flex-shrink: 0;
  margin: 0;
  padding: 16px 0 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  border-radius: 0;
}

.app-nav-brand:focus-visible {
  outline: 2px solid #5a8ec0;
  outline-offset: -2px;
}

.app-nav-brand-icon {
  display: block;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

.app-nav-primary {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 6px 12px;
  overflow-y: auto;
  overflow-x: hidden;
}

.app-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 4px;
  margin: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #8c8c8c;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.2;
}

.app-nav-item:hover {
  color: #d0d0d0;
  background: rgba(255, 255, 255, 0.05);
}

.app-nav-item.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.app-nav-item:focus-visible {
  outline: 2px solid #5a8ec0;
  outline-offset: 1px;
}

.app-nav-icon {
  display: block;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.app-nav-label {
  font-size: 11px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.app-nav-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding: 10px 4px 14px;
  font-size: 9px;
  color: #3a3a3a;
  text-align: center;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  user-select: none;
}

.app-main-column {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  background: #121212;
}

.main-panel {
  flex: 1;
  display: none;
  flex-direction: column;
  min-height: 0;
}

.main-panel.is-active {
  display: flex;
}

.main-panel-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  background: #121212;
  color: #4a4a4a;
  font-size: 14px;
  letter-spacing: 0.06em;
}

.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: row;
}

.viewport-shell {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
}

.viewport-shell #viewport {
  flex: 1;
  width: 100%;
  display: block;
  cursor: grab;
}

.viewport-shell #viewport:active {
  cursor: grabbing;
}

.camera-preview-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  right: auto;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid #4a4a4a;
  border-radius: 8px;
  background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
  color: #d0d0d0;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.camera-preview-btn:hover {
  color: #fff;
  border-color: #6a8ec0;
  background: linear-gradient(180deg, #444 0%, #333 100%);
}

.camera-preview-btn:active {
  transform: scale(0.96);
}

.camera-preview-btn[aria-pressed="true"] {
  color: #8ec8ff;
  border-color: #5a8ab8;
  background: linear-gradient(180deg, #354558 0%, #2a3545 100%);
}

.camera-preview-icon {
  width: 22px;
  height: 22px;
}

.primitive-create-wrap {
  position: absolute;
  top: 10px;
  left: 56px;
  z-index: 20;
}

.viewport-help-btn {
  position: absolute;
  top: 10px;
  left: 102px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid #4a4a4a;
  border-radius: 8px;
  background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
  color: #d0d0d0;
  font-size: 18px;
  font-weight: 700;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.viewport-help-btn:hover {
  color: #fff;
  border-color: #6a8ec0;
  background: linear-gradient(180deg, #444 0%, #333 100%);
}

.viewport-help-btn:active {
  transform: scale(0.96);
}

.viewport-help-dialog {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.viewport-help-dialog.is-open {
  display: flex;
}

.viewport-help-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  cursor: pointer;
}

.viewport-help-panel {
  position: relative;
  z-index: 1;
  width: min(520px, 96vw);
  max-height: min(88vh, 720px);
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  border: 1px solid #444;
  background: linear-gradient(180deg, #2a2a30 0%, #1e1e24 100%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}

.viewport-help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid #3a3a42;
}

.viewport-help-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #e8e8ec;
  letter-spacing: 0.02em;
}

.viewport-help-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #aaa;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.viewport-help-close:hover {
  background: rgba(200, 68, 68, 0.25);
  color: #fff;
}

.viewport-help-body {
  overflow-y: auto;
  padding: 8px 16px 16px;
}

.viewport-help-section {
  margin-top: 12px;
}

.viewport-help-section:first-child {
  margin-top: 4px;
}

.viewport-help-section-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8ec8ff;
}

.viewport-help-list {
  margin: 0;
  padding-left: 1.15em;
  font-size: 13px;
  line-height: 1.55;
  color: #c8c8d0;
}

.viewport-help-list li {
  margin-bottom: 6px;
}

.viewport-help-list li:last-child {
  margin-bottom: 0;
}

.viewport-help-list kbd {
  display: inline-block;
  min-width: 1.25em;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid #555;
  background: #1a1a1e;
  color: #e0e0e8;
  font-size: 11px;
  font-family: inherit;
  text-align: center;
  box-shadow: 0 1px 0 #0a0a0c;
}

.primitive-create-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid #4a4a4a;
  border-radius: 8px;
  background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
  color: #d0d0d0;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.primitive-create-btn:hover {
  color: #fff;
  border-color: #6a8ec0;
  background: linear-gradient(180deg, #444 0%, #333 100%);
}

.primitive-create-btn:active {
  transform: scale(0.96);
}

.primitive-create-btn[aria-expanded="true"] {
  color: #8ec8ff;
  border-color: #5a8ab8;
  background: linear-gradient(180deg, #354558 0%, #2a3545 100%);
}

.primitive-create-icon {
  width: 22px;
  height: 22px;
}

.primitive-create-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 132px;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid #3a3a42;
  background: linear-gradient(180deg, #2a2a30 0%, #1e1e24 100%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.primitive-create-menu[hidden] {
  display: none;
}

.primitive-create-item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #d8d8e0;
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.primitive-create-item:hover {
  background: rgba(90, 140, 200, 0.22);
  color: #fff;
}

.camera-frame-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.camera-frame-overlay.is-visible {
  display: flex;
}

.camera-frame-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  pointer-events: none;
}

.camera-frame-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  pointer-events: none;
}

.camera-roll-control {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.camera-roll-hint {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: rgba(255, 224, 140, 0.85);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  user-select: none;
}

.camera-roll-track {
  position: relative;
  width: 12px;
  height: min(400px, 48vh);
  min-height: 160px;
  border-radius: 6px;
  background: rgba(18, 22, 30, 0.82);
  border: 1px solid rgba(255, 224, 140, 0.5);
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  touch-action: none;
}

.camera-roll-track::after {
  content: "";
  position: absolute;
  left: -5px;
  right: -5px;
  top: 50%;
  height: 2px;
  background: rgba(255, 224, 140, 0.45);
  transform: translateY(-50%);
  pointer-events: none;
}

.camera-roll-thumb {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: linear-gradient(180deg, #6a9fd4 0%, #3d6a9e 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -50%);
  cursor: grab;
  touch-action: none;
}

.camera-roll-thumb:hover {
  filter: brightness(1.08);
}

.camera-roll-thumb:active {
  cursor: grabbing;
}

.camera-shutter-btn {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: linear-gradient(180deg, #e85a4a 0%, #c73d32 100%);
  color: rgba(255, 255, 255, 0.95);
  cursor: pointer;
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.45),
    0 0 0 4px rgba(0, 0, 0, 0.25);
}

.camera-shutter-btn:hover {
  filter: brightness(1.08);
  transform: scale(1.04);
}

.camera-shutter-btn:active {
  transform: scale(0.96);
}

.camera-shutter-icon {
  width: 26px;
  height: 26px;
}

.assets-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #121212;
}

.assets-head {
  flex-shrink: 0;
  padding: 18px 22px 14px;
  border-bottom: 1px solid #333;
}

.assets-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
  color: #e8e8e8;
  letter-spacing: 0.04em;
}

.assets-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #888;
  max-width: 52em;
}

.cat-rig-panel {
  flex-shrink: 0;
  width: 200px;
  display: none;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, #242428 0%, #1a1a1e 100%);
  border-left: 1px solid #3a3a42;
}

.cat-rig-panel.is-open {
  display: flex;
}

.cat-rig-panel-head {
  flex-shrink: 0;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #c8b890;
  border-bottom: 1px solid #333;
}

.cat-rig-panel-hint {
  flex-shrink: 0;
  margin: 0;
  padding: 8px 12px 0;
  font-size: 10px;
  line-height: 1.45;
  color: #777;
}

.cat-rig-panel-locked {
  flex-shrink: 0;
  margin: 8px 12px 0;
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.45;
  color: #e8c080;
  background: rgba(200, 140, 60, 0.12);
  border: 1px solid rgba(200, 140, 60, 0.35);
  border-radius: 6px;
}

.cat-rig-panel-locked[hidden] {
  display: none;
}

.cat-rig-panel-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cat-rig-panel-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cat-rig-panel-label {
  font-size: 11px;
  color: #aaa;
}

.cat-rig-panel-stepper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cat-rig-panel-step {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #444;
  border-radius: 6px;
  background: #2e2e34;
  color: #ddd;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.cat-rig-panel-step:hover:not(:disabled) {
  border-color: #6a8ec0;
  color: #fff;
}

.cat-rig-panel-step:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cat-rig-panel-input {
  flex: 1;
  min-width: 0;
  height: 28px;
  padding: 0 6px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #1a1a1e;
  color: #eee;
  font-size: 13px;
  font-family: inherit;
  text-align: center;
}

.cat-rig-panel-input:disabled {
  opacity: 0.45;
}

.cat-rig-panel-foot {
  flex-shrink: 0;
  padding: 10px 12px 12px;
  border-top: 1px solid #333;
}

.cat-rig-pose-btn {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #6a8ec0;
  border-radius: 8px;
  background: linear-gradient(180deg, #3d4f68 0%, #2e3d52 100%);
  color: #e8f0ff;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.cat-rig-pose-btn:hover:not(:disabled) {
  border-color: #8ec8ff;
  background: linear-gradient(180deg, #4a6080 0%, #364a62 100%);
}

.cat-rig-pose-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: #444;
  background: #2a2a30;
  color: #888;
}

.photo-strip {
  flex-shrink: 0;
  width: 220px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, #222 0%, #181818 100%);
  border-left: 1px solid #3a3a3a;
}

.photo-strip-head {
  flex-shrink: 0;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #aaa;
  border-bottom: 1px solid #333;
}

.photo-strip .photo-strip-placeholder {
  flex-shrink: 0;
  margin: 0;
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.45;
  color: #666;
  text-align: left;
  border: none;
  border-radius: 0;
  background: transparent;
}

.assets-gallery {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.assets-section-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: #b8b8c0;
  letter-spacing: 0.04em;
}

.assets-gen-list .photo-strip-item {
  position: relative;
}

.assets-gen-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 4px 6px;
  font-size: 9px;
  line-height: 1.3;
  color: #ddd;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.assets-photo-placeholder {
  margin: 0 0 16px;
  padding: 24px 16px;
  font-size: 13px;
  line-height: 1.5;
  color: #666;
  text-align: center;
  border: 1px dashed #3a3a3a;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.photo-strip-placeholder[hidden],
.assets-photo-placeholder[hidden] {
  display: none;
}

.photo-strip .photo-strip-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.assets-gallery .photo-strip-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  align-content: start;
}

.photo-strip-item {
  position: relative;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid #3d3d3d;
  background: #0d0d0d;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  cursor: default;
}

.photo-strip-item:hover:not(.is-selected) {
  border-color: #4a5560;
}

.photo-strip-item.is-selected {
  border-color: #5a9fd4;
  box-shadow: 0 0 0 1px rgba(90, 159, 212, 0.45);
}

.photo-strip-zoom {
  position: absolute;
  left: 6px;
  bottom: 6px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  background: rgba(20, 20, 20, 0.82);
  color: #e8e8e8;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.photo-strip-zoom:hover {
  background: rgba(50, 70, 95, 0.92);
  border-color: rgba(120, 170, 220, 0.6);
  color: #fff;
}

.photo-strip-zoom:active {
  transform: scale(0.95);
}

.photo-strip-zoom svg {
  display: block;
  width: 17px;
  height: 17px;
}

.photo-strip-item img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
  pointer-events: none;
}

.photo-strip-storyboard {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  margin: 0;
  padding: 6px 8px;
  border: none;
  border-radius: 0;
  background: linear-gradient(180deg, rgba(18, 20, 24, 0.95) 0%, rgba(18, 20, 24, 0.65) 100%);
  color: #dbe7f5;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.04em;
  cursor: pointer;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.photo-strip-storyboard:hover {
  color: #fff;
  background: linear-gradient(180deg, rgba(45, 70, 100, 0.95) 0%, rgba(30, 40, 55, 0.75) 100%);
}

.photo-strip-storyboard:active {
  filter: brightness(1.05);
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.photo-lightbox.is-open {
  display: flex;
}

.photo-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  cursor: pointer;
}

.photo-lightbox-panel {
  position: relative;
  z-index: 1;
  max-width: min(96vw, 1400px);
  max-height: min(92vh, 900px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-lightbox-img {
  display: block;
  max-width: min(96vw, 1400px);
  max-height: min(88vh, 860px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.55);
}

.photo-lightbox-close {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 2;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(40, 40, 40, 0.95);
  color: #eee;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.photo-lightbox-close:hover {
  background: #c44;
  color: #fff;
}

.camera-frame-inner {
  position: relative;
  /* 原约 min(72vw, 640px)，整体约 1.5 倍边长 */
  width: min(960px, 108vw, calc(100vw - 24px));
  aspect-ratio: 16 / 9;
  border: 2px solid rgba(232, 192, 64, 0.95);
  border-radius: 2px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5) inset,
    0 0 0 9999px rgba(0, 0, 0, 0.42);
}

.camera-frame-label {
  position: absolute;
  top: -22px;
  left: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 224, 140, 0.95);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.camera-frame-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: rgba(255, 224, 130, 0.95);
  border-style: solid;
  pointer-events: none;
}

.camera-frame-corner.nw {
  top: -3px;
  left: -3px;
  border-width: 3px 0 0 3px;
}
.camera-frame-corner.ne {
  top: -3px;
  right: -3px;
  border-width: 3px 3px 0 0;
}
.camera-frame-corner.sw {
  bottom: -3px;
  left: -3px;
  border-width: 0 0 3px 3px;
}
.camera-frame-corner.se {
  bottom: -3px;
  right: -3px;
  border-width: 0 3px 3px 0;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 8px 14px;
  background: linear-gradient(180deg, #2a2a2a 0%, #1f1f1f 100%);
  border-bottom: 1px solid #3d3d3d;
  font-size: 13px;
}

.toolbar-title {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.toolbar-hint {
  color: #888;
  font-size: 12px;
  flex: 1;
  margin: 0 12px;
  min-width: 0;
}

/* —— 图片生成（Seedream）—— */
.gen-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 20px 24px 28px;
  overflow: hidden;
}

.gen-inline-code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  color: #9ec8e8;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
}

.gen-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
  gap: 16px;
  align-items: stretch;
}

.gen-composer-col {
  flex: 2 2 0;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.gen-shell-head {
  flex-shrink: 0;
  margin-bottom: 16px;
}

.gen-shell-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.gen-shell-head-row .gen-shell-title {
  margin: 0;
}

.gen-auth-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.gen-auth-user {
  font-size: 12px;
  color: #9a9aa4;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gen-auth-btn {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid #3d4d60;
  background: #252a34;
  color: #9ee0f0;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

.gen-auth-btn:hover {
  border-color: #4a6080;
  color: #fff;
}

.gen-auth-btn-ghost {
  background: transparent;
  border-color: #3a3a44;
  color: #a0a0a8;
}

.gen-shell-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #ececf0;
}

.gen-shell-sub {
  margin: 0;
  font-size: 12px;
  color: #6a6a72;
  line-height: 1.5;
}

.gen-doc-link {
  color: #7ab8e8;
  text-decoration: none;
}

.gen-doc-link:hover {
  text-decoration: underline;
}

.gen-composer {
  width: 100%;
  background: #18181c;
  border: 1px solid #2a2a32;
  border-radius: 12px;
  padding: 14px 14px 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.gen-composer-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.gen-ref-file {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.gen-ref-list {
  --gen-ref-size: 108px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
}

.gen-ref-card {
  position: relative;
  flex-shrink: 0;
  width: var(--gen-ref-size);
  height: var(--gen-ref-size);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #3a3a44;
  background: #121216;
}

.gen-ref-card-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gen-ref-card-badge {
  position: absolute;
  left: 4px;
  bottom: 4px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.72);
  letter-spacing: 0.02em;
}

.gen-ref-card-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.72);
  color: #eee;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.gen-ref-card-remove:hover {
  background: #a33;
}

.gen-ref-add {
  flex-shrink: 0;
  width: var(--gen-ref-size);
  height: var(--gen-ref-size);
  margin: 0;
  padding: 0;
  border-radius: 10px;
  border: 1px dashed #3a3a44;
  background: #121216;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6e6e78;
}

.gen-ref-add:hover {
  color: #a8c8e8;
  border-color: #5a6a80;
  background: rgba(255, 255, 255, 0.03);
}

.gen-ref-plus {
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
}

.gen-prompt-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.gen-prompt {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 100px;
  resize: vertical;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #2e2e36;
  background: #121216;
  color: #e8e8ec;
  font-size: 13px;
  line-height: 1.55;
  font-family: inherit;
}

.gen-at-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  z-index: 30;
  min-width: 168px;
  max-width: min(280px, 100%);
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid #3a3a48;
  background: #1e1e28;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
}

.gen-at-menu-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #e0e0e8;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.gen-at-menu-item:hover {
  background: rgba(90, 140, 200, 0.18);
}

.gen-at-menu-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid #444;
}

.gen-at-menu-label {
  font-weight: 600;
  color: #9ee0f0;
}

.gen-chip-at:not(:disabled) {
  cursor: pointer;
  color: #b8d8f0;
}

.gen-chip-at:not(:disabled):hover {
  border-color: #4a6a90;
  background: rgba(90, 140, 200, 0.12);
}

.gen-chip-at:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.gen-prompt::placeholder {
  color: #5c5c68;
}

.gen-prompt:focus {
  outline: none;
  border-color: #4a6a90;
  box-shadow: 0 0 0 1px rgba(74, 106, 144, 0.35);
}

.gen-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #25252c;
}

.gen-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #33333c;
  background: #1e1e26;
  color: #c4c4ce;
  font-size: 12px;
  font-family: inherit;
  cursor: default;
  white-space: nowrap;
}

.gen-chip-wide {
  color: #9ee0f0;
}

.gen-model-wrap {
  position: relative;
}

.gen-chip-select {
  cursor: pointer;
}

.gen-chip-select:hover {
  border-color: #454550;
  color: #eaeaf0;
}

.gen-chip-select[aria-expanded="true"] {
  border-color: #3d4d60;
  background: #252a34;
  color: #9ee0f0;
}

.gen-model-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  min-width: 168px;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid #33333c;
  background: linear-gradient(180deg, #2a2a32 0%, #1e1e26 100%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.gen-model-menu[hidden] {
  display: none;
}

.gen-model-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  margin: 0;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #d8d8e0;
  font-size: 12px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.gen-model-item-name {
  font-size: 12px;
  line-height: 1.3;
  color: inherit;
}

.gen-model-item-provider {
  font-size: 10px;
  line-height: 1.2;
  color: #8a8a96;
}

.gen-model-item:hover .gen-model-item-provider,
.gen-model-item.is-active .gen-model-item-provider {
  color: #9ab0c8;
}

.gen-model-item.is-locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.gen-model-item.is-locked:hover {
  background: transparent;
  color: #d8d8e0;
}

.gen-model-item.is-locked .gen-model-item-provider {
  color: #a07060;
}

.gen-model-item:hover {
  background: rgba(90, 140, 200, 0.22);
  color: #fff;
}

.gen-model-item.is-active {
  background: rgba(62, 120, 180, 0.28);
  color: #9ee0f0;
}

.gen-chip-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.gen-chevron {
  margin-left: 2px;
  font-size: 10px;
  opacity: 0.75;
}

.gen-chip-toggle {
  cursor: pointer;
}

.gen-chip-toggle:hover {
  border-color: #454550;
  color: #eaeaf0;
}

.gen-chip-toggle.is-on {
  border-color: #3d4d60;
  background: #252a34;
}

.gen-chip-icon-only {
  min-width: 34px;
  justify-content: center;
  padding-left: 8px;
  padding-right: 8px;
}

.gen-mono {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
}

.gen-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 2px;
  border-radius: 50%;
  background: #4a9fff;
  vertical-align: super;
}

.gen-ratio-icon {
  font-size: 11px;
  opacity: 0.85;
}

.gen-toolbar-spacer {
  flex: 1;
  min-width: 8px;
}

.gen-cost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #8a8a96;
}

.gen-cost-spark {
  color: #7ec8ff;
  flex-shrink: 0;
}

.gen-submit {
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #2c323c;
  color: #9a9aa4;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    background 0.15s,
    color 0.15s;
}

.gen-submit:not(:disabled):hover {
  background: #3d4a5c;
  color: #fff;
}

.gen-submit:not(:disabled):active {
  transform: scale(0.96);
}

.gen-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.gen-status {
  margin: 10px 0 0;
  font-size: 12px;
  color: #7a8a9a;
  min-height: 1.2em;
}

.gen-status.gen-status-error {
  color: #e88;
}

.gen-history {
  flex: 3 3 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #141418;
  border: 1px solid #2a2a32;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.gen-history-head {
  flex-shrink: 0;
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9a9aa8;
  border-bottom: 1px solid #25252c;
  background: linear-gradient(180deg, #1a1a22 0%, #16161c 100%);
}

.gen-history-feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gen-history-empty {
  margin: 0;
  padding: 24px 8px;
  text-align: center;
  font-size: 12px;
  color: #555;
  line-height: 1.6;
}

.gen-history-empty[hidden] {
  display: none;
}

.gen-history-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: genHistoryIn 0.28s ease-out;
}

@keyframes genHistoryIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gen-history-prompt {
  align-self: flex-end;
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px 12px 4px 12px;
  background: linear-gradient(180deg, #2a3548 0%, #232a38 100%);
  border: 1px solid #3a4558;
  color: #e8ecf2;
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}

.gen-history-body {
  align-self: flex-start;
  max-width: 100%;
}

.gen-history-pending {
  padding: 16px 20px;
  border-radius: 10px;
  background: #1e1e26;
  border: 1px dashed #3a3a48;
  color: #7a8a9a;
  font-size: 12px;
}

.gen-history-item.is-pending .gen-history-pending {
  animation: genPulse 1.2s ease-in-out infinite;
}

@keyframes genPulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

.gen-history-image-wrap {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #333;
  background: #0d0d10;
  cursor: pointer;
}

.gen-history-image-wrap:hover {
  border-color: #5a7a98;
  box-shadow: 0 0 0 1px rgba(90, 122, 152, 0.35);
}

.gen-history-image {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: min(480px, 52vh);
  object-fit: contain;
  pointer-events: none;
}

.gen-image-viewer {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.gen-image-viewer.is-open {
  display: flex;
}

.gen-image-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  cursor: pointer;
}

.gen-image-viewer-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(96vw, 1100px);
  max-height: min(94vh, 900px);
  background: #18181c;
  border: 1px solid #333;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}

.gen-image-viewer-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #2a2a32;
  background: linear-gradient(180deg, #222228 0%, #1a1a20 100%);
}

.gen-image-viewer-title {
  font-size: 13px;
  font-weight: 600;
  color: #ccc;
  letter-spacing: 0.04em;
}

.gen-image-viewer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.gen-viewer-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #444;
  background: #2a2a32;
  color: #ddd;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

.gen-viewer-btn:hover {
  border-color: #6a8ab0;
  color: #fff;
}

.gen-viewer-btn-primary {
  border-color: #4a6a90;
  background: #2a3548;
  color: #b8dcf8;
}

.gen-image-viewer-close {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #aaa;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.gen-image-viewer-close:hover {
  background: rgba(200, 60, 60, 0.25);
  color: #fff;
}

.gen-image-viewer-main {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #0e0e12;
}

.gen-image-viewer-img {
  display: block;
  max-width: 100%;
  max-height: min(62vh, 640px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
}

.gen-image-viewer-foot {
  flex-shrink: 0;
  padding: 12px 14px;
  border-top: 1px solid #2a2a32;
  background: #141418;
}

.gen-viewer-thumbs {
  display: flex;
  flex-direction: row;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  align-items: center;
}

.gen-viewer-thumb {
  position: relative;
  flex-shrink: 0;
  width: 88px;
  height: 88px;
  padding: 0;
  border: 2px solid #3a3a44;
  border-radius: 10px;
  overflow: hidden;
  background: #0d0d10;
  cursor: pointer;
}

.gen-viewer-thumb.is-active {
  border-color: #5a9fd4;
  box-shadow: 0 0 0 1px rgba(90, 159, 212, 0.45);
}

.gen-viewer-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.gen-viewer-thumb-load {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7a8a9a;
  font-size: 11px;
  text-align: center;
  line-height: 1.3;
  background: #121216;
  border-style: dashed;
}

.gen-viewer-thumb-load:hover {
  color: #b8dcf8;
  border-color: #5a7a98;
}

.gen-history-error {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(180, 60, 60, 0.15);
  border: 1px solid rgba(200, 80, 80, 0.35);
  color: #eaa;
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}

.gen-history-time {
  font-size: 10px;
  color: #555;
  align-self: flex-end;
}

@media (max-width: 900px) {
  .gen-layout {
    flex-direction: column;
  }

  .gen-composer-col,
  .gen-history {
    flex: none;
  }

  .gen-history {
    max-height: 48vh;
  }
}

/* ---------- 账号登录弹窗 ---------- */
.auth-dialog {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.auth-dialog.is-open {
  pointer-events: auto;
  opacity: 1;
}

.auth-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.auth-dialog-panel {
  position: relative;
  width: min(400px, calc(100vw - 32px));
  padding: 20px 22px 22px;
  border-radius: 12px;
  border: 1px solid #33333c;
  background: linear-gradient(180deg, #2a2a32 0%, #1e1e26 100%);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.auth-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.auth-dialog-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #ececf0;
}

.auth-dialog-close {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #888;
  font-size: 20px;
  cursor: pointer;
}

.auth-dialog-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}

.auth-tab {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #888;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.auth-tab.is-active {
  background: rgba(62, 120, 180, 0.28);
  color: #9ee0f0;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #9a9aa4;
}

.auth-field input {
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid #3a3a44;
  background: #121216;
  color: #e8e8ec;
  font-size: 14px;
  font-family: inherit;
}

.auth-form-error {
  margin: 0;
  font-size: 12px;
  color: #e88;
}

.auth-submit {
  margin-top: 4px;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #3a6a9a, #2a5080);
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}

.auth-submit:hover {
  filter: brightness(1.08);
}

.auth-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

