:root {
  color-scheme: dark;
  --ink: #f8efd7;
  --ink-dark: #24180f;
  --muted: #d8c9a6;
  --parchment: #e8d4a8;
  --parchment-deep: #b98f55;
  --royal-blue: #14233f;
  --royal-blue-soft: #1f3459;
  --night: #081225;
  --gold: #d7a83f;
  --gold-bright: #f0c766;
  --moss: #516a43;
  --wine: #743441;
  --shadow: rgba(0, 0, 0, 0.36);
  font-family: ui-serif, Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--night);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 0%, rgba(215, 168, 63, 0.16), transparent 30%),
    linear-gradient(180deg, #0c1830 0%, #111c2e 46%, #0b1426 100%);
}

body.play-page {
  background:
    radial-gradient(circle at 50% 0%, rgba(215, 168, 63, 0.14), transparent 26%),
    radial-gradient(circle at 50% 42%, rgba(240, 199, 102, 0.08), transparent 38%),
    linear-gradient(180deg, #091121 0%, #0d172a 42%, #08101d 100%);
}

img,
iframe,
canvas {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

code {
  color: #fff4c8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 74px;
  padding: 12px clamp(16px, 4vw, 58px);
  background: rgba(8, 18, 37, 0.92);
  border-bottom: 1px solid rgba(240, 199, 102, 0.24);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.2);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  font-size: clamp(1.05rem, 2vw, 1.32rem);
  font-weight: 800;
}

.brand-link img,
.hero-logo,
.unity-loading img {
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34);
}

.nav-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.nav-actions a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border: 1px solid rgba(240, 199, 102, 0.28);
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
}

.nav-actions a:hover,
.nav-actions a[aria-current="page"] {
  color: var(--ink);
  background: rgba(240, 199, 102, 0.12);
}

.hero {
  min-height: 78svh;
  display: grid;
  align-items: center;
  padding: clamp(72px, 12vh, 128px) clamp(18px, 5vw, 78px) clamp(44px, 8vh, 82px);
  background-image:
    linear-gradient(90deg, rgba(8, 18, 37, 0.88), rgba(8, 18, 37, 0.66) 46%, rgba(8, 18, 37, 0.22)),
    url("hero-kingdom.jpg");
  background-position: center;
  background-size: cover;
  border-bottom: 1px solid rgba(240, 199, 102, 0.18);
}

.hero-content,
.page-hero,
.play-heading {
  width: min(760px, 100%);
}

.hero-logo {
  width: clamp(76px, 11vw, 112px);
  height: clamp(76px, 11vw, 112px);
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold-bright);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.3;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 10ch;
  font-size: clamp(3.2rem, 9vw, 7.2rem);
  line-height: 0.98;
}

h2 {
  font-size: clamp(2rem, 4.8vw, 4rem);
  line-height: 1.04;
}

h3 {
  color: #fff3cc;
  font-size: 1.25rem;
  line-height: 1.18;
}

.tagline,
.page-lede {
  margin: 20px 0 0;
  color: var(--ink);
  font-size: clamp(1.18rem, 2.8vw, 2rem);
  line-height: 1.32;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.button {
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  border: 1px solid rgba(240, 199, 102, 0.38);
  border-radius: 8px;
  background: rgba(20, 35, 63, 0.86);
  color: var(--ink);
  cursor: pointer;
  font: 800 1rem/1.1 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.22);
}

.button:hover {
  transform: translateY(-1px);
  background: var(--royal-blue-soft);
}

.button-primary {
  border-color: rgba(255, 245, 205, 0.62);
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color: var(--ink-dark);
}

.button-primary:hover {
  background: linear-gradient(180deg, #ffd980, #e1b64f);
}

.section,
.page-shell,
.play-shell {
  padding: clamp(54px, 8vw, 96px) clamp(18px, 5vw, 72px);
}

.section-heading {
  width: min(900px, 100%);
  margin: 0 auto 28px;
}

.section-heading p {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.gallery-grid,
.feature-grid {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.screenshot-card,
.feature-card,
.notes-card,
.download-panel,
.troubleshooting-note {
  border: 1px solid rgba(240, 199, 102, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(232, 212, 168, 0.1), rgba(232, 212, 168, 0.04)),
    rgba(20, 35, 63, 0.78);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.24);
}

.screenshot-card {
  margin: 0;
  overflow: hidden;
}

.screenshot-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #111f3a;
}

.screenshot-card figcaption {
  padding: 14px 16px 16px;
  color: var(--muted);
  font-weight: 800;
}

.features-section {
  background:
    linear-gradient(180deg, rgba(232, 212, 168, 0.06), rgba(8, 18, 37, 0.12)),
    rgba(8, 18, 37, 0.28);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.feature-card {
  min-height: 190px;
  padding: 20px;
}

.feature-card p,
.notes-card p,
.troubleshooting-note p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.58;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 28px clamp(18px, 5vw, 72px);
  color: var(--muted);
  background: rgba(8, 18, 37, 0.94);
  border-top: 1px solid rgba(240, 199, 102, 0.2);
}

.page-shell,
.play-shell {
  width: min(1260px, 100%);
  margin: 0 auto;
}

.play-shell-game {
  width: min(1800px, 100%);
  min-height: calc(100svh - 74px);
  padding: clamp(10px, 1.6vh, 18px) clamp(10px, 1.8vw, 22px) 18px;
}

.page-hero,
.play-heading {
  margin-bottom: 28px;
}

.play-heading {
  width: 100%;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.page-hero h1,
.play-heading h1 {
  max-width: none;
  font-size: clamp(2.5rem, 6vw, 5.4rem);
}

.play-shell-game .play-heading h1 {
  font-size: clamp(1.7rem, 3.4vw, 3.1rem);
  line-height: 0.98;
}

.play-lede {
  margin-top: 8px;
  color: var(--muted);
  font-size: clamp(1rem, 1.8vw, 1.25rem);
}

.play-actions {
  flex: 0 0 auto;
  margin-top: 0;
}

.play-status-bar {
  width: min(1700px, 100%);
  display: none;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 22px;
  margin: 0 auto 16px;
  padding: 12px 16px;
  border: 1px solid rgba(240, 199, 102, 0.18);
  border-radius: 8px;
  background: rgba(8, 18, 37, 0.62);
  color: var(--muted);
  font: 700 0.94rem/1.4 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.play-status-bar p {
  margin: 0;
}

.download-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: clamp(20px, 4vw, 34px);
  margin-bottom: 28px;
}

.version-label {
  margin: 0 0 6px;
  color: var(--gold-bright);
  font: 800 0.82rem/1.2 ui-sans-serif, system-ui, sans-serif;
  text-transform: uppercase;
}

.version-value {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
}

.compact-section {
  padding-right: 0;
  padding-left: 0;
}

.notes-card,
.troubleshooting-note {
  width: min(900px, 100%);
  padding: 22px;
}

.webgl-stage {
  width: min(1700px, 100%);
  margin: 0 auto;
}

.webgl-frame-wrap {
  position: relative;
  --frame-height: min(calc(100svh - 198px), 940px);
  width: min(100%, calc(var(--frame-height) * 1.5738));
  height: var(--frame-height);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(240, 199, 102, 0.24);
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 18%, rgba(215, 168, 63, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(240, 199, 102, 0.05), transparent 22%),
    #050914;
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.4);
}

.webgl-frame {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #050914;
  opacity: 1;
}

.loading-note {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  max-width: min(440px, calc(100% - 28px));
  padding: 10px 13px;
  border-radius: 8px;
  background: rgba(8, 18, 37, 0.9);
  color: #fff4c8;
  font: 700 0.92rem/1.2 ui-sans-serif, system-ui, sans-serif;
}

.error-note {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 2;
  max-width: min(480px, calc(100% - 28px));
  padding: 12px 14px;
  border: 1px solid rgba(240, 199, 102, 0.24);
  border-radius: 8px;
  background: rgba(8, 18, 37, 0.92);
  color: var(--muted);
  font: 700 0.92rem/1.45 ui-sans-serif, system-ui, sans-serif;
}

.is-hidden {
  display: none !important;
}

.troubleshooting-note {
  width: min(1700px, 100%);
  margin: 16px auto 0;
  padding: 16px 18px;
}

.troubleshooting-note h2 {
  font-size: clamp(1.25rem, 2vw, 1.7rem);
}

.troubleshooting-note p {
  margin-bottom: 0;
}

.webgl-page {
  min-height: 100vh;
  overflow: hidden;
}

.unity-wrap {
  position: relative;
  min-height: 100vh;
  background: #050914;
}

#unity-canvas {
  width: 100vw;
  height: 100vh;
  background: #050914;
}

.unity-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  padding: 28px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 20%, rgba(215, 168, 63, 0.2), transparent 34%),
    linear-gradient(180deg, #101e39, #050914);
}

.unity-loading h1 {
  max-width: none;
  font-size: clamp(2.4rem, 8vw, 5.6rem);
}

.unity-loading p {
  max-width: 640px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.progress-track {
  width: min(460px, 80vw);
  height: 12px;
  overflow: hidden;
  border: 1px solid rgba(240, 199, 102, 0.3);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
}

.unity-help {
  font-size: 0.9rem;
}

@media (max-width: 920px) {
  .gallery-grid,
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .download-panel {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .site-header,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-actions {
    justify-content: flex-start;
  }

  .hero {
    min-height: 74svh;
  }

  .gallery-grid,
  .feature-grid {
    grid-template-columns: 1fr;
  }

  .button,
  .button-row {
    width: 100%;
  }

  .play-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .play-status-bar {
    flex-direction: column;
  }

  .webgl-frame-wrap {
    --frame-height: min(62svh, 560px);
    width: 100%;
  }
}
