/* KCSM website — deep-space violet / stellar blue / gold (aligned with in-game UI) */

@font-face {
  font-family: 'Warhaven';
  src: url('Warhaven_Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --void: #0b0818;
  --panel: #16122e;
  --panel-2: #1c1738;
  --ink: #ede9fa;
  --haze: #9a93c4;
  --stellar: #6fa8fd;
  --stellar-deep: #4788e0;
  --gold: #e2c288;
  --gold-soft: #f4e0b8;
  --edge: #3d3566;
  --edge-strong: #a2a2ff;
  --danger: #f0709c;
  --wrap: 880px;
  --pad: 24px;
  --font-display: 'Warhaven', Georgia, "Times New Roman", serif;
  --font-body: 'Warhaven', "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-data: 'Warhaven', "Cascadia Code", Consolas, "SF Mono", monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background:
    radial-gradient(ellipse 120% 60% at 50% -10%, rgba(112, 80, 200, 0.28), transparent 55%),
    radial-gradient(ellipse 80% 40% at 90% 100%, rgba(71, 136, 224, 0.12), transparent 50%),
    var(--void);
  -webkit-font-smoothing: antialiased;
}

/* subtle starfield */
.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1px 1px at 28% 72%, rgba(180, 200, 255, 0.35), transparent),
    radial-gradient(1.5px 1.5px at 55% 28%, rgba(255, 230, 180, 0.4), transparent),
    radial-gradient(1px 1px at 72% 58%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1px 1px at 88% 22%, rgba(111, 168, 253, 0.45), transparent),
    radial-gradient(1px 1px at 40% 90%, rgba(255, 255, 255, 0.25), transparent),
    radial-gradient(1.5px 1.5px at 8% 48%, rgba(226, 194, 136, 0.35), transparent);
  opacity: 0.7;
}

/* 桌面：靠左中，宽 30vw、高 80vh */
#spine-bg {
  position: fixed;
  left: -3%;
  top: 60%;
  transform: translateY(-50%);
  width: 40vw;
  height: 80vh;
  z-index: 0;
  pointer-events: none;
  border: 0;
  box-shadow: none;
  background: transparent !important;
}
#spine-bg.spine-player,
#spine-bg .spine-player,
#spine-bg .spine-player-background,
#spine-bg canvas {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
#spine-bg .spine-player-background,
#spine-bg .spine-player-controls {
  display: none !important;
}

/* PC 右侧对称：Noah（水平镜像，位置与 Kalpa 对称） */
#spine-bg-noah {
  position: fixed;
  right: 0;
  top: 60%;
  transform: translateY(-50%) scaleX(-1) !important;
  width: 25vw;
  height: 60vh;
  z-index: 0;
  pointer-events: none;
  border: 0;
  box-shadow: none;
  background: transparent !important;
  display: none;
}
@media (min-width: 901px) {
  #spine-bg-noah {
    display: block;
  }
}
#spine-bg-noah.spine-player,
#spine-bg-noah .spine-player,
#spine-bg-noah .spine-player-background,
#spine-bg-noah canvas {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
#spine-bg-noah .spine-player-background,
#spine-bg-noah .spine-player-controls {
  display: none !important;
}

/* 语言切换 */
.lang-switch {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 20;
  display: flex;
  gap: 6px;
}
.lang-switch button {
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid rgba(162, 162, 255, 0.35);
  border-radius: 2px;
  background: rgba(10, 7, 22, 0.55);
  color: var(--ink);
  font-family: var(--font-data);
  font-size: 12px;
  letter-spacing: 0.06em;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.lang-switch button:hover {
  border-color: var(--edge-strong);
}
.lang-switch button:focus-visible {
  outline: 2px solid var(--stellar);
  outline-offset: 2px;
}
.lang-switch button.active {
  border-color: var(--stellar);
  color: var(--stellar);
}

/* 手机：贴页面底部、宽度 140%、只露出上半身 */
@media (max-width: 900px) {
  #spine-bg {
    left: 45%;
    right: auto;
    top: auto;
    bottom: 0;
    width: 160%;
    height: 100vh;
    /* 居中 + 下移半个视口，裁掉下半身 */
    transform: translate(-50%, 45%);
    /* 压暗用 brightness，不用 opacity，避免重叠时互相透出 */
    filter: brightness(0.42) saturate(0.85);
    opacity: 1;
  }

  /* Noah：正下偏右，只露上半身 + 镜像 */
  #spine-bg-noah {
    display: block;
    left: 67%;
    right: auto;
    top: auto;
    bottom: 0;
    width: 90%;
    height: 75vh;
    transform: translate(-50%, 45%) scaleX(-1) !important;
    filter: brightness(0.42) saturate(0.85);
    opacity: 1;
  }
}

.wrap {
  position: relative;
  z-index: 1;
  width: min(100% - 2 * var(--pad), var(--wrap));
  margin-inline: auto;
}

.btn:focus-visible,
.dl-btn:focus-visible {
  outline: 2px solid var(--stellar);
  outline-offset: 2px;
}

/* ---------- hero ---------- */
.hero {
  padding: 72px 0 56px;
  border-bottom: 1px solid var(--edge);
}

.hero-title {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.05;
}

.hero-line {
  display: block;
  font-size: clamp(48px, 10vw, 72px);
  letter-spacing: 0.18em;
  background: linear-gradient(180deg, #f4e0b8 0%, #eecd92 45%, #caa466 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  display: block;
  margin-top: 10px;
  font-size: clamp(18px, 3.2vw, 24px);
  letter-spacing: 0.06em;
  color: var(--ink);
  font-weight: 400;
}

.hero-lead {
  margin: 0 0 28px;
  max-width: 36em;
  color: var(--haze);
  font-size: 17px;
}

.hero-lead em {
  color: var(--ink);
  font-style: normal;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 2px;
  border: 1.5px solid transparent;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  color: #0b0818;
  background: linear-gradient(180deg, #a7d0f8 0%, #6fa8fd 55%, #4788e0 100%);
  border-color: rgba(167, 208, 248, 0.6);
}

.btn-primary:hover {
  filter: brightness(1.08);
}

/* ---------- sections ---------- */
.section {
  padding: 48px 0;
  border-bottom: 1px solid var(--edge);
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 22px;
}

.sec-num {
  font-family: var(--font-data);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--gold);
}

.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.prose p {
  margin: 0 0 1em;
  color: var(--haze);
  max-width: 42em;
}

.prose p:last-child {
  margin-bottom: 0;
}

.prose strong,
.prose em {
  color: var(--ink);
  font-style: normal;
}

code {
  font-family: var(--font-data);
  font-size: 0.9em;
  color: var(--stellar);
  background: rgba(111, 168, 253, 0.1);
  padding: 1px 6px;
  border-radius: 2px;
}

/* ruled feature list — no card grid */
.ruled-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--edge);
}

.ruled-list li {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--edge);
}

.ruled-key {
  font-family: var(--font-data);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--gold);
  padding-top: 2px;
}

.ruled-val {
  color: var(--haze);
}

/* flow */
.flow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.flow li {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--edge);
}

.flow li:first-child {
  border-top: 1px solid var(--edge);
}

.flow-i {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--edge-strong);
  border-radius: 2px;
  font-family: var(--font-data);
  font-size: 13px;
  color: var(--stellar);
  background: rgba(16, 14, 44, 0.5);
}

.flow strong {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

.flow p {
  margin: 0;
  color: var(--haze);
  font-size: 15px;
}

/* download rows */
.dl-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--edge);
  margin-bottom: 28px;
}

.dl-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 22px 0;
  border-bottom: 1px solid var(--edge);
}

.dl-row h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dl-main p {
  margin: 0 0 6px;
  color: var(--haze);
  font-size: 15px;
  max-width: 40em;
}

.dl-btn {
  min-width: 120px;
  white-space: nowrap;
}

.requirements h3 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.requirements ul {
  margin: 0;
  padding-left: 1.2em;
  color: var(--haze);
  font-size: 14px;
}

.requirements li {
  margin-bottom: 6px;
}

.requirements em {
  font-style: normal;
  color: var(--ink);
}

/* footer */
.foot {
  padding: 36px 0 48px;
}

.foot-inner {
  text-align: center;
}

.foot p {
  margin: 0;
  font-family: var(--font-data);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--haze);
}

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .hero {
    padding-top: 48px;
  }

  .ruled-list li {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .dl-row {
    grid-template-columns: 1fr;
  }

  .dl-btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .btn {
    transition: none;
  }
}
