:root {
  --site-nav-bg: #0c2340;
  --site-nav-text: #ffffff;
  --site-nav-accent: #c9a227;
  --site-footer-bg: rgba(0, 0, 0, 0.2);
  --hub-cream: #f3ead8;
  --hub-ink: #12263f;
  --hub-mustard: #c9a227;
}

html {
  overflow-x: hidden;
}

body {
  overflow-x: hidden;
}

.game-page *,
.home-page *,
.legal-page * {
  box-sizing: border-box;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  background: var(--site-nav-bg);
  color: var(--site-nav-text);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.25);
}

.site-nav {
  max-width: 1200px;
  min-height: 64px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.site-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  text-decoration: none;
  min-width: 0;
}

.site-name {
  color: var(--site-nav-text);
  text-decoration: none;
  font-size: 21px;
  font-weight: 800;
  white-space: nowrap;
}

.suomi-brand {
  margin: 0;
  color: #e6d3a3;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  white-space: nowrap;
}

.suomi-brand-foot {
  margin: 10px 0 0;
  color: #d7c49a;
  font-size: 14px;
}

.suomi-brand-foot a {
  color: #f0dfb2;
}

.content-main:has(.hub-grid),
.content-main:has(.hub-featured),
.content-main:has(.hub-shell) {
  width: min(1360px, calc(100% - 24px));
}

.hub-shell {
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr) 220px;
  gap: 28px;
  align-items: start;
}

.hub-rail {
  position: sticky;
  top: 80px;
  padding: 18px 14px 20px;
  border-radius: 14px;
  background: #0c2340;
  color: #f6efe2;
}

.hub-rail-brand {
  margin: 0 0 16px;
  color: #c9a227;
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  font-size: 15px;
  line-height: 1.3;
}

.hub-rail-h {
  margin: 0 0 8px;
  color: #c9a227;
  font-family: Georgia, Palatino, serif;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hub-rail-nav {
  display: grid;
  gap: 2px;
}

.hub-rail-nav a {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 4px 6px;
  border-radius: 6px;
  color: #f6efe2;
  text-decoration: none;
  font-size: 13px;
}

.hub-rail-nav a:hover,
.hub-rail-nav a:focus-visible {
  background: #163a3c;
}

.hub-rail-nav img {
  width: 28px;
  height: 21px;
  object-fit: cover;
  border-radius: 3px;
}

.hub-rail-dict {
  display: block;
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid #c9a227;
  border-radius: 8px;
  color: #f6efe2;
  text-align: center;
  text-decoration: none;
  font-weight: 800;
}

.hub-wod {
  position: sticky;
  top: 80px;
  padding: 20px 18px;
  border: 1px solid #c5d4e0;
  border-radius: 14px;
  background: #fff;
}

.hub-wod-kicker {
  margin: 0 0 8px;
  color: #0d7377;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hub-wod-word {
  margin: 0 0 8px;
  color: var(--hub-ink);
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  font-size: 32px;
  line-height: 1.1;
}

.hub-wod-def {
  margin: 0 0 16px;
  color: #3d3426;
}

.hub-wod-play {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #8b2e2e;
  color: #fffaf1;
  font-weight: 800;
  text-decoration: none;
}

.hub-wod-brand {
  margin: 14px 0 0;
  color: #8b2e2e;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.hub-hero {
  position: relative;
  overflow: hidden;
  min-height: 280px;
  margin: 0 0 36px;
  border-radius: 16px;
  background: #0c2340;
}

.hub-hero-art {
  display: block;
  width: 100%;
  height: 280px;
  object-fit: cover;
}

.hub-hero-card {
  position: absolute;
  left: 28px;
  top: 50%;
  width: min(420px, calc(100% - 40px));
  padding: 22px 24px 24px;
  border-radius: 10px;
  background: #fffaf1;
  box-shadow: 0 12px 32px rgba(12, 35, 64, 0.28);
  transform: translateY(-50%);
}

.hub-kicker {
  margin: 0 0 8px;
  color: #8b2e2e;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hub-hero h2,
.hub-section h2,
.hub-card-name {
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
}

.hub-hero h2 {
  margin: 0 0 10px;
  color: var(--hub-ink);
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.15;
}

.hub-featured-blurb,
.hub-section-lead {
  margin: 0 0 14px;
  color: #3d3426;
}

.hub-hero-cta {
  display: inline-flex;
  min-height: 44px;
  padding: 8px 22px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #8b2e2e;
  color: #fffaf1;
  font-weight: 800;
  text-decoration: none;
}

.hub-section {
  margin: 0 0 40px;
  padding-top: 6px;
}

.hub-section h2 {
  margin: 0 0 8px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--hub-mustard);
  color: var(--hub-ink);
  font-size: clamp(26px, 3vw, 34px);
}

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

.hub-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: transparent;
}

.hub-card-art {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #1a2744;
}

.hub-card-art .game-illustration {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hub-card-name {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 10px 12px 8px;
  background: linear-gradient(transparent, rgba(12, 35, 64, 0.82));
  color: #fffaf1;
  font-size: 20px;
}

.hub-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 8px;
  background: var(--hub-mustard);
  color: #1a160c;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.hub-badge-free {
  background: #e6d3a3;
}

.hub-blurb {
  margin: 10px 0 12px;
  color: #4a4336;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
  min-height: 2.8em;
}

.hub-play {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--hub-mustard);
  color: #1a1608;
  font-weight: 800;
  text-decoration: none;
}

.hub-play:hover {
  background: #d4b03a;
}

.hub-play-quiz {
  background: #c5d4e0;
  color: #12263f;
}

.hub-play-know {
  background: #b8c9d6;
  color: #12263f;
}

.hub-daily-link {
  display: block;
  margin-top: 8px;
  color: #5a4a28;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.home-page .hub-shell {
  margin-bottom: 36px;
}

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

  .hub-rail {
    display: none;
  }

  .hub-wod {
    position: static;
    order: 2;
  }
}

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

  .hub-hero-card {
    left: 16px;
    width: min(360px, calc(100% - 32px));
  }
}

@media (max-width: 560px) {
  .hub-grid {
    grid-template-columns: 1fr;
  }

  .hub-hero {
    min-height: 360px;
  }

  .hub-hero-art {
    height: 360px;
  }

  .hub-hero-card {
    top: auto;
    bottom: 16px;
    transform: none;
  }
}

.content-card > .suomi-brand,
.hub-page .suomi-brand {
  color: #8b2e2e;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-page header .suomi-brand-hero {
  margin: 0 0 10px;
  color: #e6d3a3;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-menu {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.site-menu a {
  color: var(--site-nav-text);
  text-decoration: none;
  padding: 10px 9px;
  border-radius: 7px;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
}

.site-menu a:hover,
.site-menu a:focus-visible {
  color: var(--site-nav-bg);
  background: var(--site-nav-accent);
  outline: none;
}

.site-menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  margin: 0 0 0 auto;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  background: transparent;
  color: var(--site-nav-text);
  font-size: 24px;
  line-height: 1;
}

.site-more-games {
  position: relative;
}

.site-more-games > summary {
  list-style: none;
  cursor: pointer;
  color: var(--site-nav-text);
  padding: 10px 9px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.site-more-games > summary::-webkit-details-marker {
  display: none;
}

.site-more-games > summary:hover,
.site-more-games[open] > summary {
  color: var(--site-nav-bg);
  background: var(--site-nav-accent);
}

.site-more-games-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  min-width: 240px;
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: var(--site-nav-bg);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.site-footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
}

.game-page {
  padding: 0 !important;
  background: #0047ab;
  color: #fff;
}

.game-page .content-card,
.game-page .daily-game {
  color: inherit;
}

.game-page > .main-wrapper {
  width: 100%;
  max-width: 1400px;
  padding: 32px 20px 24px;
}

.game-title {
  margin: 0;
  color: #fff;
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.15;
  text-align: center;
}

.game-title-wrap {
  width: min(100%, 760px);
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 280px);
  align-items: center;
  gap: clamp(16px, 4vw, 36px);
}

.game-title-wrap .game-title {
  text-align: left;
}

.game-illustration {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
}

.game-title-wrap .game-illustration {
  max-height: 200px;
  object-fit: cover;
}

.game-card-art {
  display: block;
  margin: -6px -6px 2px;
  border-radius: 12px;
  overflow: hidden;
}

.game-card-art:focus-visible {
  outline: 3px solid #00bfff;
  outline-offset: 3px;
}

.game-card-art .game-illustration {
  transition: transform 0.2s ease;
}

.game-card-art:hover .game-illustration {
  transform: scale(1.025);
}

.help-game-name {
  margin: 0 0 30px;
  color: #00bfff;
  font-size: 28px;
  font-weight: 700;
  text-align: center;
}

.game-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}

.game-nav-link {
  min-height: 44px;
  padding: 11px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #7ddcff;
  border-radius: 7px;
  background: #006da3;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}

.game-nav-link:hover,
.game-nav-link:focus-visible {
  border-color: #fff;
  background: #008fcf;
  color: #fff;
  outline: 3px solid rgba(255, 255, 255, 0.35);
  outline-offset: 2px;
}

.game-page .container,
.game-page .game-container,
.game-page .game-wrapper,
.game-page .grid-container,
.game-page .controls,
.game-page .content-section {
  max-width: 100%;
  min-width: 0;
}

.sanahaku-page .grid-container {
  width: min(100%, 560px);
}

.sanahaku-page #grid.grid {
  width: min(100%, 520px);
  grid-template-columns: repeat(10, minmax(0, 1fr));
}

.sanahaku-page .grid-cell {
  width: auto;
  height: auto;
  aspect-ratio: 1;
  font-size: clamp(17px, 4vw, 24px);
}

.sanapalapeli-page .game-container {
  width: min(100%, 760px);
  margin-inline: auto;
}

.sanapalapeli-page .grid {
  width: min(100%, 420px);
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sanapalapeli-page .grid > div {
  width: auto;
  height: auto;
  aspect-ratio: 1;
}

.sanalouhos-page .grid-container,
.sanalouhos-page #grid.grid {
  width: min(100%, 420px);
}

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

.sanalouhos-page .grid .cell {
  width: auto;
  height: auto;
  aspect-ratio: 1;
}

.sanapyramidi-page .pyramid-container {
  width: min(100%, 900px);
  margin-inline: auto;
}

.sanapyramidi-page .pyramid-row {
  width: 100%;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
}

.sanapyramidi-page .word-button {
  width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}

.ristikko-page .crossword-container {
  width: min(100%, 680px);
}

.ristikko-page .crossword-grid {
  width: min(100%, calc(var(--cols, 15) * 46px));
  grid-template-columns: repeat(var(--cols, 15), minmax(0, 1fr));
}

.ristikko-page .crossword-grid .cell {
  width: auto;
  height: auto;
  min-width: 0;
  aspect-ratio: 1;
}

.game-page .content-section {
  max-width: 900px;
  width: 100%;
  margin: 0 auto 30px;
}

.game-page .content-section p,
.game-page .content-section li {
  overflow-wrap: anywhere;
}

.help-accordion {
  width: min(100%, 960px);
  margin: 0 auto 30px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
}

.help-accordion > summary {
  min-height: 56px;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}

.help-accordion > summary::before {
  content: "＋";
  margin-right: 10px;
}

.help-accordion[open] > summary::before {
  content: "−";
}

.help-content {
  padding: 0 14px 14px;
}

.site-footer {
  width: 100%;
  margin-top: 24px;
  padding: 24px 20px;
  text-align: center;
  background: var(--site-footer-bg);
}

.site-footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
}

.site-footer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-footer p {
  margin: 14px 0 0;
  font-size: 14px;
}

.privacy-notice {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 3000;
  width: min(430px, calc(100% - 32px));
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid #cfd8e6;
  border-radius: 10px;
  background: #fff;
  color: #14213d;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.24);
  font-family: Arial, sans-serif;
  line-height: 1.45;
}

.privacy-notice p {
  margin: 0;
  font-size: 14px;
}

.privacy-notice a {
  color: #0047ab;
}

.privacy-notice button {
  min-width: 64px;
  min-height: 44px;
  margin: 0;
  padding: 9px 12px;
  border: 0;
  border-radius: 7px;
  background: #0047ab;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.legal-page {
  margin: 0;
  background: #f4f7fb;
  color: #14213d;
  font-family: Arial, sans-serif;
  line-height: 1.65;
}

.legal-main {
  width: min(760px, calc(100% - 32px));
  margin: 40px auto;
  padding: 32px;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(24, 45, 80, 0.08);
}

.legal-main h1,
.legal-main h2 {
  color: #0047ab;
}

.legal-main a {
  color: #0047ab;
}

.sanalouhos-page svg.path-line {
  width: 100%;
  height: 100%;
}

@media (max-width: 760px) {
  .site-nav {
    position: relative;
    min-height: 58px;
    padding: 7px 14px;
  }

  .site-menu-toggle {
    display: inline-grid;
    place-items: center;
    cursor: pointer;
  }

  .site-menu {
    display: none;
    position: absolute;
    top: calc(100% + 1px);
    right: 10px;
    left: 10px;
    max-height: calc(100vh - 74px);
    overflow-y: auto;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0 0 10px 10px;
    background: var(--site-nav-bg);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
  }

  .site-menu.is-open {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-menu a {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: normal;
    text-align: center;
  }

  .site-more-games {
    grid-column: 1 / -1;
  }

  .site-more-games-list {
    position: static;
    min-width: 0;
    grid-template-columns: 1fr 1fr;
  }

  .game-page > .main-wrapper {
    gap: 24px;
    padding: 24px 12px 18px;
  }

  .game-title-wrap {
    grid-template-columns: 1fr;
    width: min(100%, 440px);
    gap: 14px;
  }

  .game-title-wrap .game-title {
    text-align: center;
  }

  .game-title-wrap .game-illustration {
    width: min(100%, 360px);
    margin-inline: auto;
  }

  .game-page .content-section {
    padding: 20px 16px;
  }

  .game-page input {
    max-width: 100%;
  }

  .game-page .grid {
    max-width: 100%;
  }

  .game-page .crossword-grid {
    width: min(100%, 525px);
    grid-template-columns: repeat(var(--cols, 15), minmax(0, 1fr)) !important;
  }

  .game-page .crossword-grid .cell {
    width: auto !important;
    height: auto !important;
    min-width: 0;
    aspect-ratio: 1;
  }

  .game-page .crossword-grid .cell input {
    min-width: 0;
    font-size: clamp(12px, 4vw, 18px);
  }

  .game-page .clues-container {
    width: 100%;
    min-width: 0 !important;
  }

  .game-page .grid-cell {
    width: auto !important;
    height: auto !important;
    min-width: 0;
    aspect-ratio: 1;
    font-size: clamp(12px, 4.5vw, 19px);
  }

  .sanahaku-page #grid.grid {
    width: 100%;
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }

  .sanapalapeli-page .grid {
    width: min(100%, 420px);
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sanapalapeli-page .grid > div {
    min-width: 0;
    width: auto !important;
    height: auto !important;
    aspect-ratio: 1;
  }

  .sanalouhos-page #grid.grid {
    width: min(100%, 420px);
    max-width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sanalouhos-page .grid-container {
    width: min(100%, 420px);
    max-width: 100%;
  }

  .sanalouhos-page .icon-button {
    width: auto;
    min-width: 44px;
    padding: 0 10px;
  }

  .game-page .cell {
    max-width: 100%;
  }

  .game-page .grid .cell {
    width: auto !important;
    height: auto !important;
    min-width: 0;
    aspect-ratio: 1;
  }

  .game-page .pyramid-row {
    width: 100%;
  }

  .game-page .word-button {
    min-width: 0;
    max-width: 100%;
    padding: 10px 8px;
    overflow-wrap: anywhere;
    font-size: clamp(10px, 3vw, 14px);
  }

  .legal-main {
    margin: 24px auto;
    padding: 22px 18px;
  }

  .help-content {
    padding: 0 8px 8px;
  }

  .privacy-notice {
    right: 10px;
    bottom: 10px;
    width: calc(100% - 20px);
    align-items: flex-end;
  }
}

@media (max-width: 390px) {
  .site-name {
    font-size: 19px;
  }

  .site-menu.is-open {
    grid-template-columns: 1fr 1fr;
  }

  .game-page .crossword-grid {
    gap: 1px;
    padding: 3px;
  }

  .game-page .cell-number {
    font-size: 7px;
  }
}
