:root {
  font-family: system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans CJK SC', sans-serif;
  color: #e8f1f2;
  background: #020304;
  --panel: rgba(6, 19, 27, 0.78);
  --panel-hi: rgba(14, 38, 50, 0.92);
  --edge: rgba(127, 227, 255, 0.26);
  --edge-hi: rgba(127, 227, 255, 0.75);
  --crystal: #7fe3ff;
  --gold: #f3cf6e;
  --muted: #9db6bd;
  --u: clamp(12px, 1.6vh, 18px);
  --serif: 'Songti SC', 'STSong', 'Noto Serif CJK SC', Georgia, serif;
}
html,
body {
  margin: 0;
  min-height: 100%;
  background: #020304;
}
body {
  overflow-x: hidden;
  font-size: var(--u);
}
.bg,
.bg i {
  position: fixed;
  inset: 0;
}
.bg i {
  background-repeat: repeat-x;
  background-size: auto 100%;
  background-position: 0 0;
}
.bg__far {
  background-image: url(assets/scene/cave-v6/far.jpg);
  filter: brightness(0.8);
  animation: drift 160s linear infinite;
}
.bg__mid {
  background-image: url(assets/scene/cave-v6/mid.png);
  filter: brightness(0.8);
  animation: drift 90s linear infinite;
}
.bg__ground {
  background-image: url(assets/scene/cave-v6/ground.png);
  background-size: auto 150%;
  background-position: 0 70%;
  animation: drift 45s linear infinite;
}
.bg__fore {
  background-image: url(assets/scene/cave-v6/fore.png);
  animation: drift 38s linear infinite;
  opacity: 0.9;
}
.bg::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 55%, rgba(2, 12, 18, 0.25), rgba(1, 6, 9, 0.82) 75%);
}
@keyframes drift {
  to {
    background-position-x: -3200px;
  }
}
.start {
  position: relative;
  min-height: 100vh;
  box-sizing: border-box;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  justify-items: center;
  gap: calc(var(--u) * 1.4);
  padding: calc(var(--u) * 3) calc(var(--u) * 2) calc(var(--u) * 1.6);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
body.ready .start {
  opacity: 1;
  transform: none;
}
body.leaving .start {
  opacity: 0;
  transition-duration: 0.2s;
}
.start__head {
  text-align: center;
}
.start__title {
  margin: 0;
  font: 700 calc(var(--u) * 4.4) var(--serif);
  letter-spacing: 0.14em;
  color: var(--gold);
  text-shadow: 0 3px 12px #000, 0 0 36px rgba(127, 227, 255, 0.35);
}
.start__tagline {
  margin: 0.6em 0 0;
  color: #cfe3e7;
  font-size: calc(var(--u) * 1.15);
  text-shadow: 0 1px 6px #000;
}
.pick {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: calc(var(--u) * 0.9);
}
.pick__title {
  margin: 0;
  font-size: calc(var(--u) * 1.05);
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--crystal);
}
.heroes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: calc(var(--u) * 1.2);
}
.hero {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  justify-items: center;
  gap: 0.5em;
  width: calc(var(--u) * 17);
  padding: calc(var(--u) * 1) calc(var(--u) * 1.1) calc(var(--u) * 1.1);
  border-radius: calc(var(--u) * 1.2);
  border: 1px solid var(--edge);
  background: linear-gradient(170deg, var(--panel-hi), var(--panel));
  color: inherit;
  font: inherit;
  text-align: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}
.hero:not(.hero--locked):hover {
  transform: translateY(-4px);
  border-color: var(--edge-hi);
}
.hero:not(.hero--locked):active {
  transform: translateY(-1px) scale(0.99);
}
.hero--on {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 0 34px rgba(243, 207, 110, 0.28), 0 14px 34px rgba(0, 0, 0, 0.5);
}
.hero--on::after {
  content: '✓';
  position: absolute;
  top: 0.6em;
  right: 0.7em;
  display: grid;
  place-items: center;
  width: 1.7em;
  height: 1.7em;
  border-radius: 50%;
  background: var(--gold);
  color: #2a1d05;
  font-weight: 800;
}
.hero:focus-visible,
.cta:focus-visible,
.ghost:focus-visible,
.seg-ctl button:focus-visible,
.card button:focus-visible {
  outline: 3px solid var(--crystal);
  outline-offset: 3px;
}
.hero__art {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: calc(var(--u) * 13);
  min-height: 0;
  overflow: hidden;
  width: 100%;
  border-radius: 0.8em;
  background: radial-gradient(ellipse at 50% 85%, rgba(127, 227, 255, 0.22), transparent 65%);
}
.hero__art img {
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.6));
}
.hero__name {
  display: grid;
  font: 700 calc(var(--u) * 1.6) var(--serif);
  color: var(--gold);
}
.hero__name small {
  font: 600 calc(var(--u) * 0.85) system-ui, sans-serif;
  color: var(--crystal);
  letter-spacing: 0.08em;
}
.hero__desc {
  font-size: calc(var(--u) * 0.92);
  line-height: 1.5;
  color: #cfe3e7;
}
.hero__vs {
  display: flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.3em 0.8em 0.3em 0.3em;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
  font-size: calc(var(--u) * 0.88);
  color: var(--muted);
}
.hero__vs img {
  width: 1.9em;
  height: 1.9em;
  border-radius: 50%;
  border: 1px solid var(--edge-hi);
}
.hero__vs b {
  color: #e8f1f2;
}
.hero__vs em {
  font-style: normal;
  padding: 0 0.45em;
  border-radius: 0.6em;
  background: rgba(127, 227, 255, 0.14);
}
.hero--locked {
  cursor: not-allowed;
  opacity: 0.55;
  grid-template-rows: auto auto 1fr;
}
.hero__art--group {
  display: grid;
  grid-template-columns: repeat(2, auto);
  place-content: center;
  gap: 0.5em;
}
.hero__art--group img {
  height: auto;
  width: calc(var(--u) * 4.4);
  height: calc(var(--u) * 4.4);
  border-radius: 50%;
  filter: grayscale(0.8) brightness(0.8);
  border: 1px solid var(--edge);
}
.start__actions {
  display: grid;
  justify-items: center;
  gap: calc(var(--u) * 0.9);
}
.cta {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  padding: 0.75em 2.2em;
  border-radius: 999px;
  border: 1px solid #ffe39a;
  background: linear-gradient(170deg, #f3cf6e, #c9952f);
  color: #2a1d05;
  font: 800 calc(var(--u) * 1.45) var(--serif);
  letter-spacing: 0.1em;
  cursor: pointer;
  box-shadow: 0 0 30px rgba(243, 207, 110, 0.35), 0 10px 24px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
.cta:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: 0 0 44px rgba(243, 207, 110, 0.5), 0 12px 28px rgba(0, 0, 0, 0.5);
}
.cta:active {
  transform: translateY(1px) scale(0.98);
}
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 1.6em;
  height: 1.6em;
  padding: 0 0.35em;
  border-radius: 0.35em;
  border: 1px solid currentColor;
  font: 700 0.55em ui-monospace, Menlo, monospace;
  letter-spacing: 0;
  opacity: 0.7;
}
.start__minor {
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 0.8);
}
.ghost {
  padding: 0.5em 1.1em;
  border-radius: 999px;
  border: 1px solid var(--edge-hi);
  background: var(--panel);
  color: #e8f1f2;
  font: 600 calc(var(--u) * 0.95) system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.15s ease;
}
.ghost:hover {
  background: var(--panel-hi);
}
.seg-ctl {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--edge);
}
.seg-ctl button {
  padding: 0.35em 0.9em;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 600 calc(var(--u) * 0.9) system-ui, sans-serif;
  cursor: pointer;
}
.seg-ctl button:hover {
  color: #fff;
}
.seg-ctl button.on {
  background: rgba(127, 227, 255, 0.2);
  color: #fff;
  box-shadow: inset 0 0 0 1px var(--edge-hi);
}
.start__foot {
  margin: 0;
  color: var(--muted);
  font-size: calc(var(--u) * 0.85);
  text-align: center;
  text-shadow: 0 1px 4px #000;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  animation: fade 0.2s ease;
}
.modal[hidden] {
  display: none;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.card {
  width: min(calc(var(--u) * 36), 90vw);
  padding: calc(var(--u) * 1.5) calc(var(--u) * 1.8);
  border-radius: calc(var(--u) * 1.2);
  background: radial-gradient(ellipse at 50% -20%, rgba(127, 227, 255, 0.16), transparent 60%), linear-gradient(170deg, #10303b, #071820 70%);
  border: 1px solid var(--edge-hi);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
  animation: pop 0.25s ease;
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
}
.card h2 {
  margin: 0 0 0.4em;
  font: 700 calc(var(--u) * 1.9) var(--serif);
  color: var(--gold);
}
.rules {
  list-style: none;
  margin: 0.5em 0 0.8em;
  padding: 0;
  display: grid;
  gap: 0.7em;
}
.rules li {
  display: grid;
  grid-template-columns: 2.8em 1fr;
  gap: 0.8em;
  align-items: center;
  line-height: 1.45;
}
.rules img {
  width: 2.8em;
  height: 2.8em;
  object-fit: contain;
  border-radius: 0.6em;
  background: rgba(127, 227, 255, 0.08);
}
.small {
  font-size: 0.85em;
  color: var(--muted);
}
.card__actions {
  display: flex;
  justify-content: flex-end;
}
.card .primary {
  padding: 0.6em 1.3em;
  border-radius: 0.75em;
  border: 1px solid #ffe39a;
  background: linear-gradient(170deg, #f3cf6e, #c9952f);
  color: #2a1d05;
  font: 700 1em system-ui, sans-serif;
  cursor: pointer;
}
.card .primary:hover {
  filter: brightness(1.1);
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}
.deckpick { display: grid; justify-items: center; gap: calc(var(--u) * 0.6); }
.deckpick__opts { display: flex; gap: calc(var(--u) * 0.8); flex-wrap: wrap; justify-content: center; }
.deckpick__opts button { min-height: 44px; display: grid; gap: 2px; padding: calc(var(--u) * 0.5) calc(var(--u) * 1.2); color: #e8f1f2; font: inherit; font-size: calc(var(--u) * 1); background: rgba(8, 24, 32, 0.7); border: 1px solid rgba(120, 200, 215, 0.35); border-radius: 12px; cursor: pointer; }
.deckpick__opts button small { font-size: calc(var(--u) * 0.8); opacity: 0.75; }
.deckpick__opts button.on { border-color: #f3cf6e; background: rgba(243, 207, 110, 0.16); }
.deckpick__opts button:focus-visible { outline: 2px solid #7fe3f0; outline-offset: 2px; }
