:root {
  --ink: #f3efe2;
  --muted: #b9c0ca;
  --soft: #8b95a6;
  --base: #0b0d14;
  --panel: #131722;
  --panel-strong: #191f2e;
  --line: rgba(243, 239, 226, 0.14);
  --gold: #d7a84c;
  --gold-bright: #f8d36f;
  --teal: #4ba3b7;
  --sky: #8bd8ff;
  --violet: #6f4ad5;
  --ember: #c45b45;
  --danger: #e15d54;
  --ok: #65d297;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(11, 13, 20, 0.94), rgba(11, 13, 20, 0.98)),
    #0b0d14;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  letter-spacing: 0;
}

body.menu-open,
body.loading {
  overflow: hidden;
}

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

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

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

::selection {
  background: rgba(248, 211, 111, 0.3);
  color: var(--ink);
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1rem;
  background: #0b0d14;
  color: var(--gold-bright);
  transition: opacity 260ms ease, visibility 260ms ease;
}

.loading-screen img {
  animation: ritualPulse 1.6s ease-in-out infinite;
}

.loading-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.site-particles {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.site-particles span {
  position: absolute;
  color: rgba(139, 216, 255, 0.22);
  font-size: 1.3rem;
  animation: floatRune linear infinite;
  text-shadow: 0 0 14px rgba(139, 216, 255, 0.24);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.25rem;
  min-height: 74px;
  padding: 0.7rem max(1rem, calc((100% - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(11, 13, 20, 0.88);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  font-weight: 800;
  color: var(--ink);
}

.brand img {
  border-radius: 8px;
  box-shadow: 0 0 22px rgba(215, 168, 76, 0.28);
}

.brand span {
  white-space: nowrap;
}

.site-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.2rem;
}

.site-nav a {
  border-radius: 8px;
  padding: 0.55rem 0.78rem;
  color: var(--muted);
  font-size: 0.95rem;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.site-nav a:hover,
.site-nav a.is-active {
  background: rgba(215, 168, 76, 0.13);
  color: var(--gold-bright);
}

.site-nav a:focus-visible,
.button:focus-visible,
.mode-button:focus-visible,
.menu-toggle:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
canvas:focus-visible {
  outline: 3px solid rgba(139, 216, 255, 0.7);
  outline-offset: 3px;
}

.language-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--soft);
  font-size: 0.9rem;
}

.language-picker select {
  min-width: 8.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.52rem 0.7rem;
  background: #10131d;
  color: var(--ink);
}

.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #10131d;
  color: var(--ink);
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  background: currentColor;
  transition: transform 180ms ease, opacity 180ms ease;
}

.hero,
.page-hero,
.section,
.site-footer {
  padding-left: max(1rem, calc((100% - 1180px) / 2));
  padding-right: max(1rem, calc((100% - 1180px) / 2));
}

.home-hero {
  min-height: 68vh;
  display: grid;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding-top: 4rem;
  padding-bottom: 4rem;
  background:
    linear-gradient(90deg, rgba(11, 13, 20, 0.94) 0%, rgba(11, 13, 20, 0.76) 46%, rgba(11, 13, 20, 0.42) 100%),
    url("../assets/images/temple-hero.svg") center/cover no-repeat;
}

.home-hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(215, 168, 76, 0.8), rgba(75, 163, 183, 0.7), transparent);
}

.hero-content {
  width: min(680px, 100%);
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--gold-bright);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

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

h1 {
  font-size: 3.6rem;
  max-width: 13ch;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.12rem;
}

.hero-copy,
.page-hero p,
.section-heading p {
  color: var(--muted);
  max-width: 760px;
}

.hero-copy {
  margin: 1.1rem 0 0;
  font-size: 1.15rem;
}

.hero-actions,
.control-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero-actions {
  margin-top: 1.5rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.76rem 1rem;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(1px) scale(0.99);
}

.button.primary {
  background: var(--gold);
  color: #17120b;
  box-shadow: 0 12px 26px rgba(215, 168, 76, 0.22);
}

.button.secondary {
  background: var(--teal);
  color: #071015;
  box-shadow: 0 12px 26px rgba(75, 163, 183, 0.22);
}

.button.ghost,
.button.quiet {
  border-color: var(--line);
  background: rgba(19, 23, 34, 0.72);
}

.button.ghost:hover,
.button.quiet:hover {
  border-color: rgba(139, 216, 255, 0.45);
}

.section {
  padding-top: 4.5rem;
  padding-bottom: 4.5rem;
}

.section-heading {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.8rem;
}

.intro-section {
  display: grid;
  gap: 2rem;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
}

.symbol-strip {
  display: grid;
  grid-template-columns: repeat(3, 4.4rem);
  gap: 0.7rem;
}

.symbol-strip span {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--gold-bright);
  font-size: 2rem;
  box-shadow: inset 0 0 24px rgba(75, 163, 183, 0.12);
}

.game-section {
  background:
    linear-gradient(180deg, rgba(19, 23, 34, 0.62), rgba(11, 13, 20, 0.9));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 1rem;
  align-items: start;
}

.game-stage {
  position: relative;
  min-width: 0;
  border: 1px solid rgba(215, 168, 76, 0.24);
  border-radius: 8px;
  overflow: hidden;
  background: #08090d;
  box-shadow: var(--shadow);
}

#ritualCanvas {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  background:
    radial-gradient(circle at center, rgba(75, 163, 183, 0.14), transparent 34%),
    #08090d;
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.9rem;
  padding: 2rem;
  text-align: center;
  background: rgba(8, 9, 13, 0.82);
  backdrop-filter: blur(8px);
  transition: opacity 180ms ease, visibility 180ms ease;
}

.game-overlay img {
  width: min(180px, 44%);
  opacity: 0.78;
  animation: ritualPulse 2.2s ease-in-out infinite;
}

.game-overlay p {
  max-width: 28rem;
  margin: 0;
  color: var(--muted);
}

.game-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.round-alert {
  position: absolute;
  left: 50%;
  top: 1rem;
  transform: translateX(-50%);
  max-width: calc(100% - 2rem);
  border: 1px solid rgba(139, 216, 255, 0.32);
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  background: rgba(16, 19, 29, 0.86);
  color: var(--sky);
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transition: opacity 180ms ease, transform 180ms ease;
}

.round-alert.is-visible {
  opacity: 1;
  transform: translate(-50%, 0.25rem);
}

.game-panel {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.target-panel,
.stat,
.meter-wrap,
.achievement-mini,
.feature-card,
.daily-card,
.contact-card,
.symbol-grid article,
.tip-list p,
.legal-content,
.contact-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(19, 23, 34, 0.86);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.2);
}

.target-panel {
  display: grid;
  place-items: center;
  gap: 0.4rem;
  padding: 1.1rem;
  text-align: center;
}

.target-panel span,
.stat span,
.meter-label span {
  color: var(--soft);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.target-glyph {
  display: grid;
  place-items: center;
  width: 82px;
  aspect-ratio: 1;
  border: 1px solid rgba(215, 168, 76, 0.38);
  border-radius: 50%;
  color: var(--gold-bright);
  font-size: 2.5rem;
  text-shadow: 0 0 18px rgba(248, 211, 111, 0.35);
  animation: ritualPulse 2.4s ease-in-out infinite;
}

.target-panel small {
  color: var(--muted);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.stat {
  min-height: 74px;
  padding: 0.75rem;
}

.stat strong {
  display: block;
  margin-top: 0.25rem;
  color: var(--ink);
  font-size: 1.35rem;
}

.meter-wrap {
  padding: 0.9rem;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.55rem;
}

.meter {
  height: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  background: #08090d;
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--ok), var(--gold-bright), var(--danger));
  transition: width 180ms ease;
}

.mode-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.mode-button {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem;
  background: var(--panel);
  color: var(--muted);
  font-weight: 800;
  line-height: 1.15;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.mode-button:hover {
  transform: translateY(-1px);
  border-color: rgba(215, 168, 76, 0.35);
  color: var(--ink);
}

.mode-button.active {
  background: rgba(215, 168, 76, 0.16);
  border-color: rgba(248, 211, 111, 0.5);
  color: var(--gold-bright);
}

.control-row .button {
  flex: 1 1 7rem;
}

.achievement-mini {
  padding: 1rem;
}

.achievement-mini h3 {
  margin-bottom: 0.65rem;
}

.achievement-mini ul {
  display: grid;
  gap: 0.45rem;
  max-height: 160px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.achievement-mini li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.achievement-mini li.unlocked {
  color: var(--gold-bright);
}

.achievement-stack {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 70;
  display: grid;
  gap: 0.75rem;
  width: min(340px, calc(100% - 2rem));
}

.achievement-toast {
  border: 1px solid rgba(248, 211, 111, 0.42);
  border-radius: 8px;
  padding: 0.9rem;
  background: rgba(19, 23, 34, 0.96);
  box-shadow: var(--shadow);
  animation: achievementIn 360ms ease both;
}

.achievement-toast strong {
  display: block;
  color: var(--gold-bright);
}

.achievement-toast span {
  color: var(--muted);
  font-size: 0.9rem;
}

.feature-grid,
.symbol-grid,
.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.feature-card,
.contact-card,
.symbol-grid article {
  padding: 1.1rem;
}

.feature-card {
  min-height: 210px;
}

.feature-card img {
  margin-bottom: 1rem;
}

.feature-card p,
.symbol-grid p,
.contact-card p,
.legal-content p,
.tip-list p,
.split-section p,
.form-section p {
  color: var(--muted);
}

.daily-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  align-items: center;
  padding: 1.25rem;
  background:
    linear-gradient(135deg, rgba(215, 168, 76, 0.14), rgba(75, 163, 183, 0.12)),
    rgba(19, 23, 34, 0.92);
}

.daily-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.daily-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.daily-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.38rem 0.65rem;
  color: var(--sky);
  background: rgba(8, 9, 13, 0.42);
  font-size: 0.9rem;
}

.cta-section {
  text-align: center;
}

.cta-section h2,
.cta-section p {
  margin-left: auto;
  margin-right: auto;
}

.cta-section p {
  color: var(--muted);
  max-width: 680px;
}

.cta-section .hero-actions {
  justify-content: center;
}

.page-hero {
  padding-top: 5.5rem;
  padding-bottom: 4.5rem;
  background:
    linear-gradient(90deg, rgba(11, 13, 20, 0.95), rgba(19, 23, 34, 0.72)),
    url("../assets/images/temple-hero.svg") center/cover no-repeat;
  border-bottom: 1px solid var(--line);
}

.page-hero h1 {
  max-width: 880px;
  font-size: 3rem;
}

.page-hero p:last-child {
  margin-bottom: 0;
  max-width: 780px;
}

.split-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.split-section > div,
.strategy-section,
.form-section {
  min-width: 0;
}

.symbol-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.symbol-grid article strong {
  display: grid;
  place-items: center;
  width: 56px;
  aspect-ratio: 1;
  margin-bottom: 0.85rem;
  border: 1px solid rgba(248, 211, 111, 0.35);
  border-radius: 50%;
  color: var(--gold-bright);
  font-size: 1.9rem;
}

.tip-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.tip-list p {
  margin: 0;
  padding: 1rem;
}

.contact-card {
  min-height: 150px;
}

.contact-card span {
  display: inline-grid;
  place-items: center;
  width: 52px;
  aspect-ratio: 1;
  margin-bottom: 0.85rem;
  border: 1px solid rgba(139, 216, 255, 0.34);
  border-radius: 50%;
  color: var(--sky);
  font-size: 1.4rem;
}

.form-section {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 1rem;
  align-items: start;
}

.contact-form {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
}

.contact-form label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-weight: 700;
}

.contact-form input,
.contact-form textarea,
.contact-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.78rem 0.85rem;
  background: #0f131d;
  color: var(--ink);
}

.contact-form textarea {
  resize: vertical;
}

.form-status {
  min-height: 1.5rem;
  margin: 0;
  color: var(--sky);
}

.legal-content {
  max-width: 920px;
  margin-left: max(1rem, calc((100% - 1180px) / 2));
  margin-right: max(1rem, calc((100% - 1180px) / 2));
  padding: 1.2rem;
}

.legal-content h2:not(:first-child) {
  margin-top: 1.8rem;
}

.site-footer {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.8fr;
  gap: 1.5rem;
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
  border-top: 1px solid var(--line);
  background: #090a0f;
}

.site-footer h2 {
  margin-bottom: 0.8rem;
  font-size: 1rem;
}

.site-footer a,
.site-footer p {
  display: block;
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--gold-bright);
}

.footer-brand {
  margin-bottom: 0.7rem;
}

.copyright {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}

body.corruption-warning #ritualCanvas,
body.corruption-warning .game-stage {
  animation: warningShake 180ms linear 2;
}

@keyframes ritualPulse {
  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(248, 211, 111, 0));
  }
  50% {
    transform: scale(1.04);
    filter: drop-shadow(0 0 18px rgba(248, 211, 111, 0.45));
  }
}

@keyframes floatRune {
  from {
    transform: translateY(110vh) rotate(0deg);
    opacity: 0;
  }
  14%,
  82% {
    opacity: 1;
  }
  to {
    transform: translateY(-14vh) rotate(180deg);
    opacity: 0;
  }
}

@keyframes achievementIn {
  from {
    transform: translateY(0.8rem);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes warningShake {
  0%,
  100% {
    transform: translateX(0);
  }
  35% {
    transform: translateX(-4px);
  }
  70% {
    transform: translateX(4px);
  }
}

@media (max-width: 1080px) {
  .site-header {
    grid-template-columns: auto auto 1fr;
  }

  .menu-toggle {
    display: inline-block;
  }

  .site-nav {
    position: fixed;
    top: 74px;
    left: 0;
    right: 0;
    display: grid;
    justify-content: stretch;
    gap: 0;
    padding: 0.6rem 1rem 1rem;
    border-bottom: 1px solid var(--line);
    background: rgba(11, 13, 20, 0.97);
    transform: translateY(-120%);
    transition: transform 220ms ease;
  }

  .site-nav.is-open {
    transform: translateY(0);
  }

  .site-nav a {
    padding: 0.85rem;
  }

  .language-picker {
    justify-self: end;
  }

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

  .game-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .target-panel,
  .achievement-mini {
    grid-column: span 2;
  }

  .symbol-grid,
  .tip-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .site-header {
    grid-template-columns: auto auto;
  }

  .brand span {
    font-size: 0.95rem;
  }

  .language-picker {
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .language-picker select {
    flex: 1;
  }

  .home-hero {
    min-height: 64vh;
  }

  h1 {
    font-size: 2.5rem;
  }

  h2,
  .page-hero h1 {
    font-size: 2rem;
  }

  .intro-section,
  .split-section,
  .form-section,
  .daily-card,
  .site-footer {
    grid-template-columns: 1fr;
  }

  .symbol-strip {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .symbol-strip span {
    font-size: 1.5rem;
  }

  .feature-grid,
  .symbol-grid,
  .contact-grid,
  .tip-list,
  .game-panel {
    grid-template-columns: 1fr;
  }

  .target-panel,
  .achievement-mini {
    grid-column: auto;
  }

  .mode-group {
    grid-template-columns: 1fr;
  }

  .control-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .daily-card .button {
    width: 100%;
  }
}

@media (max-width: 430px) {
  .site-header {
    gap: 0.65rem;
  }

  .brand img {
    width: 36px;
    height: 36px;
  }

  .symbol-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .section,
  .page-hero {
    padding-top: 3rem;
    padding-bottom: 3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
