:root {
  --bg: #07080b;
  --panel: rgba(13, 14, 19, 0.82);
  --line: rgba(214, 175, 94, 0.38);
  --line-soft: rgba(214, 175, 94, 0.16);
  --gold: #d6af5e;
  --gold-hi: #f3d58c;
  --text: #e9e3d5;
  --dim: #9c9584;
  --fire: #e8492c;
  --earth: #8a5a2b;
  --earth-green: #6c9a3f;
  --water: #3a8be0;
  --wind: #ffffff;
  --radius: 10px;
  --max: 1100px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(1200px 600px at 50% 700px, #141720 0%, transparent 70%);
  color: var(--text);
  font: 15px/1.6 Inter, system-ui, sans-serif;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; }
ul { margin: 0; padding: 0; list-style: none; }

/* Flanking characters, like the classic portal */
.side {
  position: absolute;
  top: 640px;
  width: 520px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent);
  mask-image: linear-gradient(to bottom, #000 70%, transparent);
}
.side-left { left: calc(50% - 550px - 440px); }
.side-right { right: calc(50% - 550px - 440px); }
@media (max-width: 1500px) { .side { opacity: 0.2; } }
@media (max-width: 1200px) { .side { display: none; } }

/* Hero */
.hero {
  position: relative;
  height: 640px;
  overflow: hidden;
}
.hero-art {
  position: absolute;
  inset: 0;
  background: url(/img/hero.webp?v=4) right center / cover no-repeat;
  animation: drift 30s ease-in-out infinite alternate;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, rgba(7, 8, 11, 0.75) 0%, rgba(7, 8, 11, 0.1) 45%, transparent 70%),
    linear-gradient(to bottom, transparent 55%, var(--bg) 100%);
}
@keyframes drift { from { transform: scale(1.02); } to { transform: scale(1.08) translateX(-1%); } }
@media (prefers-reduced-motion: reduce) { .hero-art { animation: none; } }

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: var(--max);
  margin: 0 auto;
  padding: 120px 16px 0;
}
.logo img { width: min(480px, 88vw); height: auto; filter: drop-shadow(0 6px 24px rgba(0, 0, 0, 0.7)); }
.tagline {
  font-family: Cinzel, serif;
  font-size: 22px;
  letter-spacing: 0.08em;
  margin: 18px 0 28px;
  text-shadow: 0 2px 12px #000;
}
.btn-primary {
  display: inline-block;
  padding: 13px 30px;
  font-family: Cinzel, serif;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  color: #1a1306;
  background: linear-gradient(#f6dc96, #c9993f);
  border: 1px solid #f9e6b0;
  border-radius: 4px;
  box-shadow: 0 0 24px rgba(214, 175, 94, 0.35);
  transition: box-shadow 0.2s, transform 0.2s;
}
.btn-primary:hover { box-shadow: 0 0 36px rgba(243, 213, 140, 0.6); transform: translateY(-1px); }

.status {
  position: absolute;
  z-index: 2;
  right: max(16px, calc(50% - 550px));
  bottom: 22px;
  padding: 5px 14px;
  font-size: 13px;
  color: var(--dim);
  background: rgba(10, 11, 15, 0.7);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  backdrop-filter: blur(6px);
}
.dot { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--dim); }

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(9, 10, 14, 0.86);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.6), 0 10px 30px rgba(0, 0, 0, 0.4);
}
.nav-links {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  justify-content: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-links a {
  padding: 15px 18px;
  font-family: Cinzel, serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  color: var(--text);
  opacity: 0.78;
  border-bottom: 2px solid transparent;
  transition: opacity 0.2s, border-color 0.2s;
}
.nav-links a:hover { opacity: 1; border-bottom-color: var(--line); }

/* Layout */
.wrap {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 24px auto 0;
  padding: 0 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
}
.main, .side-col { display: grid; gap: 16px; }

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 20px 22px 22px;
  backdrop-filter: blur(8px);
  scroll-margin-top: 70px;
}
.panel::before {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}
.panel-title {
  font-family: Cinzel, serif;
  font-size: 20px;
  padding-bottom: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
}
.lead { margin: -6px 0 16px; color: var(--dim); }
.note { margin: 0 0 12px; color: var(--dim); font-size: 13px; }
.sub { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); margin: 18px 0 10px; }

/* Showcase */
.showcase { padding: 0; overflow: hidden; }
.showcase img { width: 100%; aspect-ratio: 16 / 8; object-fit: cover; }
.showcase-text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 60px 22px 18px;
  background: linear-gradient(transparent, rgba(7, 8, 11, 0.92));
}
.showcase-text h2 { font-family: Cinzel, serif; font-size: 26px; }
.showcase-text p { margin: 4px 0 0; max-width: 520px; color: #d7d0c0; }

/* Dev Log timeline */
.tl-month { margin: -4px 0 14px; font: 700 13px Cinzel, serif; letter-spacing: 0.1em; text-transform: uppercase; }
.timeline { position: relative; padding-left: 28px; display: grid; gap: 18px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; display: grid; grid-template-columns: 112px 1fr; gap: 16px; align-items: start; }
.timeline li::before { content: ""; position: absolute; left: -26px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--gold); }
.timeline li:first-child::before { background: var(--gold); box-shadow: 0 0 10px rgba(214, 175, 94, 0.7); }
.timeline img { width: 112px; aspect-ratio: 3 / 2; object-fit: cover; border: 1px solid var(--line-soft); border-radius: 4px; }
.timeline time { display: block; font-size: 12px; color: var(--dim); letter-spacing: 0.04em; }
.timeline h3 { font-size: 15px; color: var(--text); }
.timeline p { margin: 4px 0 0; font-size: 14px; color: #c9c2b2; }

/* Elements */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 0;
  font: 700 14px Cinzel, serif;
  letter-spacing: 0.08em;
  color: var(--dim);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-color: currentColor; }
.tab[data-el="fire"][aria-selected="true"] { color: var(--fire); }
.tab[data-el="earth"][aria-selected="true"] { color: var(--earth-green); }
.tab[data-el="water"][aria-selected="true"] { color: var(--water); }
.tab[data-el="wind"][aria-selected="true"] { color: var(--wind); }

.element { display: grid; grid-template-columns: 260px 1fr; gap: 20px; animation: fade 0.35s ease; }
.element[hidden] { display: none; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.element img { border-radius: 6px; border: 1px solid var(--line-soft); aspect-ratio: 1; object-fit: cover; }
.element h3 { font-family: Cinzel, serif; font-size: 26px; }
.element h3 span { font: 500 13px Inter, sans-serif; color: var(--dim); margin-left: 8px; letter-spacing: 0.06em; text-transform: uppercase; }
.el-fire h3 { color: var(--fire); }
.el-earth h3 { color: var(--earth-green); }
.el-water h3 { color: var(--water); }
.el-wind h3 { color: var(--wind); }
.element .style { color: var(--dim); font-style: italic; margin: 4px 0 6px; }
.element p { margin: 0 0 6px; }
.element dl { margin: 14px 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14px; }
.element dt { color: var(--dim); }
.element dd { margin: 0; }

/* World */
.world { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.world figure { margin: 0; }
.world img { border-radius: 6px; border: 1px solid var(--line-soft); aspect-ratio: 16 / 10; object-fit: cover; }
.world h3 { font-family: Cinzel, serif; font-size: 18px; margin-top: 10px; }
.world p { margin: 2px 0 0; font-size: 14px; color: #c9c2b2; }

/* Features */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 24px; }
.features li { padding-top: 12px; border-top: 1px solid var(--line-soft); }
.features h3 { font-size: 14px; color: var(--text); margin-bottom: 2px; }
.features p { margin: 0; font-size: 13px; color: #c9c2b2; }

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.gallery a { display: block; overflow: hidden; border-radius: 4px; border: 1px solid var(--line-soft); }
.gallery img { aspect-ratio: 16 / 10; object-fit: cover; transition: transform 0.3s; }
.gallery a:hover img { transform: scale(1.06); }

/* Sidebar */
.hall { padding-top: 16px; }
.hall-title {
  font-family: Cinzel, serif;
  font-size: 22px;
  text-align: center;
  color: var(--gold);
  padding: 10px 0;
  margin-bottom: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: radial-gradient(closest-side, rgba(214, 175, 94, 0.12), transparent);
}
.factions { display: grid; gap: 10px; margin-bottom: 12px; }
.factions li { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 10px; }
.factions i { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 10px currentColor; background: currentColor; }
.c-fire { color: var(--fire); }
.c-earth { color: var(--earth-green); background: linear-gradient(135deg, var(--earth), var(--earth-green)) !important; }
.c-water { color: var(--water); }
.c-wind { color: var(--wind); }
.factions span { color: var(--dim); font-size: 13px; }

.rows { display: grid; gap: 4px; font-size: 14px; }
.rows + .rows { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.rows li { display: flex; justify-content: space-between; }
.rows li span:last-child { color: var(--dim); }

.tribes { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 14px; }

.btn-muted {
  width: 100%;
  padding: 11px;
  font: 700 14px Cinzel, serif;
  letter-spacing: 0.08em;
  color: var(--dim);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  cursor: not-allowed;
}
.req { font-size: 13px; color: #c9c2b2; display: grid; gap: 10px; }
.req li { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; }
.req svg { width: 20px; height: 20px; color: var(--dim); }

/* Footer */
.footer {
  position: relative;
  z-index: 1;
  margin-top: 40px;
  padding: 28px 16px 40px;
  text-align: center;
  background: #040506;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  color: var(--dim);
}
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-bottom: 10px; }
.footer-links a { text-decoration: none; color: var(--text); }
.footer-links a:hover { color: var(--gold-hi); }
.footer p { margin: 0; }

/* Lightbox */
.lightbox { padding: 0; border: 1px solid var(--line); border-radius: 6px; background: #000; max-width: 94vw; max-height: 90vh; }
.lightbox::backdrop { background: rgba(0, 0, 0, 0.85); }
.lightbox img { max-height: 88vh; width: auto; }
.lightbox button { position: absolute; top: 6px; right: 10px; font-size: 28px; color: #fff; background: none; border: 0; cursor: pointer; }

/* Responsive */
@media (max-width: 900px) {
  .wrap { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .hero { height: 620px; }
  .hero-art { background: #081e3b url(/img/hero.webp?v=4) 78% 100% / auto 62% no-repeat; animation: none; }
  .hero::after { background: linear-gradient(to bottom, transparent 75%, var(--bg) 100%); }
  .hero-inner { padding-top: 60px; text-align: center; }
  .logo img { margin: 0 auto; width: min(320px, 82vw); }
  .tagline { margin-left: 0; font-size: 18px; }
  .btn-primary { margin-left: 0; }
  .status { right: 16px; }
  .nav-links { justify-content: flex-start; }
  .nav-links a { padding: 13px 12px; font-size: 13px; }
  .panel { padding: 16px; }
  .element { grid-template-columns: 1fr; }
  .element img { aspect-ratio: 16 / 10; object-position: center 40%; }
  .tab { font-size: 12px; letter-spacing: 0.04em; }
  .showcase-text { position: static; padding: 14px 16px 16px; background: none; }
  .world { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: 1fr 1fr; }
  .timeline { padding-left: 24px; }
  .timeline li { grid-template-columns: 80px 1fr; gap: 12px; }
  .timeline li::before { left: -22px; }
  .timeline::before { left: 5px; }
  .timeline img { width: 80px; }
}

/* Keyboard focus */
a:focus-visible, button:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; border-radius: 3px; }

@media (max-width: 640px) {
  .nav-links { -webkit-mask-image: linear-gradient(to right, #000 85%, transparent); mask-image: linear-gradient(to right, #000 85%, transparent); }
  .nav-links a:last-child { padding-right: 40px; }
  .features { gap: 14px; }
}

.tab img { width: 28px; height: 28px; opacity: 0.55; transition: opacity 0.2s; }
.tab:hover img, .tab[aria-selected="true"] img { opacity: 1; }
.element h3 { display: flex; align-items: center; gap: 10px; }
.el-icon { width: 40px; height: 40px; }
@media (max-width: 640px) {
  .tab { flex-direction: column; gap: 4px; }
}

/* Element wheel */
.wheel { display: block; width: 100%; max-width: 520px; margin: 0 auto 20px; }
.wheel .quad { cursor: pointer; outline: none; }
.wheel .quad path { transition: filter 0.2s; }
.wheel .quad:hover path, .wheel .quad:focus-visible path { filter: brightness(1.15); }
.wheel .quad:focus-visible path { stroke: var(--gold-hi); stroke-width: 3; }
.wheel .wc { font: 700 18px Cinzel, serif; fill: #fff; text-anchor: middle; letter-spacing: 0.06em; }
.wheel .wc-dark { fill: #1c2230; }
.wheel .wl text { font: 600 15px Inter, sans-serif; fill: var(--text); text-anchor: middle; }
