:root {
  color-scheme: light;
  --ink: #172326;
  --muted: #5b6a6f;
  --paper: #f6efe2;
  --surface: #fffaf0;
  --surface-strong: #ffffff;
  --line: #d7cbb5;
  --teal: #124f59;
  --teal-2: #1f7a7a;
  --amber: #d99b2b;
  --rose: #c65b6a;
  --green: #3f835f;
  --blue: #4b77b8;
  --purple: #7a62a9;
  --shadow: 0 18px 42px rgba(23, 35, 38, 0.14);
  --tile-shadow: 0 10px 0 rgba(23, 35, 38, 0.12), 0 16px 24px rgba(23, 35, 38, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(18, 79, 89, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(18, 79, 89, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, #e8f3ee 0, var(--paper) 430px);
  background-size: 34px 34px, 34px 34px, auto;
  line-height: 1.62;
}

a {
  color: var(--teal);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--teal-2);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 3px solid rgba(18, 79, 89, 0.22);
  background: rgba(255, 250, 240, 0.94);
  backdrop-filter: blur(16px);
}

.header-inner,
.footer-inner,
.section-inner,
.article-layout {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}

.header-inner {
  display: grid;
  grid-template-columns: auto minmax(300px, 1fr) auto;
  min-height: 78px;
  align-items: center;
  gap: 18px;
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 820;
  text-decoration: none;
}

.brand img {
  width: 44px;
  height: 44px;
  border: 2px solid #ffffff;
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(18, 79, 89, 0.22);
}

.brand span {
  min-width: 0;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.nav,
.language-switcher,
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav {
  justify-content: center;
}

.nav a,
.language-switcher a,
.article-side a {
  border: 1px solid rgba(18, 79, 89, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 760;
  text-decoration: none;
}

.nav a {
  padding: 7px 10px;
}

.nav a[aria-current="page"],
.language-switcher a[aria-current="true"],
.article-side a:hover {
  border-color: var(--teal);
  background: var(--teal);
  color: #ffffff;
}

.language-switcher {
  justify-content: flex-end;
}

.language-switcher a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  font-size: 0.78rem;
}

.language-switcher span {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 6px;
  background: rgba(18, 79, 89, 0.11);
  font-size: 0.74rem;
}

.language-switcher a[aria-current="true"] span {
  background: rgba(255, 255, 255, 0.22);
}

.hero {
  padding: 54px 0 46px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.98fr) minmax(360px, 1.02fr);
  gap: 42px;
  align-items: center;
}

.hero-copy {
  position: relative;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin: 0;
  font-size: 4.2rem;
}

h2 {
  margin: 0;
  font-size: 2.25rem;
}

h3 {
  margin: 0 0 10px;
  font-size: 1.15rem;
}

p {
  margin: 0 0 1rem;
}

.lead {
  max-width: 720px;
  margin-top: 20px;
  color: #314247;
  font-size: 1.16rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border: 2px solid #0e3f46;
  border-radius: 8px;
  padding: 10px 16px;
  background: var(--teal);
  color: #ffffff;
  font-weight: 820;
  text-decoration: none;
  box-shadow: 0 5px 0 #0e3f46;
  transform: translateY(0);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.button:hover {
  color: #ffffff;
  transform: translateY(2px);
  box-shadow: 0 3px 0 #0e3f46;
}

.button.secondary {
  border-color: #8b621a;
  background: var(--amber);
  box-shadow: 0 5px 0 #8b621a;
  color: #251807;
}

.game-stage {
  position: relative;
  border: 3px solid #153d42;
  border-radius: 8px;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.86), rgba(232,243,238,0.92)),
    repeating-linear-gradient(45deg, rgba(18, 79, 89, 0.08) 0 8px, transparent 8px 16px);
  box-shadow: var(--shadow);
}

.game-stage::before {
  content: "";
  position: absolute;
  inset: 10px;
  z-index: -1;
  border-radius: 8px;
  background: #d99b2b;
  transform: rotate(-2deg);
}

.stage-hud,
.target-strip,
.stage-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-radius: 8px;
  font-weight: 800;
}

.stage-hud,
.stage-stats {
  color: #ffffff;
  background: #153d42;
  padding: 10px 12px;
}

.stage-hud b,
.stage-stats b {
  color: #ffd166;
}

.target-strip {
  margin: 12px 0;
  border: 2px solid rgba(21, 61, 66, 0.2);
  background: #fff8df;
  padding: 10px 12px;
}

.target-strip strong {
  display: inline-grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  background: var(--rose);
  color: #ffffff;
  font-size: 1.75rem;
  box-shadow: 0 5px 0 #8f3944;
}

.target-strip small {
  color: var(--muted);
  font-weight: 800;
}

.mini-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  aspect-ratio: 1;
  border: 3px solid #153d42;
  border-radius: 8px;
  padding: 10px;
  background: #2c5156;
}

.board-cell {
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
}

.element-tile {
  position: relative;
  grid-template-rows: auto auto;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.54);
  color: #102125;
  box-shadow: var(--tile-shadow);
  animation: tile-pop 3.8s ease-in-out infinite;
  animation-delay: calc(var(--delay) * 180ms);
}

.element-tile b {
  align-self: end;
  font-size: 1.55rem;
  line-height: 1;
}

.element-tile small {
  max-width: 100%;
  align-self: start;
  overflow: hidden;
  padding: 0 4px;
  color: rgba(16, 33, 37, 0.74);
  font-size: 0.58rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.element-tile em {
  position: absolute;
  top: 5px;
  right: 6px;
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 900;
  opacity: 0.72;
}

.tile-h { background: #f9f0cf; }
.tile-he { background: #cde7f4; }
.tile-li { background: #d7eec6; }
.tile-be { background: #ffe0a4; }
.tile-b { background: #f4b4a8; }
.tile-c { background: #d4d8dc; }
.tile-n { background: #b8cdf7; }
.tile-o { background: #f0a8b0; color: #3c1015; }
.tile-f { background: #c1e4bd; }
.tile-ne { background: #d8c8f0; }

.band {
  padding: 50px 0;
  border-top: 3px solid rgba(18, 79, 89, 0.13);
}

.links-band {
  background: rgba(255, 250, 240, 0.72);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

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

.tile {
  min-height: 176px;
  border: 2px solid #153d42;
  border-radius: 8px;
  padding: 20px;
  background: var(--surface-strong);
  box-shadow: 0 7px 0 rgba(21, 61, 66, 0.18);
}

.tile strong {
  display: inline-block;
  margin-bottom: 12px;
  border-radius: 6px;
  background: #e6f1ec;
  padding: 4px 7px;
  color: var(--teal);
  font-size: 0.78rem;
}

.tile p:last-child,
.article li:last-child {
  margin-bottom: 0;
}

.link-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.link-list a {
  display: grid;
  min-height: 86px;
  align-content: space-between;
  border: 2px solid #153d42;
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 820;
  text-decoration: none;
  box-shadow: 0 6px 0 rgba(21, 61, 66, 0.18);
}

.link-list a b {
  color: var(--rose);
  font-size: 0.82rem;
}

.article-shell {
  padding: 46px 0 66px;
}

.article-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.article-side {
  position: sticky;
  top: 106px;
  display: grid;
  gap: 12px;
  border: 2px solid #153d42;
  border-radius: 8px;
  padding: 16px;
  background: #fff8df;
  box-shadow: 0 7px 0 rgba(21, 61, 66, 0.18);
}

.article-side img {
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(18, 79, 89, 0.24);
}

.article-side span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 760;
}

.article-side nav {
  display: grid;
  gap: 8px;
}

.article-side a {
  padding: 8px 10px;
}

.article {
  border: 2px solid #153d42;
  border-radius: 8px;
  padding: 30px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.article header {
  margin-bottom: 26px;
  padding-bottom: 24px;
  border-bottom: 3px solid rgba(18, 79, 89, 0.14);
}

.article h1 {
  font-size: 3.15rem;
}

.metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.metadata span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 9px;
  background: #fff8df;
}

.article-grid {
  margin-bottom: 26px;
}

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

.article-section h2 {
  margin-bottom: 14px;
  font-size: 1.55rem;
}

.article ul {
  margin: 0;
  padding-left: 1.25rem;
}

.article li {
  margin-bottom: 0.62rem;
}

.site-footer {
  border-top: 3px solid rgba(18, 79, 89, 0.18);
  padding: 28px 0;
  background: #153d42;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.94rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-inner strong {
  display: block;
  color: #ffffff;
}

.footer-links a {
  color: #ffffff;
}

@keyframes tile-pop {
  0%, 78%, 100% {
    transform: translateY(0) scale(1);
  }
  84% {
    transform: translateY(-4px) scale(1.025);
  }
}

@media (max-width: 1040px) {
  .header-inner {
    grid-template-columns: 1fr;
    padding: 14px 0;
  }

  .nav,
  .language-switcher {
    justify-content: flex-start;
  }

  .hero-grid,
  .article-layout {
    grid-template-columns: 1fr;
  }

  .article-side {
    position: static;
  }

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

@media (max-width: 760px) {
  .site-header {
    position: static;
  }

  .header-inner {
    gap: 9px;
    padding: 10px 0;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
  }

  .nav a {
    overflow: hidden;
    padding: 6px 4px;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .language-switcher {
    width: 100%;
    justify-content: flex-start;
  }

  .hero {
    padding-top: 34px;
  }

  h1,
  .article h1 {
    font-size: 2.2rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  .lead {
    font-size: 1.04rem;
  }

  .game-stage {
    padding: 12px;
  }

  .mini-board {
    gap: 7px;
    padding: 7px;
  }

  .element-tile b {
    font-size: 1.12rem;
  }

  .element-tile small {
    display: none;
  }

  .grid,
  .link-list {
    grid-template-columns: 1fr;
  }

  .language-switcher a {
    padding: 5px;
    font-size: 0;
  }

  .language-switcher span {
    width: 28px;
    font-size: 0.76rem;
  }

  .section-heading {
    display: block;
  }

  .article {
    padding: 22px;
  }
}

@media (max-width: 430px) {
  .header-inner,
  .footer-inner,
  .section-inner,
  .article-layout {
    width: min(100% - 24px, 1160px);
  }

  .nav a,
  .language-switcher a {
    font-size: 0.74rem;
  }

  .language-switcher a {
    font-size: 0;
  }
}

@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;
  }
}
