:root {
  --bg: #07070c;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-2: #0f0f19;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #ececf4;
  --muted: #8a8aa3;
  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --lime: #a3e635;
  --pink: #f472b6;
  --red: #ff4d6d;
  --grad: linear-gradient(120deg, var(--violet), var(--cyan));
  --fire: linear-gradient(120deg, #ff1744, #ff9100, #ffd600, #ff9100, #ff1744);
  --radius: 18px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- achtergrond ---------- */

.bg { position: fixed; inset: 0; overflow: hidden; z-index: -1; pointer-events: none; }
.bg::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% -20%, transparent 40%, var(--bg) 85%);
}
.blob {
  position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%;
  filter: blur(90px); opacity: 0.28; transition: background 1.2s ease;
  animation: drift 26s ease-in-out infinite alternate;
}
.b1 { background: var(--violet); top: -18vmax; left: -10vmax; }
.b2 { background: var(--cyan); top: -22vmax; right: -16vmax; animation-delay: -9s; opacity: 0.18; }
.b3 { background: var(--pink); bottom: -30vmax; left: 20vw; animation-delay: -17s; opacity: 0.12; }
body.ultra-mode .b1 { background: #ff3d00; }
body.ultra-mode .b2 { background: #ff9100; }
body.ultra-mode .b3 { background: #ff1744; }
@keyframes drift {
  to { transform: translate(6vmax, 5vmax) scale(1.12); }
}

#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }

/* ---------- basis-elementen ---------- */

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.03em; font-size: 22px; }
.logo-mark {
  width: 26px; height: 26px; border-radius: 8px; background: var(--grad);
  clip-path: polygon(18% 8%, 82% 8%, 60% 50%, 82% 92%, 18% 92%, 40% 50%);
  transition: transform .5s cubic-bezier(.3, 1.6, .5, 1);
}
.brand:hover .logo-mark { transform: scaleX(.7) rotate(180deg); }
body.ultra-mode .logo-mark { background: var(--fire); background-size: 300% 100%; animation: fire 2s linear infinite; }

.btn {
  position: relative; border: 0; cursor: pointer; white-space: nowrap;
  padding: 10px 18px; border-radius: 12px; font-weight: 650;
  background: var(--grad); color: #07070c;
  box-shadow: 0 6px 24px -8px rgba(139, 92, 246, .7);
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.1); box-shadow: 0 10px 30px -8px rgba(34, 211, 238, .6); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .6; cursor: default; transform: none; }
.btn.pulse { animation: pop .4s ease; }

.ghost-btn {
  border: 1px solid var(--border); background: var(--panel); cursor: pointer;
  padding: 9px 16px; border-radius: 12px; color: var(--muted); white-space: nowrap;
  transition: color .2s, border-color .2s, background .2s;
}
.ghost-btn:hover { color: var(--text); border-color: var(--border-strong); background: rgba(255, 255, 255, .06); }

.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 0; background: transparent;
  color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer;
  transition: color .2s, background .2s;
}
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, .07); }

:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ---------- layout ---------- */

.top {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 920px; margin: 0 auto; padding: 22px 20px 0;
}
.wrap { max-width: 920px; margin: 0 auto; padding: 24px 20px 80px; }
.wrap.quake { animation: quake .5s cubic-bezier(.36, .07, .19, .97); }

.hero { text-align: center; margin: 26px 0 34px; }
.hero h1 { font-size: clamp(34px, 6.4vw, 58px); line-height: 1.05; letter-spacing: -0.045em; margin: 0 0 12px; font-weight: 850; }
.hero p { color: var(--muted); margin: 0; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
body.ultra-mode .grad { background-image: var(--fire); background-size: 300% 100%; animation: fire 3s linear infinite; }

/* ---------- niveaus ---------- */

.levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.level {
  --mx: 50%; --my: 50%;
  position: relative; overflow: hidden; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 3px;
  padding: 16px; border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: radial-gradient(160px circle at var(--mx) var(--my), rgba(255, 255, 255, .07), transparent 70%), var(--panel);
  transition: transform .2s ease, border-color .2s ease, box-shadow .3s ease;
}
.level:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.level.active {
  border-color: transparent;
  background:
    radial-gradient(160px circle at var(--mx) var(--my), rgba(255, 255, 255, .08), transparent 70%) padding-box,
    linear-gradient(var(--panel-2), var(--panel-2)) padding-box,
    var(--grad) border-box;
  box-shadow: 0 12px 40px -14px rgba(139, 92, 246, .75);
}
.level.pick { animation: pick .35s cubic-bezier(.3, 1.7, .5, 1); }
.lv-name { font-weight: 750; font-size: 17px; letter-spacing: -0.01em; }
.lv-desc { color: var(--muted); font-size: 12.5px; }
.lv-meter { display: flex; gap: 4px; margin-bottom: 8px; }
.lv-meter i { width: 16px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .1); }
.level.active .lv-meter i.on { background: var(--grad); }
.lv-meter i.on { background: rgba(255, 255, 255, .35); }

.level-ultra .lv-name { background: var(--fire); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 900; letter-spacing: .04em; }
.level-ultra.active {
  background:
    radial-gradient(160px circle at var(--mx) var(--my), rgba(255, 145, 0, .14), transparent 70%) padding-box,
    linear-gradient(#150a08, #150a08) padding-box,
    var(--fire) border-box;
  background-size: auto, auto, 300% 100%;
  animation: fire 2.2s linear infinite;
  box-shadow: 0 12px 44px -12px rgba(255, 90, 0, .8);
}
.level-ultra.active .lv-name { animation: fire 2s linear infinite; }
.level-ultra.active .lv-meter i.on { background: var(--fire); background-size: 400% 100%; animation: fire 1.4s linear infinite; }
.level-ultra.active.pick { animation: pick .35s cubic-bezier(.3, 1.7, .5, 1), fire 2.2s linear infinite; }

/* ---------- schakelaars ---------- */

.options { display: flex; flex-wrap: wrap; gap: 10px 26px; justify-content: center; margin: 20px 0 22px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--muted); user-select: none; }
.switch small { opacity: .7; margin-left: 4px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.track { width: 38px; height: 22px; border-radius: 99px; background: rgba(255, 255, 255, .1); position: relative; transition: background .25s; flex: none; }
.thumb { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #d7d7e4; transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.switch input:checked + .track { background: var(--grad); }
.switch input:checked + .track .thumb { transform: translateX(16px); background: #fff; }
.switch input:checked ~ span:last-child { color: var(--text); }
.switch input:focus-visible + .track { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ---------- dropzone ---------- */

.drop {
  position: relative; display: block; cursor: pointer; border-radius: 24px;
  padding: 46px 20px; text-align: center;
  border: 2px dashed rgba(255, 255, 255, .14);
  background: var(--panel);
  transition: border-color .25s, background .25s, transform .25s cubic-bezier(.3, 1.5, .5, 1), box-shadow .3s;
}
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop:hover, .drop:focus-within { border-color: rgba(139, 92, 246, .6); background: rgba(139, 92, 246, .06); }
.drop.over {
  border-color: var(--cyan); border-style: solid; transform: scale(1.015);
  background: rgba(34, 211, 238, .07);
  box-shadow: 0 0 0 6px rgba(34, 211, 238, .08), 0 20px 60px -20px rgba(34, 211, 238, .5);
}
.drop.gulp { animation: gulp .45s cubic-bezier(.3, 1.6, .5, 1); }
body.ultra-mode .drop:hover, body.ultra-mode .drop.over { border-color: #ff9100; background: rgba(255, 110, 0, .06); box-shadow: 0 20px 60px -24px rgba(255, 90, 0, .6); }
.drop-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.drop-icon {
  width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; margin-bottom: 8px;
  background: linear-gradient(140deg, rgba(139, 92, 246, .25), rgba(34, 211, 238, .18));
  color: #fff; transition: transform .35s cubic-bezier(.3, 1.7, .5, 1);
}
.drop-icon svg { width: 34px; height: 34px; }
.drop:hover .drop-icon, .drop.over .drop-icon { transform: translateY(-4px) rotate(-6deg) scale(1.06); }
.drop.over .drop-icon svg { animation: bob .7s ease-in-out infinite alternate; }
.drop-title { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.drop-sub { color: var(--muted); font-size: 13.5px; }

/* ---------- bestandenlijst ---------- */

.list { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  padding: 14px 14px 14px 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--panel);
  animation: enter .45s cubic-bezier(.2, 1.3, .4, 1) both;
  transition: border-color .3s, box-shadow .4s;
}
.item.leaving { animation: leave .26s ease forwards; }
.item.shake { animation: shake .45s ease; }
.item.glow { animation: glow 1.4s ease; }
.item.is-done { border-color: rgba(163, 230, 53, .22); }
.item.is-done.is-ultra { border-color: rgba(255, 145, 0, .35); }
.item.is-error { border-color: rgba(255, 77, 109, .35); }

.item-icon {
  width: 44px; height: 52px; border-radius: 10px; display: grid; place-items: center;
  font-size: 11px; font-weight: 800; letter-spacing: .06em; color: #fff;
  background: linear-gradient(160deg, #3a2a6e, #1c1c30); position: relative;
  transition: transform .5s cubic-bezier(.3, 1.6, .5, 1);
}
.item.is-working .item-icon { animation: squeeze 1s ease-in-out infinite; }
.item.is-done .item-icon { background: linear-gradient(160deg, #3f6b12, #1c2a14); transform: scale(.88); }
.item.is-done.is-ultra .item-icon { background: linear-gradient(160deg, #b33a00, #3a1406); }
.item.is-error .item-icon { background: linear-gradient(160deg, #7a1f33, #2a1018); }

.item-main { min-width: 0; }
.item-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.item-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.item-badge { flex: none; font-size: 12.5px; font-weight: 800; padding: 2px 9px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.item-badge:empty { display: none; }
.item-badge.good { background: rgba(163, 230, 53, .15); color: var(--lime); }
.item-badge.good.huge { background: var(--lime); color: #0b1400; box-shadow: 0 0 22px -4px rgba(163, 230, 53, .8); }
.item.is-ultra .item-badge.good { background: var(--fire); background-size: 300% 100%; color: #1a0700; animation: fire 2s linear infinite; box-shadow: 0 0 24px -4px rgba(255, 110, 0, .9); }
.item-badge.calm { background: rgba(255, 255, 255, .08); color: var(--muted); }
.item-badge.bad { background: rgba(255, 77, 109, .14); color: var(--red); }
.item-badge.pop, #saved-total.pop { animation: pop .6s cubic-bezier(.3, 1.8, .5, 1); }
.item.is-ultra .item-badge.pop { animation: pop .6s cubic-bezier(.3, 1.8, .5, 1), fire 2s linear infinite; }

.item-sizes { display: flex; gap: 8px; align-items: baseline; color: var(--muted); font-size: 13px; margin: 2px 0 8px; font-variant-numeric: tabular-nums; }
.item-sizes .arrow { opacity: .5; }
.item.is-done .size-new { color: var(--text); font-weight: 700; }
.item.is-done .size-orig { text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, .25); }

.bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: 99px; background: var(--grad); }
.item.is-working .bar-fill {
  width: 100% !important;
  background: linear-gradient(90deg, var(--violet), var(--cyan), var(--pink), var(--violet));
  background-size: 300% 100%; animation: shimmer 1.2s linear infinite;
}
.item.is-working.is-ultra .bar-fill, .item.is-done.is-ultra .bar-fill { background: var(--fire); background-size: 300% 100%; animation: shimmer 1s linear infinite; }
.item.is-done .bar-fill { background: linear-gradient(90deg, var(--lime), #4ade80); }
.item.is-error .bar-fill { background: rgba(255, 77, 109, .5); }
.item.is-queued .bar-fill { width: 0 !important; }

.item-status { font-size: 12.5px; color: var(--muted); margin-top: 6px; min-height: 1.5em; font-variant-numeric: tabular-nums; }
.item.is-error .item-status { color: #ff8fa3; }
.item-actions { display: flex; align-items: center; gap: 8px; }
.item.is-done .dl { animation: pop .5s .25s cubic-bezier(.3, 1.8, .5, 1) both; }

/* ---------- samenvatting ---------- */

.summary {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
  margin-top: 16px; padding: 14px 16px; border-radius: var(--radius);
  background: linear-gradient(120deg, rgba(139, 92, 246, .1), rgba(34, 211, 238, .06));
  border: 1px solid var(--border);
}
.sum-text { color: var(--muted); }
#saved-total { display: inline-block; margin-left: 6px; font-size: 20px; color: var(--text); font-variant-numeric: tabular-nums; }
.sum-actions { display: flex; gap: 8px; }

/* ---------- flash-tekst ---------- */

.flash {
  position: fixed; left: 50%; top: 42%; z-index: 60; pointer-events: none; white-space: nowrap;
  font-size: clamp(44px, 11vw, 120px); font-weight: 950; letter-spacing: -0.04em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: flash 1.3s cubic-bezier(.2, 1, .3, 1) forwards;
}
.flash-fire { background-image: var(--fire); background-size: 300% 100%; filter: drop-shadow(0 0 30px rgba(255, 110, 0, .6)); }

/* ---------- inlogpagina ---------- */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: 100%; max-width: 380px; padding: 34px 30px 30px; border-radius: 24px;
  background: rgba(15, 15, 25, .72); border: 1px solid var(--border);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .9);
  animation: enter .6s cubic-bezier(.2, 1.2, .4, 1) both;
}
.login-card.shake { animation: shake .45s ease; }
.login-card.success { animation: success .45s ease forwards; }
.brand-big { font-size: 34px; justify-content: center; }
.brand-big .logo-mark { width: 36px; height: 36px; }
.login-sub { text-align: center; color: var(--muted); margin: 6px 0 26px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 12px 14px; border-radius: 12px; font: inherit; color: var(--text);
  background: rgba(255, 255, 255, .04); border: 1px solid var(--border); outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.field input:focus { border-color: var(--violet); background: rgba(139, 92, 246, .06); box-shadow: 0 0 0 4px rgba(139, 92, 246, .18); }
.login-msg { min-height: 22px; color: #ff8fa3; font-size: 13.5px; margin: 2px 0 10px; }
.btn-big { width: 100%; padding: 13px; font-size: 16px; }
.login-card.loading .btn-big span { opacity: 0; }
.login-card.loading .btn-big::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid rgba(7, 7, 12, .3); border-top-color: #07070c; animation: spin .7s linear infinite;
}

/* ---------- keyframes ---------- */

@keyframes fire { to { background-position: 300% 0; } }
@keyframes shimmer { to { background-position: -300% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { to { transform: translateY(4px); } }
@keyframes enter { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes leave { to { opacity: 0; transform: translateX(30px) scale(.96); } }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes pick { 50% { transform: scale(.95); } }
@keyframes gulp { 40% { transform: scale(.96); } 70% { transform: scale(1.02); } }
@keyframes squeeze { 50% { transform: scaleX(.78) scaleY(1.05); } }
@keyframes glow { 0% { box-shadow: 0 0 0 0 rgba(163, 230, 53, .5); } 100% { box-shadow: 0 0 0 18px rgba(163, 230, 53, 0); } }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@keyframes quake {
  10%, 90% { transform: translate(-2px, 1px); }
  20%, 80% { transform: translate(4px, -2px); }
  30%, 50%, 70% { transform: translate(-6px, 2px); }
  40%, 60% { transform: translate(6px, -1px); }
}
@keyframes flash {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4) rotate(-6deg); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1.08) rotate(-3deg); }
  70% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-3deg); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1.1) rotate(-3deg); }
}
@keyframes success { to { opacity: 0; transform: scale(.94) translateY(-10px); filter: blur(4px); } }

/* ---------- mobiel & toegankelijkheid ---------- */

@media (max-width: 720px) {
  .levels { grid-template-columns: repeat(2, 1fr); }
  .item { grid-template-columns: auto 1fr; }
  .item-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .drop { padding: 34px 16px; }
}

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