:root {
  --ink: #10242b;
  --soft-ink: #47636d;
  --deep: #07333a;
  --lake: #0b7285;
  --lake-dark: #075466;
  --mint: #2fbf9f;
  --reed: #6d9f42;
  --gold: #f2b84b;
  --coral: #e86952;
  --paper: #f7fbf7;
  --mist: #e8f3ef;
  --panel: #ffffff;
  --line: rgba(16, 36, 43, 0.14);
  --shadow: 0 18px 50px rgba(5, 42, 52, 0.16);
  --radius: 8px;
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, #f5fbf8 0%, #eaf6f1 45%, #f9fbf4 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  opacity: 0;
  transition: opacity 220ms ease;
}

body.is-loaded {
  opacity: 1;
}

body.nav-open {
  overflow: hidden;
}

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

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

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

.container {
  width: min(100% - 32px, var(--max));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 251, 247, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.header-inner {
  width: min(100% - 24px, 1240px);
  min-height: 74px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
  font-weight: 900;
  color: var(--deep);
}

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

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.site-nav a {
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--soft-ink);
  font-weight: 750;
  font-size: 0.9rem;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  background: #dff1eb;
  color: var(--deep);
}

.site-nav a:active,
.button:active,
.menu-toggle:active {
  transform: translateY(1px);
}

.language-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--soft-ink);
  font-size: 0.84rem;
  font-weight: 750;
}

.language-control select,
.mode-picker select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 0 34px 0 12px;
  box-shadow: 0 6px 16px rgba(5, 42, 52, 0.06);
}

.mobile-language {
  display: none;
}

.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--deep);
  border-radius: 4px;
  transition: transform 180ms ease, opacity 180ms ease;
}

.nav-open .menu-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-open .menu-toggle span:nth-child(2) {
  opacity: 0;
}

.nav-open .menu-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 18px;
  font-weight: 850;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, color 180ms ease;
}

.button.primary {
  color: #072b24;
  background: var(--gold);
  box-shadow: 0 12px 24px rgba(242, 184, 75, 0.28);
}

.button.primary:hover {
  background: #ffd06a;
  box-shadow: 0 16px 30px rgba(242, 184, 75, 0.36);
}

.button.secondary {
  color: #fff;
  background: var(--lake);
}

.button.secondary:hover {
  background: var(--lake-dark);
}

.button.ghost {
  color: var(--deep);
  background: #edf7f2;
  border-color: var(--line);
}

.button.small {
  min-height: 42px;
  padding-inline: 14px;
  font-size: 0.88rem;
}

.button:disabled {
  cursor: not-allowed;
  color: #6a7b80;
  background: #dfe8e4;
  box-shadow: none;
}

.hero-shell {
  position: relative;
  overflow: hidden;
  padding: 52px 0 42px;
  background:
    radial-gradient(circle at 22% 18%, rgba(47, 191, 159, 0.2), transparent 32%),
    linear-gradient(145deg, #eaf9f4 0%, #d8f0ea 48%, #fff8e4 100%);
}

.hero-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    linear-gradient(115deg, rgba(255, 255, 255, 0.34) 0 1px, transparent 1px 44px),
    linear-gradient(25deg, rgba(7, 51, 58, 0.08) 0 1px, transparent 1px 58px);
  animation: waterDrift 18s linear infinite;
}

.hero-art {
  position: absolute;
  right: 4vw;
  top: 72px;
  width: min(42vw, 520px);
  opacity: 0.32;
  filter: saturate(1.2);
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-copy {
  width: min(760px, 100%);
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--lake-dark);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

h1 {
  margin: 0;
  color: var(--deep);
  font-size: clamp(2.7rem, 3.4rem, 3.4rem);
  line-height: 0.98;
}

h2 {
  margin: 0;
  color: var(--deep);
  font-size: clamp(1.75rem, 2.15rem, 2.15rem);
  line-height: 1.08;
}

h3 {
  margin: 0;
  color: var(--deep);
  font-size: 1.05rem;
  line-height: 1.2;
}

.hero-copy p:not(.eyebrow),
.page-hero p:not(.eyebrow),
.game-header p:not(.eyebrow),
.cta-inner p {
  max-width: 720px;
  color: var(--soft-ink);
  font-size: 1.05rem;
}

.hero-actions,
.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.game-shell {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(7, 51, 58, 0.12);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.game-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  margin-bottom: 16px;
}

.game-header h2 {
  font-size: 1.55rem;
}

.game-actions {
  justify-content: flex-end;
}

.mode-picker {
  display: grid;
  gap: 4px;
  color: var(--soft-ink);
  font-weight: 800;
  font-size: 0.82rem;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: 16px;
  align-items: stretch;
}

.game-stage {
  min-width: 0;
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: 360px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  background: #0d778d;
  border: 1px solid rgba(7, 51, 58, 0.2);
}

#frenzy-canvas {
  width: 100%;
  height: 100%;
}

.loading-screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 10px;
  align-content: center;
  color: #fff;
  background: linear-gradient(135deg, rgba(5, 59, 75, 0.92), rgba(16, 126, 139, 0.82));
  transition: opacity 280ms ease, visibility 280ms ease;
}

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

.loader-ring {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.34);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

.notification-stack {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  gap: 8px;
  width: min(320px, calc(100% - 24px));
  pointer-events: none;
}

.game-toast {
  padding: 10px 12px;
  color: #fff;
  background: rgba(7, 51, 58, 0.92);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: 0 14px 28px rgba(4, 34, 40, 0.24);
  animation: toastIn 220ms ease both;
  font-weight: 750;
  font-size: 0.88rem;
}

.game-toast.good {
  border-color: var(--mint);
}

.game-toast.warn {
  border-color: var(--coral);
}

.hud-panel {
  min-width: 0;
  border-radius: var(--radius);
  background: #f3fbf7;
  border: 1px solid var(--line);
  padding: 12px;
}

.stat-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stat-grid li {
  min-height: 70px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid rgba(16, 36, 43, 0.08);
}

.stat-grid .wide {
  grid-column: 1 / -1;
}

.stat-grid span {
  color: var(--soft-ink);
  font-size: 0.73rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
}

.stat-grid strong {
  color: var(--deep);
  font-size: 1.16rem;
  line-height: 1;
}

.achievement-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

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

.achievement {
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  opacity: 0.58;
  transition: transform 180ms ease, opacity 180ms ease, border-color 180ms ease;
}

.achievement.is-unlocked {
  opacity: 1;
  border-color: rgba(242, 184, 75, 0.7);
  background: linear-gradient(180deg, #fff9e8, #ffffff);
}

.achievement:hover {
  transform: translateY(-2px);
}

.achievement strong {
  display: block;
  font-size: 0.91rem;
  color: var(--deep);
}

.achievement span {
  color: var(--soft-ink);
  font-size: 0.78rem;
}

.content-band {
  padding: 64px 0;
  background: #fff;
}

.content-band.muted {
  background: #eef7f2;
}

.split-section {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 32px;
  align-items: start;
}

.split-section p {
  margin: 0;
  color: var(--soft-ink);
  font-size: 1.08rem;
}

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

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

.feature-card,
.info-card,
.daily-card,
.contact-card,
.contact-form {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(8, 51, 58, 0.08);
}

.feature-card,
.info-card {
  padding: 20px;
}

.feature-card p,
.info-card p {
  color: var(--soft-ink);
  margin: 10px 0 0;
}

.feature-grid.compact .feature-card {
  min-height: 160px;
}

.feature-icon,
.contact-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-bottom: 14px;
  border-radius: var(--radius);
  background: #dff1eb;
  color: var(--lake-dark);
  font-weight: 900;
}

.feature-card:nth-child(2n) .feature-icon {
  background: #fff0cf;
  color: #7a5205;
}

.feature-card:nth-child(3n) .feature-icon {
  background: #ffe7df;
  color: #873623;
}

.daily-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  align-items: center;
}

.daily-card {
  padding: 24px;
}

.daily-card dl {
  display: grid;
  gap: 14px;
  margin: 20px 0;
}

.daily-card dt {
  color: var(--lake-dark);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.daily-card dd {
  margin: 2px 0 0;
  color: var(--soft-ink);
}

.lake-note {
  display: grid;
  place-items: center;
  min-height: 250px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #d9f1ea, #fff4cf);
  border: 1px solid var(--line);
}

.cta-band {
  padding: 46px 0;
  background: var(--deep);
  color: #fff;
}

.cta-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.cta-inner h2 {
  color: #fff;
}

.cta-inner p {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.78);
}

.page-hero {
  padding: 74px 0;
  background:
    linear-gradient(135deg, #e4f6ef, #fff7dc);
  border-bottom: 1px solid var(--line);
}

.compact-hero {
  padding: 58px 0;
}

.page-hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 34px;
  align-items: center;
}

.page-hero h1 {
  margin-bottom: 14px;
}

.narrative {
  width: min(850px, calc(100% - 32px));
  color: var(--soft-ink);
  font-size: 1.12rem;
}

.section-title {
  margin-bottom: 20px;
}

.contact-layout {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: 24px;
  align-items: start;
}

.contact-cards {
  display: grid;
  gap: 16px;
}

.contact-card,
.contact-form {
  padding: 22px;
}

.contact-card a {
  color: var(--lake-dark);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.contact-form {
  display: grid;
  gap: 16px;
}

.contact-form label {
  display: grid;
  gap: 7px;
  color: var(--soft-ink);
  font-weight: 800;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  color: var(--ink);
  background: #fbfefd;
}

.contact-form textarea {
  resize: vertical;
  min-height: 144px;
}

.form-status {
  display: none;
  margin: 0;
  padding: 12px;
  border-radius: var(--radius);
  color: #063a31;
  background: #daf6e8;
  font-weight: 750;
}

.form-status.is-visible {
  display: block;
}

.policy-content {
  width: min(860px, calc(100% - 32px));
}

.policy-content .lead {
  font-size: 1.12rem;
  color: var(--soft-ink);
  margin-top: 0;
}

.policy-content article {
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

.policy-content p {
  color: var(--soft-ink);
}

.site-footer {
  background: #082c32;
  color: rgba(255, 255, 255, 0.8);
  padding: 44px 0 22px;
}

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

.footer-brand {
  color: #fff;
}

.site-footer h2 {
  margin: 0 0 12px;
  color: #fff;
  font-size: 0.95rem;
}

.site-footer p {
  margin: 8px 0;
}

.site-footer a {
  display: block;
  margin: 8px 0;
  color: rgba(255, 255, 255, 0.78);
}

.site-footer a:hover {
  color: #fff;
}

.copyright {
  width: min(100% - 32px, var(--max));
  margin: 30px auto 0;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.88rem;
  text-align: center;
}

@keyframes waterDrift {
  from {
    background-position: 0 0, 0 0;
  }
  to {
    background-position: 160px 80px, -120px 90px;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .game-layout {
    grid-template-columns: 1fr;
  }

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

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

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

@media (max-width: 860px) {
  .desktop-language {
    display: none;
  }

  .mobile-language {
    display: grid;
    width: 100%;
    margin-top: 10px;
  }

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

  .site-nav {
    position: fixed;
    left: 12px;
    right: 12px;
    top: 82px;
    display: grid;
    gap: 6px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
  }

  .nav-open .site-nav {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .site-nav a {
    padding: 13px 12px;
  }

  .hero-shell {
    padding-top: 34px;
  }

  .hero-art {
    width: 300px;
    opacity: 0.18;
  }

  h1 {
    font-size: clamp(2.25rem, 2.55rem, 2.55rem);
  }

  h2 {
    font-size: clamp(1.45rem, 1.7rem, 1.7rem);
  }

  .game-header,
  .split-section,
  .daily-layout,
  .page-hero-inner,
  .contact-layout,
  .cta-inner {
    grid-template-columns: 1fr;
  }

  .cta-inner {
    display: grid;
  }

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

  .canvas-wrap {
    min-height: 300px;
  }

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

  .page-hero {
    padding: 50px 0;
  }

  .page-hero-inner img,
  .lake-note {
    display: none;
  }

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

@media (max-width: 560px) {
  .container {
    width: min(100% - 22px, var(--max));
  }

  .header-inner {
    width: min(100% - 18px, 1240px);
  }

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

  .hero-shell {
    padding-top: 24px;
    padding-bottom: 30px;
  }

  .hero-copy {
    margin-bottom: 16px;
  }

  .hero-copy p:not(.eyebrow),
  .game-header p:not(.eyebrow) {
    font-size: 0.95rem;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-actions .button {
    width: auto;
    min-height: 44px;
    padding-inline: 10px;
    font-size: 0.9rem;
  }

  .game-actions {
    align-items: stretch;
  }

  .game-actions .button,
  .daily-card .button,
  .contact-form .button,
  .cta-inner .button,
  .mode-picker,
  .mode-picker select {
    width: 100%;
  }

  .game-header {
    gap: 10px;
    margin-bottom: 10px;
  }

  .game-header h2 {
    font-size: 1.32rem;
  }

  .game-shell {
    padding: 12px;
  }

  .canvas-wrap {
    min-height: 260px;
  }

  .stat-grid,
  .achievement-grid,
  .feature-grid,
  .info-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .content-band {
    padding: 46px 0;
  }

  .notification-stack {
    left: 10px;
    right: 10px;
    width: auto;
  }
}

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