@font-face {
  font-family: "Fredoka";
  src: url("/static/fonts/Fredoka/Fredoka-VariableFont_wdth,wght.ttf")
    format("truetype-variations");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

/* Every component here sizes itself as a box, not as a box plus its own
   padding — 36 rules already said `box-sizing: border-box` one at a time, and
   the few that forgot overflowed their containers (`width: 100%` plus padding).
   Set it once so a new element cannot reintroduce that bug. The single rule
   that wants the other model opts out explicitly. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Reserve the scrollbar gutter so a page that scrolls and a page that does not
   keep the same content width. Without it the centred top bar sat 7px to the
   left on shorter pages. Overlay-scrollbar platforms ignore this. */
html {
  scrollbar-gutter: stable;
}

:root {
  --primary: #212631;
  --accent: #2b3646;
  --hover-accent: rgba(100, 129, 166, 0.8);
  --text-main: #e6e6eb;
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.065);
  --text-shadow-outline:
    -1px -1px 0 var(--accent), 1px -1px 0 var(--accent),
    -1px 1px 0 var(--accent), 1px 1px 0 var(--accent);
  /* Interactive accent — the "site colour": selected nav item, primary
     buttons, sliders, focus rings and glows. Gentle purple by default; pet and
     egg pages replace all four from the item's own hex so the page takes on its
     colour. Keep the -rgb triple in sync with -accent: the derived alphas are
     built from it. */
  --ui-accent: #a78bfa;
  --ui-accent-rgb: 167, 139, 250;
  --ui-accent-soft: rgba(var(--ui-accent-rgb), 0.16);
  --ui-accent-line: rgba(var(--ui-accent-rgb), 0.5);
  --ui-accent-glow: rgba(var(--ui-accent-rgb), 0.28);

  --radius-card: 16px;
  --radius-control: 8px;
  --transition-fast: 120ms ease;
  --transition-slow: 300ms cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Demand tiers — the single source for cards, the pet page, and demand.gg. */
  --demand-very-low: #a33232;
  --demand-low: #ff5757;
  --demand-medium: #ffc83d;
  --demand-above-average: #c5e84f;
  --demand-high: #2ee66b;
  --demand-very-high: #4d9dff;
  --demand-insane: #c06cff;
  --demand-na: #7c8494;

  /* Trend glyph colours, shared by cards and the pet page. */
  --trend-rising: #4ade80;
  --trend-dropping: #ff6b6b;
  --trend-unstable: #eab308;
  --trend-stable: #a8b1c2;

  /* Catalogue card rhythm and type. */
  --card-gap-compact: 8px;
  --card-gap-roomy: 12px;
  --card-pad-compact: 8px;
  --card-pad-roomy: 12px;
  --card-title-compact: 14px;
  --card-title-roomy: 18px;
  --card-demand-size: 12px;
  --card-demand-size-compact: 11px;
  --card-exists-size: 12px;
  --card-exists-size-compact: 11px;
  --card-icon-size: 14px;
  --card-icon-size-compact: 12px;

  /* Quiet surface shared by the pet page, egg detail, profile and dashboard. */
  --surface-soft: rgba(255, 255, 255, 0.02);
  --surface-soft-border: rgba(255, 255, 255, 0.04);
  --surface-soft-radius: 10px;


  /* Type scale — the px steps the sheets already use, named so a step can be
     changed once. Roles: 8-9 label, 10-12 dense UI, 13-14 body, 16+ headings. */
  --fs-8: 8px;
  --fs-9: 9px;
  --fs-10: 10px;
  --fs-11: 11px;
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-16: 16px;
  --fs-18: 18px;
  --fs-20: 20px;
  --fs-22: 22px;
  --fs-24: 24px;

  /* Spacing steps used by `gap`. */
  --gap-2: 2px;
  --gap-3: 3px;
  --gap-4: 4px;
  --gap-5: 5px;
  --gap-6: 6px;
  --gap-7: 7px;
  --gap-8: 8px;
  --gap-9: 9px;
  --gap-10: 10px;
  --gap-12: 12px;
  --gap-14: 14px;
  --gap-16: 16px;
  --gap-20: 20px;

  /* Stacking order. Only the layers that matter are named; the handful of
     one-off values inside components stay local until they are reviewed. */
  --z-base: 0;
  --z-raised: 1;
  --z-sticky: 2;
  --z-content: 3;
  --z-overlay: 60;
  --z-popup: 1200;

  /* Breakpoint scale. The sheets still contain one-off widths (a legacy of
     each page choosing its own); new work should use these five and anything
     else should be moved onto the nearest one. */
  --bp-xl: 1280px;
  --bp-lg: 1100px;
  --bp-md: 900px;
  --bp-sm: 760px;
  --bp-xs: 620px;

  /* Popup menus: same charcoal as the top bar, with a quiet rim. */
  --popup-bg: #0e1118;
  --popup-border: rgba(255, 255, 255, 0.06);
  --popup-radius: 10px;
  --popup-shadow: 0 18px 40px rgba(0, 0, 0, 0.42);

  /* Text greys — the values the pages already share, named once. */
  --text-muted: #8b94a6;
  --text-dim: #737d90;
  --text-soft: #dce1ea;
  --text-faint: #a8b1c2;
  --text-icon: #c8d0dc;
  --text-strong: #e8ebf2;
  --text-quiet: #7f8899;
  --text-ghost: #5a6273;
  --text-label: #9aa6ba;

  /* White alphas for translucent surfaces and hairlines. */
  --w-015: rgba(255, 255, 255, 0.015);
  --w-02: rgba(255, 255, 255, 0.02);
  --w-022: rgba(255, 255, 255, 0.022);
  --w-025: rgba(255, 255, 255, 0.025);
  --w-03: rgba(255, 255, 255, 0.03);
  --w-035: rgba(255, 255, 255, 0.035);
  --w-04: rgba(255, 255, 255, 0.04);
  --w-045: rgba(255, 255, 255, 0.045);
  --w-05: rgba(255, 255, 255, 0.05);
  --w-055: rgba(255, 255, 255, 0.055);
  --w-06: rgba(255, 255, 255, 0.06);
  --w-065: rgba(255, 255, 255, 0.065);
  --w-07: rgba(255, 255, 255, 0.07);
  --w-075: rgba(255, 255, 255, 0.075);
  --w-08: rgba(255, 255, 255, 0.08);
  --w-09: rgba(255, 255, 255, 0.09);
  --w-10: rgba(255, 255, 255, 0.1);
  --w-12: rgba(255, 255, 255, 0.12);
  --w-14: rgba(255, 255, 255, 0.14);
  --w-15: rgba(255, 255, 255, 0.15);

  /* Rarity colours — one palette for cards, chips, eggs and the pet page. */
  --rarity-common: #c8d0dc;
  --rarity-unique: #b07cff;
  --rarity-rare: #5aa6ff;
  --rarity-epic: #f3a13f;
  --rarity-legendary: #ff8000;
  --rarity-secret: #f700ff;
  --rarity-celestial: #35e6c2;
  --rarity-infinity: #a6e9ff;
  --rarity-void: #fff;
}

body {
  margin: 0;
  padding: 16px;
  color: var(--text-main);
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: normal;
  background: url("/static/res/icons/pet_background.webp") repeat;
  background-color: var(--primary);
  background-blend-mode: overlay;
  background-attachment: fixed;
  min-height: 100dvh;
}

h1 {
  text-align: center;
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 700;
  margin-bottom: 20px;
  color: white;
  letter-spacing: 0.4px;
  text-shadow: var(--text-shadow-outline);
}

/* Fixed navigation – shared */

/* Feed container – shared */
#hatch-feed {
  max-width: 720px;
  margin: auto;
}

/* Native selects are upgraded to a shared trigger + portalled listbox. */
.custom-select {
  display: inline-grid;
  max-width: 100%;
  vertical-align: middle;
}

.custom-select > select,
.custom-select > .custom-select-trigger {
  grid-area: 1 / 1;
}

.custom-select > select.custom-select-native {
  visibility: hidden;
  pointer-events: none;
}

.custom-select-trigger {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0 26px 0 9px;
  overflow: hidden;
  border: 1px solid var(--surface-soft-border);
  border-radius: var(--radius-control);
  background: var(--surface-soft);
  color: var(--text-soft);
  font-family: inherit;
  font-size: 11px;
  font-weight: 550;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.custom-select-trigger:hover {
  border-color: var(--w-14);
  background: var(--w-055);
}

.custom-select-trigger[aria-expanded="true"] {
  border-color: var(--ui-accent-line);
  background: var(--ui-accent-soft);
  color: #fff;
}

.custom-select-trigger:focus-visible {
  outline: 2px solid rgba(var(--ui-accent-rgb), 0.45);
  outline-offset: 1px;
}

.custom-select-trigger:disabled {
  opacity: 0.55;
  cursor: default;
}

.custom-select-trigger::after {
  position: absolute;
  top: 50%;
  right: 10px;
  width: 5px;
  height: 5px;
  border-right: 1.5px solid var(--text-label);
  border-bottom: 1.5px solid var(--text-label);
  content: "";
  transform: translateY(-70%) rotate(45deg);
}

.custom-select-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-menu {
  position: fixed;
  z-index: 1200;
  display: flex;
  max-height: none;
  flex-direction: column;
  gap: 1px;
  overflow: visible;
  padding: 5px;
  border: 1px solid var(--popup-border);
  border-radius: var(--popup-radius);
  background: var(--popup-bg);
  box-shadow: var(--popup-shadow);
}

.custom-select-option {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 28px;
  padding: 6px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-icon);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.custom-select-option:hover,
.custom-select-option:focus-visible {
  outline: 0;
  background: var(--w-055);
  color: #fff;
}

.custom-select-option[aria-selected="true"] {
  background: var(--ui-accent-soft);
  color: #fff;
  font-weight: 600;
}

.custom-select-option:disabled {
  opacity: 0.45;
  cursor: default;
}

/* Dashboard controls are direct flex items; the wrapper inherits their slot. */
.pdash-controls > .custom-select {
  flex: 0 1 auto;
}

@media (max-width: 760px) {
  .pdash-controls > .custom-select {
    flex: 1 1 140px;
    min-width: 0;
  }
}

/* Estimate tildes are a marker, not part of the number. */
.value-tilde {
  color: var(--text-faint);
  font-weight: 500;
  letter-spacing: 0;
  margin-right: 2px;
}

/* Demand-tier text used by previews on the poll, drawer and settle action. */
.demand-tier-text { font-weight: 600; }
.demand-tier-text.very-low { color: var(--demand-very-low); }
.demand-tier-text.low { color: var(--demand-low); }
.demand-tier-text.average { color: var(--demand-medium); }
.demand-tier-text.above-average { color: var(--demand-above-average); }
.demand-tier-text.high { color: var(--demand-high); }
.demand-tier-text.very-high { color: var(--demand-very-high); }
.demand-tier-text.insane { color: var(--demand-insane); }
.demand-tier-text.na { color: var(--demand-na); }

/* Shiny/Mythic badges shared by catalogue cards and the search dropdown. */
.variant-icons {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: none;
}

.variant-icons svg {
  width: 14px;
  height: 14px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.8;
}

@media (max-width: 760px) {
  .custom-select-option {
    min-height: 34px;
    font-size: 12px;
  }
}
