@font-face {
  font-family: "Fredoka";
  src: url("../fonts/fredoka-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --sky: #8fd3f4;
  --sky-2: #c9ecfb;
  --grass: #6cc24a;
  --grass-dark: #3f8f2a;
  --cream: #fff8e7;
  --cream-2: #fdeec8;
  --yolk: #ffcc33;
  --yolk-dark: #e0a800;
  --ink: #3b2b1a;
  --ink-soft: #7a6450;
  --line: #e8d6ab;
  --panel: var(--cream);
  --panel-2: var(--cream-2);
  --bg-top: var(--sky);
  --bg-bottom: var(--sky-2);
  --shadow: 0 4px 0 rgba(59, 43, 26, 0.18);
  --chugg: #ff7a59;
  --rugg: #5aa9e6;
  --warn: #c0532b;
  --ok: var(--grass-dark);
  --radius: 18px;
  --t-common: #9aa5ad;
  --t-nice: #6cc24a;
  --t-rare: #3d8bfd;
  --t-elite: #a259ff;
  --t-legendary: #ff9f1c;
  --t-unique: #ff4f8b;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --panel: #2a2433;
  --panel-2: #342d40;
  --ink: #fdf3dc;
  --ink-soft: #c9b99c;
  --line: #4a4058;
  --bg-top: #1b2440;
  --bg-bottom: #121828;
  --shadow: 0 4px 0 rgba(0, 0, 0, 0.45);
  --grass-dark: #8fdc6a;
  --ok: #8fdc6a;
  --warn: #ff9b7a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Fredoka", ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 420px, var(--bg-bottom) 100%);
  background-color: var(--bg-bottom);
  min-height: 100vh;
  line-height: 1.4;
}

a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ---------- header ---------- */
header.top { padding: 18px 0 8px; position: relative; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-egg {
  width: 40px; height: 48px; border-radius: 50% 50% 46% 46% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 35% 30%, #fff 0 12%, var(--yolk) 13% 100%);
  border: 3px solid var(--ink); box-shadow: var(--shadow);
}
.brand h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: 0.5px; color: #2b2015; }
:root[data-theme="dark"] .brand h1 { color: var(--ink); }
.brand small { display: block; font-size: 13px; font-weight: 500; color: #4b3a28; }
:root[data-theme="dark"] .brand small { color: var(--ink-soft); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.icon-btn {
  border: 3px solid var(--ink); background: var(--panel); border-radius: 999px;
  width: 44px; height: 44px; cursor: pointer; box-shadow: var(--shadow); font-size: 20px;
  display: grid; place-items: center;
}

nav.tabs {
  display: flex; gap: 6px; overflow-x: auto; padding: 12px 0 10px; scrollbar-width: none;
}
nav.tabs::-webkit-scrollbar { display: none; }
nav.tabs a {
  flex: 0 0 auto; text-decoration: none; font-weight: 600; font-size: 15px;
  padding: 8px 14px; border-radius: 999px; background: var(--panel);
  border: 3px solid var(--ink); box-shadow: var(--shadow);
}
nav.tabs a[aria-current="page"] { background: var(--yolk); color: #2b2015; }

/* grass strip */
.grass {
  height: 22px; margin-top: 4px;
  background:
    radial-gradient(circle at 10px -4px, transparent 12px, var(--grass) 13px) repeat-x;
  background-size: 22px 22px;
  border-bottom: 6px solid var(--grass-dark);
}

main { padding: 18px 0 60px; }

/* ---------- panels ---------- */
.panel {
  background: var(--panel); border: 3px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.panel + .panel { margin-top: 14px; }
h2 { font-size: 24px; margin: 0 0 6px; }
h3 { font-size: 18px; margin: 14px 0 6px; }
.lede { color: var(--ink-soft); margin: 0 0 12px; }
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; }

.stat-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.stat {
  background: var(--panel-2); border: 2px solid var(--line); border-radius: 14px;
  padding: 6px 12px; min-width: 88px;
}
.stat b { display: block; font-size: 22px; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--ink-soft); }

/* ---------- controls ---------- */
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.controls label { font-size: 13px; color: var(--ink-soft); display: flex; flex-direction: column; gap: 2px; }
select, input[type="search"], input[type="text"] {
  border: 2px solid var(--ink); border-radius: 12px; background: var(--panel-2);
  padding: 7px 10px; font-size: 15px; min-height: 40px; max-width: 100%;
}
input.bad { border-color: var(--warn); }
.chip-btn {
  border: 2px solid var(--ink); border-radius: 999px; background: var(--panel-2);
  padding: 6px 12px; cursor: pointer; font-weight: 600; min-height: 40px;
}
.chip-btn[aria-pressed="true"] { background: var(--yolk); color: #2b2015; }

/* ---------- nest cards ---------- */
.grid-nests { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.nest-card {
  background: var(--panel); border: 3px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 10px;
  min-width: 0;
}
.nest-head { display: flex; gap: 10px; align-items: center; }
.egg-art {
  width: 72px; height: 72px; flex: 0 0 72px; border-radius: 16px; background: var(--panel-2);
  border: 2px solid var(--line); display: grid; place-items: center; position: relative;
}
.egg-art img { width: 64px; height: 64px; object-fit: contain; }
.egg-art .nest-img { position: absolute; bottom: -8px; right: -8px; width: 34px; height: 34px;
  background: var(--panel); border-radius: 10px; border: 2px solid var(--line); }
.nest-meta { min-width: 0; flex: 1; }
.nest-meta .kg { font-size: 26px; font-weight: 700; line-height: 1; }
.nest-meta .kg small { font-size: 14px; font-weight: 500; }
.birds { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.bird { position: relative; border-radius: 10px; overflow: hidden; border: 2px solid var(--line);
  background: var(--panel-2); aspect-ratio: 1; }
.bird img { width: 100%; height: 100%; object-fit: cover; }
.bird.empty { border-style: dashed; }
.bird .r { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; }
.nest-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }

.badge {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  border: 2px solid currentColor; line-height: 1.4; white-space: nowrap;
}
.badge.solid { color: #2b2015; border-color: transparent; }
.status-incubating { color: var(--rugg); }
.status-ready { color: var(--yolk-dark); }
:root[data-theme="dark"] .status-ready { color: var(--yolk); }
.status-unknown { color: var(--ink-soft); }
.tier-common { background: var(--t-common); }
.tier-nice { background: var(--t-nice); }
.tier-rare { background: var(--t-rare); color: #fff !important; }
.tier-elite { background: var(--t-elite); color: #fff !important; }
.tier-legendary { background: var(--t-legendary); }
.tier-unique { background: var(--t-unique); color: #fff !important; }
.kind-rugg { background: var(--rugg); color: #fff !important; }
.kind-chugg { background: var(--chugg); color: #fff !important; }
.new-badge { background: var(--warn); color: #fff !important; border-color: transparent; }

.bar { height: 10px; border-radius: 999px; background: var(--panel-2); border: 2px solid var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--grass); }
.bar.est > i { background: repeating-linear-gradient(45deg, var(--grass) 0 6px, var(--yolk) 6px 12px); }

/* ---------- nugg grid ---------- */
.grid-nuggs { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (max-width: 420px) { .grid-nuggs { grid-template-columns: repeat(2, 1fr); } }
.nugg-card {
  background: var(--panel); border: 3px solid var(--ink); border-radius: 16px; box-shadow: var(--shadow);
  overflow: hidden; text-decoration: none; display: flex; flex-direction: column; min-width: 0;
}
.nugg-card .art { aspect-ratio: 1; background: var(--panel-2); }
.nugg-card .art img { width: 100%; height: 100%; object-fit: cover; }
.nugg-card .cap { padding: 6px 8px 8px; display: flex; flex-direction: column; gap: 4px; }
.nugg-card .cap b { font-size: 15px; }
.nugg-card .cap .row { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }

/* ---------- detail ---------- */
.detail { display: grid; gap: 16px; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); }
@media (max-width: 760px) { .detail { grid-template-columns: minmax(0, 1fr); } }
.detail .big { border-radius: 16px; border: 3px solid var(--ink); overflow: hidden; background: var(--panel-2); }
.traits { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.trait { background: var(--panel-2); border: 2px solid var(--line); border-radius: 12px; padding: 6px 10px; min-width: 0; }
.trait span { display: block; font-size: 12px; color: var(--ink-soft); }
.trait b { overflow-wrap: anywhere; }
.trait.none b { color: var(--ink-soft); font-style: italic; font-weight: 500; }
.trait em { font-style: normal; font-size: 12px; color: var(--ink-soft); }
.bird-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.bird-list .bird-item { background: var(--panel-2); border: 2px solid var(--line); border-radius: 12px; overflow: hidden; font-size: 13px; }
.bird-list .bird-item img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.bird-list .bird-item div { padding: 4px 6px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 2px solid var(--line); white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.rate-bar { display: inline-block; height: 10px; background: var(--chugg); border-radius: 6px; vertical-align: middle; }

.cuts { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
@media (max-width: 420px) { .cuts { grid-template-columns: minmax(0, 1fr); } }

svg.chart { width: 100%; height: auto; display: block; }
svg.chart text { fill: var(--ink-soft); font-size: 11px; font-family: inherit; }
svg.chart .axis { stroke: var(--line); stroke-width: 1.5; }
svg.chart .dot { fill: var(--rugg); opacity: 0.35; }
svg.chart .floor { stroke: var(--grass-dark); stroke-width: 3; fill: none; }
svg.chart .floor-pt { fill: var(--grass-dark); }
svg.chart .band { fill: var(--yolk); opacity: 0.25; }

.notice { border-left: 6px solid var(--yolk); background: var(--panel-2); padding: 8px 12px; border-radius: 10px; margin: 10px 0; }
.notice.warn { border-left-color: var(--warn); }
.countdown { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; }

footer { padding: 20px 0 40px; font-size: 13px; color: var(--ink-soft); text-align: center; }
.empty-state { text-align: center; padding: 28px 10px; color: var(--ink-soft); }
.more { display: block; margin: 16px auto 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
