:root {
  color-scheme: light;
  --paper: #f4f2ec;
  --ink: #18211e;
  --muted: #61706a;
  --line: #d7ded7;
  --white: #fffdfc;
  --surface-strong: #f8fbf8;
  --surface-soft: #eef5f1;
  --surface-soft-line: #bfd0c6;
  --surface-search: #eaf1ee;
  --surface-search-line: #cadbd3;
  --surface-active: #e8f2ed;
  --surface-success: #dff2e7;
  --surface-danger: #ffd6d2;
  --surface-disabled: #e7ebea;
  --floating-surface: rgba(255, 255, 255, 0.92);
  --floating-surface-strong: rgba(248, 251, 248, 0.9);
  --frame-surface: rgba(23, 33, 33, 0.92);
  --frame-line: rgba(255, 255, 255, 0.24);
  --popup-line: rgba(255, 255, 255, 0.18);
  --leaf: #2f7d55;
  --leaf-dark: #235f42;
  --gold: #d9aa2e;
  --coral: #d96459;
  --blue: #3975a6;
  --critical: #b73228;
  --critical-strong: #c84d4d;
  --status-neutral-text: #61706a;
  --status-neutral-bg: #f5f8f6;
  --status-neutral-line: #dae5de;
  --status-info-text: #365467;
  --status-info-bg: #eef6fb;
  --status-info-line: #cddfed;
  --status-warning-text: #7a5900;
  --status-warning-bg: #fff4d4;
  --status-warning-line: #efcf72;
  --status-success-text: #1f5d40;
  --status-success-bg: #e8f5ee;
  --status-success-line: #b8dec8;
  --status-danger-text: #5f4851;
  --status-danger-bg: #eef1f2;
  --status-danger-line: #cad4d7;
  --ordjakt-text: #121213;
  --ordjakt-key: #d3d6da;
  --ordjakt-border: #d3d6da;
  --ordjakt-fill-border: #878a8c;
  --crossword-panel: #ffffff;
  --crossword-panel-line: #c6d0cb;
  --crossword-grid-bg: #18211e;
  --crossword-cell: #f7faf8;
  --crossword-ink: #18211e;
  --crossword-muted: #6b7a73;
  --crossword-cell-number: rgba(255, 253, 252, 0.92);
  --crossword-active: #cfe0fb;
  --crossword-selected: #2454c7;
  --crossword-correct: #cbe8d4;
  --crossword-wrong: #f2c7c2;
  --ordjakt-correct: #2f8f63;
  --ordjakt-correct-dark: #1e6948;
  --ordjakt-present: #f0c44c;
  --ordjakt-present-dark: #b88410;
  --ordjakt-absent: #647278;
  --ordjakt-absent-dark: #49545a;
  --accent: #355247;
  --accent-soft: #edf2ef;
  --accent-strong: #274238;
  --accent-line: #c9d4cd;
  --accent-wash: rgba(53, 82, 71, 0.12);
  --theme-toggle-track: rgba(53, 82, 71, 0.12);
  --page-glow: radial-gradient(circle at top right, rgba(53, 82, 71, 0.12), transparent 38%);
  --shadow: 0 18px 44px rgba(23, 33, 33, 0.12);
  --shadow-strong: 0 24px 54px rgba(23, 33, 33, 0.18);
  --shadow-soft: 0 10px 22px rgba(23, 33, 33, 0.08);
  --shadow-soft-hover: 0 14px 28px rgba(23, 33, 33, 0.11);
}

:root[data-color-scheme="dark"] {
  color-scheme: dark;
  --paper: #111816;
  --ink: #edf3ef;
  --muted: #9eada6;
  --line: #2b3732;
  --white: #18211e;
  --surface-strong: #1e2824;
  --surface-soft: #202b26;
  --surface-soft-line: #3b4b44;
  --surface-search: #1c2824;
  --surface-search-line: #34423d;
  --surface-active: #1f3129;
  --surface-success: #1d3c2c;
  --surface-danger: #462826;
  --surface-disabled: #25302c;
  --floating-surface: rgba(24, 33, 30, 0.92);
  --floating-surface-strong: rgba(30, 40, 36, 0.9);
  --frame-surface: rgba(237, 243, 239, 0.12);
  --frame-line: rgba(237, 243, 239, 0.18);
  --popup-line: rgba(237, 243, 239, 0.16);
  --critical: #ff8f88;
  --critical-strong: #df6b63;
  --status-neutral-text: #b7c4be;
  --status-neutral-bg: #18211e;
  --status-neutral-line: #314039;
  --status-info-text: #b8d7e7;
  --status-info-bg: #16242c;
  --status-info-line: #365264;
  --status-warning-text: #f1d37b;
  --status-warning-bg: #2f2614;
  --status-warning-line: #6a5521;
  --status-success-text: #bce4cb;
  --status-success-bg: #152720;
  --status-success-line: #315443;
  --status-danger-text: #d9c2ca;
  --status-danger-bg: #262126;
  --status-danger-line: #54414b;
  --ordjakt-text: #f2f5f4;
  --ordjakt-key: #2b3732;
  --ordjakt-border: #43524b;
  --ordjakt-fill-border: #8fa098;
  --crossword-panel: #18211e;
  --crossword-panel-line: #314039;
  --crossword-grid-bg: #18211e;
  --crossword-cell: #f6f8f7;
  --crossword-ink: #18211e;
  --crossword-muted: #6b7a73;
  --crossword-cell-number: rgba(246, 248, 247, 0.96);
  --crossword-active: #c9daf8;
  --crossword-selected: #5a8dff;
  --crossword-correct: #c8e6d1;
  --crossword-wrong: #f0c4c2;
  --ordjakt-correct: #5eb97f;
  --ordjakt-correct-dark: #459868;
  --ordjakt-present: #d9b652;
  --ordjakt-present-dark: #bc9834;
  --ordjakt-absent: #53635c;
  --ordjakt-absent-dark: #435049;
  --theme-toggle-track: rgba(237, 243, 239, 0.08);
  --page-glow: radial-gradient(circle at top right, rgba(111, 168, 136, 0.16), transparent 42%);
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
  --shadow-strong: 0 24px 54px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 10px 22px rgba(0, 0, 0, 0.24);
  --shadow-soft-hover: 0 14px 28px rgba(0, 0, 0, 0.32);
}

:root[data-color-palette="rose"] {
  --leaf: #ff4fa8;
  --leaf-dark: #db2d8b;
  --gold: #ffc95c;
  --coral: #ff78b7;
  --blue: #d764f2;
  --theme-toggle-track: rgba(255, 79, 168, 0.24);
  --page-glow: radial-gradient(circle at top right, rgba(255, 109, 185, 0.3), transparent 42%);
}

:root[data-color-scheme="dark"][data-color-palette="rose"] {
  --leaf: #ff7ac3;
  --leaf-dark: #f553aa;
  --gold: #ffd57f;
  --coral: #ff9bce;
  --blue: #e18cff;
  --theme-toggle-track: rgba(255, 122, 195, 0.2);
  --page-glow: radial-gradient(circle at top right, rgba(255, 112, 191, 0.34), transparent 46%);
}

:root[data-color-palette="ocean"] {
  --leaf: #2d8f8e;
  --leaf-dark: #1d6566;
  --gold: #d2b45f;
  --coral: #f08b62;
  --blue: #2d7fb1;
  --theme-toggle-track: rgba(45, 127, 177, 0.14);
  --page-glow: radial-gradient(circle at top right, rgba(58, 142, 197, 0.18), transparent 40%);
}

:root[data-color-scheme="dark"][data-color-palette="ocean"] {
  --leaf: #48a9a8;
  --leaf-dark: #338382;
  --gold: #e1c170;
  --coral: #f4a079;
  --blue: #66b6e2;
  --theme-toggle-track: rgba(102, 182, 226, 0.12);
  --page-glow: radial-gradient(circle at top right, rgba(91, 171, 220, 0.2), transparent 44%);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--page-glow), var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  color: var(--ink);
  background: var(--page-glow), var(--paper);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
  transition: background-color 180ms ease, color 180ms ease;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

body.theme-home {
  --accent: #355247;
  --accent-soft: #edf2ef;
  --accent-strong: #274238;
  --accent-line: #c9d4cd;
  --accent-wash: rgba(53, 82, 71, 0.12);
}

:root[data-color-scheme="dark"] body.theme-home {
  --accent: #7db498;
  --accent-soft: #18241f;
  --accent-strong: #d9efe2;
  --accent-line: #355045;
  --accent-wash: rgba(125, 180, 152, 0.18);
}

:root[data-color-palette="rose"] body.theme-home {
  --accent: #ff53aa;
  --accent-soft: #ffd8eb;
  --accent-strong: #c81f79;
  --accent-line: #ff9ecb;
  --accent-wash: rgba(255, 83, 170, 0.24);
}

:root[data-color-scheme="dark"][data-color-palette="rose"] body.theme-home {
  --accent: #ff85c8;
  --accent-soft: #3d1027;
  --accent-strong: #ffdff0;
  --accent-line: #ff78bf;
  --accent-wash: rgba(255, 133, 200, 0.28);
}

:root[data-color-palette="ocean"] body.theme-home {
  --accent: #2b7ba8;
  --accent-soft: #e3f1f8;
  --accent-strong: #1e5674;
  --accent-line: #c2dceb;
  --accent-wash: rgba(43, 123, 168, 0.15);
}

:root[data-color-scheme="dark"][data-color-palette="ocean"] body.theme-home {
  --accent: #73b9df;
  --accent-soft: #16232c;
  --accent-strong: #dff4fd;
  --accent-line: #365667;
  --accent-wash: rgba(115, 185, 223, 0.18);
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  padding: 16px max(16px, calc((100% - 1120px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--floating-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-width: 0;
}

.brand-logo-container {
  position: relative;
  display: inline-block;
  margin-top: 6px;
}

.brand-mark {
  width: 42px;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: #f4d08f;
  border: 2px solid #c9a463;
  border-radius: 6px;
  font-family: Arial, sans-serif;
  box-shadow: 3px 4px 0 var(--accent);
  position: relative;
}

:root[data-color-scheme="dark"] .brand-mark {
  background: #e2be7a;
  color: #18211e;
}

.brand-mark .letter {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  margin-top: -2px;
}

.brand-mark .points {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 0.6rem;
  font-weight: bold;
}

.brand-crown {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%) rotate(12deg);
  font-size: 1.2rem;
  filter: drop-shadow(1px 1px 0 rgba(0,0,0,0.2));
  z-index: 1;
  user-select: none;
}

.brand-title,
.brand-subtitle {
  display: block;
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 800;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.86rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-nav a {
  padding: 8px 11px;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a.active {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: var(--accent-line);
  outline: none;
}

.site-nav a.nav-info-link {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 9px;
}

/* Dropdown */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 11px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 180ms ease;
}

.nav-dropdown-toggle:hover,
.nav-dropdown-toggle:focus-visible,
.nav-dropdown-toggle.active,
.nav-dropdown.open .nav-dropdown-toggle,
.nav-dropdown:hover .nav-dropdown-toggle {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: var(--accent-line);
  outline: none;
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--floating-surface);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
  min-width: 180px;
  z-index: 20;
  padding: 6px;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
  display: flex;
}

.nav-dropdown-menu a {
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 600;
  margin-bottom: 2px;
}

.nav-dropdown-menu a:last-child {
  margin-bottom: 0;
}

/* Søkefelt */
.nav-search-container {
  position: relative;
  margin-left: 8px;
  display: flex;
  align-items: center;
}

.nav-search-input {
  padding: 8px 14px 8px 32px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-search) url('data:image/svg+xml;utf8,<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="%2361706a" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>') no-repeat 12px center;
  color: var(--ink);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  width: 160px;
  transition: all 0.2s ease;
}

.nav-search-input::placeholder {
  color: var(--muted);
}

.nav-search-input:focus {
  width: 220px;
  border-color: var(--accent);
  background-color: var(--white);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.nav-search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--floating-surface);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  width: max(100%, 220px);
  display: flex;
  flex-direction: column;
  z-index: 20;
  padding: 6px;
}

.nav-search-results[hidden] {
  display: none !important;
}

.nav-search-results a,
.nav-search-no-results {
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--ink);
  text-decoration: none;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 600;
  margin-bottom: 2px;
}

.nav-search-results a:last-child {
  margin-bottom: 0;
}

.nav-search-results a:hover,
.nav-search-results a:focus-visible {
  background: var(--surface-active);
  color: var(--accent-strong);
  border-color: var(--accent-line);
}

.nav-search-no-results {
  color: var(--muted);
  font-style: italic;
  font-weight: normal;
  text-align: center;
  padding: 14px;
}

.theme-controls {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.theme-menu-button,
.theme-swatch {
  min-height: 42px;
  min-width: 42px;
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-strong);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.theme-menu-button:hover,
.theme-menu-button:focus-visible,
.theme-swatch:hover,
.theme-swatch:focus-visible {
  transform: translateY(-1px);
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: var(--accent-line);
  box-shadow: var(--shadow-soft-hover);
  outline: none;
}

.theme-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 12;
  width: max-content;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  background: var(--floating-surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.theme-menu[hidden] {
  display: none;
}

.theme-swatch[data-active="true"] {
  border-color: var(--accent-strong);
  box-shadow: inset 0 0 0 2px var(--accent-soft), var(--shadow-soft-hover);
}

.theme-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-preview-color {
  width: 16px;
  aspect-ratio: 1;
  display: block;
  background: var(--theme-preview-color, var(--accent));
  border: 1px solid rgba(23, 33, 33, 0.12);
  border-radius: 999px;
}

main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.intro-section {
  min-height: 280px;
  padding: 42px 0 34px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  gap: 32px;
  align-items: end;
}

body.theme-home .intro-section {
  min-height: auto;
  padding: 18px 0 22px;
  grid-template-columns: 1fr;
  gap: 0;
  align-items: start;
}

.intro-copy {
  max-width: 720px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(2.25rem, 8vw, 5.4rem);
  line-height: 0.96;
}

h2 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.1;
}

.intro-copy p:last-child,
.page-heading p:last-child,
.coming-soon p,
.featured-panel p,
.theme-card p {
  color: var(--muted);
  font-size: 1.05rem;
}

.intro-copy p:last-child {
  max-width: 560px;
}

.intro-image {
  margin: 0;
}

.intro-image img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  grid-auto-rows: 1fr;
  gap: 10px;
  padding: 8px 0 44px;
  align-items: stretch;
}

body.theme-home .game-grid[aria-label="Spillvalg"] {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

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

.about-section h2 {
  font-size: 1.6rem;
  margin: 0 0 12px;
  color: var(--accent-strong);
}

.about-section p {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 0;
}

.game-card {
  min-height: 200px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 14px;
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.game-card:hover,
.game-card:focus-visible {
  transform: translateY(-5px);
  border-color: var(--ink);
  box-shadow: var(--shadow-strong);
  outline: none;
}

.card-art {
  width: 100%;
  max-width: 180px;
  margin: 0 auto;
  align-self: start;
}

.crossword-art,
.mini-crossword,
.large-crossword {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.crossword-art span,
.mini-crossword span,
.large-crossword span {
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--surface-soft-line);
}

.crossword-art span:empty,
.mini-crossword span:empty,
.large-crossword span.empty {
  background: var(--ink);
  border-color: var(--ink);
}

.wordsearch-art,
.search-preview {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  position: relative;
}

.wordsearch-art span,
.search-preview span {
  position: relative;
  z-index: 1;
  color: var(--ink);
  background: var(--surface-search);
  border: 1px solid var(--surface-search-line);
}

.wordsearch-art::after {
  content: "";
  position: absolute;
  top: 15%;
  left: 5%;
  width: 90%;
  height: 30%;
  background: rgba(255, 210, 0, 0.45);
  border-radius: 999px;
  transform-origin: top left;
  transform: rotate(32deg);
  z-index: 2;
  pointer-events: none;
}

.anagram-art,
.anagram-preview {
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.anagram-art span,
.anagram-preview span {
  width: 46px;
  color: #333;
  background: #e8d5a6;
  border: 1px solid #c9b37c;
  border-radius: 4px;
  box-shadow: 2px 3px 5px rgba(0,0,0,0.2);
  transform: rotate(var(--tilt, 0deg));
  position: relative;
}

.anagram-art span::after,
.anagram-preview span::after {
  content: "1";
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 0.5rem;
  font-weight: 700;
  color: #555;
}

.anagram-art span:nth-child(1) { --tilt: -8deg; }

.anagram-art span:nth-child(2) { --tilt: 6deg; }

.anagram-art span:nth-child(3) { --tilt: -3deg; }

.anagram-art span:nth-child(4) { --tilt: 9deg; }

.anagram-art span:nth-child(5) { --tilt: -6deg; }

.anagram-art span:nth-child(6) { --tilt: 4deg; }

.ordras-art {
  min-height: 108px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  max-width: 152px;
  margin-top: 6px;
}

.ordras-card {
  overflow: hidden;
}

.ordras-art span {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 12px;
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  color: #12314a;
  background: linear-gradient(180deg, #dce8ff, #a9c1ff);
  border: 1px solid rgba(66, 98, 184, 0.28);
  box-shadow: 0 10px 18px rgba(38, 61, 133, 0.12);
}

.ordras-art span:nth-child(1) { transform: translateY(4px) rotate(-4deg); }
.ordras-art span:nth-child(2) { transform: translateY(-2px) rotate(3deg); }
.ordras-art span:nth-child(3) { transform: translateY(5px) rotate(-2deg); }
.ordras-art span:nth-child(4) { transform: translateY(-4px) rotate(4deg); }
.ordras-art span:nth-child(5) { transform: translateY(2px) rotate(-3deg); }
.ordras-art span:nth-child(6) { transform: translateY(-1px) rotate(2deg); }

.ordjakt-art {
  display: grid !important;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  transform: rotateX(50deg) rotateZ(-35deg) scale(0.9);
  transform-style: preserve-3d;
  margin-top: 15px;
}

.ordjakt-art span {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 6px;
  font-weight: 800;
  color: var(--white);
  background: var(--ordjakt-absent);
  border: 1px solid var(--ordjakt-border);
  box-shadow: -2px 2px 0px rgba(0,0,0,0.15);
}

.ordjakt-art span:nth-child(1),
.ordjakt-art span:nth-child(4),
.ordjakt-art span:nth-child(8) {
  background: var(--leaf);
  border-color: var(--leaf);
}

.ordjakt-art span:nth-child(2),
.ordjakt-art span:nth-child(7) {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--ink);
}

.ordfall-art {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.ordfall-art span {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  color: var(--white);
  background: linear-gradient(145deg, var(--blue), var(--accent-strong));
  border: 1px solid var(--accent-strong);
  box-shadow: 3px 3px 0 rgba(23, 33, 33, 0.15);
}

.ordfall-art span:nth-child(4) {
  opacity: 0;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.ordfall-art span:nth-child(n + 5) {
  animation: float-fall-alt 3.5s infinite ease-in-out;
}

@keyframes float-fall {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(6px) rotate(2deg); }
}

@keyframes float-fall-alt {
  0%, 100% { transform: translateY(8px) rotate(0deg); }
  50% { transform: translateY(14px) rotate(-2deg); }
}

.ordfall-art span:nth-child(1) { animation: float-fall 3s infinite ease-in-out; }
.ordfall-art span:nth-child(2) { animation: float-fall 3.2s infinite ease-in-out 1s; }
.ordfall-art span:nth-child(3) { animation: float-fall 2.8s infinite ease-in-out 0.5s; }

.andre-sprak-art {
  display: grid !important;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.andre-sprak-art span {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  color: var(--white);
  background: linear-gradient(145deg, var(--leaf), var(--accent-strong));
  border: 1px solid var(--leaf-dark);
  box-shadow: 3px 3px 0 rgba(23, 33, 33, 0.15);
}

.flag-art {
  width: 100%;
  max-width: 140px;
  margin: 0 auto;
  align-self: start;
  aspect-ratio: 3 / 2;
  min-height: 92px;
  flex: 0 0 auto;
  box-sizing: border-box;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border: 1px solid rgba(0,0,0,0.1);
  display: block;
  position: relative;
  overflow: hidden;
  background-color: #ffffff;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
}

.flag-de {
  background: linear-gradient(to bottom, #000000 33.33%, #FF0000 33.33%, #FF0000 66.66%, #FFCC00 66.66%) !important;
}

.flag-fr {
  background: linear-gradient(to right, #0055A4 33.33%, #FFFFFF 33.33%, #FFFFFF 66.66%, #EF4135 66.66%) !important;
}

.flag-es {
  background: linear-gradient(to bottom, #AA151B 25%, #F1BF00 25%, #F1BF00 75%, #AA151B 75%) !important;
  position: relative;
}
.flag-es::after {
  content: "";
  position: absolute;
  left: 30%;
  top: 50%;
  transform: translateY(-50%);
  width: 12%;
  aspect-ratio: 3/4;
  background: #AA151B;
  border-radius: 2px;
}

.flag-en {
  background: repeating-linear-gradient(to bottom, #B22234 0, #B22234 10%, #FFFFFF 10%, #FFFFFF 20%) !important;
  position: relative;
}
.flag-en::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 45%;
  height: 55%;
  background: #3C3B6E;
  border-bottom-right-radius: 2px;
}

.flag-ru {
  background: linear-gradient(to bottom, #FFFFFF 33.33%, #0039A6 33.33%, #0039A6 66.66%, #D52B1E 66.66%) !important;
}

.flag-zh {
  background: #EE1C25 !important;
  position: relative;
}
.flag-zh::after {
  content: "★";
  position: absolute;
  top: 10%;
  left: 15%;
  color: #FFFF00;
  font-size: 2.4rem;
  line-height: 1;
}

.flag-it {
  background: linear-gradient(to right, #009246 33.33%, #FFFFFF 33.33%, #FFFFFF 66.66%, #CE2B37 66.66%) !important;
}

.flag-pl {
  background: linear-gradient(to bottom, #FFFFFF 50%, #DC143C 50%) !important;
}

.flag-hi {
  background: linear-gradient(to bottom, #FF9933 33.33%, #FFFFFF 33.33%, #FFFFFF 66.66%, #138808 66.66%) !important;
  position: relative;
}
.flag-hi::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 2px solid #000080;
}

.flag-uk {
  background: linear-gradient(to bottom, #0057B7 50%, #FFDD00 50%) !important;
}

.flag-br {
  background: #009B3A !important;
  position: relative;
  overflow: hidden;
}
.flag-br::before {
  content: "";
  position: absolute;
  top: 10%;
  left: 10%;
  right: 10%;
  bottom: 10%;
  background: #FEDF00;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}
.flag-br::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2rem;
  height: 2rem;
  background: #002776;
  border-radius: 50%;
}

.flag-ja {
  background: #FFFFFF !important;
  position: relative;
  border: 1px solid var(--surface-soft-line);
}
.flag-ja::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2rem;
  height: 2rem;
  background: #BC002D;
  border-radius: 50%;
}

.tastemesteren-art,
.tastemesteren-preview {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  width: 100%;
  max-width: 160px;
}

.tastemesteren-art span,
.tastemesteren-preview span {
  display: grid;
  place-items: center;
  width: calc(20% - 4px);
  aspect-ratio: 1;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--surface-soft-line);
  box-shadow: 2px 2px 0 rgba(23, 33, 33, 0.15);
  border-radius: 4px;
  transition: all 0.2s ease;
}

.tastemesteren-art span:empty,
.tastemesteren-preview span:empty {
  background: var(--surface-soft);
  border-color: var(--surface-soft-line);
  box-shadow: none;
}

/* Light up a few keys */
.tastemesteren-art span:nth-child(4),
.tastemesteren-art span:nth-child(9) {
  background: var(--leaf);
  color: var(--white);
  border-color: var(--leaf-dark);
  transform: translateY(2px);
  box-shadow: 0px 0px 0 rgba(23, 33, 33, 0.15);
}

/* The spacebar */
.tastemesteren-art span:nth-child(13) {
  width: calc(60% - 4px);
  aspect-ratio: auto;
  height: 28px;
  color: transparent;
  background: var(--surface-soft);
}

/* Hide the last two keys to make room for spacebar */
.tastemesteren-art span:nth-child(14),
.tastemesteren-art span:nth-child(15) {
  display: none;
}

.card-text {
  display: block;
  flex: 1 1 auto;
}

.card-title,
.card-description,
.card-action {
  display: block;
}

.card-title {
  margin-bottom: 0;
  font-size: clamp(1.05rem, 1.7vw, 1.25rem);
  font-weight: 850;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.card-description {
  color: var(--muted);
  max-width: 24ch;
  font-size: 0.98rem;
}

.card-action {
  width: fit-content;
  margin-top: auto;
  padding: 8px 11px;
  color: var(--white);
  background: var(--ink);
  border-radius: 8px;
  font-weight: 800;
}

.page-heading,
.coming-soon {
  max-width: 780px;
}

.page-heading {
  padding: 34px 0 14px;
}

.theme-section {
  padding-bottom: 16px;
}

.coming-soon {
  padding: 54px 0 30px;
}

.featured-panel {
  margin: 10px 0 26px;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--white);
  background: var(--leaf-dark);
  border-radius: 8px;
}

.featured-panel--center {
  justify-content: center;
  text-align: center;
}

.featured-panel--text {
  display: block;
}

.featured-panel__content {
  max-width: 62ch;
}

.featured-panel__content h2 {
  margin: 0 0 12px;
}

.featured-panel__content p {
  margin: 0 0 12px;
}

.featured-panel__content p:last-child {
  margin-bottom: 0;
}

.featured-panel .eyebrow,
.featured-panel p {
  color: var(--surface-active);
}

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

.overview-actions a {
  text-decoration: none;
}

.primary-link,
.theme-card {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 14px;
  color: var(--ink);
  background: var(--white);
  border-radius: 8px;
  font-weight: 800;
  text-decoration: none;
}

.primary-link:hover,
.primary-link:focus-visible,
.theme-card:hover,
.theme-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.primary-link {
  color: var(--white);
  background: var(--accent-strong);
}

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

.theme-card {
  min-height: 0;
  padding: 11px 12px 10px;
  display: block;
  color: inherit;
  background: var(--floating-surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.theme-card:hover,
.theme-card:focus-visible {
  transform: translateY(-1px);
  border-color: var(--accent-strong);
  background: var(--accent-soft);
  box-shadow: var(--shadow-soft-hover);
}

.theme-card h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.1;
}

.theme-level {
  display: inline-flex;
  margin-top: 8px;
  padding: 4px 7px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
}

.coming-soon {
  min-height: 540px;
}

.puzzle-shell {
  min-height: 520px;
  padding: 54px 0 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 32px;
  align-items: center;
}

.puzzle-copy {
  max-width: 700px;
}

.puzzle-copy p {
  color: var(--muted);
  font-size: 1.05rem;
}

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

.secondary-button {
  min-height: 42px;
  padding: 9px 14px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.secondary-button:hover,
.secondary-button:focus-visible {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: var(--accent-line);
  outline: none;
}

.puzzle-board {
  padding: 18px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.large-crossword {
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.large-crossword span {
  min-width: 0;
  font-size: clamp(0.8rem, 3vw, 1.4rem);
}

.clue-section {
  padding: 0 0 52px;
}

.clue-section h2 {
  margin-bottom: 16px;
}

.clue-list {
  max-width: 780px;
  margin: 0;
  padding-left: 24px;
  color: var(--muted);
  font-size: 1.05rem;
}

.clue-list li + li {
  margin-top: 10px;
}

.theme-choice {
  min-height: 560px;
  padding: 54px 0 52px;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(300px, 1fr);
  gap: 28px;
  align-items: center;
}

.theme-choice p {
  max-width: 620px;
  color: var(--muted);
  font-size: 1.05rem;
}

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

.word-count-card {
  min-height: 220px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease;
}

.word-count-card:hover,
.word-count-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--accent-strong);
  outline: none;
}

.word-count-card span {
  width: 58px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: var(--white);
  background: var(--accent-strong);
  border-radius: 8px;
  font-size: 1.5rem;
  font-weight: 850;
}

.word-count-card strong {
  display: block;
  font-size: 1.5rem;
}

.word-count-card small {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 800;
}

.play-crossword-grid {
  --cell-size: clamp(20px, 2.4vw, 30px);
  display: grid;
  grid-template-columns: repeat(var(--crossword-width), var(--cell-size));
  width: max-content;
  margin: 0 auto;
  border: 2px solid var(--crossword-grid-bg);
  background: var(--crossword-grid-bg);
  gap: 2px;
}

.clue-group {
  min-width: 0;
}

.clue-group summary {
  margin-bottom: 10px;
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: 850;
  list-style-position: inside;
}

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

.stats-grid div {
  min-height: 78px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stats-grid span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.stats-grid strong {
  font-size: 1.25rem;
  line-height: 1.1;
}

.game-shell {
  padding: 12px 0 52px;
}

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

.game-panel,
.sidebar-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.game-panel {
  padding: 20px;
}

.game-panel-head {
  margin-bottom: 16px;
}

.game-panel-head h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 0.98;
}

.game-panel-head p:last-child,
.sidebar-card p {
  color: var(--muted);
  font-size: 0.95rem;
}

.game-status {
  min-height: 28px;
  margin: 0 0 16px;
  padding: 11px 14px;
  color: var(--status-neutral-text);
  background: var(--status-neutral-bg);
  border: 1px solid var(--status-neutral-line);
  border-radius: 12px;
  font-size: 0.94rem;
  font-weight: 800;
}

.game-status[data-tone="info"] {
  color: var(--status-info-text);
  background: var(--status-info-bg);
  border-color: var(--status-info-line);
}

.game-status[data-tone="warning"] {
  color: var(--status-warning-text);
  background: var(--status-warning-bg);
  border-color: var(--status-warning-line);
}

.game-status[data-tone="success"] {
  color: var(--status-success-text);
  background: var(--status-success-bg);
  border-color: var(--status-success-line);
}

.game-status[data-tone="danger"] {
  color: var(--status-danger-text);
  background: var(--status-danger-bg);
  border-color: var(--status-danger-line);
}

.game-sidebar {
  display: grid;
  gap: 18px;
}

.sidebar-card {
  padding: 18px;
}

.sidebar-card h2 {
  margin-bottom: 12px;
  color: var(--accent-strong);
  font-size: 1.15rem;
}

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

.mini-stats div {
  min-height: 74px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mini-stats span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.mini-stats strong {
  font-size: 1.25rem;
}

.sidebar-actions,
.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.size-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.size-toolbar .chip-row {
  flex: 1 1 auto;
}

.theme-chip {
  min-height: 38px;
  padding: 8px 12px;
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.theme-chip:hover,
.theme-chip:focus-visible,
.theme-chip.active {
  color: var(--white);
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  outline: none;
}

.word-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.word-pill {
  padding: 7px 10px;
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.word-pill.found {
  color: var(--white);
  background: var(--leaf);
  border-color: var(--leaf);
}

.seo-copy {
  margin: 0 0 52px;
  padding: 18px 20px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.seo-copy h2 {
  margin-bottom: 10px;
  color: var(--accent-strong);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.seo-copy p {
  max-width: 64ch;
  color: var(--muted);
  font-size: 0.95rem;
}

.search-preview {
  grid-template-columns: repeat(6, 1fr);
}

.search-preview span:nth-child(n+13):nth-child(-n+18) {
  background: var(--surface-danger);
  border-color: var(--coral);
}

.anagram-preview {
  justify-content: flex-start;
}

.site-footer {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 36px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  border-top: 1px solid var(--border);
}

.footer-back-nav a {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.footer-back-nav a:hover {
  text-decoration: underline;
}

.footer-global-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
}

.footer-global-nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.footer-global-nav a:hover {
  color: var(--ink);
}

.footer-copyright {
  font-size: 0.875rem;
  color: var(--muted);
}

@media (max-width: 980px) {
  .intro-section {
    grid-template-columns: 1fr;
  }

.puzzle-shell {
    grid-template-columns: 1fr;
  }

.theme-choice {
    grid-template-columns: 1fr;
  }

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

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

.intro-image {
    max-width: 420px;
  }

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

  body.theme-home .game-grid[aria-label="Spillvalg"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@media (max-width: 700px) {
  .game-shell {
    padding-top: 8px;
  }

.game-panel,
  .sidebar-card {
    padding: 14px;
  }

.site-header {
    align-items: flex-start;
    flex-direction: column;
  }

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

.theme-controls {
    width: 100%;
  }

.theme-menu {
    right: auto;
    left: 0;
  }

.theme-menu-button {
    margin-left: 0;
  }

.intro-section {
    min-height: auto;
    padding-top: 28px;
  }

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

  body.theme-home .game-grid[aria-label="Spillvalg"] {
    grid-template-columns: 1fr;
  }

.game-card {
    min-height: 240px;
  }

.featured-panel {
    align-items: flex-start;
    flex-direction: column;
  }

.word-count-grid {
    grid-template-columns: 1fr;
  }

.word-count-card {
    min-height: 160px;
  }

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

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

@keyframes ordjakt-shake {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-4px);
  }

  50% {
    transform: translateX(4px);
  }

  75% {
    transform: translateX(-3px);
  }
}
.intro-eyebrow { margin-bottom: 0.25rem; }
.intro-title { font-size: 2.5rem; font-weight: 800; margin-top: 0; line-height: 1.1; }


input, textarea, [contenteditable] {
  user-select: auto;
  -webkit-user-select: auto;
}

/* Native App Hide Rules */
.is-native-app .intro-section,
.is-native-app .intro-copy,
.is-native-app [class$='-seo-article'],
.is-native-app .featured-panel,
.is-native-app .site-footer {
  display: none !important;
}

/* Adjust top padding if intro-section is hidden on the home page */
.is-native-app.theme-home main {
  padding-top: 2rem;
}

a, button, input, textarea, [role='button'] {
  touch-action: manipulation;
}

.is-native-app .brand-title,
.is-native-app .brand-subtitle {
  display: none !important;
}

.is-native-app .brand-mark {
  width: 36px;
}

.is-native-app .site-header {
  padding: 12px max(16px, calc((100% - 1120px) / 2));
  padding-top: max(12px, env(safe-area-inset-top));
}
