:root {
  color-scheme: dark;
  --bg: #030303;
  --panel: #080808;
  --panel-2: #111;
  --line: #fff;
  --muted: #aaa;
  --text: #fff;
  --soft: rgba(255,255,255,.1);
  --danger: #ff7474;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 22% 0%, rgba(255,255,255,.08), transparent 24rem),
    radial-gradient(circle at 80% 8%, rgba(255,255,255,.05), transparent 22rem),
    var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

button, input { font: inherit; }
button { color: inherit; }

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(170px, .75fr) minmax(430px, 3fr) minmax(290px, 1.45fr);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 14px;
}

.lang-switch,
.build-tools,
.title-block {
  border: 2px solid var(--line);
  background: rgba(0,0,0,.78);
  padding: 12px;
  min-height: 84px;
}

.title-block {
  text-align: center;
  display: grid;
  align-content: center;
}

.title-block h1 {
  margin: 0 0 6px;
  letter-spacing: .08em;
  font-size: clamp(24px, 2.7vw, 42px);
}

.build-title-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 6px auto 6px;
  width: min(100%, 520px);
}

#buildTitleLabel {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
}

#buildTitle {
  flex: 1;
  min-width: 0;
  color: #fff;
  background: #000;
  border: 1px solid rgba(255,255,255,.82);
  padding: 5px 8px;
  outline: none;
}

.version-note {
  margin-top: 6px !important;
  color: #777 !important;
  font-size: 12px !important;
  letter-spacing: .02em;
}

.title-block p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.lang-label,
.code-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .16em;
}

.lang-buttons,
.code-row,
.image-export-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.image-export-row { margin-top: 8px; }

.pill-btn,
.action-btn,
.tier-btn {
  color: var(--text);
  background: #000;
  border: 2px solid var(--line);
  padding: 8px 12px;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}

.wide-btn { width: 100%; justify-content: center; }

.pill-btn:hover,
.action-btn:hover,
.tier-btn:hover,
.picker-card:hover,
.detail-picker-card:hover,
.slot-card:hover {
  background: #1b1b1b;
  transform: translateY(-1px);
}

.pill-btn.active,
.tier-btn.selected {
  background: #fff;
  color: #000;
}

#buildCode {
  flex: 1;
  min-width: 120px;
  color: #fff;
  background: #000;
  border: 2px solid #fff;
  padding: 9px 10px;
  outline: none;
}

#status {
  margin-top: 8px;
  min-height: 18px;
  font-size: 13px;
  color: #d6ffd6;
}

#status.error { color: var(--danger); }

.main-frame {
  display: grid;
  grid-template-columns: minmax(560px, 1fr) minmax(560px, 1fr);
  grid-template-areas:
    "left right"
    "prophecies prophecies";
  gap: 14px;
}

.left-frame { grid-area: left; display: grid; gap: 14px; align-content: start; }
.right-frame { grid-area: right; display: grid; gap: 14px; align-content: start; }

.panel,
.required-stats-panel {
  border: 2px solid var(--line);
  background: rgba(0,0,0,.78);
  padding: 12px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08) inset;
}

.panel h2,
.required-stats-panel h2 {
  margin: 0 0 10px;
  font-size: 17px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.weapons-panel { min-height: 354px; }
.rosary-panel { min-height: 286px; }
.equipment-panel { min-height: 564px; display: flex; }
.prophecies-panel { grid-area: prophecies; }

.weapon-stack { display: grid; gap: 10px; height: 100%; }

.slot-card {
  position: relative;
  border: 2px solid #fff;
  background: linear-gradient(180deg, #0d0d0d, #050505);
  color: #fff;
  cursor: pointer;
  overflow: hidden;
}

.weapon-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  min-height: 104px;
}

.slot-demon { grid-template-columns: 1fr; }

.slot-main-frame {
  display: grid;
  grid-template-columns: 78px 104px minmax(0, 1fr);
  min-width: 0;
  min-height: 100%;
}

.thumb-wrap {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #050505;
  border-right: 1px solid rgba(255,255,255,.45);
  overflow: hidden;
  align-self: stretch;
  display: grid;
  place-items: center;
}

.weapon-card .thumb-wrap,
.equipment-card .thumb-wrap {
  aspect-ratio: auto;
  height: 100%;
  min-height: 96px;
}

.thumb-wrap img,
.picker-img img,
.detail-picker-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.slot-text {
  padding: 10px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.compact-name { border-right: 1px solid rgba(255,255,255,.45); }

.slot-label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.slot-name {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.22;
  word-break: break-word;
}

.slot-detail {
  min-width: 0;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.35;
  overflow: auto;
  scrollbar-color: #fff #111;
  scrollbar-width: thin;
}

.slot-detail::-webkit-scrollbar,
.detail-picker-content::-webkit-scrollbar,
.item-grid::-webkit-scrollbar,
.detail-picker-list::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.slot-detail::-webkit-scrollbar-thumb,
.detail-picker-content::-webkit-scrollbar-thumb,
.item-grid::-webkit-scrollbar-thumb,
.detail-picker-list::-webkit-scrollbar-thumb {
  background: #fff;
}

.slot-detail::-webkit-scrollbar-track,
.detail-picker-content::-webkit-scrollbar-track,
.item-grid::-webkit-scrollbar-track,
.detail-picker-list::-webkit-scrollbar-track {
  background: #111;
}

.mysteria-list { display: grid; gap: 8px; }
.mysteria-line { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: start; }
.mysteria-line b { color: #000; background: #fff; text-align: center; padding: 1px 0; font-size: 12px; }
.mysteria-line span { min-width: 0; }
.empty-detail { color: var(--muted); }
.plain-detail { white-space: normal; }

.tier-row {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  border-left: 2px solid #fff;
  min-width: 44px;
}

.tier-row .tier-btn {
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,.55);
  padding: 0 6px;
  font-size: 17px;
}

.tier-row .tier-btn:last-child { border-bottom: 0; }

.equipment-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(260px, 1fr);
  gap: 10px;
}

.equipment-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  min-height: 258px;
}

.equipment-card.slot-melee { grid-template-columns: 1fr; }

.equipment-body {
  display: grid;
  grid-template-rows: 112px minmax(0, 1fr);
  min-width: 0;
}

.equipment-top {
  display: grid;
  grid-template-columns: 45% minmax(0, 1fr);
  min-width: 0;
  border-bottom: 2px solid #fff;
}

.equipment-top .thumb-wrap { border-right: 1px solid rgba(255,255,255,.45); }
.equipment-detail { min-height: 0; }
.equipment-card .tier-row { min-width: 34px; }
.equipment-card .tier-btn { font-size: 15px; padding: 0 2px; }

.rosary-slots {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.rosary-slot {
  min-height: 228px;
  display: grid;
  grid-template-rows: 90px 58px minmax(70px, 1fr);
}

.rosary-slot .thumb-wrap,
.prophecy-slot .thumb-wrap {
  border-right: 0;
  border-bottom: 1px solid rgba(255,255,255,.45);
  aspect-ratio: auto;
}

.rosary-name-block {
  padding: 8px;
  border-bottom: 1px solid rgba(255,255,255,.45);
}

.rosary-slot .slot-name { font-size: 14px; }
.rosary-detail { padding: 8px; font-size: 12px; }

.required-stats-panel {
  min-height: 90px;
  display: grid;
  align-content: center;
}

.required-stats-panel h2 {
  text-align: center;
  color: #ffeded;
}

.required-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.required-stat {
  border: 1px solid rgba(255,255,255,.7);
  background: #050505;
  padding: 8px 6px;
  text-align: center;
  display: grid;
  gap: 4px;
}

.required-stat span { color: var(--muted); font-size: 12px; }
.required-stat strong { font-size: 20px; }

.prophecy-slots {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.prophecy-slot {
  min-height: 150px;
  display: grid;
  grid-template-rows: 104px 1fr;
}

.prophecy-slot .slot-text { padding: 8px; justify-content: start; }
.prophecy-slot .slot-name { font-size: 14px; }

.modal { display: none; }
.modal.open { display: block; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.78);
  z-index: 50;
}

.modal-box {
  position: fixed;
  z-index: 60;
  left: 50%;
  top: 50%;
  width: min(1020px, calc(100vw - 32px));
  max-height: min(820px, calc(100vh - 32px));
  transform: translate(-50%, -50%);
  border: 3px solid #fff;
  background: #020202;
  box-shadow: 0 20px 70px rgba(0,0,0,.75);
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.modal-head,
.modal-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #fff;
  padding: 12px 14px;
}

.modal-head h2 { margin: 0; font-size: 20px; }

#searchInput {
  width: 100%;
  background: #000;
  color: #fff;
  border: 2px solid #fff;
  padding: 10px;
  outline: none;
}

.item-grid {
  overflow: auto;
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  grid-auto-rows: auto;
  align-items: start;
  gap: 24px 16px;
}

.picker-card {
  min-height: 0;
  border: 2px solid #fff;
  background: #080808;
  color: #fff;
  text-align: left;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.picker-card.selected,
.detail-picker-card.selected {
  outline: 3px solid #fff;
  outline-offset: -7px;
  background: #161616;
}

.picker-img {
  width: 100%;
  aspect-ratio: 3 / 4;
  height: auto;
  border-bottom: 1px solid rgba(255,255,255,.5);
  background: #050505;
  display: grid;
  place-items: center;
  padding: 10px;
  flex: 0 0 auto;
  overflow: hidden;
  box-sizing: border-box;
}

.picker-copy {
  padding: 12px 10px;
  display: grid;
  grid-template-rows: minmax(38px, auto) minmax(18px, auto);
  gap: 6px;
  flex: 0 0 86px;
  min-height: 86px;
  align-content: start;
  background: #080808;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
  border-top: 1px solid rgba(255,255,255,.5);
}

.picker-copy span { color: var(--muted); font-size: 13px; }
.picker-copy strong,
.picker-copy span {
  display: block;
  white-space: normal;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.picker-copy strong { font-size: 15px; font-weight: 800; }

.item-grid.picker-type-prophecies {
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 26px 18px;
}

.item-grid.picker-type-gun {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 26px 18px;
}

.item-grid.picker-type-prophecies .picker-card { min-height: 246px; }
.item-grid.picker-type-gun .picker-card { min-height: 258px; }

.item-grid.picker-type-gun .picker-img {
  aspect-ratio: auto;
  min-height: 168px;
  height: 176px;
  max-height: none;
}

.item-grid.picker-type-gun .picker-img img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 154px;
  object-fit: contain;
}

.item-grid.picker-type-prophecies .picker-img {
  aspect-ratio: 1 / 1;
  height: auto;
}

.item-grid.picker-type-prophecies .picker-img img { object-fit: contain; }

.detail-picker-list {
  overflow: auto;
  padding: 18px;
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: auto;
  align-content: start;
  gap: 12px;
}

.detail-picker-card {
  width: 100%;
  min-height: 112px;
  border: 2px solid #fff;
  background: #080808;
  color: #fff;
  cursor: pointer;
  padding: 8px;
  display: grid;
  grid-template-columns: 94px minmax(115px, 145px) 16px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  text-align: left;
}

.detail-picker-img {
  background: #050505;
  border: 2px solid #fff;
  width: 94px;
  min-height: 94px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.detail-picker-name {
  display: grid;
  align-content: center;
  gap: 6px;
  min-width: 0;
}

.detail-picker-name strong {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.detail-picker-name span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.detail-picker-separator {
  justify-self: center;
  width: 8px;
  max-height: 68px;
  align-self: center;
  border-radius: 99px;
  background: #fff;
}

.detail-picker-content {
  min-width: 0;
  display: grid;
  gap: 12px;
  align-content: center;
  max-height: 164px;
  overflow: auto;
  padding-right: 6px;
}

.detail-picker-content.single-column { grid-template-columns: 1fr; }
.detail-picker-content.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.content-column {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.content-column span {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.content-column p {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.clear-card {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.detail-clear-card {
  grid-template-columns: 1fr;
  min-height: 92px;
}

.clear-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  font-size: 44px;
  line-height: 1;
}

.no-result {
  border: 2px dashed rgba(255,255,255,.65);
  padding: 24px;
  color: var(--muted);
}

.site-footer {
  max-width: 1280px;
  margin: 18px auto 28px;
  padding: 0 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  text-align: center;
}

.site-footer p { margin: 4px 0; }
.site-footer a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.site-footer a:hover,
.site-footer a:focus { text-decoration-thickness: 2px; }

.export-wrapper .modal { display: none !important; }

@media (max-width: 1180px) {
  .topbar { grid-template-columns: 1fr; }
  .main-frame {
    grid-template-columns: 1fr;
    grid-template-areas:
      "left"
      "right"
      "prophecies";
  }
}

@media (max-width: 760px) {
  .slot-main-frame { grid-template-columns: 76px minmax(90px, 1fr); }
  .weapon-card .slot-detail { grid-column: 1 / -1; border-top: 1px solid rgba(255,255,255,.45); }
  .equipment-grid,
  .rosary-slots,
  .prophecy-slots,
  .required-stats { grid-template-columns: 1fr 1fr; }
  .code-row { flex-wrap: wrap; }
  #buildCode { flex-basis: 100%; }
  .detail-picker-card { grid-template-columns: 84px minmax(0, 1fr); }
  .detail-picker-separator { display: none; }
  .detail-picker-content { grid-column: 1 / -1; max-height: none; }
  .detail-picker-content.two-columns { grid-template-columns: 1fr; }
}

/* 2026-07-07: prophecy slot image area should be square; name area is excluded from ratio. */
.prophecy-slot {
  grid-template-rows: auto 1fr;
}

.prophecy-slot .thumb-wrap {
  aspect-ratio: 1 / 1;
  height: auto;
  min-height: 0;
  border-right: 0;
  border-bottom: 1px solid rgba(255,255,255,.45);
}

.export-node {
  position: absolute;
  left: 0;
  top: 0;
  width: 1280px;
  min-height: 720px;
  background: #030303;
  color: #fff;
  pointer-events: none;
  z-index: 0;
  contain: layout paint style;
}

/* 2026-07-07: shrink only the main-page Rosary and Prophecies placeholder artwork so the SVG fits fully inside those slots. */
.rosary-slot .thumb-wrap .placeholder-img,
.prophecy-slot .thumb-wrap .placeholder-img {
  width: 72%;
  height: 72%;
  max-width: 72%;
  max-height: 72%;
  object-fit: contain;
  margin: auto;
}

.rosary-slot .thumb-wrap,
.prophecy-slot .thumb-wrap {
  display: grid;
  place-items: center;
}

/* 2026-07-07 export fix: allow cloned HTML export to wrap text instead of clipping when html2canvas fallback is used. */
.export-wrapper .slot-card,
.export-wrapper .slot-detail,
.export-wrapper .equipment-detail,
.export-wrapper .slot-name {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.export-wrapper .slot-detail,
.export-wrapper .equipment-detail {
  overflow: hidden;
  scrollbar-width: none;
}
.export-wrapper .slot-detail::-webkit-scrollbar,
.export-wrapper .equipment-detail::-webkit-scrollbar { display: none; }
