:root {
  --void: #07060a;
  --ink: #efe6d2;
  --muted: #9b8f78;
  --gold: #c9a44c;
  --gold-bright: #e8d5a3;
  --gold-deep: #7a5e28;
  --line: #6e5a32;
  --line-dim: #3d3420;
  --violet: #c4a0ff;
  --violet-dim: #6b4aa0;
  --valid: #c6b06a;
  --reorder: #d4a24a;
  --invalid: #c45a4a;
  --serif: "Palatino Linotype", Palatino, "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", serif;
  --sans: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--void);
}

body {
  color: var(--ink);
  font: 15px/1.65 var(--sans);
  color-scheme: dark;
}

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  background:
    url("../assets/bg-night.jpg") center / cover no-repeat;
  filter: saturate(0.92) contrast(1.05);
}

.sky::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(7, 6, 10, 0.42) 0%, rgba(7, 6, 10, 0.72) 46%, rgba(7, 6, 10, 0.94) 100%),
    radial-gradient(80% 50% at 50% 0%, rgba(107, 74, 160, 0.18), transparent 70%);
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  box-shadow: inset 0 0 180px 40px rgba(0, 0, 0, 0.72);
}

.wrap {
  position: relative;
  z-index: 2;
  width: min(820px, 100%);
  margin: 0 auto;
  padding: 28px 20px 72px;
}

.hero {
  text-align: center;
  margin-bottom: 26px;
}

.crest {
  display: block;
  width: 132px;
  height: 132px;
  margin: 0 auto 10px;
  object-fit: contain;
  mix-blend-mode: screen;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.55));
}

.kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 700;
  letter-spacing: 0.16em;
  background: linear-gradient(180deg, #f3e6c4 0%, #c9a44c 55%, #8a6a28 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
}

.lede {
  margin: 0 auto 8px;
  max-width: 34em;
  color: var(--muted);
}

.meta {
  margin: 0;
  color: #7d725c;
  font-size: 12px;
  letter-spacing: 0.06em;
}

.tablet {
  position: relative;
  padding: 28px 24px 22px;
  background:
    linear-gradient(180deg, rgba(14, 12, 18, 0.86), rgba(8, 7, 12, 0.94)),
    url("../assets/stone.jpg") center / cover;
  border: 1px solid var(--line);
  box-shadow:
    0 0 0 1px #120e08,
    0 0 0 2px var(--line-dim),
    0 28px 80px rgba(0, 0, 0, 0.55);
}

.corner {
  position: absolute;
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.corner::before,
.corner::after {
  content: "";
  position: absolute;
  background: var(--gold);
}

.corner.tl,
.corner.tr { top: -1px; }
.corner.bl,
.corner.br { bottom: -1px; }
.corner.tl,
.corner.bl { left: -1px; }
.corner.tr,
.corner.br { right: -1px; }

.corner.tl::before,
.corner.tr::before,
.corner.bl::before,
.corner.br::before {
  width: 18px;
  height: 1px;
}

.corner.tl::after,
.corner.tr::after,
.corner.bl::after,
.corner.br::after {
  width: 1px;
  height: 18px;
}

.tablet-title {
  margin: 0 0 18px;
  text-align: center;
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.38em;
}

.tablet-title::before,
.tablet-title::after {
  content: "◆";
  display: inline-block;
  margin: 0 12px;
  font-size: 8px;
  color: var(--gold);
  transform: translateY(-1px);
}

.slots {
  display: grid;
  gap: 12px;
}

.relic-slot {
  display: grid;
  grid-template-columns: 48px 1fr;
  min-height: 72px;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid var(--line-dim);
  box-shadow: inset 0 0 0 1px rgba(201, 164, 76, 0.08);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.relic-slot.filled {
  border-color: var(--gold);
  box-shadow: inset 0 0 28px rgba(201, 164, 76, 0.08);
}

.relic-slot.deep {
  border-color: var(--violet-dim);
  box-shadow: inset 0 0 32px rgba(107, 74, 160, 0.22);
}

.slot-index {
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--line-dim);
  background: linear-gradient(180deg, #2a2216, #120e0a);
  color: var(--gold);
  font-family: var(--serif);
  font-size: 18px;
}

.slot-body {
  min-width: 0;
  padding: 8px 10px 10px;
}

.slot-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
  min-height: 16px;
}

.slot-label {
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.28em;
}

.slot-id {
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.relic-slot.deep .slot-id {
  color: var(--violet);
}

.combo {
  position: relative;
}

.combo input {
  width: 100%;
  height: 40px;
  padding: 0 36px 0 8px;
  border: 0;
  border-bottom: 1px solid #4a4030;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  outline: none;
  text-overflow: ellipsis;
}

.combo input::placeholder {
  color: #6a6254;
}

.combo input:focus {
  border-bottom-color: var(--gold);
}

.combo input.is-deep {
  color: var(--violet);
}

.combo-clear {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}

.combo-clear:hover {
  color: var(--gold-bright);
}

.combo-list {
  position: absolute;
  z-index: 30;
  left: -10px;
  right: -10px;
  top: calc(100% + 8px);
  max-height: 280px;
  overflow: auto;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: #100e14;
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}

.combo-list[hidden] {
  display: none;
}

.combo-list li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 14px 9px 16px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  border-left: 2px solid transparent;
}

.combo-list li.active,
.combo-list li:hover {
  background: linear-gradient(90deg, rgba(201, 164, 76, 0.16), transparent 70%);
  border-left-color: var(--gold);
  color: var(--gold-bright);
}

.combo-list li.deep {
  color: var(--violet);
}

.combo-list .effect-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.combo-list .effect-id {
  flex: none;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.combo-list li.deep .effect-id {
  color: var(--violet);
}

.combo-list .empty {
  color: var(--muted);
  cursor: default;
  padding: 14px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.btn {
  appearance: none;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #1c1812, #0e0c0a);
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.18em;
  cursor: pointer;
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
}

.btn:hover:not(:disabled) {
  border-color: var(--gold);
  color: #fff8e6;
  box-shadow: 0 0 16px rgba(201, 164, 76, 0.18);
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-gold {
  background: linear-gradient(180deg, #e2c67a, #b08936 55%, #7a5e28);
  border-color: #f0dca8;
  color: #1a1408;
  font-weight: 700;
}

.btn-gold:hover:not(:disabled) {
  color: #1a1408;
  filter: brightness(1.08);
}

.filter {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.filter input {
  margin-top: 3px;
  accent-color: var(--gold);
}

.verdict {
  margin-top: 18px;
  padding: 16px 14px 14px;
  text-align: center;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line-dim);
}

.verdict-kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.4em;
}

.result {
  min-height: 48px;
  color: var(--muted);
  white-space: pre-wrap;
}

.verdict[data-status="valid"] {
  border-color: var(--gold);
  box-shadow: inset 0 0 24px rgba(201, 164, 76, 0.1);
}

.verdict[data-status="valid"] .result {
  color: var(--valid);
}

.verdict[data-status="reorderable"] {
  border-color: #a87a32;
}

.verdict[data-status="reorderable"] .result {
  color: var(--reorder);
}

.verdict[data-status="invalid"] {
  border-color: #6a3030;
  box-shadow: inset 0 0 24px rgba(140, 50, 40, 0.12);
}

.verdict[data-status="invalid"] .result {
  color: var(--invalid);
}

.share {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.qq-label {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 42px;
  margin: 0;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--line-dim);
  background: rgba(0, 0, 0, 0.35);
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.08em;
}

.notes {
  margin: 18px 0 0;
  color: #7a7162;
  font-size: 12px;
}

a {
  color: var(--gold);
}

code {
  font-size: 0.95em;
  color: var(--gold-bright);
}

footer {
  margin-top: 26px;
  text-align: center;
  color: #6a6358;
  font-size: 12px;
}

.credit {
  margin: 14px 0 0;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.12em;
}

@media (max-width: 640px) {
  .wrap {
    width: 100%;
    padding: 16px 12px 56px;
  }

  .crest {
    width: 108px;
    height: 108px;
  }

  .kicker {
    letter-spacing: 0.22em;
  }

  .hero h1 {
    letter-spacing: 0.08em;
  }

  .tablet {
    padding: 20px 14px 16px;
  }

  .relic-slot {
    grid-template-columns: 36px 1fr;
  }

  .toolbar .btn-gold {
    flex: 1 1 100%;
  }

  .toolbar .btn:not(.btn-gold) {
    flex: 1 1 calc(50% - 10px);
  }

  .share {
    flex-direction: column;
  }

  .share .qq-label,
  .share .btn {
    width: 100%;
    flex: none;
  }
}
