body {
  background: #09090b;
  color: #f4f4f5;
  font-family: system-ui, -apple-system, sans-serif;
  margin: 0;
  padding: 40px 20px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
}

/* 并排容器 */
.app-wrapper {
  display: flex;
  flex-direction: row;
  gap: 30px;
  flex-wrap: wrap; /* 屏幕窄时自动换行 */
  justify-content: center;
  align-items: stretch;
  max-width: 1960px;
  width: 100%;
}

.container {
  flex: 1; /* 平分宽度 */
  min-width: 330px; /* 支持四列布局，仍保持可读性 */
  max-width: 460px;
  background: #18181b;
  padding: 30px;
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  border: 1px solid #27272a;
  display: flex;
  flex-direction: column;
}

.title {
  text-align: center;
  margin-top: 0;
  margin-bottom: 25px;
  background: linear-gradient(to right, #6366f1, #a855f7, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 26px;
  font-weight: 800;
}

/* 编辑器特有样式 */
.editor-header {
  margin-bottom: 15px;
}

.save-btn {
  background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%) !important;
  box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3) !important;
}

textarea {
  width: 100%;
  background: #27272a;
  border: 1px solid #3f3f46;
  border-radius: 12px;
  color: #fff;
  padding: 15px;
  box-sizing: border-box;
  font-size: 14px;
  outline: none;
  resize: none; /* 禁用手动拉伸以保持卡片整齐 */
  line-height: 1.6;
}

.select-input,
.number-input {
  width: 100%;
  background: #27272a;
  border: 1px solid #3f3f46;
  border-radius: 12px;
  color: #fff;
  padding: 12px 14px;
  box-sizing: border-box;
  font-size: 14px;
  outline: none;
}

.text-input {
  width: 100%;
  background: #27272a;
  border: 1px solid #3f3f46;
  border-radius: 12px;
  color: #fff;
  padding: 11px 14px;
  box-sizing: border-box;
  font-size: 14px;
  outline: none;
}

textarea:focus { border-color: #6366f1; }
.select-input:focus,
.number-input:focus,
.text-input:focus { border-color: #6366f1; }

.input-group { margin-bottom: 15px; }
label { display: block; margin-bottom: 8px; font-size: 13px; color: #a1a1aa; font-weight: 500; }

.options-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  background: #27272a;
  padding: 15px;
  border-radius: 12px;
}

.checkbox-item { display: flex; align-items: center; font-size: 12px; color: #d4d4d8; cursor: pointer; }
.checkbox-item input { margin-right: 6px; accent-color: #6366f1; }
.inline-input {
  width: 45px !important;
  padding: 4px !important;
  margin-left: 6px;
  text-align: center;
  background: #1a1a1f;
  border: 1px solid #3f3f46;
  color: #fff;
  border-radius: 8px;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:active { transform: scale(0.98); }

.result-header { display: flex; justify-content: space-between; align-items: center; margin-top: 25px; margin-bottom: 8px; }
.btn-secondary { padding: 6px 16px; border: none; border-radius: 8px; background: #3f3f46; color: #fff; font-size: 12px; cursor: pointer; }
.btn-danger { background: #7f1d1d; }

#result {
  background: #0c0c0e;
  color: #10b981;
  border: 1px solid #27272a;
  font-family: 'Fira Code', monospace;
  min-height: 430px;
  max-height: 900px;
  flex: 1;
}

#notepad {
  background: #111113;
  border-style: dashed;
  min-height: 430px;
  max-height: 900px;
  flex: 1;
}

.editor-content-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

.suffix-select-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.suffix-select-row .select-input {
  flex: 1;
}

.suffix-manager-panel {
  margin-top: 10px;
  background: #111113;
  border: 1px dashed #3f3f46;
  border-radius: 12px;
  padding: 10px;
}

.suffix-edit-row {
  display: flex;
  gap: 8px;
}

.suffix-edit-row .text-input {
  flex: 1;
}

.suffix-tip {
  margin-top: 8px;
  font-size: 12px;
  color: #71717a;
}

.shuffle-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.shuffle-toolbar .btn-secondary {
  flex: 1;
}

.suffix-list-row {
  margin-top: 8px;
}

.shuffle-block-list {
  background: #101012;
  border: 1px dashed #3f3f46;
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 8px;
  min-height: 300px;
  max-height: 520px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shuffle-block {
  border: 1px solid #2f2f38;
  border-radius: 10px;
  background: #212127;
  padding: 8px;
}

.shuffle-block-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.shuffle-block-name {
  font-weight: 700;
}

.shuffle-block-text {
  background: #2a2a32;
  border: 1px solid #3f3f46;
  margin-bottom: 8px;
  min-height: 96px;
}

.shuffle-block-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.shuffle-block-suffix {
  flex: 1 1 100%;
  min-width: 0;
  height: 34px;
  padding: 6px 10px;
}

.shuffle-field {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #d4d4d8;
  font-size: 12px;
  white-space: nowrap;
}

.shuffle-field-input {
  width: 56px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #3f3f46;
  background: #1a1a1f;
  color: #fff;
  box-sizing: border-box;
  font-size: 12px;
}

.shuffle-block-btn {
  padding: 6px 10px;
  min-width: 44px;
  white-space: nowrap;
}

.shuffle-empty {
  min-height: 160px;
  border: 1px dashed #3f3f46;
  border-radius: 10px;
  color: #71717a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.shuffle-status {
  min-height: 18px;
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 12px;
  color: #a1a1aa;
}

.shuffle-status.error {
  color: #fca5a5;
}

#shuffleCurrentBlockLabel {
  color: #a1a1aa;
  font-weight: 500;
}

.shuffle-current-name {
  color: #f59e0b;
  font-weight: 800;
}

.shuffle-result-list {
  background: #111113;
  border: 1px dashed #3f3f46;
  border-radius: 12px;
  padding: 10px;
  box-sizing: border-box;
  min-height: 430px;
  max-height: 900px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.shuffle-output-item {
  background: #1b1b20;
  border: 1px solid #2f2f38;
  border-radius: 10px;
  padding: 10px;
}

.shuffle-output-head {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.shuffle-output-copy-btn {
  padding: 5px 12px;
}

.shuffle-output-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.6;
  color: #22d3ee;
}

.shuffle-output-item:nth-child(6n+1) .shuffle-output-text {
  color: #22d3ee;
}

.shuffle-output-item:nth-child(6n+2) .shuffle-output-text {
  color: #34d399;
}

.shuffle-output-item:nth-child(6n+3) .shuffle-output-text {
  color: #f59e0b;
}

.shuffle-output-item:nth-child(6n+4) .shuffle-output-text {
  color: #f472b6;
}

.shuffle-output-item:nth-child(6n+5) .shuffle-output-text {
  color: #60a5fa;
}

.shuffle-output-item:nth-child(6n+6) .shuffle-output-text {
  color: #a78bfa;
}

.hidden {
  display: none !important;
}

.name-library-info {
  margin-top: 12px;
  margin-bottom: 10px;
  font-size: 12px;
  color: #a1a1aa;
}

.name-result-list {
  background: #111113;
  border: 1px dashed #3f3f46;
  border-radius: 12px;
  padding: 12px;
  box-sizing: border-box;
  min-height: 430px;
  max-height: 900px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
  flex: 1;
}

.name-item {
  background: #1b1b20;
  border: 1px solid #2f2f38;
  border-radius: 10px;
  padding: 10px 12px;
}

.name-copy-btn {
  width: 100%;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 10px;
  text-align: center;
  cursor: pointer;
}

.name-copy-btn:active {
  transform: scale(0.99);
}

.name-cn {
  margin-top: 8px;
  font-size: 20px;
  font-weight: 800;
  color: #f4f4f5;
  letter-spacing: 1px;
  text-align: center;
}

.name-meta {
  margin-top: 5px;
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
}

.name-empty-tip {
  grid-column: 1 / -1;
  height: 100%;
  min-height: 404px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #71717a;
  font-size: 14px;
}

@media (max-width: 900px) {
  body {
    padding: 20px 12px;
  }

  .container {
    min-width: 100%;
    max-width: 100%;
    padding: 20px;
  }

  .name-result-list {
    min-height: 340px;
    grid-template-columns: 1fr;
  }

  .shuffle-toolbar {
    flex-wrap: wrap;
  }

  .shuffle-toolbar .btn-secondary {
    min-width: 120px;
    flex: 1 1 48%;
  }

  .shuffle-field-input {
    width: 56px;
  }

  .shuffle-block-btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
  }
}
