/* ═══════════════════════════════════════════════════════════
   WikiCrawl — Stylesheet
   ───────────────────────────────────────────────────────────
   Æstetik: avisagtig / bogagtig tone med papirfarver og
   Playfair Display som display-font.
   Alle farver er defineret som CSS-variable i :root så de
   nemt kan ændres ét sted.
═══════════════════════════════════════════════════════════ */

/* ── Reset & CSS-variable ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink:     #1a1008;   /* primær tekstfarve */
  --paper:   #f5f0e8;   /* baggrund */
  --paper2:  #ede7d5;   /* sekundær baggrund */
  --accent:  #c0392b;   /* rød accent (logo, klik-effekter) */
  --accent2: #e67e22;   /* orange (tæller) */
  --gold:    #b8860b;   /* guld (sejrsskærm) */
  --muted:   #7a6a52;   /* dæmpet tekst */
  --border:  #c8b89a;   /* kanter */
  --link:    #1a5276;   /* Wikipedia-link farve */
  --easy:    #1a6644;   /* Let-badge */
  --hard:    #7d1a1a;   /* Svær-badge */
  --shadow:  rgba(26,16,8,0.15);
}

html, body {
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 16px;
}

/* ── Skærme ── */
/* Alle skærme er skjult som standard; .active viser dem */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }


/* ═══════════════════════════════════════════
   STARTSKÆRM
═══════════════════════════════════════════ */
#screen-start {
  align-items: center;
  justify-content: flex-start;
  padding: 32px 20px 60px;
  /* Subtile radiale gradienter + ternæt baggrund */
  background:
    radial-gradient(ellipse at 20% 20%, rgba(192,57,43,.07) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(184,134,11,.08) 0%, transparent 60%),
    var(--paper);
  position: relative;
  overflow: hidden;
}

/* Diskret millimeterpapir-mønster */
#screen-start::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 39px, var(--border) 39px, var(--border) 40px),
    repeating-linear-gradient(90deg, transparent, transparent 39px, var(--border) 39px, var(--border) 40px);
  opacity: .18;
  pointer-events: none;
}

.start-wrap { max-width: 640px; width: 100%; position: relative; z-index: 1; }

/* Logo */
.logo { text-align: center; margin-bottom: 6px; }
.logo h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(2.8rem, 8vw, 5rem);
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -2px;
  line-height: 1;
  text-shadow: 3px 3px 0 rgba(192,57,43,.15);
}
.logo .chain {
  font-size: 2rem;
  display: inline-block;
  animation: sway 3s ease-in-out infinite;
}
@keyframes sway {
  0%, 100% { transform: rotate(-5deg); }
  50%       { transform: rotate(5deg); }
}

.tagline {
  text-align: center;
  color: var(--muted);
  font-size: .95rem;
  font-style: italic;
  margin-bottom: 18px;
  line-height: 1.6;
}
.tagline strong { color: var(--ink); font-style: normal; }



/* ── Faner ── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 18px;
}
.tab-btn {
  flex: 1;
  padding: 10px 6px;
  background: transparent;
  border: none;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: .88rem;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab-btn:hover:not(.active) { color: var(--ink); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Info-boks med regler ── */
.rules-box {
  background: var(--paper2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: .84rem;
  color: var(--muted);
  line-height: 1.7;
  box-shadow: 1px 2px 6px var(--shadow);
}
.rules-box strong { color: var(--ink); }

.section-label {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

/* ── Udfordringskort ── */
.challenge-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.ch-card {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 11px 14px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .1s;
  box-shadow: 1px 2px 5px var(--shadow);
  position: relative;
}
/* Rød venstre-kant ved hover */
.ch-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform .15s;
}
.ch-card:hover                { border-color: var(--accent); box-shadow: 2px 4px 12px var(--shadow); transform: translateX(2px); }
.ch-card:hover::before        { transform: scaleY(1); }
.ch-card:hover .ch-hint       { display: block; }

.ch-body   { display: flex; align-items: center; flex: 1; min-width: 0; }
.ch-start  { font-weight: 600; color: var(--link); flex: 1; font-size: .9rem; }
.ch-arrow  { color: var(--border); font-size: 1rem; margin: 0 9px; flex-shrink: 0; }
.ch-target { font-weight: 600; color: var(--accent); flex: 1; text-align: right; font-size: .9rem; }
.ch-hint {
  font-size: .73rem;
  color: var(--muted);
  font-style: italic;
  width: 100%;
  margin-top: 4px;
  padding-top: 5px;
  border-top: 1px dashed var(--border);
  display: none;
}

/* Kopi-link-knap på kortet */
.ch-actions { flex-shrink: 0; margin-left: 8px; }
.ch-link-btn {
  width: 26px; height: 26px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--paper2);
  cursor: pointer;
  font-size: .78rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: border-color .12s, color .12s;
  position: relative;
  z-index: 2; /* Over kortets klik-flade */
}
.ch-link-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Sværheds-badges */
.badge {
  display: inline-block;
  font-size: .63rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  border-radius: 3px;
  padding: 2px 6px;
  margin-right: 7px;
  white-space: nowrap;
}
.badge-easy { background: #d4edda; color: var(--easy); border: 1px solid #a3d5b0; }
.badge-hard { background: #f8d7da; color: var(--hard); border: 1px solid #f1aeb5; }

/* ── Dagens opgave ── */
.daily-box {
  background: white;
  border: 2px solid var(--gold);
  border-radius: 6px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 2px 4px 10px var(--shadow);
}
.daily-date {
  font-size: .74rem;
  color: var(--muted);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.daily-cards { display: flex; flex-direction: column; gap: 9px; }

/* ── Arkiv ── */
.archive-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 400px;
  overflow-y: auto;
}
.archive-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: border-color .12s;
}
.archive-item:hover { border-color: var(--accent); }
.archive-date { font-size: .73rem; color: var(--muted); min-width: 88px; flex-shrink: 0; }
.archive-challenges {
  flex: 1;
  font-size: .82rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

/* ── Brugerdefineret udfordring ── */
.custom-box {
  background: var(--paper2);
  border: 1px dashed var(--border);
  border-radius: 4px;
  padding: 15px 16px;
}
.custom-row {
  display: flex;
  gap: 7px;
  align-items: center;
  margin-top: 9px;
  flex-wrap: wrap;
}
.custom-row input {
  flex: 1;
  min-width: 100px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: white;
  font-family: inherit;
  font-size: .87rem;
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
}
.custom-row input:focus { border-color: var(--accent); }
.custom-row input::placeholder { color: var(--muted); }
.custom-arrow { color: var(--muted); }

/* ── Knapper (generelle) ── */
.btn-primary {
  padding: 8px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 3px;
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: .88rem;
  cursor: pointer;
  transition: background .15s, transform .1s;
  white-space: nowrap;
}
.btn-primary:hover { background: #a93226; transform: translateY(-1px); }

.btn-secondary {
  padding: 7px 14px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: inherit;
  font-size: .84rem;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }


/* ═══════════════════════════════════════════
   VALIDERINGSSKÆRM
═══════════════════════════════════════════ */
#screen-validating {
  align-items: center;
  justify-content: center;
  background: var(--paper);
}
.val-box {
  max-width: 440px;
  width: 90%;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 36px;
  box-shadow: 4px 8px 24px var(--shadow);
  text-align: center;
}
.val-box h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.4rem;
  margin-bottom: 8px;
}
.val-route { color: var(--muted); font-size: .9rem; margin-bottom: 22px; }
.val-route strong { color: var(--ink); }
.val-status {
  color: var(--muted);
  font-size: .82rem;
  font-style: italic;
  min-height: 1.4em;
  margin-bottom: 18px;
}

/* ── Spinner (bruges flere steder) ── */
.spinner {
  width: 44px; height: 44px;
  border: 3px solid var(--paper2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 18px;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* ═══════════════════════════════════════════
   SPILLESKÆRM
═══════════════════════════════════════════ */
#screen-game {
  flex-direction: column;
  height: 100vh;
}

/* Øverste navigationslinje */
.game-header {
  background: var(--ink);
  color: var(--paper);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 50px;
  flex-shrink: 0;
  border-bottom: 2px solid var(--accent);
}
.game-logo {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -.5px;
  margin-right: 4px;
  flex-shrink: 0;
}
.nav-btn {
  background: rgba(255,255,255,.08);
  color: var(--paper);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 3px;
  width: 30px; height: 30px;
  font-size: .82rem;
  cursor: pointer;
  transition: background .15s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-btn:hover:not(:disabled) { background: rgba(255,255,255,.18); }
.nav-btn:disabled { opacity: .3; cursor: not-allowed; }

.current-article {
  flex: 1;
  font-size: .76rem;
  color: rgba(245,240,232,.45);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.target-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(192,57,43,.2);
  border: 1px solid rgba(192,57,43,.4);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: .74rem;
  color: #f0a090;
  flex-shrink: 0;
}
.target-pill .pill-label { font-size: .6rem; text-transform: uppercase; letter-spacing: .1em; opacity: .7; }
.target-pill .pill-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.menu-btn {
  background: transparent;
  color: var(--paper);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 3px;
  padding: 0 10px;
  font-size: .9rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
  height: 30px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.menu-btn:hover { background: rgba(255,255,255,.12); }

/* Brødkrumme-linje med artikel-tæller */
.breadcrumb-bar {
  background: var(--paper2);
  border-bottom: 1px solid var(--border);
  padding: 5px 12px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  min-height: 30px;
}
.bc-scroll {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-wrap: nowrap;
}
.bc-scroll::-webkit-scrollbar { display: none; }

.bc-item {
  white-space: nowrap;
  color: var(--link);
  cursor: pointer;
  font-size: .74rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  flex-shrink: 0;
}
.bc-item.current { color: var(--ink); font-weight: 600; text-decoration: none; cursor: default; }
.bc-sep { color: var(--border); flex-shrink: 0; font-size: .74rem; }

.art-counter {
  flex-shrink: 0;
  margin-left: 10px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
  font-family: 'Playfair Display', Georgia, serif;
  font-size: .9rem;
  font-weight: 700;
  color: var(--accent2);
  white-space: nowrap;
}

/* ── Wikipedia-artikelvisning ── */
.article-wrap { flex: 1; overflow-y: auto; background: white; }
.article-inner { max-width: 760px; margin: 0 auto; padding: 26px 20px 60px; }

/* Styling af Wikipedias HTML-indhold */
.wiki-content h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.85rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  padding-bottom: 7px;
  margin-bottom: 16px;
  line-height: 1.2;
}
.wiki-content h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.3rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  padding-bottom: 3px;
  margin: 24px 0 9px;
}
.wiki-content h3 { font-size: 1.02rem; font-weight: 600; margin: 16px 0 6px; }
.wiki-content p  { line-height: 1.8; margin-bottom: 12px; font-size: .94rem; }

/* Aktive Wikipedia-links (brødtekst) */
.wiki-content a.wiki-link {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  transition: color .12s;
}
.wiki-content a.wiki-link:hover { color: var(--accent); }

/* Deaktiverede links (tabeller, metadata, eksterne) */
.wiki-content a.wiki-dead {
  color: inherit;
  text-decoration: none;
  cursor: default;
  pointer-events: none;
}

.wiki-content ul, .wiki-content ol { padding-left: 22px; margin-bottom: 12px; }
.wiki-content li { line-height: 1.7; margin-bottom: 3px; font-size: .92rem; }
.wiki-content table { border-collapse: collapse; margin: 12px 0; font-size: .82rem; max-width: 100%; overflow-x: auto; display: block; }
.wiki-content th { background: var(--paper2); border: 1px solid var(--border); padding: 5px 8px; font-weight: 600; text-align: left; }
.wiki-content td { border: 1px solid var(--border); padding: 4px 8px; }
.wiki-content img { max-width: 100%; height: auto; border: 1px solid var(--border); padding: 2px; background: var(--paper2); }

/* Infoboxe og tabeller flyder til højre på desktop */
.wiki-content .infobox,
.wiki-content .wikitable { float: right; margin: 0 0 12px 18px; max-width: 270px; font-size: .79rem; }

/* Indlæsningsindikator */
.loading-art {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: var(--muted);
  gap: 14px;
}
.loading-art .spinner { width: 34px; height: 34px; }


/* ═══════════════════════════════════════════
   SEJRSSKÆRM
═══════════════════════════════════════════ */
#screen-win {
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(184,134,11,.12) 0%, transparent 60%),
    var(--paper);
}
.win-box { max-width: 500px; width: 90%; text-align: center; padding: 20px; }
.win-trophy {
  font-size: 5rem;
  display: block;
  margin-bottom: 12px;
  animation: bounce 1s ease infinite alternate;
}
@keyframes bounce {
  from { transform: translateY(0); }
  to   { transform: translateY(-12px); }
}
.win-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--accent);
  margin-bottom: 8px;
  text-shadow: 2px 2px 0 rgba(192,57,43,.15);
}
.win-stats { display: flex; justify-content: center; gap: 28px; margin: 16px 0; }
.stat-box  { text-align: center; }
.stat-num {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.3rem;
  font-weight: 700;
  color: var(--gold);
  display: block;
}
.stat-label { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }

.win-path {
  background: var(--paper2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 15px;
  margin: 16px 0;
  text-align: left;
  font-size: .79rem;
  color: var(--muted);
  line-height: 2;
}
.win-path strong {
  display: block;
  color: var(--ink);
  margin-bottom: 4px;
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.path-step      { display: inline-block; color: var(--link); font-style: italic; }
.path-step.last { color: var(--accent); font-weight: 600; }

.win-btns { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }


/* ═══════════════════════════════════════════
   MENU-MODAL
═══════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,16,8,.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 24px;
  max-width: 340px;
  width: 90%;
  box-shadow: 4px 8px 28px rgba(0,0,0,.25);
}
.modal h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.2rem;
  margin-bottom: 13px;
}
.modal-btns { display: flex; flex-direction: column; gap: 7px; }
.modal-btns button {
  padding: 9px 13px;
  border-radius: 3px;
  font-family: inherit;
  font-size: .87rem;
  cursor: pointer;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--paper2);
  color: var(--ink);
  transition: background .12s, border-color .12s;
}
.modal-btns button:hover { background: var(--paper); border-color: var(--accent); }
.modal-btns button.danger { color: var(--accent); }


/* ═══════════════════════════════════════════
   TOAST-NOTIFIKATION
═══════════════════════════════════════════ */
.notif {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(80px); /* skjult nede */
  background: var(--ink);
  color: var(--paper);
  padding: 9px 16px;
  border-radius: 4px;
  font-size: .82rem;
  z-index: 200;
  transition: transform .3s ease;
  white-space: nowrap;
  pointer-events: none;
}
.notif.show { transform: translateX(-50%) translateY(0); }


/* ═══════════════════════════════════════════
   SCROLLBARS
═══════════════════════════════════════════ */
.article-wrap::-webkit-scrollbar  { width: 5px; }
.article-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.archive-list::-webkit-scrollbar  { width: 5px; }
.archive-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }


/* ═══════════════════════════════════════════
   RESPONSIVT DESIGN (mobil)
═══════════════════════════════════════════ */
@media (max-width: 560px) {
  /* Infoboxe fylder hele bredden på mobil */
  .wiki-content .infobox,
  .wiki-content .wikitable { float: none; max-width: 100%; margin: 0 0 12px; }
}

@media (max-width: 480px) {
  /* Mål-pill: kortere tekst */
  .target-pill .pill-name { max-width: 70px; }
  /* Logo skjules for at spare plads */
  .game-logo { display: none; }
}
