/* 开辟鸿蒙 / 命运抉择 — 视觉对齐 main.html · main.css（墨绿底、金铜描边） */
:root {
  --mj-main-bg: #0f1412;
  --mj-panel-bg: rgba(22, 28, 24, 0.92);
  --mj-border: rgba(140, 120, 83, 0.45);
  --mj-gold: #e8c547;
  --mj-gold-dim: #b89a4a;
  --mj-text: #e8e4dc;
  --mj-muted: #8a9088;
  --mj-chat-bg: rgba(0, 0, 0, 0.28);

  /* 兼容本文件旧变量名 */
  --primary-color: var(--mj-border);
  --text-primary: var(--mj-text);
  --input-bg: rgba(0, 0, 0, 0.35);
  /* 自定义出身等深色表单控件（下拉选项区） */
  --mj-form-control-bg: rgba(8, 12, 10, 0.92);
  --mj-form-control-border: rgba(100, 92, 72, 0.5);
  --mj-form-control-text: #c4bcaa;
  --input-border: rgba(140, 120, 83, 0.35);

  --rarity-mundane: #808080;
  /* 普通：直接绿色（区别于平庸灰） */
  --rarity-common: #4caf50;
  --rarity-rare: #4fc3f7;
  --rarity-epic: #ba68c8;
  --rarity-legendary: #e8c547;
  --rarity-mythic: #ff5252;
}

#character-creation-screen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: 100dvh;
  background: rgba(15, 20, 18, 0.88);
  z-index: 3500;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  box-sizing: border-box;
  font-family: "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--mj-text);
}

#character-creation-screen.hidden {
  display: none !important;
}

.creation-container {
  width: 90%;
  max-width: 1200px;
  background: var(--mj-panel-bg);
  border-radius: 8px;
  padding: 22px 24px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(95vh, 100dvh);
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--mj-border);
  box-sizing: border-box;
  backdrop-filter: blur(6px);
}

.creation-content {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 10px;
}

.creation-content::-webkit-scrollbar {
  width: 6px;
}
.creation-content::-webkit-scrollbar-thumb {
  background: rgba(140, 120, 83, 0.35);
  border-radius: 4px;
}
.creation-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.creation-nav {
  flex-shrink: 0;
}

.creation-step-indicator:empty {
  display: none;
  margin: 0;
}

.creation-step-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px 14px;
  margin-left: -6px;
  margin-right: -6px;
  border-bottom: 1px solid var(--mj-border);
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(30, 36, 32, 0.98), rgba(20, 26, 22, 0.96));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  border-radius: 6px 6px 0 0;
}

.creation-step-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--mj-gold);
  letter-spacing: 0.06em;
}

.creation-step-title i {
  font-size: 1em;
  opacity: 0.88;
  color: var(--mj-gold-dim);
}

.creation-step-subtitle {
  color: var(--mj-muted);
  font-size: 0.8rem;
  margin-top: 4px;
  font-weight: normal;
}

.points-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--mj-border);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 0.9rem;
  color: var(--mj-text);
}

.points-badge i {
  color: var(--mj-gold-dim);
}

.points-badge .cost {
  color: var(--mj-gold);
  font-size: 1.05em;
  font-variant-numeric: tabular-nums;
}

.creation-section-title {
  margin: 16px 0 10px;
  padding-bottom: 6px;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--mj-gold);
  border-bottom: 1px solid var(--mj-border);
}

.creation-section-title:first-of-type {
  margin-top: 4px;
}

.creation-section-title i {
  margin-right: 8px;
  color: var(--mj-gold-dim);
  font-size: 0.95em;
}

.creation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.creation-card {
  background: var(--mj-chat-bg);
  border: 1px solid var(--mj-border);
  border-radius: 8px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.creation-card:hover {
  border-color: rgba(232, 197, 71, 0.35);
  background: rgba(0, 0, 0, 0.38);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.creation-card.selected {
  background: rgba(232, 197, 71, 0.08);
  border-color: var(--mj-gold);
  box-shadow: 0 0 0 1px rgba(232, 197, 71, 0.2);
}

.creation-card.selected::after {
  content: "\f00c";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  top: 10px;
  right: 10px;
  color: var(--mj-gold);
  font-size: 0.95em;
}

.creation-card h4 {
  margin: 0;
  color: var(--mj-text);
  font-size: 1em;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.creation-card.selected h4 {
  color: var(--mj-gold);
}

.creation-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--mj-muted);
  line-height: 1.5;
}

.creation-card .cost {
  color: var(--mj-gold);
  font-weight: 600;
  font-size: 0.82em;
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(140, 120, 83, 0.35);
}

.major-action-button {
  width: 100%;
  padding: 10px 15px;
  font-size: 0.95rem;
  font-family: inherit;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--mj-border);
  color: var(--mj-gold-dim);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-sizing: border-box;
}

.major-action-button:hover:not(:disabled) {
  background: rgba(140, 120, 83, 0.18);
  border-color: rgba(232, 197, 71, 0.45);
  color: var(--mj-gold);
}

.major-action-button:disabled {
  border-color: rgba(90, 95, 88, 0.5);
  color: var(--mj-muted);
  cursor: not-allowed;
  opacity: 0.55;
}

.major-action-button.small-font-btn {
  font-size: 0.85em;
  padding: 6px 12px;
  width: auto;
}

.creation-nav-enhanced {
  display: flex;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--mj-border);
  gap: 12px;
}

.creation-nav-enhanced .nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  font-size: 0.95rem;
  border-radius: 6px;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  width: auto;
}

.creation-nav-enhanced .nav-btn-back {
  background: transparent;
  border: 1px solid var(--mj-border);
  color: var(--mj-muted);
}

.creation-nav-enhanced .nav-btn-back:hover {
  background: rgba(0, 0, 0, 0.22);
  color: var(--mj-text);
  border-color: rgba(140, 120, 83, 0.55);
}

.creation-nav-enhanced .nav-btn-next {
  background: rgba(232, 197, 71, 0.1);
  border: 1px solid rgba(232, 197, 71, 0.4);
  color: var(--mj-gold);
}

.creation-nav-enhanced .nav-btn-next:hover:not(:disabled) {
  background: rgba(232, 197, 71, 0.16);
  border-color: var(--mj-gold);
}

.creation-nav-enhanced .nav-btn-next:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#trait-options-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.trait-card {
  width: 148px;
  height: 148px;
  background: var(--mj-chat-bg);
  border: 2px solid;
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  box-sizing: border-box;
}

.trait-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.trait-card.selected {
  transform: scale(1.02);
  box-shadow: 0 0 0 1px rgba(232, 197, 71, 0.25);
}

.trait-card .trait-rarity {
  position: absolute;
  top: 5px;
  left: 5px;
  font-size: 0.68em;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
}

.trait-card .trait-name {
  font-size: 0.98em;
  font-weight: 600;
  margin-top: 22px;
  color: var(--mj-text);
}

.trait-card .trait-detail-btn {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: none;
  border: none;
  color: var(--mj-muted);
  cursor: pointer;
  font-size: 1em;
}

.trait-card .trait-detail-btn:hover {
  color: var(--mj-gold-dim);
}

.trait-card.rarity-平庸 { border-color: var(--rarity-mundane); }
.trait-card.rarity-平庸 .trait-rarity { background: var(--rarity-mundane); color: #1a1a1a; }
.trait-card.rarity-普通 { border-color: var(--rarity-common); }
.trait-card.rarity-普通 .trait-rarity { background: var(--rarity-common); color: #06130a; }
.trait-card.rarity-稀有 { border-color: var(--rarity-rare); }
.trait-card.rarity-稀有 .trait-rarity { background: var(--rarity-rare); color: #1a1a1a; }
.trait-card.rarity-史诗 { border-color: var(--rarity-epic); }
.trait-card.rarity-史诗 .trait-rarity { background: var(--rarity-epic); color: #fff; }
.trait-card.rarity-传说 { border-color: var(--rarity-legendary); }
.trait-card.rarity-传说 .trait-rarity { background: var(--rarity-legendary); color: #1a1a1a; }
.trait-card.rarity-神迹 { border-color: var(--rarity-mythic); }
.trait-card.rarity-神迹 .trait-rarity { background: var(--rarity-mythic); color: #fff; }
.trait-card.rarity-负面状态 { border-color: #e57373; }
.trait-card.rarity-负面状态 .trait-rarity { background: #c62828; color: #fff; }

.action-buttons-grid {
  display: grid;
  gap: 10px;
}

.linggen-cost {
  position: absolute;
  bottom: 6px;
  font-size: 0.72em;
  color: var(--mj-text);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.trait-card .selected-indicator {
  position: absolute;
  top: 6px;
  right: 6px;
  color: var(--mj-gold);
  font-size: 0.95em;
}

#linggen-result-display {
  min-height: 170px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-primary);
}

.linggen-orb {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border: 2px solid rgba(140, 120, 83, 0.5);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: transform 0.25s ease;
}

.linggen-tag {
  position: absolute;
  top: -14px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.78em;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 1px 2px #000;
}

.linggen-elements {
  font-size: 1.05em;
  text-align: center;
  color: #fff;
  text-shadow: 0 0 5px #000;
}

.orb-type-天灵根 {
  background: radial-gradient(circle, #fffde7, #ffd600);
  border-color: #ffc107;
}
.tag-type-天灵根 { background: #ffc107; }
.orb-type-真灵根 {
  background: radial-gradient(circle, #e1f5fe, #4fc3f7);
  border-color: #03a9f4;
}
.tag-type-真灵根 { background: #03a9f4; }
.orb-type-伪灵根 {
  background: radial-gradient(circle, #f5f5f5, #9e9e9e);
  border-color: #757575;
}
.tag-type-伪灵根 { background: #757575; }
.orb-type-无灵根 {
  background: radial-gradient(circle, #424242, #212121);
  border-color: #616161;
}
.tag-type-无灵根 { background: #616161; }

.panel-card {
  background: var(--mj-chat-bg);
  border: 1px solid var(--mj-border);
  border-radius: 8px;
  padding: 14px 16px;
}

.creation-birthplace-card {
  margin-top: 0;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

.creation-birthplace-line {
  margin: 0;
  color: var(--mj-text);
  font-size: 0.92rem;
}

.creation-birthplace-line strong {
  color: var(--mj-gold);
  font-weight: 600;
}

.creation-birthplace-desc {
  margin: 12px 0 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--mj-muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.creation-birthplace-desc--hint {
  font-style: italic;
  opacity: 0.92;
}

.muted {
  color: var(--mj-muted);
}

/* —— 自定义出身弹窗（#mj-custom-birth-root，壳层复用 main.css · .mj-trait-modal-root） —— */
.mj-custom-birth-dialog {
  max-width: 420px;
}

.mj-custom-birth-body {
  max-height: 70vh;
  overflow: auto;
}

.mj-custom-birth-label {
  display: block;
  color: #c9b88a;
  font-size: 13px;
  margin: 10px 0 4px;
}

.mj-custom-birth-label:first-of-type {
  margin-top: 0;
}

.mj-custom-birth-label-hint {
  opacity: 0.7;
  font-weight: normal;
}

.mj-custom-birth-input,
.mj-custom-birth-select,
.mj-custom-birth-textarea {
  width: 100%;
  box-sizing: border-box;
  border-radius: 8px;
  border: 1px solid var(--mj-form-control-border);
  background: var(--mj-form-control-bg);
  color: var(--mj-form-control-text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.mj-custom-birth-input {
  height: 40px;
  padding: 0 12px;
}

.mj-custom-birth-input::placeholder,
.mj-custom-birth-textarea::placeholder {
  color: var(--mj-form-control-text);
  opacity: 0.45;
}

.mj-custom-birth-select {
  height: 40px;
  padding: 0 10px;
  flex: 1;
  min-width: 100px;
  cursor: pointer;
  color-scheme: dark;
}

.mj-custom-birth-select option,
.mj-custom-birth-select optgroup {
  background: #141a16;
  color: var(--mj-form-control-text);
}

.mj-custom-birth-select--minor {
  min-width: 0;
}

.mj-custom-birth-realm-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.mj-custom-birth-realm-minor-wrap {
  flex: 1;
  min-width: 100px;
}

.mj-custom-birth-realm-minor-wrap.mj-custom-birth-realm-minor-wrap--hidden {
  display: none;
}

.mj-custom-birth-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: rgba(201, 184, 138, 0.75);
  line-height: 1.4;
}

.mj-custom-birth-textarea {
  padding: 10px 12px;
  resize: vertical;
  min-height: 100px;
}

.mj-custom-birth-label[for="mj-custom-birth-background"] {
  margin-top: 14px;
}

.mj-custom-birth-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

.mj-custom-birth-actions .major-action-button {
  width: auto;
  flex: 0 0 auto;
  min-width: 100px;
}

.mj-custom-birth-btn-cancel {
  opacity: 0.9;
}

@media (max-width: 640px) {
  .creation-container {
    width: 96%;
    padding: 16px 14px;
  }
  .creation-step-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .creation-nav-enhanced {
    flex-direction: column;
    gap: 10px;
  }

  .creation-nav-enhanced .nav-btn {
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
  }

  .action-buttons-grid {
    grid-template-columns: 1fr;
  }
}
