:root {
  --bg: #07090f;
  --panel: rgba(14, 19, 29, 0.9);
  --panel-border: rgba(130, 180, 255, 0.18);
  --text-main: #f4f7ff;
  --text-muted: #9aa8c7;
  --accent: #74a0ff;
  --accent-2: #72e2c3;
  --danger: #ff7e8f;
  --shadow: 0 28px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at 0% 0%, rgba(116, 160, 255, 0.24), transparent 24%),
    radial-gradient(circle at 100% 0%, rgba(114, 226, 195, 0.18), transparent 20%),
    linear-gradient(180deg, #070a10 0%, #0b111a 100%);
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 44px;
}

.hero {
  margin-bottom: 24px;
}

.hero-tag {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.26em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 42px);
}

.hero-desc {
  margin: 12px 0 0;
  max-width: 760px;
  line-height: 1.8;
  color: var(--text-muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  padding: 22px;
}

.toolbar,
.mode-area,
.editor-block,
.action-area {
  margin-bottom: 20px;
}

.toolbar,
.output-title-row,
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toolbar-label,
.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text-muted);
}

.field-hint {
  color: #8191b3;
  font-size: 13px;
}

.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.section-heading-row.compact {
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 0;
}

.select-field,
.text-panel,
.text-input,
.primary-btn,
.ghost-btn {
  border-radius: 14px;
  border: 1px solid transparent;
  font: inherit;
}

.select-field,
.text-panel,
.text-input {
  width: 100%;
  background: rgba(7, 11, 18, 0.86);
  color: var(--text-main);
  border-color: rgba(130, 180, 255, 0.18);
}

.select-field,
.text-input {
  min-height: 50px;
  padding: 0 14px;
  font-size: 15px;
}

.text-panel {
  min-height: 220px;
  resize: vertical;
  padding: 16px;
  font-size: 18px;
  line-height: 1.8;
}

.output-panel {
  min-height: 260px;
}

.mode-cards {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mode-card {
  border: 1px solid rgba(130, 180, 255, 0.16);
  background: rgba(10, 14, 22, 0.82);
  border-radius: 14px;
  padding: 14px;
}

.mode-card.is-active {
  border-color: rgba(116, 160, 255, 0.65);
  box-shadow: inset 0 0 0 1px rgba(116, 160, 255, 0.2);
}

.mode-card-tag {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--accent);
}

.mode-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.mode-card p,
.mode-panel-desc {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.7;
}

.mode-panels {
  margin-top: 12px;
}

.mode-panel {
  border: 1px solid rgba(114, 226, 195, 0.2);
  background: rgba(8, 13, 20, 0.8);
  border-radius: 14px;
  padding: 12px;
}

.info-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.info-chip {
  border: 1px solid rgba(114, 226, 195, 0.28);
  color: #9bead2;
  background: rgba(114, 226, 195, 0.08);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.primary-btn,
.ghost-btn {
  cursor: pointer;
  transition: 0.18s ease;
}

.primary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  min-width: 220px;
  min-height: 58px;
  padding: 0 26px;
  background: linear-gradient(135deg, var(--accent) 0%, #8a88ff 55%, #6fe3c5 100%);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
}

.ghost-btn {
  min-height: 42px;
  padding: 0 14px;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.action-area {
  display: flex;
  justify-content: center;
}

.error-message {
  margin: 14px 0 0;
  color: var(--danger);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 6, 11, 0.72);
}

.modal[hidden] {
  display: none !important;
}

.modal-card {
  width: min(860px, 100%);
  background: #101623;
  border: 1px solid rgba(130, 180, 255, 0.2);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.modal-tag {
  margin: 0;
  color: var(--accent-2);
  letter-spacing: 0.18em;
  font-size: 11px;
}

.modal-header h2 {
  margin: 4px 0 0;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.settings-section {
  background: rgba(8, 12, 19, 0.76);
  border: 1px solid rgba(130, 180, 255, 0.14);
  border-radius: 14px;
  padding: 14px;
}

.settings-section h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.settings-note {
  margin-top: 14px;
  border-left: 3px solid var(--accent);
  background: rgba(116, 160, 255, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
  color: #c5d2f1;
  line-height: 1.7;
}

.settings-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.settings-save-btn {
  min-width: 140px;
  min-height: 46px;
  font-size: 16px;
}

.settings-test-btn {
  min-height: 42px;
  font-size: 14px;
}

.settings-status {
  margin: 0;
  color: #9bead2;
  font-size: 14px;
}

.connection-status {
  margin: 0;
  color: #c5d2f1;
  font-size: 14px;
}

.connection-status.success {
  color: #9bead2;
}

.connection-status.error {
  color: #ff9aa6;
}

.export-key-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 200, 130, 0.28);
  border-radius: 10px;
  background: rgba(255, 200, 130, 0.08);
  color: #ffdca8;
  font-size: 13px;
}

.export-key-toggle input {
  accent-color: #ffb454;
}

/* =========================
   V2 新增样式（仅追加）
   ========================= */

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

.output-actions {
  display: flex;
  gap: 8px;
}

.help-card {
  max-height: min(80vh, 780px);
  overflow: auto;
}

.help-content ol {
  margin: 0;
  padding-left: 18px;
  line-height: 1.8;
  color: var(--text-muted);
}

.help-content pre {
  margin: 8px 0;
  padding: 10px;
  border-radius: 10px;
  background: rgba(6, 10, 16, 0.8);
  border: 1px solid rgba(130, 180, 255, 0.16);
  color: #d8e4ff;
  overflow-x: auto;
}

.help-content code {
  color: #9bead2;
}

.auth-card {
  max-width: 560px;
}

.auth-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.auth-tabs .ghost-btn.is-active,
.library-tabs .ghost-btn.is-active {
  border-color: rgba(116, 160, 255, 0.6);
  box-shadow: inset 0 0 0 1px rgba(116, 160, 255, 0.2);
}

.auth-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.library-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(460px, 100%);
  height: 100vh;
  background: #0f1522;
  border-left: 1px solid rgba(130, 180, 255, 0.2);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.35);
  z-index: 1000;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.library-drawer[hidden] {
  display: none !important;
}

.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.library-header h2 {
  margin: 0;
  font-size: 20px;
}

.library-tabs {
  display: flex;
  gap: 8px;
}

.library-list {
  flex: 1;
  overflow: auto;
  border: 1px solid rgba(130, 180, 255, 0.14);
  border-radius: 12px;
  padding: 10px;
  background: rgba(8, 12, 19, 0.72);
}

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

.library-item {
  border: 1px solid rgba(130, 180, 255, 0.14);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  background: rgba(9, 14, 22, 0.88);
}

.library-item-meta {
  color: #9fb0d8;
  font-size: 12px;
  margin-bottom: 6px;
}

.library-item-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

@media (max-width: 860px) {
  .mode-cards,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-actions {
    flex-direction: column;
    align-items: flex-start;
  }
}

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

  .panel {
    padding: 14px;
  }

  .text-panel {
    min-height: 180px;
    font-size: 16px;
  }

  .primary-btn {
    width: 100%;
  }

  .toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .output-title-row {
    flex-direction: column;
    align-items: flex-start;
  }
}
