:root {
  color-scheme: light;
  --ink: #17201d;
  --muted: #5d6a65;
  --panel: #f7f4ee;
  --surface: rgba(255, 252, 246, 0.88);
  --card: #fffaf1;
  --button: #fffdf8;
  --line: #d8d0c3;
  --blue: #1d6f8f;
  --red: #b54635;
  --green: #3f7f4d;
  --yellow: #d5a93b;
  --board: #26352f;
  --tile: #fbfaf6;
  --focus: #e9b44c;
  --brand-cyan: #00d8df;
  --brand-blue: #151eea;
  --brand-magenta: #f004de;
  --brand-red: #f91b16;
  --brand-green: #13ed10;
  --shadow: rgba(42, 35, 24, 0.14);
  --page:
    linear-gradient(135deg, rgba(29, 111, 143, 0.14), transparent 34%),
    linear-gradient(315deg, rgba(181, 70, 53, 0.13), transparent 30%),
    #ebe4d8;
}

html.dark-theme {
  color-scheme: dark;
  --ink: #f1eee7;
  --muted: #c2bbb0;
  --panel: #1f2926;
  --surface: rgba(28, 35, 32, 0.9);
  --card: #26312d;
  --button: #202a27;
  --line: #48524d;
  --blue: #6fb4d4;
  --red: #d47c6a;
  --green: #7fa876;
  --yellow: #e8b34c;
  --board: #111a18;
  --tile: #f4efe4;
  --focus: #f0bc55;
  --shadow: rgba(0, 0, 0, 0.32);
  --page:
    linear-gradient(135deg, rgba(29, 111, 143, 0.2), transparent 34%),
    linear-gradient(315deg, rgba(181, 70, 53, 0.16), transparent 30%),
    #141917;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.home-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

.hero,
.game-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 22px 52px var(--shadow);
}

.hero {
  min-height: min(58vh, 560px);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 241, 0.64);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
  font-size: 1.1rem;
  font-weight: 950;
}

.brand-mark img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

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

.nav-links a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #bfb5a4;
  border-radius: 8px;
  background: var(--button);
  padding: 0 12px;
  font-weight: 800;
}

.nav-links .theme-toggle {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #bfb5a4;
  border-radius: 8px;
  background: var(--button);
  padding: 0 12px;
  font-weight: 800;
  cursor: pointer;
}

.nav-links a:hover,
.nav-links .theme-toggle:hover,
.game-card:hover {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(233, 180, 76, 0.22), 0 22px 52px var(--shadow);
}

.hero-content {
  display: grid;
  align-content: end;
  max-width: 760px;
  padding: 42px 32px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(4rem, 14vw, 10rem);
  line-height: 0.82;
}

.hero-logo {
  display: block;
  width: min(100%, 820px);
  max-height: 190px;
  margin: 0 0 20px;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 16px 24px rgba(42, 35, 24, 0.12));
}

.hero-content h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.lede {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.45;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.game-card {
  display: grid;
  grid-template-rows: 220px 1fr;
  min-height: 420px;
  overflow: hidden;
}

.game-card .card-art::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 54px;
  height: 54px;
  background: url("dicelogo.png") center / contain no-repeat;
  opacity: 0.14;
  pointer-events: none;
}

.prototype-band {
  margin-top: 16px;
}

.prototype-link {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1.2fr);
  align-items: center;
  gap: 18px;
  min-height: 150px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(232, 184, 87, 0.18), transparent 42%),
    linear-gradient(315deg, rgba(29, 111, 143, 0.16), transparent 38%),
    var(--surface);
  box-shadow: 0 22px 52px var(--shadow);
}

.prototype-link:hover {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(233, 180, 76, 0.22), 0 22px 52px var(--shadow);
}

.prototype-link h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 0.95;
}

.prototype-link p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.45;
}

.card-art {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  background: var(--board);
}

.word-art,
.biseptilex-art,
.flip-art {
  grid-template-columns: repeat(4, 54px);
  grid-template-rows: repeat(2, 54px);
  gap: 9px;
}

.word-art span,
.biseptilex-art span,
.flip-art span {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 2px solid #efe7da;
  border-radius: 8px;
  background: var(--tile);
  color: var(--board);
  font-size: 1.65rem;
  font-weight: 950;
}

.word-art span:nth-child(1),
.word-art span:nth-child(5) {
  background: var(--blue);
  color: white;
}

.word-art span:nth-child(3),
.word-art span:nth-child(7) {
  background: var(--yellow);
  color: white;
}

.word-art span:nth-child(8) {
  background: var(--red);
  color: white;
}

.biseptilex-art {
  grid-template-columns: repeat(7, 38px);
  grid-template-rows: 62px;
}

.biseptilex-art span {
  width: 38px;
  height: 62px;
  font-size: 1.35rem;
}

.biseptilex-art span:nth-child(1),
.biseptilex-art span:nth-child(4) {
  background: var(--green);
  color: white;
}

.biseptilex-art span:nth-child(2),
.biseptilex-art span:nth-child(6) {
  background: var(--yellow);
  color: white;
}

.biseptilex-art span:nth-child(5) {
  background: var(--blue);
  color: white;
}

.orbit-art {
  overflow: hidden;
}

.orbit-ring {
  position: absolute;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
}

.ring-one {
  width: 132px;
  height: 132px;
}

.ring-two {
  width: 204px;
  height: 204px;
}

.orbit-center {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  background: #202522;
  color: white;
  font-weight: 950;
}

.orbit-tile {
  position: absolute;
  width: 48px;
  height: 58px;
  border: 2px solid #efe7da;
  border-radius: 8px;
  background:
    linear-gradient(var(--blue), var(--blue)) top 7px left 11px / 26px 7px no-repeat,
    linear-gradient(var(--red), var(--red)) bottom 7px left 11px / 26px 7px no-repeat,
    linear-gradient(var(--green), var(--green)) top 16px left 7px / 7px 26px no-repeat,
    linear-gradient(var(--yellow), var(--yellow)) top 16px right 7px / 7px 26px no-repeat,
    var(--tile);
}

.tile-one {
  transform: translate(96px, -58px) rotate(12deg);
}

.tile-two {
  transform: translate(-92px, 60px) rotate(-18deg);
}

.tile-three {
  transform: translate(14px, 94px) rotate(28deg);
}

.flip-art {
  grid-template-columns: repeat(3, 58px);
  grid-template-rows: repeat(3, 58px);
}

.flip-art span {
  width: 58px;
  height: 58px;
  font-size: 2rem;
}

.flip-art span:nth-child(odd) {
  color: var(--blue);
}

.flip-art span:nth-child(even) {
  color: var(--red);
}

.spell-card-home {
  background:
    linear-gradient(135deg, rgba(63, 127, 77, 0.16), transparent 42%),
    linear-gradient(315deg, rgba(181, 70, 53, 0.14), transparent 38%),
    var(--panel);
}

.spell-art {
  grid-template-columns: repeat(4, 58px);
  grid-template-rows: repeat(2, 58px);
  gap: 0;
  background: #26352f;
}

.spell-board-square {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  font-size: 2.1rem;
  font-weight: 950;
}

.spell-board-square.light {
  background: #efe2c7;
  color: #16211d;
}

.spell-board-square.dark {
  background: #557066;
  color: #fffdf8;
}

.cultivessence-card {
  background:
    linear-gradient(135deg, rgba(63, 127, 77, 0.16), transparent 42%),
    linear-gradient(315deg, rgba(217, 169, 59, 0.18), transparent 38%),
    var(--panel);
}

.cultivessence-card .card-copy h2 {
  font-size: clamp(1.45rem, 2.6vw, 2.05rem);
  line-height: 1;
  overflow-wrap: anywhere;
}

.cultivessence-art {
  overflow: hidden;
  background:
    linear-gradient(90deg, transparent 49%, rgba(233, 180, 76, 0.16) 50%, transparent 51%),
    linear-gradient(0deg, transparent 49%, rgba(63, 127, 77, 0.14) 50%, transparent 51%),
    #26352f;
  background-size: 56px 56px;
}

.monster-sigil {
  position: relative;
  display: grid;
  width: 112px;
  height: 112px;
  place-items: center;
  border: 2px solid rgba(255, 250, 241, 0.5);
  background: #f4ead7;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.2);
  transform: rotate(45deg);
}

.monster-sigil span {
  position: absolute;
  background: #26352f;
}

.monster-sigil span:nth-child(1) {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.monster-sigil span:nth-child(2),
.monster-sigil span:nth-child(3) {
  top: 24px;
  width: 22px;
  height: 38px;
}

.monster-sigil span:nth-child(2) {
  left: 20px;
  transform: rotate(-28deg);
}

.monster-sigil span:nth-child(3) {
  right: 20px;
  transform: rotate(28deg);
}

.monster-sigil span:nth-child(4) {
  bottom: 22px;
  width: 54px;
  height: 12px;
}

.essence-orb {
  position: absolute;
  width: 58px;
  height: 58px;
  border: 2px solid rgba(255, 250, 241, 0.6);
  border-radius: 50%;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
}

.essence-orb.fire {
  left: 18%;
  top: 22%;
  background: var(--red);
}

.essence-orb.wood {
  right: 17%;
  top: 24%;
  background: var(--green);
}

.essence-orb.water {
  left: 50%;
  bottom: 15%;
  background: var(--blue);
  transform: translateX(-50%);
}

.frontier-card {
  background:
    linear-gradient(135deg, rgba(181, 70, 53, 0.16), transparent 42%),
    linear-gradient(315deg, rgba(29, 111, 143, 0.14), transparent 38%),
    var(--panel);
}

.frontier-card .card-copy h2 {
  font-size: clamp(1.75rem, 3.2vw, 2.2rem);
  line-height: 1;
  overflow-wrap: anywhere;
}

.frontier-art {
  display: grid;
  place-items: center;
  gap: 2px;
  background: #26352f;
  grid-template-columns: repeat(3, 60px);
  grid-template-rows: repeat(3, 52px);
}

.frontier-hex {
  position: relative;
  width: 50px;
  height: 58px;
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  border: 1px solid rgba(255, 250, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.frontier-hex.hex-center {
  background: var(--yellow);
  grid-column: 2;
  grid-row: 2;
}

.frontier-hex.hex-left {
  background: var(--green);
  grid-column: 1;
  grid-row: 2;
}

.frontier-hex.hex-right {
  background: var(--red);
  grid-column: 3;
  grid-row: 2;
}

.frontier-hex.hex-top-left {
  background: #a7b2aa;
  grid-column: 1;
  grid-row: 1;
  opacity: 0.6;
}

.frontier-hex.hex-top-right {
  background: #a7b2aa;
  grid-column: 3;
  grid-row: 1;
  opacity: 0.6;
}

.frontier-hex.hex-bottom {
  background: #a7b2aa;
  grid-column: 2;
  grid-row: 3;
  opacity: 0.6;
}

.mobion-card {
  background:
    linear-gradient(135deg, rgba(232, 184, 87, 0.18), transparent 42%),
    linear-gradient(315deg, rgba(115, 168, 232, 0.18), transparent 38%),
    var(--panel);
}

.mobion-art {
  position: relative;
  min-height: 150px;
  overflow: hidden;
}

.mobion-art .tower {
  position: absolute;
  bottom: 18px;
  width: 34px;
  border: 3px solid rgba(255, 255, 255, 0.24);
  background: #596b75;
  image-rendering: pixelated;
}

.tower-one {
  left: 26%;
  height: 72px;
}

.tower-two {
  left: 43%;
  height: 104px;
  background: #7d6f54;
}

.tower-three {
  left: 60%;
  height: 58px;
  background: #76656f;
}

.mana-sun {
  position: absolute;
  left: 50%;
  top: 28px;
  width: 54px;
  height: 54px;
  border: 4px solid rgba(232, 184, 87, 0.65);
  transform: translateX(-50%);
  background: rgba(232, 184, 87, 0.18);
  box-shadow: 0 0 28px rgba(232, 184, 87, 0.24);
}

.card-copy {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 20px;
  background: var(--card);
}

.card-copy h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 0.95;
}

.card-copy p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.42;
}

@media (max-width: 860px) {
  .home-shell {
    width: min(100vw - 18px, 640px);
    padding-top: 9px;
  }

  .site-nav {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

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

  .hero-content {
    padding: 38px 18px;
  }

  .game-grid {
    grid-template-columns: 1fr;
  }

  .prototype-link {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .game-card {
    grid-template-rows: 190px 1fr;
    min-height: 0;
  }
}

@media (max-width: 420px) {
  .nav-links {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr;
  }

  .nav-links a {
    justify-content: center;
  }

  .word-art,
  .biseptilex-art,
  .flip-art {
    transform: scale(0.84);
  }
}
