@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&family=Rowdies:wght@400;700&display=swap');

:root {
  color-scheme: light;
  
  /* Ordkongen Fantasy Theme Base */
  --primary: #2d5a3c;
  --primary-dark: #1e4029;
  --primary-shadow: #142e1d;
  --secondary: #8b5a2b;
  --secondary-dark: #6b421a;
  --secondary-shadow: #4a2d10;
  --background: #fdf8eb;
  --surface: #fcf7ec;
  --surface-hover: #ffffff;
  --text-main: #3b3a30;
  --text-muted: #6b695c;
  --border-light: #e8dcc4;
  --gold: #f5b041;
  --gold-dark: #d68910;
  --gold-shadow: #a04000;

  --font-heading: 'Rowdies', cursive;
  --font-body: 'Outfit', sans-serif;

  /* UI Sub-surfaces */
  --surface-soft-line: #e8dcc4;
  --surface-search: #fcf7ec;
  --surface-search-line: #e8dcc4;
  --surface-active: #f5eedc;
  --surface-success: #dff2e7;
  --surface-danger: #ffd6d2;
  --surface-disabled: #e7ebea;
  --floating-surface: rgba(253, 248, 235, 0.92);
  --floating-surface-strong: rgba(253, 248, 235, 0.98);
  --frame-surface: rgba(45, 90, 60, 0.92);
  --frame-line: rgba(255, 255, 255, 0.24);
  --popup-line: rgba(255, 255, 255, 0.18);
  
  --leaf: #2f7d55;
  --leaf-dark: #235f42;
  --coral: #d96459;
  --blue: #3975a6;
  --critical: #b73228;
  --critical-strong: #c84d4d;
  
  /* Status Colors */
  --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;
  
  /* Game Colors (Wordle, Crossword, etc.) */
  --ordjakt-text: #121213;
  --ordjakt-key: #e8dcc4;
  --ordjakt-border: #e8dcc4;
  --ordjakt-fill-border: #8b5a2b;
  --crossword-panel: #fcf7ec;
  --crossword-panel-line: #e8dcc4;
  --crossword-grid-bg: #1e4029;
  --crossword-cell: #ffffff;
  --crossword-ink: #3b3a30;
  --crossword-muted: #6b695c;
  --crossword-cell-number: rgba(255, 255, 255, 0.92);
  --crossword-active: #f5b041;
  --crossword-selected: #2d5a3c;
  --crossword-correct: #cbe8d4;
  --crossword-wrong: #f2c7c2;
  --ordjakt-correct: #2d5a3c;
  --ordjakt-correct-dark: #1e4029;
  --ordjakt-present: #f5b041;
  --ordjakt-present-dark: #d68910;
  --ordjakt-absent: #6b695c;
  --ordjakt-absent-dark: #3b3a30;
  
  /* Accents */
  --accent: #2d5a3c;
  --accent-soft: #fcf7ec;
  --accent-strong: #1e4029;
  --accent-line: #e8dcc4;
  --accent-wash: rgba(45, 90, 60, 0.12);
  --theme-toggle-track: rgba(45, 90, 60, 0.12);
  --page-glow: radial-gradient(circle at top right, rgba(245, 176, 65, 0.12), transparent 38%);
  
  /* Shadows */
  --shadow: 0 18px 44px rgba(45, 90, 60, 0.12);
  --shadow-strong: 0 24px 54px rgba(45, 90, 60, 0.18);
  --shadow-soft: 0 10px 22px rgba(45, 90, 60, 0.08);
  --shadow-soft-hover: 0 14px 28px rgba(45, 90, 60, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background-color: var(--background);
}

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(--text-main);
  background-color: var(--background);
  background-image: url('../img/viking_bg_day.png');
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
  font-family: var(--font-body, 'Outfit', sans-serif);
  line-height: 1.5;
  transition: background-color 180ms ease, color 180ms ease;
  -webkit-tap-highlight-color: transparent;
}

/* Dynamic Time-of-day Backgrounds for PC side borders */
html[data-time-theme="day"] body,
body.time-day {
  background-image: url('../img/viking_bg_day.png');
}

html[data-time-theme="evening"] body,
body.time-evening {
  background-image: url('../img/viking_bg_sunset.png');
}

html[data-time-theme="night"] body,
body.time-night {
  background-image: url('../img/viking_bg_night.png');
}

.site-frame {
  width: 60%;
  margin: 0 auto;
  background-color: var(--background);
  background-image: radial-gradient(circle at 50% 0%, #ffffff 0%, var(--background) 100%);
  min-height: 100vh;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
}

@media (max-width: 1400px) {
  .site-frame {
    width: 80%;
  }
}

@media (max-width: 900px) {
  .site-frame {
    width: 100%;
    box-shadow: none;
  }
}

a {
  color: inherit;
}

/* ==========================================================================
   BUTTONS & UTILITIES
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 1.1rem;
  padding: 1rem 2rem;
  border-radius: 9999px;
  cursor: pointer;
  border: none;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-transform: uppercase;
  letter-spacing: 1px;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(to bottom, rgba(16, 185, 129, 0.85), rgba(5, 150, 105, 0.95)), url('../img/ui_button_wood.png') center/cover;
  color: white;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  box-shadow: 0 6px 0 var(--primary-shadow), 0 15px 20px rgba(45, 90, 60, 0.3), inset 0 2px 0 rgba(255,255,255,0.2);
}

.btn-primary:hover {
  transform: translateY(2px);
  box-shadow: 0 4px 0 var(--primary-shadow), 0 10px 15px rgba(45, 90, 60, 0.3);
}

.btn-primary:active {
  transform: translateY(6px);
  box-shadow: 0 0 0 var(--primary-shadow);
}

.btn-secondary {
  background: white;
  color: var(--text-main);
  box-shadow: 0 6px 0 var(--border-light), 0 15px 20px rgba(0,0,0,0.05);
  border: 2px solid var(--border-light);
}

.btn-secondary:hover {
  transform: translateY(2px);
  box-shadow: 0 4px 0 var(--border-light), 0 10px 15px rgba(0,0,0,0.05);
}

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

.site-nav a.nav-highlight-btn {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary-dark);
  transition: all 180ms ease;
}

.site-nav a.nav-highlight-btn:hover,
.site-nav a.nav-highlight-btn:focus-visible {
  background: var(--primary-dark);
  color: #ffffff;
  border-color: var(--primary-shadow);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(45, 90, 60, 0.15);
}

/* 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,
.header-search {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  width: auto;
}

.nav-search-input,
.header-search .search-input {
  padding: 0.55rem 1rem 0.55rem 2.5rem;
  border-radius: 9999px;
  border: 2px solid var(--border-light, #e8dcc4);
  background: #ffffff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%232d5a3c" stroke-width="2.5" 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(--text-main, #3b3a30);
  font-size: 0.92rem;
  font-weight: 500;
  font-family: var(--font-body, 'Outfit', sans-serif);
  outline: none;
  width: 220px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.03);
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.nav-search-input::placeholder,
.header-search .search-input::placeholder {
  color: var(--text-muted, #6b695c);
  opacity: 0.75;
}

.nav-search-input:focus,
.header-search .search-input:focus {
  width: 260px;
  border-color: var(--primary, #2d5a3c);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(45, 90, 60, 0.15), 0 2px 8px rgba(0,0,0,0.06);
}

.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-family: var(--font-heading);
  font-size: clamp(2.25rem, 8vw, 5.4rem);
  line-height: 0.96;
}

h2 {
  margin: 0;
  font-family: var(--font-heading);
  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; }



.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: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--text-main);
  background: var(--surface);
  border: 2px solid var(--border-light);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.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(--text-muted);
}

.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: 1fr;
  gap: 48px;
  align-items: start;
  max-width: 800px;
  margin: 0 auto;
}

.theme-choice > div:first-child {
  text-align: center;
}

.theme-choice p {
  max-width: 620px;
  margin: 0 auto;
  color: var(--text-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: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--text-main);
  background: var(--surface);
  border: 2px solid var(--border-light);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: all 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}

.word-count-card:hover,
.word-count-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--primary);
  background: var(--surface-hover);
  box-shadow: var(--shadow-md);
  outline: none;
}

.word-count-card.active {
  border-color: var(--gold);
  background: var(--white);
  box-shadow: 0 0 0 2px var(--gold), 0 15px 30px rgba(214, 137, 16, 0.15);
  transform: translateY(-4px);
}

.word-count-card span {
  width: 58px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: #ffffff !important;
  background: var(--primary-dark);
  border-radius: 12px;
  font-size: 1.5rem;
  font-weight: 850;
  font-family: var(--font-heading);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  transition: all 0.2s;
}

.word-count-card.active span {
  background: var(--gold);
  color: var(--text-main) !important;
  box-shadow: 0 4px 12px rgba(214, 137, 16, 0.3);
}

.word-count-card strong {
  display: block;
  font-size: 1.5rem;
  margin-top: 1rem;
  font-family: var(--font-heading);
}

.word-count-card small {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.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 14px;
  color: #1e293b !important;
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  transition: all 0.2s ease;
}

.theme-chip:hover,
.theme-chip:focus-visible {
  color: #0f172a !important;
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
}

.theme-chip.active,
.theme-chip[aria-pressed="true"],
.theme-chip.is-active {
  color: #ffffff !important;
  background: #0284c7 !important;
  border-color: #0284c7 !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35) !important;
  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;
}



.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));
}
/* ==========================================================================
   GLOBAL HEADER (PORTED FROM HOME)
   ========================================================================== */
.home-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  background: var(--surface);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 3rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  border-bottom: 2px solid var(--border-light);
  box-sizing: border-box;
}

.header-top-mobile {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-menu {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: space-between;
  gap: 1.5rem;
}

.hamburger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
}

.hamburger-btn span {
  display: block;
  width: 25px;
  height: 3px;
  background: var(--text-main);
  transition: all 0.3s ease;
  border-radius: 3px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.home-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.home-logo .icon {
  font-size: 2rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.logo-text {
  display: flex;
  flex-direction: column;
}

body {
  font-family: var(--font-body);
  background-color: var(--background);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.logo-main {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--text-main);
  line-height: 1;
  letter-spacing: 0.5px;
}

.logo-sub {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.home-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.home-nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 1rem;
  transition: color 0.2s;
  position: relative;
}

.home-nav a:hover, .home-nav a.active {
  color: var(--text-main);
}

.home-nav a.active::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
}



.user-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-light);
  font-weight: 800;
  font-size: 1rem;
}

.user-stats .gem {
  color: var(--primary);
}

.user-stats .coin {
  color: var(--gold);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: white;
  padding: 0.4rem 1rem 0.4rem 0.4rem;
  border-radius: var(--radius-full);
  border: 2px solid var(--gold);
  cursor: pointer;
  transition: transform 0.2s;
  box-shadow: 0 4px 10px rgba(251, 191, 36, 0.2);
}

.user-profile:hover {
  transform: scale(1.05);
}

.avatar-wrapper {
  width: 42px;
  height: 42px;
  background: var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  border: 2px solid white;
}

.user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.username {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-main);
}

.user-level {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 700;
}

/* ==========================================================================
   BOXED LAYOUT FOR SUBPAGES (DESKTOP)
   ========================================================================== */
@media (min-width: 1024px) {
  /* Constrain the main content to 100% width so it fills the site-frame */
  body:not(.theme-home) main {
    width: 100%;
    max-width: 1400px; /* Sane upper limit */
    margin: 0 auto;
    /* Fjernet indre borders og shadow for at innholdet skal flyte fritt inn i site-frame */
  }

  body:not(.theme-home) main {
    min-height: calc(100vh - 160px); /* Ensure it stretches down nicely */
  }
}

/* ==========================================================================
   MOBILE RESPONSIVENESS (GLOBAL)
   ========================================================================== */
@media (max-width: 1024px) {
  .game-grid,
  body.theme-home .game-grid[aria-label="Spillvalg"] {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }
}

html, body {
  width: 100%;
  margin: 0;
  padding: 0;
  -webkit-overflow-scrolling: touch;
}

.site-frame {
  overflow-x: hidden;
}

@media (max-width: 768px) {
  .site-header {
    padding: 12px 16px;
  }
  .home-header {
    padding: 0.75rem 1rem;
  }
  .header-right {
    gap: 0.75rem;
  }
  .header-search {
    width: auto;
    flex: 1;
  }
  .game-grid,
  body.theme-home .game-grid[aria-label="Spillvalg"] {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

@media (max-width: 480px) {
  .game-grid,
  body.theme-home .game-grid[aria-label="Spillvalg"] {
    grid-template-columns: 1fr;
  }
}

/* PWA Standalone Mode */
@media all and (display-mode: standalone) {
  .site-header,
  .site-footer,
  .featured-panel,
  .wordle-seo-article,
  .anagram-seo-article,
  .seo-article,
  .wordle-info-box {
    display: none !important;
  }
  
  .site-frame {
    height: 100vh;
    padding: 0 !important;
    max-width: 100%;
    box-shadow: none;
    width: 100% !important;
  }
  
  .game-shell {
    height: 100vh;
    border-radius: 0;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: .5;
  }
}

/* Varslingssystem (Notifications) */
.notification-dropdown {
  position: absolute;
  top: 48px;
  right: 0;
  width: 320px;
  background: var(--surface, #fcf7ec);
  border: 1px solid var(--border-light, #e8dcc4);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  z-index: 10000;
  overflow: hidden;
  max-height: 400px;
  display: flex;
  flex-direction: column;
}

.notif-header {
  padding: 12px 16px;
  font-weight: 700;
  border-bottom: 1px solid var(--border-light, #e8dcc4);
  background: rgba(0,0,0,0.03);
  color: var(--primary-dark, #1e4029);
}

.notif-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light, #e8dcc4);
  cursor: pointer;
  transition: background 0.2s;
}

.notif-item:hover {
  background: var(--surface-hover, #ffffff);
}

.notif-item.unread {
  background: var(--surface-active, #f5eedc);
}

.notif-item.unread:hover {
  background: #fdf3e1;
}

.notif-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main, #3b3a30);
  margin-bottom: 4px;
}

.notif-msg {
  font-size: 0.85rem;
  color: var(--text-muted, #6b695c);
  line-height: 1.3;
}

/* Ordkongen Global Toast */
.ordkongen-toast {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--primary-dark, #1e1e2f);
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  z-index: 10000;
  transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 1px solid rgba(255,255,255,0.1);
}
.ordkongen-toast.show {
  bottom: 40px;
}

/* Ordkongen Share Modal */
.share-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(4px);
}
.share-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.share-modal-content {
  background: var(--surface, #2a2a3f);
  padding: 2rem;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  text-align: center;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s ease;
  box-shadow: 0 15px 35px rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.05);
  color: white;
}
.share-modal-overlay.active .share-modal-content {
  transform: translateY(0);
}
.share-modal-close {
  position: absolute;
  top: 10px; right: 15px;
  background: none; border: none;
  color: rgba(255,255,255,0.6);
  font-size: 1.5rem;
  cursor: pointer;
}
.share-modal-close:hover {
  color: white;
}
.share-modal-content h3 {
  font-family: var(--font-heading, 'Poppins', sans-serif);
  font-size: 1.5rem;
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: var(--secondary-gold, #f3d47c);
}
.share-modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.btn-share {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: transform 0.2s, filter 0.2s;
  color: white;
}
.btn-share:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}
.btn-share.fb { background: #1877F2; }
.btn-share.x { background: #000000; border: 1px solid rgba(255,255,255,0.2); }
.btn-share.reddit { background: #FF4500; }
.btn-share.copy { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); }

/* ==========================================================================
   MOBILE GAME FOCUS (Aggressiv Hovedrolle for Spill på Mobil - 100 % Bredde)
   ========================================================================== */
@media (max-width: 768px) {
  /* Compact Header on Mobile for Game Pages */
  body.game-page .site-header,
  body.game-page .home-header {
    min-height: 40px !important;
    padding: 0.2rem 0.5rem !important;
  }

  body.game-page .site-logo-img {
    height: 32px !important;
  }

  body.game-page main,
  body.game-page .ordsprint-page-container,
  body.game-page .ordjakt-main-container {
    padding: 0 !important;
    margin: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
  }

  /* Full 100% Width Edge-to-Edge Game Viewport on Mobile */
  body.game-page .clean-game-wrapper,
  body.game-page .game-panel-container,
  body.game-page .ordjakt-game-frame,
  body.game-page .anagramkongen-game-frame,
  body.game-page .ordsveis-game-frame,
  body.game-page .crosswordle-game-frame,
  body.game-page .game-container-wrapper,
  body.game-page .web-game-frame,
  body.game-page .game-panel {
    max-width: 100% !important;
    width: 100% !important;
    height: clamp(500px, calc(100dvh - 50px), 800px) !important;
    margin: 0 auto !important;
    padding: 0 !important;
    border-radius: 16px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  body.game-page iframe {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    touch-action: none !important;
    overscroll-behavior: contain;
  }
}

/* ==========================================================================
   UNIVERSAL GAME TOUCH & POINTER ISOLATION (Gjelder ALLE spill på alle skjermer)
   ========================================================================== */
body.game-page {
  overscroll-behavior-y: none;
}

/* Fast 0ms tap response and no blue highlight site-wide */
button, a, input, select, textarea, [role="button"], .btn, .icon-btn, .clickable, .col-target, .powerup-item {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

/* Prevent text selection inside game boards and controls */
.clean-game-wrapper,
.game-panel-container,
.ordjakt-game-frame,
.ordjakt-iframe,
.ordsprint-main-viewport,
.ordsprint-iframe-frame,
.anagramkongen-game-frame,
.ordsveis-game-frame,
.ordsveis-iframe,
.crosswordle-game-frame,
.game-container-wrapper,
.web-game-frame,
.game-panel,
.board-frame,
.col-target,
body.game-page iframe,
iframe.game-iframe {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: contain;
  pointer-events: auto !important;
}

/* Viking Rune & Norse Custom UI Utility Classes */
.viking-rune-accent {
  display: inline-block;
  font-family: 'Rowdies', cursive, sans-serif;
  color: #fbbf24;
  letter-spacing: 2px;
  font-size: 0.85em;
  opacity: 0.85;
  margin: 0 6px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.viking-knot-border {
  position: relative;
  border: 2px solid rgba(251, 191, 36, 0.35) !important;
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.1), inset 0 0 12px rgba(0,0,0,0.3);
}

.viking-title-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15) 0%, rgba(217, 119, 6, 0.2) 100%);
  border: 1.5px solid #fbbf24;
  color: #fbbf24;
  padding: 4px 14px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section-title::before {
  content: 'ᚢ ᚦ ';
  color: #fbbf24;
  font-size: 0.75em;
  opacity: 0.7;
  margin-right: 6px;
}

.section-title::after {
  content: ' ᚨ ᚱ';
  color: #fbbf24;
  font-size: 0.75em;
  opacity: 0.7;
  margin-left: 6px;
}




