:root {
  color-scheme: dark;
  font: 16px/1.6 system-ui, "Malgun Gothic", sans-serif;
  background: #0b1014;
  color: #dce5eb;
  --muted: #b4c1cb;
  --steel: #b0c9d8;
  --line: #485762;
  --edge: #6a7f8e;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; isolation: isolate; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, #0a0b0c22, #0a0b0c75),
    url("battle-backdrop.jpg") center / cover no-repeat, #0c0c0d;
}
main { --gutter: clamp(1rem, 5vw, 5rem); max-width: 94rem; margin: auto; padding: 0 var(--gutter) 2rem; }
header { padding: clamp(1rem, 4vw, 3rem) 0; }
.brand { display: block; width: clamp(5.2rem, 9vw, 7rem); }
.brand img, .hero h1 img { display: block; width: 100%; height: auto; }
h1, h2, h3, h4, p { margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(2.2rem, 7vw, 4rem); line-height: 1.15; margin-block: .4rem .8rem; }
h2 { font-size: 1.22rem; margin-bottom: .85rem; }
header > :last-child, footer, .notice, .condition, details > p { color: var(--muted); }
.panel { background: #111a21e6; border: 1px solid var(--line); padding: clamp(1rem, 3vw, 1.8rem); margin-bottom: 1rem; }
.step { display: inline-block; color: var(--steel); margin-right: .4rem; font-size: .85em; }
.classes, .controls, .cards { display: grid; gap: .75rem; }
.classes { grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); }
.controls { grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
button, select, input {
  width: 100%; padding: .65rem; min-height: 2.85rem; border: 1px solid var(--edge);
  background: #1b2832; color: inherit; font: inherit;
}
button, select, summary { cursor: pointer; }
label { min-width: 0; }
label > :is(input, select) { margin-top: .25rem; }
button:hover { border-color: var(--steel); }
button[aria-pressed="true"] { border-color: var(--steel); background: #304756; color: #eef6fa; font-weight: 700; }
:focus-visible { outline: 2px solid var(--steel); outline-offset: 3px; }
:disabled { cursor: not-allowed; opacity: .65; }
.cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.cards:not(:empty) { margin-top: .9rem; }
.card { min-width: 0; padding: 1rem; border: 1px solid var(--line); background: linear-gradient(145deg, #243440e8, #151e26f0 60%); }
.card h4 { font-size: 1.05rem; }
.gem-heading { display: flex; align-items: center; gap: .55rem; }
.gem-icon { flex: 0 0 auto; object-fit: contain; }
.category { color: var(--steel); font-size: .82rem; }
.effect, .condition { font-size: .9rem; margin-top: .35rem; }
.tiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .32rem; margin: .8rem 0 .45rem; }
.tier { text-align: center; background: #10191f; border-top: 1px solid var(--edge); padding: .36rem .2rem; }
.tier:last-child { border-color: var(--steel); }
.tier dt { color: var(--muted); font-size: .76rem; }
.tier dd { margin: 0; font-size: .87rem; font-weight: 650; color: #deedf5; overflow-wrap: anywhere; }
details { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: .75rem; }
summary { color: var(--steel); }
details > p, footer { font-size: .83rem; }
footer { padding: .4rem 0 1rem; }
a { color: var(--steel); }
.fan-notice {
  max-width: 94rem; margin: auto; padding: .5rem clamp(1rem, 5vw, 5rem);
  border-bottom: 1px solid var(--line); background: #0c141bf5;
  color: var(--muted); font-size: .82rem; text-align: center;
}
.fan-notice strong { color: #e2eaf0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem 1.4rem; flex-wrap: wrap;
  padding: .9rem clamp(1rem, 5vw, 5rem); max-width: 94rem; margin: auto;
  background: #101a22e8; border-bottom: 1px solid var(--line);
}
.topbar a, .overview a, .cta { text-decoration: none; }
.topbar nav { display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
#nav-toggle { display: none; width: auto; }
.topbar nav a { color: inherit; }
.topbar a:hover, .overview a:hover, .next:hover { color: var(--steel); text-decoration: underline; }
.guide-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: clamp(1rem, 4vw, 3rem); align-items: center; }
.hero {
  padding: clamp(1.4rem, 4vw, 3rem) 0 2.4rem;
}
.hero-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .45rem 1rem; margin-bottom: .85rem; }
.hero h1 { width: clamp(13rem, 30vw, 25rem); max-width: 100%; margin: 0; }
.hero-heading, #codex > h2, .source, footer { text-shadow: 0 1px 5px #05090d, 0 0 10px #05090d; }
.hero-heading p { color: var(--muted); font-size: .8rem; letter-spacing: .05em; }
.battle-frame {
  margin: 0; padding: clamp(.35rem, .8vw, .65rem);
  border: 1px solid var(--edge);
  background: repeating-linear-gradient(123deg, #ffffff06 0 1px, transparent 1px 5px),
    linear-gradient(140deg, #5368776b, #111b2424 27%, #17263124 75%, #4357666b);
  box-shadow: inset 0 0 0 2px #121212, 0 .85rem 2.8rem #0008;
}
.battle-screen {
  position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9;
  width: 100%; border: 1px solid #080808;
  background: #0a0b0c38;
}
.battle-screen::before, .battle-screen::after {
  content: ""; pointer-events: none; position: absolute; width: clamp(1rem, 2.6vw, 2.2rem); aspect-ratio: 1;
  border: solid var(--steel); opacity: .8;
}
.battle-screen::before { top: .55rem; left: .55rem; border-width: 1px 0 0 1px; }
.battle-screen::after { bottom: .55rem; right: .55rem; border-width: 0 1px 1px 0; }
.battle-screen video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.guide-video { min-width: 0; align-self: start; }
.gem-demo { display: grid; align-content: start; gap: .75rem; min-width: 0; }
.battle-caption { display: flex; justify-content: space-between; gap: .7rem; padding: .48rem .3rem .1rem; color: var(--muted); font-size: .75rem; letter-spacing: .07em; }
.overview span, .source { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1.2rem; }
.cta { display: inline-block; min-height: 3rem; padding: .63rem 1.25rem; border: 1px solid #885e65; color: #f2e7ea; background: linear-gradient(#493039, #2c1c23); font-weight: 650; }
.cta.secondary { background: #16222add; color: #e1edf4; border-color: var(--edge); }
.cta:hover { text-decoration: underline; }
.overview { position: relative; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: 1px; border: 1px solid var(--line); background: var(--line); margin-bottom: 3rem; }
.overview a { display: grid; padding: clamp(.85rem, 2vw, 1.4rem); background: linear-gradient(145deg, #23313ce8, #111b23ed 65%); color: inherit; }
.overview small { color: var(--steel); font: 1.35rem Georgia, serif; margin-bottom: .35rem; }
.overview span { font-size: .85rem; }
.guide { margin-bottom: 2.5rem; }
.guide.panel { border-inline: 0; background: linear-gradient(120deg, #1c2a35e8, #0f181fe8 76%); }
.guide > h2 small { display: block; font-size: .72rem; color: var(--steel); letter-spacing: .17em; }
.guide h3 { margin: .6rem 0 .4rem; }
.guide h3:not(:first-child) { margin-top: 1.1rem; }
.guide .panel > h3 { margin: 0 0 .85rem; }
.guide .section-title, .guide > h2 { font-size: clamp(1.45rem, 3vw, 2rem); }
.source { margin-bottom: .85rem; font-size: .85rem; }
.guide-steps { padding-left: 1.55rem; margin: .7rem 0; }
.guide-steps li + li { margin-top: .3rem; }
.next { display: inline-block; margin-top: .85rem; }
.media-slot {
  display: grid; place-content: center; gap: .3rem; min-height: 10rem; padding: 1rem; text-align: center;
  border: 1px solid var(--line); color: var(--muted);
  background: repeating-linear-gradient(130deg, #6c849218 0 1px, transparent 1px 9px), #111b23d9;
}
.media-slot strong { color: var(--steel); }
.socket-figure { margin: 0; padding: 1.8rem 1rem; text-align: center; color: var(--muted); border: 1px solid var(--line); background: radial-gradient(ellipse at 50% 45%, #2c454fe8, #121c24ef 75%); }
.socket-figure figcaption { margin-top: 1.2rem; font-size: .83rem; }
.socket-links { --socket-size: clamp(2.5rem, 5vw, 3.6rem); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: relative; max-width: 23rem; margin: auto; padding: 0; list-style: none; }
.socket-links::before { content: ""; position: absolute; left: 12.5%; right: 12.5%; top: calc(var(--socket-size) / 2); height: 2px; background: var(--steel); }
.socket-links li { position: relative; display: grid; justify-items: center; align-content: start; gap: .45rem; }
.socket-cell { display: grid; place-items: center; width: var(--socket-size); aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--edge); background: #121b22; }
.socket-links li:first-child .socket-cell { border-radius: .12rem; }
.socket-name { color: #e2eaf0; font-size: .75rem; }
.socket-links img { display: block; width: 90%; height: auto; }
@media (max-width: 45rem) {
  body::before { background-position: center, right center; }
  #nav-toggle { display: block; }
  #nav-toggle[aria-expanded="false"] + nav { display: none; }
  .topbar nav { flex-basis: 100%; }
  .guide-layout { grid-template-columns: 1fr; }
  .hero { padding-bottom: 1.7rem; }
  .hero-heading { display: grid; }
}
