:root {
  --bg: #08090c;
  --bg-soft: #0d1016;
  --surface: #121722;
  --surface-raised: #171d2a;
  --surface-muted: #0f131b;
  --ink: #f4f7fb;
  --muted: #98a2b3;
  --line: #273142;
  --line-strong: #354258;
  --accent: #20c7a7;
  --accent-strong: #12a88c;
  --accent-soft: rgba(32, 199, 167, 0.14);
  --gold: #d6a94a;
  --danger: #e35b4f;
  --danger-soft: rgba(227, 91, 79, 0.13);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(32, 199, 167, 0.12), transparent 30%),
    linear-gradient(180deg, #0b0e13 0%, var(--bg) 42%, #07080b 100%);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

.site-announcement {
  overflow: hidden;
  max-height: 64px;
  opacity: 1;
  transform: translateY(0);
  transition:
    max-height 0.52s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.52s cubic-bezier(0.22, 1, 0.36, 1);
}

.site-announcement.closing {
  max-height: 0;
  opacity: 0;
  transform: translateY(-12px);
}

.site-announcement-inner {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 48px;
  background-color: #1197f5;
  background-position: center;
  background-size: cover;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  position: relative;
  text-align: center;
}

.site-announcement-label {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 4px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.15);
  font-size: 12px;
}

.site-announcement-link {
  color: inherit;
  text-decoration: none;
}

.site-announcement-link:hover {
  text-decoration: underline;
}

.site-announcement-close {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: transparent;
  color: inherit;
  font-size: 24px;
  line-height: 30px;
  opacity: 0.76;
}

.site-announcement-close:hover {
  background: rgba(255, 255, 255, 0.16);
  opacity: 1;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.app-shell {
  width: min(1480px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.topbar {
  position: relative;
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 20px;
  overflow: hidden;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(8, 9, 12, 0.92) 0%, rgba(8, 9, 12, 0.72) 48%, rgba(8, 9, 12, 0.32) 100%),
    url("bannerShine.jpg") center / cover no-repeat;
  box-shadow: var(--shadow);
}

.topbar-content {
  position: relative;
  z-index: 1;
}

.topbar .view-tabs {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.15;
  font-weight: 800;
}

h2 {
  font-size: 18px;
  line-height: 1.35;
}

.panel-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.view-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: rgba(15, 19, 27, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sub-tabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px;
  background: rgba(9, 12, 18, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tab-button,
.sub-tab-button,
.primary-button,
.ghost-button,
.danger-button,
.preset-button,
.small-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 14px;
  background: var(--surface-muted);
  color: var(--ink);
  white-space: nowrap;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.tab-button:hover,
.sub-tab-button:hover,
.ghost-button:hover,
.preset-button:hover,
.small-button:hover {
  border-color: var(--line-strong);
  background: #1a2130;
}

.tab-button.active,
.sub-tab-button.active,
.primary-button {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #031411;
  font-weight: 700;
}

.primary-button:hover {
  background: linear-gradient(180deg, #2ae0bd 0%, var(--accent-strong) 100%);
  transform: translateY(-1px);
}

.ghost-button {
  border-color: var(--line);
}

.danger-button {
  color: #fff;
  background: #9f352f;
  border-color: rgba(227, 91, 79, 0.42);
}

.danger-button:hover {
  background: var(--danger);
}

.mode-panel {
  display: none;
}

.mode-panel.active {
  display: block;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.editor-grid,
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(380px, 0.82fr);
  gap: 16px;
}

.panel {
  background: linear-gradient(180deg, rgba(23, 29, 42, 0.96), rgba(18, 23, 34, 0.96));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.toolbar,
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.custom-form .settings-actions {
  margin-top: 18px;
}

.field-label {
  display: block;
  margin: 14px 0 7px;
  color: #b7c0ce;
  font-size: 13px;
  font-weight: 700;
}

.prompt-textarea,
.notes-textarea,
.text-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #090c12;
  color: var(--ink);
  outline: none;
}

.prompt-textarea::placeholder,
.notes-textarea::placeholder,
.text-input::placeholder {
  color: #5f6b7c;
}

.prompt-textarea,
.notes-textarea {
  resize: vertical;
  padding: 13px;
  line-height: 1.75;
}

.prompt-textarea {
  min-height: 214px;
}

.prompt-textarea.large {
  min-height: 310px;
}

.prompt-textarea.compact {
  min-height: 132px;
}

.notes-textarea {
  min-height: 92px;
}

.prompt-edit-box,
#generalPromptEditor {
  min-height: 250px;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 13px;
  line-height: 1.6;
}

.shot-common-prompt {
  min-height: 156px;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 4px;
}

.text-input {
  min-height: 42px;
  padding: 0 12px;
}

.prompt-textarea:focus,
.notes-textarea:focus,
.text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.json-output {
  min-height: 532px;
  height: 532px;
  max-height: 690px;
  margin: 0;
  overflow: auto;
  resize: vertical;
  padding: 15px;
  border: 1px solid #1d2635;
  border-radius: 7px;
  background: #070a0f;
  color: #d9f8ef;
  line-height: 1.58;
  font-size: 13px;
  white-space: pre-wrap;
}

.presets-panel {
  margin-top: 16px;
}

.preset-groups {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.preset-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: rgba(9, 12, 18, 0.68);
}

.preset-group h3 {
  margin: 0 0 10px;
  color: #dfe6f0;
  font-size: 15px;
}

.button-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-button {
  min-height: 34px;
  border-color: #2a3446;
  background: #111722;
  color: #d6deeb;
  font-size: 13px;
}

.preset-button:hover {
  border-color: rgba(32, 199, 167, 0.56);
  background: #172337;
  color: #fff;
}

.preset-button.negative {
  border-color: rgba(227, 91, 79, 0.34);
  color: #ffb7b0;
  background: var(--danger-soft);
}

.preset-button.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #f4fffb;
}

.preset-tooltip {
  position: fixed;
  z-index: 9999;
  display: none;
  max-width: min(420px, calc(100vw - 28px));
  padding: 10px 12px;
  border: 1px solid rgba(32, 199, 167, 0.42);
  border-radius: 8px;
  background: rgba(7, 10, 15, 0.96);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.46);
  color: #eafaf5;
  font-size: 13px;
  line-height: 1.6;
  pointer-events: none;
  white-space: pre-wrap;
}

.preset-tooltip.visible {
  display: block;
}

.status-message {
  min-height: 22px;
  margin-top: 10px;
  color: var(--accent);
  font-size: 13px;
}

.shot-base-grid,
.shot-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.shot-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 10px;
}

.shots-list {
  display: grid;
  gap: 12px;
}

.shot-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: rgba(9, 12, 18, 0.68);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.shot-card.dragging {
  border-color: rgba(32, 199, 167, 0.72);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.26);
  opacity: 0.62;
}

.shots-list.is-dragging .shot-card:not(.dragging) {
  border-color: rgba(255, 255, 255, 0.14);
}

.shot-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.shot-title-group {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.shot-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  cursor: grab;
  font-size: 16px;
  line-height: 1;
}

.shot-drag-handle:hover {
  border-color: rgba(32, 199, 167, 0.48);
  color: #eafaf5;
  background: rgba(32, 199, 167, 0.12);
}

.shot-drag-handle:active {
  cursor: grabbing;
}

.shot-card h3,
.shot-toolbar h3 {
  color: #eef3fa;
  font-size: 15px;
}

.shot-card h3 span {
  margin-left: 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
}

.custom-form {
  display: block;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0;
  color: var(--muted);
  font-size: 14px;
}

.checkbox-line input {
  accent-color: var(--accent);
}

.preset-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.saved-presets-panel {
  margin-top: 16px;
}

.preset-search-row {
  display: grid;
  grid-template-columns: minmax(220px, 420px) auto;
  align-items: end;
  gap: 10px;
  margin: -2px 0 14px;
}

.preset-search-row .field-label {
  grid-column: 1 / -1;
  margin-top: 0;
}

.preset-search-count {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  padding-bottom: 11px;
}

.empty-search-result {
  grid-column: 1 / -1;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  background: rgba(9, 12, 18, 0.44);
}

.category-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.category-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(9, 12, 18, 0.68);
}

.category-item strong,
.category-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-item strong {
  color: #eef3fa;
  font-size: 13px;
}

.category-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.category-item .small-actions {
  gap: 5px;
  margin-top: 8px;
}

.category-item .small-button {
  min-height: 28px;
  flex: 1;
  padding: 0 6px;
}

.compact-list {
  grid-template-columns: 1fr;
  margin-top: 14px;
}

.preset-list-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(9, 12, 18, 0.68);
}

.preset-list-item h3 {
  margin: 0 0 6px;
  color: #eef3fa;
  font-size: 15px;
}

.preset-list-item p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.preset-meta {
  margin-top: 8px;
  color: var(--gold);
  font-size: 12px;
}

.small-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.small-button {
  min-height: 30px;
  padding: 0 10px;
  border-color: var(--line);
  font-size: 12px;
}

.empty-text {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1100px) {
  .editor-grid,
  .settings-grid,
  .preset-groups,
  .preset-list {
    grid-template-columns: 1fr 1fr;
  }

  .category-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 18px, 720px);
    padding-top: 14px;
  }

  .topbar,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .view-tabs,
  .sub-tabs,
  .toolbar,
  .settings-actions {
    width: 100%;
  }

  .tab-button,
  .sub-tab-button,
  .primary-button,
  .ghost-button,
  .danger-button {
    flex: 1;
  }

  .editor-grid,
  .settings-grid,
  .preset-groups,
  .preset-list,
  .preset-search-row,
  .category-list,
  .shot-base-grid,
  .shot-fields {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 24px;
  }
}
