:root {
  --bg: #f6f1ea;
  --ink: #2c2825;
  --muted: #72695f;
  --line: #efe4d8;
  --card: #fffcf9;
  --coral: #ff6b57;
  --coral-deep: #e85745;
  --mint: #2fbfa0;
  --mint-deep: #14967d;
  --mint-soft: #e5f8f3;
  --sun: #ffb703;
  --sun-soft: #fff3d2;
  --sky: #6cb6ff;
  --lilac: #7d72e8;
  --shadow: 0 14px 40px rgba(74, 46, 24, 0.07);
  --radius: 24px;
  --display: "Fredoka", "Trebuchet MS", sans-serif;
  --body: "Nunito", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--body);
  background:
    radial-gradient(circle at 6% -8%, #ffe4d8 0, transparent 34%),
    radial-gradient(circle at 100% 0%, #ddf7ef 0, transparent 30%),
    radial-gradient(circle at 90% 100%, #ece7ff 0, transparent 26%),
    var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: #ffd3c8; }
:focus-visible { outline: 3px solid #ffb199; outline-offset: 2px; }
body.busy { cursor: progress; }

.wrap { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: clamp(1.8rem, 3vw, 2.6rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.12rem; }
p { margin: 0; }
a { color: var(--mint-deep); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 20px;
  background: rgba(255, 252, 249, 0.9);
  border-bottom: 1px solid rgba(80, 50, 30, 0.06);
  backdrop-filter: blur(14px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 650;
}
.nav {
  display: flex;
  gap: 4px;
  overflow: auto;
  flex: 1;
}
.nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.92rem;
  padding: 8px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.nav a.active, .nav a:hover { background: white; color: var(--ink); box-shadow: 0 4px 14px rgba(70, 40, 20, 0.06); }
.who { display: flex; align-items: center; gap: 8px; }
.coinpill, .namepill {
  background: white;
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px var(--line);
}
.coinpill { background: var(--sun-soft); color: #8a5a00; }
.page { padding: 28px 0 64px; }
.page-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-end; margin-bottom: 18px; }
.kicker { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--coral); margin-bottom: 6px; }
.lead { color: var(--muted); font-size: 1.05rem; line-height: 1.5; max-width: 62ch; }
.muted { color: var(--muted); }
.tiny { font-size: 0.82rem; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.stack { display: grid; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.7);
  padding: 18px;
}
.card.pad-lg { padding: 26px; }
a.card, a.pet-card, a.shop-tile {
  text-decoration: none;
  color: inherit;
  display: block;
}
.pet-card, .species-card, .item-card, .listing-card, .shop-tile, .thread-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.pet-card:hover, .species-card:hover, .item-card:hover, .listing-card:hover, .shop-tile:hover, .thread-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px rgba(74, 46, 24, 0.1);
}

.btn {
  border: 0;
  background: white;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1.5px #eadfd4;
}
.btn.primary { background: var(--coral); color: white; box-shadow: 0 8px 18px rgba(255, 107, 87, 0.28); }
.btn.primary:hover { background: var(--coral-deep); }
.btn.soft { background: var(--mint-soft); color: var(--mint-deep); box-shadow: none; }
.btn.ghost { background: transparent; }
.btn.danger { color: #c44836; box-shadow: inset 0 0 0 1.5px #f3c7c0; }
.btn.small { padding: 7px 12px; font-size: 0.86rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.wide { width: 100%; }

.badge, .mood, .tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 800;
}
.badge.gewoon, .tag { background: #f3efe9; color: #6d655c; }
.badge.bijzonder { background: var(--mint-soft); color: var(--mint-deep); }
.badge.zeldzaam { background: #f0edff; color: #5548c8; }
.badge.legendarisch { background: var(--sun-soft); color: #9a6200; }
.mood.good { background: var(--mint-soft); color: var(--mint-deep); }
.mood.warn { background: var(--sun-soft); color: #9a6200; }
.mood.bad { background: #ffe8e4; color: #c44836; }
.tag.fav { background: #fff0d8; color: #9a6200; }

.stats { display: grid; gap: 7px; }
.stat { display: grid; grid-template-columns: 92px 1fr 28px; gap: 8px; align-items: center; font-size: 0.82rem; font-weight: 700; }
.stat em { font-style: normal; color: var(--muted); text-align: right; }
.bar { height: 8px; background: #f3ece4; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; }
.bar i.hunger { background: #ff6b57; }
.bar i.thirst { background: #6cb6ff; }
.bar i.happy { background: #ffb703; }
.bar i.energy { background: #7d72e8; }
.bar i.hygiene { background: #2fbfa0; }
.bar i.health { background: #ff8fab; }

.pet-grid, .item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.species-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.gate-grid > *, .shop-layout > *, .forum-layout > * { min-width: 0; }
.pet-card, .species-card, .item-card { padding: 14px; }
.pet-card .avatar, .species-card .avatar, .preview .avatar { margin: 0 auto; }
.species-card { text-align: center; border: 2px solid transparent; background: white; border-radius: 18px; box-shadow: var(--shadow); width: 100%; cursor: pointer; }
.choice, .cat-list button, .like { cursor: pointer; }
.species-card.selected { border-color: var(--coral); box-shadow: 0 0 0 4px #ffe1da; }
.species-card strong, .item-card strong, .pet-card strong { display: block; }
.price { font-family: var(--display); font-size: 1.25rem; color: #9a6200; }

.hero { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 12px; align-items: center; }
.hero-pet { display: grid; justify-items: center; text-align: center; gap: 6px; }
.shop-tile { min-height: 118px; }
.shop-tile span { display: block; color: var(--muted); margin-top: 6px; font-weight: 700; }
.notice {
  background: #fff7ef;
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: inset 0 0 0 1px #f3dfd0;
}

.shop-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.shop-tabs a { text-decoration: none; }
.shop-layout { display: grid; grid-template-columns: 280px 1fr; gap: 14px; }
.swatches, .seg { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch, .seg button {
  width: 34px; height: 34px; border-radius: 50%; border: 2px solid white; box-shadow: 0 0 0 1px #e6d9cc;
}
.swatch.selected { box-shadow: 0 0 0 3px var(--coral); }
.seg button { width: auto; border-radius: 999px; padding: 8px 14px; background: white; }
.seg button.selected { background: var(--ink); color: white; box-shadow: none; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field span { font-size: 0.82rem; font-weight: 800; color: var(--muted); }
input, select, textarea {
  width: 100%;
  border: 1.5px solid #eadfd4;
  background: white;
  border-radius: 14px;
  padding: 11px 12px;
}
textarea { min-height: 110px; resize: vertical; }
.glyph { width: 42px; height: 42px; }

.listing-card { display: grid; grid-template-columns: 92px 1fr auto; gap: 12px; align-items: center; }
.listing-card .meta { display: grid; gap: 4px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input, .filters select { width: auto; min-width: 140px; }

.nest {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 8px 0 18px;
}
.nest .side { text-align: center; width: 160px; }
.heart { color: var(--coral); font-size: 1.6rem; }
.pick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  border-radius: 16px;
  padding: 8px;
  background: white;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px var(--line);
}
.choice.selected { border-color: var(--mint); }
.choice .who-line { display: grid; }

.forum-layout { display: grid; grid-template-columns: 220px 1fr; gap: 14px; }
.cat-list { display: grid; gap: 6px; }
.cat-list button, .cat-list a {
  text-align: left;
  text-decoration: none;
  background: transparent;
  border: 0;
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 800;
  color: var(--muted);
}
.cat-list .active, .cat-list button:hover { background: white; color: var(--ink); }
.post-body, .reply { white-space: pre-wrap; line-height: 1.55; }
.reply { padding: 12px 0; border-top: 1px solid var(--line); }
.like { background: transparent; border: 0; font-weight: 800; color: var(--muted); padding: 0; }
.like.on { color: var(--coral); }

.dex { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.dex-item { text-align: center; padding: 8px; border-radius: 16px; background: #fff; }
.dex-item.locked { filter: grayscale(1); opacity: 0.38; }
.achieve-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.achieve { padding: 12px; border-radius: 16px; background: var(--mint-soft); }
.achieve.locked { background: #f6f2ec; opacity: 0.72; }
.log-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.log-list li { display: flex; justify-content: space-between; gap: 12px; }

.panel { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.panel button.itempick {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  border-radius: 16px;
  padding: 10px 12px;
  background: white;
  border: 1px solid var(--line);
  min-width: 140px;
}

.gate { min-height: 100vh; display: grid; place-items: center; padding: 28px 16px; }
.gate-card { width: min(1040px, 100%); }
.auth-card { width: min(440px, 100%); }
.gate-grid { display: grid; grid-template-columns: 300px 1fr; gap: 22px; }
.preview { text-align: center; display: grid; justify-items: center; gap: 8px; align-content: start; }

.loading, .fatal {
  min-height: 100vh;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 8px;
}
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(44, 40, 37, 0.35);
  display: grid;
  place-items: center;
  z-index: 40;
  padding: 18px;
}
.dialog { width: min(460px, 100%); }
.footer { margin-top: 28px; color: var(--muted); font-size: 0.9rem; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 800; color: var(--mint-deep); }
.live i {
  width: 8px; height: 8px; border-radius: 50%; background: var(--mint);
  box-shadow: 0 0 0 0 rgba(47, 191, 160, 0.6);
  animation: pulse 1.8s infinite;
}
.share { background: white; border-radius: 14px; padding: 10px 12px; word-break: break-all; }

#toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 8px;
  z-index: 50;
  width: min(320px, calc(100% - 32px));
}
.toast {
  background: var(--ink);
  color: white;
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  animation: rise 0.25s ease;
}

.empty { text-align: center; padding: 28px 16px; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.step { background: white; border-radius: 18px; padding: 14px; }
.step b { display: block; font-family: var(--display); margin-bottom: 4px; }

@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(47, 191, 160, 0); } }

@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; align-items: center; }
  .nav { order: 3; flex: 1 0 100%; width: 100%; min-width: 100%; flex-wrap: wrap; overflow: visible; }
  .nav a { padding: 8px 10px; }
  .grid-2, .grid-3, .grid-4, .hero, .gate-grid, .shop-layout, .forum-layout, .pick-grid, .steps, .achieve-grid {
    grid-template-columns: 1fr;
  }
  .species-grid, .dex { grid-template-columns: repeat(2, 1fr); }
  .listing-card { grid-template-columns: 72px 1fr; }
  .listing-card .buy { grid-column: 1 / -1; }
  .page-head, .spread { align-items: flex-start; flex-direction: column; }
}
.admin-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.admin-side {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 18px 12px 28px;
  background: rgba(255, 252, 249, 0.92);
  border-right: 1px solid rgba(80, 50, 30, 0.06);
}
.admin-side button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 9px 12px;
  font-weight: 800;
  color: var(--muted);
}
.admin-side button.active { background: var(--ink); color: white; }
.admin-main { padding: 28px 22px 64px; width: min(1080px, 100%); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat-grid article h2 { font-size: 1.7rem; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table th { font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.span-2 { grid-column: 1 / -1; }
.banner { background: var(--sun-soft); border-radius: 16px; padding: 12px 14px; }
.tag.bad { background: #ffe4de; color: #c44836; }
.admin-side .brand { margin: 0 8px 14px; }

@media (max-width: 800px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: static; height: auto; display: flex; flex-wrap: wrap; gap: 4px; }
  .admin-side .brand { width: 100%; }
  .admin-side button { width: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
