:root {
  --bg: #1b1b1b;
  --bg-alt: #242424;
  --text: #e2e2e2;
  --muted: #a0a0a0;
  --green: #51c55d;
  --green-dark: #3fa84b;
  --orange: #ff8a1f;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: var(--green); }
img { max-width: 100%; height: auto; }
h1, h2 { line-height: 1.2; margin: 0 0 .6em; }
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* Topbar */
.topbar { background: #141414; border-bottom: 1px solid #2c2c2c; position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; }
.menu { display: flex; gap: 4px; margin-right: auto; }
.menu a {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px;
  color: var(--text); text-decoration: none; font-weight: 600; font-size: .95rem;
}
.menu a:hover, .menu a.active { background: #2a2a2a; color: var(--green); }
.logout-form { display: flex; margin: 0; }
.logout-button {
  padding: 8px 12px; border: 0; border-radius: 8px; background: none; cursor: pointer;
  color: var(--text); font: inherit; font-weight: 600; font-size: .95rem;
}
.logout-button:hover { background: #2a2a2a; color: var(--green); }
.menu-toggle { position: absolute; opacity: 0; pointer-events: none; }
.menu-button { display: none; cursor: pointer; padding: 10px; margin-left: auto; }
.menu-button span { display: block; width: 24px; height: 3px; background: var(--text); margin: 4px 0; border-radius: 2px; }
.menu-toggle:focus-visible + .menu-button { outline: 2px solid var(--green); }

.status {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
  background: #222; font-size: .8rem; font-weight: 700; letter-spacing: .03em;
}
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #c0392b; }
.status-online .status-dot { background: var(--green); }
.status-ip { color: var(--muted); font-weight: 600; }

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(ellipse 60% 55% at 50% 32%, rgba(255, 106, 0, .22), rgba(255, 106, 0, 0) 70%), #141414;
  padding: 56px 0 80px;
  text-align: center;
}
.hero-inner { position: relative; z-index: 1; }
.embers { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
/* Varm glød bag logoet: rastres én gang og pulserer kun med opacity (ingen filter/blur i animationer). */
.hero-inner::before {
  content: '';
  position: absolute;
  z-index: -1;
  top: -40px;
  left: 50%;
  width: clamp(320px, 80vw, 820px);
  height: clamp(200px, 48vw, 480px);
  margin-left: calc(clamp(320px, 80vw, 820px) / -2);
  background: radial-gradient(ellipse at center, rgba(255, 140, 30, .55), rgba(255, 140, 30, 0) 70%);
  pointer-events: none;
  will-change: opacity;
  opacity: .45;
  animation: glow-pulse 3s ease-in-out infinite;
}
.hero-logo {
  display: block;
  margin: 0 auto 16px;
  width: clamp(260px, 50vw, 520px);
  height: auto;
  will-change: transform;
  animation: logo-pulse 3s ease-in-out infinite;
}
@keyframes logo-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}
@keyframes glow-pulse {
  0%, 100% { opacity: .45; }
  50% { opacity: .9; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-logo { animation: none; }
  .hero-inner::before { animation: none; }
  .embers { display: none; }
}
.hero h1 { font-size: clamp(2rem, 6vw, 3.5rem); font-weight: 800; }
.tagline { font-size: clamp(1rem, 2.5vw, 1.25rem); max-width: 640px; margin: 0 auto 28px; }
.btn {
  display: inline-block; padding: 14px 28px; border-radius: 8px; font-weight: 700;
  text-decoration: none; border: 0; cursor: pointer; font-family: inherit; font-size: 1rem;
}
.btn-primary { background: var(--green); color: #0f1f11; }
.btn-primary:hover { background: var(--green-dark); }

/* Sektioner */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; padding-top: 48px; padding-bottom: 24px; }
.card { background: var(--bg-alt); border-radius: var(--radius); padding: 24px; border: 1px solid #2f2f2f; }
.card h2 { font-size: 1.15rem; color: var(--orange); }
.card p { margin: 0; color: var(--text); }
.ip-box { text-align: center; padding-top: 32px; padding-bottom: 32px; }
.ip { display: inline-block; font-size: clamp(1.4rem, 5vw, 2.2rem); font-weight: 800; background: var(--bg-alt); border: 2px dashed var(--green); border-radius: var(--radius); padding: 12px 28px; margin: 0; }
.about { padding-top: 16px; padding-bottom: 56px; max-width: 760px; }
.page { padding-top: 48px; padding-bottom: 64px; max-width: 800px; }
.center { text-align: center; }
.rules-section { background: var(--bg-alt); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 20px; }
.rules-section h2 { color: var(--orange); font-size: 1.2rem; }
.rules-section li { margin-bottom: 8px; }
.rules-page { max-width: 860px; }
.rules-toc { background: var(--bg-alt); border-radius: var(--radius); padding: 16px 24px; margin: 24px 0; }
.rules-toc h2 { font-size: 1.1rem; color: var(--orange); margin-bottom: .4em; }
.rules-toc ol { margin: 0; padding-left: 1.4em; }
.rules-toc ul { margin: 2px 0 6px; padding-left: 1.2em; }
.rules-section { scroll-margin-top: 80px; }
.rules-group { scroll-margin-top: 80px; margin-top: 24px; padding-top: 12px; border-top: 1px solid #333; }
.rules-group h3 { font-size: 1.1rem; color: var(--green); }
.rule { margin: 16px 0; }
.rule h4 { font-size: 1rem; margin: 0 0 .3em; }
.rule-nr { color: var(--orange); margin-right: 4px; }
.rule p { margin: 0 0 .6em; }
.rule ul { margin: 0 0 .6em; padding-left: 1.4em; }

/* Footer */
.footer { background: #141414; border-top: 1px solid #2c2c2c; padding: 28px 0; margin-top: 32px; color: var(--muted); font-size: .9rem; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer p { margin: 0; }

/* Mobil */
@media (max-width: 780px) {
  .menu-button { display: block; }
  .menu { display: none; flex-direction: column; width: 100%; order: 3; margin: 0; }
  .menu-toggle:checked ~ .menu { display: flex; }
  .status { order: 2; width: 100%; justify-content: center; margin-bottom: 8px; }
  .hero { padding: 40px 0 56px; }
  .footer-inner { flex-direction: column; text-align: center; }
}

/* Profil og kobling */
.muted { color: var(--muted); }
.profile-head, .profile-player { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.profile-name { font-size: 1.3rem; font-weight: 700; margin: 0; }
.skin { border-radius: 8px; image-rendering: pixelated; background: var(--bg-alt); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 0; }
.stats div { background: var(--bg-alt); border: 1px solid #2f2f2f; border-radius: var(--radius); padding: 16px; }
.stats dt { color: var(--muted); font-size: 0.85rem; margin-bottom: 4px; }
.stats dd { margin: 0; font-size: 1.15rem; font-weight: 700; overflow-wrap: anywhere; }
.link-form { display: flex; flex-direction: column; gap: 12px; max-width: 360px; }
.link-form input[type="text"] { padding: 12px; border-radius: 8px; border: 1px solid #3a3a3a; background: var(--bg-alt); color: var(--text); font-size: 1.1rem; letter-spacing: 0.15em; text-transform: uppercase; }
.form-error { background: #3a1d1d; border: 1px solid #7a2e2e; color: #ffb4b4; padding: 12px 16px; border-radius: 8px; }

/* Vagtside og leaderboard */
.achievements { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 24px; }
.achievement h3 { font-size: 1.05rem; margin: 0 0 4px; color: var(--orange); }
.achievement p { margin: 4px 0; }
.progress { width: 100%; height: 12px; accent-color: var(--green); }
.plain-list, .badges { list-style: none; padding: 0; margin: 0 0 24px; }
.plain-list li { padding: 6px 0; border-bottom: 1px solid #2f2f2f; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { background: var(--bg-alt); border: 1px solid var(--orange); border-radius: var(--radius); padding: 6px 12px; font-weight: 700; }
.month-form { display: flex; align-items: center; gap: 12px; margin: 16px 0 24px; flex-wrap: wrap; }
.month-form select { padding: 10px; border-radius: 8px; border: 1px solid #3a3a3a; background: var(--bg-alt); color: var(--text); font: inherit; }
.board { width: 100%; border-collapse: collapse; margin-bottom: 32px; }
.board th, .board td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #2f2f2f; overflow-wrap: anywhere; }
.board th { color: var(--muted); font-size: 0.85rem; }
.board tr.me { background: var(--bg-alt); outline: 2px solid var(--green); font-weight: 700; }

.apply-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 24px; }
.apply-choice { display: block; background: var(--bg-alt); border: 1px solid #2f2f2f; border-radius: var(--radius); padding: 20px; color: var(--text); text-decoration: none; }
.apply-choice:hover, .apply-choice:focus-visible { border-color: var(--green); }
.apply-choice h2 { margin: 0 0 8px; font-size: 1.15rem; }
.apply-choice p { margin: 0; color: var(--muted); }
.apply-form { display: flex; flex-direction: column; gap: 18px; margin-top: 20px; }
.apply-form .field { display: flex; flex-direction: column; gap: 6px; }
.apply-form label { font-weight: 600; }
.apply-form input, .apply-form textarea { padding: 12px; border-radius: 8px; border: 1px solid #3a3a3a; background: var(--bg-alt); color: var(--text); font: inherit; width: 100%; }
.apply-form input:focus-visible, .apply-form textarea:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.apply-form [aria-invalid="true"] { border-color: #7a2e2e; }
.apply-form .btn { align-self: flex-start; }
.field-help { color: var(--muted); }
.field-error { margin: 0; color: #ffb4b4; font-size: 0.9rem; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Direktørpanel */
.page-wide { max-width: 1000px; }
.btn-secondary { background: #3a3a3a; color: var(--text); }
.btn-danger { background: #a83a3a; color: #fff; }
.flash { padding: 12px 16px; border-radius: var(--radius); margin: 0 0 20px; border: 1px solid #2f2f2f; }
.flash-ok { background: #1f3a23; color: #c9f0cd; }
.flash-fejl { background: #3d1f1f; color: #ffb4b4; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0; }
.inline-form input[type="text"], .stack-form textarea {
  background: var(--bg); color: var(--text); border: 1px solid #3a3a3a; border-radius: 8px;
  padding: 10px 12px; font-family: inherit; font-size: 1rem;
}
.stack-form { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; margin-bottom: 24px; }
.stack-form textarea { width: 100%; resize: vertical; }
.action-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid #2f2f2f; }
.table th { color: var(--muted); font-size: 0.85rem; }
.pending { color: var(--orange); font-weight: 700; }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Direktørpanel: undernavigation, trin, ansøgninger og log */
.subnav { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 20px; padding-bottom: 12px; border-bottom: 1px solid #2f2f2f; }
.subnav a { color: var(--muted); font-weight: 600; text-decoration: none; }
.subnav a:hover, .subnav a.active { color: var(--orange); }
.inline-form input[type="number"], .inline-form select, .inline-form input.input-sm {
  background: var(--bg); color: var(--text); border: 1px solid #3a3a3a; border-radius: 8px;
  padding: 8px 10px; font-family: inherit; font-size: 1rem;
}
.input-sm { width: 9rem; }
.row-uden-loen td { background: rgba(255, 140, 0, 0.08); }
.badge-warn { color: var(--orange); font-weight: 700; white-space: nowrap; }
.row-fejlet td { background: #3d1f1f; color: #ffb4b4; }
.answers { margin: 8px 0 0; }
.answers dt { color: var(--muted); font-size: 0.85rem; }
.answers dd { margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.app-card { margin-bottom: 16px; }
.app-card h3 { margin: 0 0 4px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 16px; }
.filter-row a.active { color: var(--orange); font-weight: 700; }
.log-detail { overflow-wrap: anywhere; font-size: 0.85rem; color: var(--muted); }

.badge-chip { display: inline-block; margin-left: 6px; padding: 1px 8px; border: 1px solid var(--orange); border-radius: var(--radius); background: var(--bg-alt); font-size: 0.8em; font-weight: 700; white-space: nowrap; }

.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 24px; }
.account-card { display: flex; align-items: center; gap: 16px; }
.account-card p { margin: 0; }
