:root {
  --blob: #ff8fab;
  --blob-dark: #d94f79;
  --paper: #fff7e8;
  --ink: #223044;
  --muted: #667085;
  --card: rgba(255,255,255,0.88);
  --line: rgba(34, 48, 68, 0.14);
  --shadow: 0 20px 60px rgba(48, 60, 80, 0.18);
  --radius: 28px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* { box-sizing: border-box; }

/* Zorg dat verborgen login/signup-formulieren echt niet renderen, ook als een class display:grid zet. */
[hidden] { display: none !important; }


html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  font-family: "Trebuchet MS", "Comic Sans MS", "Segoe UI", system-ui, sans-serif;
  background: var(--paper);
  overflow-x: hidden;
}

button, input { font: inherit; }
button, input, label { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; touch-action: manipulation; }
input { font-size: 16px; }

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: calc(32px + var(--safe-top)) 0 calc(150px + var(--safe-bottom));
}

.hero {
  display: flex;
  align-items: start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 20px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 5.4vw, 4.1rem);
  line-height: 0.94;
  letter-spacing: -0.06em;
}
.hero h1 {
  white-space: nowrap;
  text-wrap: nowrap;
}
.hero-title-wrap { flex: 1 1 100%; min-width: 0; }
h2 { font-size: clamp(1.45rem, 3vw, 2.25rem); margin-bottom: 8px; }
h3 { font-size: 1.1rem; margin-bottom: 12px; }
.hero-subtitle { max-width: 720px; color: var(--muted); font-size: 1.08rem; margin-bottom: 0; }
.eyebrow {
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--blob-dark);
}

.panel {
  display: none;
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.92);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: clamp(18px, 3vw, 30px);
  margin-bottom: 22px;
  transform-origin: 50% 18px;
}

@keyframes panelEnter {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.panel.active { display: block; animation: panelEnter .28s ease both; }
.overview-panel.active { display: block; }
.panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.panel-header.compact { margin-bottom: 14px; }
.panel-header p, .overview-panel p { color: var(--muted); margin-bottom: 0; }

.tables-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.table-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 14px;
  border: 2px solid transparent;
  border-radius: 20px;
  background: rgba(255,255,255,0.70);
  box-shadow: 0 10px 25px rgba(34,48,68,0.08);
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.table-choice:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(34,48,68,0.12); }
.table-choice input { width: 20px; height: 20px; accent-color: var(--choice); }
.table-choice:has(input:checked) {
  border-color: var(--choice);
  background: color-mix(in srgb, var(--choice) 16%, white);
}
.table-badge {
  display: inline-flex;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: var(--choice);
  box-shadow: inset 0 -5px 0 rgba(0,0,0,0.08), 0 8px 16px rgba(34,48,68,0.10);
  flex: 0 0 auto;
}

.menu-actions {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 1fr .75fr auto;
  gap: 12px;
  align-items: stretch;
  margin-top: 20px;
}
.option-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,0.68);
  box-shadow: 0 8px 22px rgba(34,48,68,0.07);
}
.option-card input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--blob); }
.option-card strong, .option-card small { display: block; }
.option-card small { color: var(--muted); font-size: .86rem; }
.option-number-wrap { flex: 1; min-width: 0; }
.number-input {
  width: 72px;
  min-height: 46px;
  border-radius: 18px;
  border: 1px solid var(--line);
  text-align: center;
  font-weight: 900;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.7);
  outline: none;
}
.number-input:focus { border-color: var(--blob); }

.button-row { display: flex; flex-wrap: wrap; gap: 10px; }
.button-row.centered { justify-content: center; }
.primary, .secondary, .ghost, .danger {
  border: 0;
  border-radius: 999px;
  min-height: 48px;
  padding: 0 18px;
  font-weight: 900;
  transition: transform .16s ease, filter .16s ease, box-shadow .16s ease;
}
.primary {
  color: white;
  background: var(--blob-dark);
  box-shadow: 0 12px 0 color-mix(in srgb, var(--blob-dark) 78%, black), 0 18px 30px color-mix(in srgb, var(--blob) 30%, transparent);
}
.secondary {
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  box-shadow: 0 9px 20px rgba(34,48,68,0.07);
}
.ghost {
  color: var(--ink);
  background: rgba(255,255,255,0.58);
  border: 1px solid var(--line);
}
.danger {
  color: white;
  background: #d92d20;
  box-shadow: 0 12px 0 #8f1d16, 0 18px 30px rgba(217,45,32,.22);
}
.small { min-height: 38px; padding: 0 14px; }
.start-button { min-width: 150px; }

.warning-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(34, 48, 68, 0.38);
  backdrop-filter: blur(4px);
}
.warning-overlay[hidden] { display: none !important; }
.warning-card {
  width: min(520px, 100%);
  text-align: center;
  border-radius: 30px;
  padding: clamp(22px, 4vw, 34px);
  background: #fffafa;
  border: 3px solid #d92d20;
  box-shadow: 0 28px 80px rgba(143, 29, 22, .28);
  animation: warningPop .22s ease both;
}
@keyframes warningPop {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.warning-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #d92d20;
  color: white;
  font-size: 2.5rem;
  font-weight: 1000;
  box-shadow: 0 12px 0 #8f1d16;
}
.warning-card h2 { color: #8f1d16; margin-bottom: 10px; }
.warning-card p { color: #5f1f1a; }
.warning-actions { margin-top: 20px; }
.danger-text { color: #d92d20; }
body.warning-open { overflow: hidden; }
.primary:hover, .secondary:hover, .ghost:hover, .danger:hover { transform: translateY(-2px); filter: brightness(1.02); }
.primary:active, .secondary:active, .ghost:active, .danger:active { transform: translateY(0); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}
.pill-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.pill {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.76);
  border: 1px solid var(--line);
}

.question-card {
  text-align: center;
  padding: clamp(18px, 4vw, 40px);
  border-radius: 30px;
  background: white;
  border: 1px solid rgba(255,255,255,0.72);
  box-shadow: inset 0 -10px 0 rgba(34,48,68,0.04), 0 16px 30px rgba(34,48,68,0.08);
  transition: box-shadow .22s ease, transform .22s ease;
}
.question-card.is-changing { animation: cardSwap .34s ease both; }

@keyframes cardSwap {
  0% { opacity: .35; transform: translateX(14px) scale(.985); }
  65% { opacity: 1; transform: translateX(-3px) scale(1.01); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}
.question {
  margin: 0 0 24px;
  font-size: clamp(3rem, 10vw, 7.2rem);
  letter-spacing: -0.05em;
}
.answer-form { max-width: 520px; margin: 0 auto; text-align: left; }
.answer-form label { display: block; margin: 0 0 8px 12px; font-weight: 900; color: var(--muted); }
.answer-line { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
#answerInput {
  width: 100%;
  min-height: 58px;
  padding: 0 18px;
  border-radius: 999px;
  border: 2px solid transparent;
  background: white;
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 1.25rem;
  font-weight: 900;
  outline: none;
}
#answerInput:focus { border-color: var(--blob); }
.feedback {
  min-height: 34px;
  margin-top: 16px;
  font-weight: 900;
  font-size: 1.05rem;
}
.feedback.good { color: #07805d; }
.feedback.bad { color: #c73b54; }

.session-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}
.mini-panel {
  padding: 18px;
  border-radius: 24px;
  background: rgba(255,255,255,0.62);
  border: 1px solid var(--line);
}
.progress-track {
  height: 18px;
  background: rgba(34,48,68,0.12);
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0 10px;
}
.progress-track span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--blob-dark);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.10);
  transition: width .25s ease;
}
.wrong-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.wrong-list li {
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  font-weight: 800;
}

.finish-card { text-align: center; padding: clamp(18px, 4vw, 42px); }
.finish-card h2 { font-size: clamp(2.2rem, 6vw, 4rem); margin-bottom: 10px; }
.finish-card p { color: var(--muted); }
.prize-banner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 10px auto 20px;
  padding: 12px 16px;
  border-radius: 999px;
  background: #fff3bd;
  color: #7a5400;
  font-weight: 900;
  border: 1px solid rgba(122,84,0,.15);
  box-shadow: 0 12px 30px rgba(158,109,0,.12);
}

.legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  background: rgba(255,255,255,.70);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 900;
}
.dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.10), 0 3px 8px rgba(34,48,68,.12);
}
.status-new { background: #f2f4f7; border: 1px solid #d0d5dd; }
.status-green { background: #3ccf8e; }
.status-yellow { background: #ffd45a; }
.status-orange { background: #ff9f43; }
.status-red { background: #ff5c7a; }

.mastery-grid-wrap { overflow: auto; }
.mastery-grid {
  display: grid;
  grid-template-columns: 34px repeat(12, 42px);
  grid-auto-rows: 42px;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 0 8px;
  -webkit-overflow-scrolling: touch;
}
.grid-label {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 900;
  font-size: .94rem;
}
.grid-corner { opacity: .35; }
.grid-cell {
  border: 0;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  min-height: 42px;
  width: 42px;
}
.grid-cell .dot {
  width: 25px;
  height: 25px;
  transition: transform .16s ease, box-shadow .16s ease;
}
.grid-cell:hover .dot, .grid-cell:focus-visible .dot {
  transform: scale(1.14);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.13), 0 8px 16px rgba(34,48,68,.18);
}
.grid-cell:focus-visible { outline: 3px solid var(--blob); border-radius: 999px; }

.closet-preview {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 16px;
  border-radius: 24px;
  background: rgba(255,255,255,.62);
  border: 1px solid var(--line);
}
.closet-cloud {
  position: relative;
  width: 170px;
  height: 136px;
  flex: 0 0 auto;
}
.closet-cloud img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
#closetWolkjeImage { z-index: 2; }
#closetCosmeticImage {
  z-index: 3;
  transform: translate(var(--fit-x, 0), var(--fit-y, 0)) scale(var(--fit-scale, 1)) rotate(var(--fit-rotate, 0deg));
  transform-origin: 50% 50%;
}
#closetCosmeticImage[data-layer="back"] { z-index: 1; }
#prizeText { margin: 0; color: var(--muted); font-weight: 900; }
.closet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.cosmetic-card {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 16px;
  border: 2px solid transparent;
  border-radius: 24px;
  background: rgba(255,255,255,.72);
  box-shadow: 0 10px 25px rgba(34,48,68,.08);
  min-height: 190px;
  text-align: center;
}
.cosmetic-card.is-equipped { border-color: var(--blob); background: color-mix(in srgb, var(--blob) 12%, white); }
.cosmetic-card.is-locked { opacity: .62; }
.cosmetic-card > img {
  width: 112px;
  height: 90px;
  object-fit: contain;
}
.cosmetic-card h3 { margin: 0; }
.cosmetic-card p { margin: 0; color: var(--muted); font-size: .9rem; }
.cosmetic-card button { width: 100%; }

.mascot {
  --size: 158px;
  position: fixed;
  right: max(calc(12px + var(--safe-right)), calc((100vw - 1220px) / 2));
  bottom: calc(18px + var(--safe-bottom));
  z-index: 5;
  width: 220px;
  pointer-events: none;
  display: grid;
  justify-items: center;
  gap: 5px;
}
.mascot-stage {
  position: relative;
  width: var(--size);
  height: calc(var(--size) * .8);
  isolation: isolate;
  animation: cloudFloat 3.3s ease-in-out infinite;
}
.wolkje-img, .cosmetic-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.wolkje-img { z-index: 2; }
.cosmetic-img {
  z-index: 3;
  transform: translate(var(--fit-x, 0), var(--fit-y, 0)) scale(var(--fit-scale, 1)) rotate(var(--fit-rotate, 0deg));
  transform-origin: 50% 50%;
}
.cosmetic-img[data-layer="back"] { z-index: 1; }
.table-bubble {
  position: absolute;
  right: 7px;
  bottom: 8px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 16px;
  color: var(--ink);
  background: white;
  border: 2px solid rgba(0,0,0,0.08);
  font-size: 1.25rem;
  font-weight: 900;
  box-shadow: 0 10px 18px rgba(34,48,68,0.16);
}
.table-bubble.empty { display: none; }

.mascot-speech {
  position: relative;
  max-width: 205px;
  padding: 10px 12px;
  border-radius: 22px 22px 8px 22px;
  background: white;
  box-shadow: 0 12px 28px rgba(34,48,68,0.16);
  border: 1px solid var(--line);
  font-size: .9rem;
  font-weight: 900;
  text-align: center;
}
.mascot-speech::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -7px;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  background: white;
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  transform: rotate(45deg);
}
@keyframes cloudFloat {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-9px) rotate(1.5deg); }
}

.site-footer {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  margin: 18px 0 0;
  padding: 12px 0 2px;
}
.site-footer a {
  color: var(--muted);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 900;
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  box-shadow: 0 10px 24px rgba(34,48,68,0.08);
  transition: transform .16s ease, color .16s ease, box-shadow .16s ease;
}
.site-footer a:hover {
  color: var(--ink);
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(34,48,68,0.12);
}

.confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  left: var(--x);
  top: -24px;
  width: var(--s);
  height: calc(var(--s) * 1.45);
  border-radius: 5px;
  background: var(--c);
  opacity: .98;
  box-shadow: 0 7px 14px rgba(34,48,68,0.12);
  animation: confettiFall var(--d) ease-in forwards;
  animation-delay: var(--delay);
}
.confetti-piece.round { border-radius: 999px; }
.confetti-piece.gold { box-shadow: 0 0 0 1px rgba(116,80,0,0.10), 0 9px 18px rgba(158,109,0,0.18); }

@keyframes confettiFall {
  0% { transform: translate3d(0, -20px, 0) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translate3d(var(--drift), 108vh, 0) rotate(var(--r)); opacity: 0; }
}

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

@media (max-width: 980px) {
  .hero, .panel-header, .topbar { flex-direction: column; align-items: stretch; }
  .hero-actions, .button-row, .pill-row { justify-content: flex-start; }
  .tables-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .menu-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .start-button { grid-column: 1 / -1; }
  .session-layout { grid-template-columns: 1fr; }
  .closet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mascot { transform: scale(.84); transform-origin: bottom right; }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 1120px);
    padding-top: calc(18px + var(--safe-top));
    padding-bottom: calc(154px + var(--safe-bottom));
  }
  h1 { font-size: clamp(2.1rem, 13vw, 3.5rem); line-height: .98; }
  h2 { font-size: clamp(1.35rem, 7vw, 2rem); }
  .hero-subtitle { font-size: 1rem; }
  .panel { border-radius: 24px; padding: 16px; margin-bottom: 16px; }
  .panel-header { gap: 12px; margin-bottom: 16px; }
  .tables-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .table-choice { min-height: 58px; padding: 12px; border-radius: 18px; }
  .table-choice:hover { transform: none; }
  .table-badge { width: 32px; height: 32px; border-radius: 11px; }
  .menu-actions { grid-template-columns: 1fr; gap: 10px; margin-top: 14px; }
  .option-card { min-height: 58px; padding: 12px; }
  .primary, .secondary, .ghost, .danger { width: 100%; min-height: 52px; padding: 0 16px; }
  .small { width: auto; min-height: 44px; }
  .topbar { margin-bottom: 14px; }
  .pill-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .pill { justify-content: center; min-height: 42px; padding: 0 10px; font-size: .94rem; }
  .question-card { padding: 18px 14px; border-radius: 24px; }
  .question { font-size: clamp(3rem, 19vw, 5.4rem); margin-bottom: 18px; }
  .answer-line { grid-template-columns: 1fr; }
  #answerInput { min-height: 62px; border-radius: 24px; font-size: 1.3rem; text-align: center; }
  .feedback { min-height: 44px; font-size: 1rem; }
  .mini-panel { border-radius: 20px; padding: 14px; }
  .legend { gap: 7px; }
  .legend span { font-size: .8rem; padding: 6px 8px; }
  .mastery-grid { grid-template-columns: 28px repeat(12, 34px); grid-auto-rows: 34px; gap: 5px; }
  .grid-cell { width: 34px; min-height: 34px; }
  .grid-cell .dot { width: 21px; height: 21px; }
  .grid-label { font-size: .84rem; }
  .closet-preview { flex-direction: column; align-items: center; text-align: center; }
  .closet-grid { grid-template-columns: 1fr; }
  .site-footer { padding-bottom: calc(2px + var(--safe-bottom)); }
  .site-footer a { font-size: .86rem; padding: 8px 12px; }
  .mascot { right: calc(4px + var(--safe-right)); bottom: calc(6px + var(--safe-bottom)); transform: scale(.72); }
}

@media (max-width: 420px) {
  .app-shell { width: min(100% - 14px, 1120px); padding-bottom: calc(126px + var(--safe-bottom)); }
  .tables-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .table-choice { gap: 8px; font-size: .95rem; }
  .table-badge { width: 28px; height: 28px; }
  .pill-row { grid-template-columns: 1fr 1fr; }
  .pill { font-size: .88rem; }
  .mascot-speech { max-width: 150px; padding: 8px 10px; font-size: .78rem; }
  .mascot { width: 156px; transform: scale(.62); right: calc(-4px + var(--safe-right)); bottom: calc(0px + var(--safe-bottom)); }
}

@media (max-width: 350px) {
  .tables-grid { grid-template-columns: 1fr; }
  .pill-row { grid-template-columns: 1fr; }
}

body:not([data-screen="menu"]) #overviewPanel,
body:not([data-screen="menu"]) #resetStatsBtn,
body:not([data-screen="menu"]) #closetBtn {
  display: none;
}


.coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: #fff3bd;
  color: #7a5400;
  border: 1px solid rgba(122,84,0,.15);
  box-shadow: 0 10px 24px rgba(158,109,0,.12);
  font-weight: 900;
}
.coin-line {
  margin: 6px 0 0;
  color: #7a5400;
  font-weight: 900;
}
.closet-info { min-width: 0; }
.cosmetic-preview-mini {
  position: relative;
  width: 132px;
  height: 106px;
  display: grid;
  place-items: center;
}
.cosmetic-preview-mini img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.cosmetic-preview-mini .preview-cloud { z-index: 2; }
.cosmetic-preview-mini .preview-cosmetic {
  z-index: 3;
  transform: translate(var(--fit-x, 0), var(--fit-y, 0)) scale(var(--fit-scale, 1)) rotate(var(--fit-rotate, 0deg));
  transform-origin: 50% 50%;
}
.cosmetic-preview-mini .preview-cosmetic[data-layer="back"] { z-index: 1; }
.cosmetic-card.is-affordable {
  border-color: #ffd166;
  box-shadow: 0 12px 28px rgba(158,109,0,.12);
}
.cosmetic-card button:disabled {
  cursor: not-allowed;
  opacity: .72;
}

.coin-pop {
  position: absolute;
  left: var(--x);
  top: 48vh;
  font-size: 1.7rem;
  filter: drop-shadow(0 8px 10px rgba(122,84,0,.22));
  animation: coinPop 1050ms ease-out forwards;
  animation-delay: var(--delay);
}
@keyframes coinPop {
  0% { transform: translate3d(0, 18px, 0) scale(.7) rotate(-10deg); opacity: 0; }
  16% { opacity: 1; }
  100% { transform: translate3d(var(--drift), -96px, 0) scale(1.25) rotate(15deg); opacity: 0; }
}

/* Cloudflare login gate */
body[data-auth="checking"] .app-shell,
body[data-auth="signed-out"] .app-shell,
body[data-auth="checking"] .mascot,
body[data-auth="signed-out"] .mascot {
  display: none;
}

body[data-auth="signed-in"] .auth-screen {
  display: none;
}

.auth-screen {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(24px + var(--safe-top)) calc(18px + var(--safe-right)) calc(24px + var(--safe-bottom)) calc(18px + var(--safe-left));
}

.auth-form[hidden] { display: none !important; }

.auth-card {
  width: min(500px, 100%);
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(255,255,255,0.95);
  border-radius: 34px;
  box-shadow: var(--shadow);
  padding: clamp(24px, 5vw, 40px);
  text-align: center;
}

.auth-wolkje {
  width: min(210px, 56vw);
  display: block;
  margin: 0 auto 18px;
  filter: drop-shadow(0 18px 16px rgba(34,48,68,.18));
}

.auth-card h1 {
  font-size: clamp(2rem, 8vw, 3.7rem);
  line-height: .95;
  margin-bottom: 10px;
}

.auth-subtitle {
  color: var(--muted);
  margin: 0 auto 20px;
  max-width: 34ch;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  margin-bottom: 18px;
}

.auth-tab {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.auth-tab.active {
  background: var(--blob);
  color: white;
  box-shadow: 0 9px 18px rgba(34,48,68,.12);
}

.auth-form {
  display: grid;
  gap: 10px;
  text-align: left;
}

.auth-form label {
  font-weight: 900;
  color: var(--ink);
}

.auth-form input {
  width: 100%;
  min-height: 52px;
  border-radius: 18px;
  border: 1px solid var(--line);
  padding: 0 16px;
  color: var(--ink);
  background: white;
  outline: none;
}

.auth-form input:focus {
  border-color: var(--blob);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--blob) 18%, transparent);
}

.auth-submit { margin-top: 8px; width: 100%; }

.auth-message {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.auth-message.error { color: #b42318; }
.auth-message.success { color: #087443; }

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.78);
  border: 1px solid var(--line);
  box-shadow: 0 8px 18px rgba(34,48,68,.07);
  color: var(--ink);
  font-weight: 900;
}

@media (max-width: 640px) {
  .auth-screen { align-items: start; padding-top: calc(18px + var(--safe-top)); }
  .auth-card { border-radius: 28px; padding: 22px; }
  .auth-wolkje { width: min(170px, 54vw); margin-bottom: 12px; }
  .auth-card h1 { letter-spacing: -0.05em; }
  .auth-subtitle { font-size: .96rem; }
}

@media (max-width: 380px) {
  .auth-card { padding: 18px; }
  .auth-card h1 { font-size: 2.15rem; }
}
