:root {
  --bg: #0b0f14;
  --panel: #111821;
  --text: #e8eef6;
  --muted: rgba(232,238,246,.6);
  --accent: #c7a24b;
  --good: #5fd38d;
  --bad: #ff4d4d;
  --line: rgba(255,255,255,.08);
  --ease: cubic-bezier(.16, 1, .3, 1);
}

html[data-theme="light"] {
  --bg: #f6f4ee;
  --panel: #ffffff;
  --text: #14161c;
  --muted: rgba(20,22,28,.6);
  --accent: #a8842f;
  --good: #1f9d63;
  --bad: #d93b3b;
  --line: rgba(20,22,28,.12);
}

/* BASE */
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 10%, rgba(199,162,75,.12), transparent 45%),
    radial-gradient(circle at 80% 90%, rgba(255,255,255,.03), transparent 45%),
    var(--bg);
  color: var(--text);
  font-family: "Special Elite", monospace;
}

/* ENTRY ANIMATION */
.wrap {
  width: min(760px, 92vw);
  padding: 40px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.02);
  backdrop-filter: blur(10px);
  animation: bootIn .7s var(--ease) both;
}

@keyframes bootIn {
  from { opacity: 0; transform: translateY(18px) scale(.98); filter: blur(8px); }
  to   { opacity: 1; transform: translateY(0) scale(1);    filter: blur(0);   }
}

/* TOP BAR */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.title {
  font-size: 34px;
  letter-spacing: 2px;
  position: relative;
  overflow: hidden;
}

.title::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(199,162,75,.25), transparent);
  transform: translateX(-120%);
  animation: scan 2.5s var(--ease) .2s both;
}

@keyframes scan { to { transform: translateX(120%); } }

/* ── STREAK / STATS BAR ── */
.statsBar {
  display: flex;
  gap: 20px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  margin-bottom: 16px;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--muted);
  animation: fadeUp .5s var(--ease) .1s both;
}

.statItem {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.statLabel { font-size: 9px; opacity: .6; text-transform: uppercase; }

.statValue {
  font-size: 18px;
  color: var(--text);
  line-height: 1;
}

.statValue.streak { color: var(--accent); }

/* divider between stats */
.statDivider {
  width: 1px;
  background: var(--line);
  align-self: stretch;
}

/* ── COUNTDOWN ── */
.countdown {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.countdownLabel { font-size: 9px; opacity: .6; text-transform: uppercase; letter-spacing: 1px; }

#countdownTimer {
  font-size: 15px;
  color: var(--accent);
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 2px;
}

/* BUTTONS ROW */
.btnRow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.themeBtn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 1px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: transform .15s var(--ease), border .2s;
}

.themeBtn:hover { transform: translateY(-2px); border-color: var(--accent); }

/* DEFINITION */
.definition {
  margin: 20px 0;
  font-size: 20px;
  line-height: 1.5;
  opacity: 0;
  animation: fadeUp .6s var(--ease) .2s forwards;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}

/* CHALLENGE BADGE */
.challengeBadge {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 2px;
  margin-bottom: 10px;
  animation: fadeUp .4s var(--ease) both;
}

/* FORM */
form {
  display: flex;
  gap: 10px;
}

input {
  flex: 1;
  padding: 12px;
  background: #0d131b;
  border: 1px solid var(--line);
  color: var(--text);
  font-family: inherit;
  transition: border .2s var(--ease), transform .2s;
}

input:focus { outline: none; border-color: var(--accent); transform: scale(1.01); }

button {
  padding: 12px 16px;
  background: var(--accent);
  border: none;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 1px;
  transition: transform .15s var(--ease), filter .15s;
}

button:active { transform: scale(.96); }

/* GRID */
.grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

/* CELL */
.cell {
  min-height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid var(--line);
  font-size: 12px;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(8px);
  animation: cellIn .35s var(--ease) forwards;
}

.cell:nth-child(1) { animation-delay: .05s; }
.cell:nth-child(2) { animation-delay: .1s;  }
.cell:nth-child(3) { animation-delay: .15s; }
.cell:nth-child(4) { animation-delay: .2s;  }
.cell:nth-child(5) { animation-delay: .25s; }

@keyframes cellIn { to { opacity: 1; transform: translateY(0); } }

.cell.hit  { border-color: var(--good); color: var(--good); }
.cell.miss { border-color: var(--bad);  color: var(--bad);  }

/* SHAKE */
.shake { animation: shake .35s; }

@keyframes shake {
  0%   { transform: translateX(0);   }
  20%  { transform: translateX(-4px);}
  40%  { transform: translateX(4px); }
  60%  { transform: translateX(-3px);}
  80%  { transform: translateX(3px); }
  100% { transform: translateX(0);   }
}

/* STATUS */
.status { margin-top: 12px; font-size: 12px; color: var(--muted); }

/* HINTS */
.hints { margin-top: 10px; font-size: 12px; color: var(--muted); }

.hint {
  margin-top: 6px;
  padding-left: 10px;
  border-left: 2px solid var(--accent);
  opacity: 0;
  transform: translateX(-6px);
  animation: hintIn .4s var(--ease) forwards;
}

@keyframes hintIn { to { opacity: 1; transform: translateX(0); } }

/* ── MODAL ── */
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0);
  opacity: 0;
  pointer-events: none;
  transition: .3s var(--ease);
  z-index: 9999;
}

.modal.show {
  background: rgba(0,0,0,.75);
  opacity: 1;
  pointer-events: auto;
}

.modalBox {
  background: var(--panel);
  padding: 34px 38px;
  border: 1px solid var(--line);
  text-align: center;
  min-width: 280px;
  transform: translateY(14px) scale(.97);
  opacity: 0;
  transition: .35s var(--ease);
}

.modal.show .modalBox { transform: translateY(0) scale(1); opacity: 1; }

.modalBox h2 { margin: 0 0 10px; font-size: 22px; letter-spacing: 3px; }

#finalWord {
  font-size: 28px;
  color: var(--accent);
  letter-spacing: 4px;
  margin: 8px 0 16px;
}

#nextWord { font-size: 11px; color: var(--muted); margin-bottom: 20px; }

/* ── MODAL ACTION BUTTONS ── */
.modalActions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.modalBtn {
  padding: 10px 16px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: border .2s var(--ease), transform .15s;
  text-align: center;
  text-decoration: none;
  display: block;
}

.modalBtn:hover { border-color: var(--accent); transform: translateY(-1px); }

.modalBtn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: bold;
}

/* share result grid preview */
.sharePreview {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin: 10px 0 4px;
  font-size: 18px;
  letter-spacing: 2px;
}

/* streak in modal */
.modalStreak {
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 2px;
  margin-bottom: 6px;
}

/* toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--panel);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 10px 20px;
  font-size: 12px;
  letter-spacing: 2px;
  opacity: 0;
  pointer-events: none;
  transition: .3s var(--ease);
  z-index: 99999;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── CHALLENGE MODAL (send to friend) ── */
.challengeLink {
  background: rgba(0,0,0,.3);
  border: 1px solid var(--line);
  padding: 10px 12px;
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
  word-break: break-all;
  text-align: left;
  margin: 10px 0;
  cursor: pointer;
  transition: border .2s;
}

.challengeLink:hover { border-color: var(--accent); }

/* MOBILE */
@media (max-width: 600px) {
  body { place-items: start; padding: 20px 0; }
  .wrap { padding: 20px; }
  .title { font-size: 26px; }
  .definition { font-size: 18px; }
  form { flex-direction: column; }
  input, button { width: 100%; box-sizing: border-box; }
  .cell { font-size: 10px; min-height: 34px; }
  .statsBar { gap: 12px; flex-wrap: wrap; }
  .btnRow { gap: 6px; }
  .themeBtn { font-size: 10px; padding: 6px 10px; }
  .modalBox { padding: 24px 20px; min-width: unset; width: 90vw; }
}

/* ── WELCOME MODAL (MISSION BRIEFING) ── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 15, 20, 0.95); /* Gebruik je --bg met transparantie */
    backdrop-filter: blur(10px);
    display: none; /* Wordt flex via JS */
    align-items: center;
    justify-content: center;
    z-index: 20000;
}

.briefing-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-top: 4px solid var(--accent); /* Gouden bovenrand voor autoriteit */
    padding: 40px;
    max-width: 500px;
    width: 90%;
    font-family: "IBM Plex Mono", monospace;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.briefing-card h2 {
    color: var(--accent);
    font-family: "Special Elite", serif;
    letter-spacing: 3px;
    margin-bottom: 5px;
    font-size: 1.4rem;
}

.briefing-card hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 20px 0;
}

.briefing-card p {
    color: var(--text);
    line-height: 1.6;
    font-size: 14px;
}

.briefing-list {
    list-style: none;
    padding: 0;
    margin: 25px 0;
}

.briefing-list li {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 12px;
    padding-left: 25px;
    position: relative;
}

.briefing-list li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--accent);
}

.warning-box {
    background: rgba(255, 77, 77, 0.05);
    border: 1px solid rgba(255, 77, 77, 0.2);
    color: var(--bad);
    padding: 15px;
    font-size: 11px;
    text-align: center;
    letter-spacing: 1px;
    margin-bottom: 30px;
    text-transform: uppercase;
}

.accept-btn {
    width: 100%;
    background: var(--accent);
    color: var(--bg);
    border: none;
    padding: 15px;
    font-family: "IBM Plex Mono", monospace;
    font-weight: 600;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.2s var(--ease);
}


/* De 'glitch' animatie voor de titel */
.glitch {
    position: relative;
}

.glitch::after {
    content: attr(data-text);
    position: absolute;
    left: 2px;
    text-shadow: -1px 0 var(--bad);
    top: 0;
    color: var(--accent);
    background: var(--panel);
    overflow: hidden;
    clip: rect(0, 900px, 0, 0);
    animation: noise-anim 2s infinite linear alternate-reverse;
}

@keyframes noise-anim {
    0% { clip: rect(10px, 9999px, 20px, 0); }
    100% { clip: rect(40px, 9999px, 80px, 0); }
}