/* Web account pages: login + dashboard. */

.web-body {
  --page-glow-b: rgba(180, 90, 255, 0.08);
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  color: var(--text-main);
  font-family: "Fredoka", system-ui, sans-serif;
  background:
    radial-gradient(1100px 600px at 15% -10%, rgba(80, 108, 255, 0.16), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(180, 90, 255, 0.1), transparent 55%),
    url("/static/res/icons/pet_background.webp") repeat,
    #141821;
  background-blend-mode: normal, normal, overlay, normal;
  background-attachment: fixed;
}

/* The catalogue and account pages share this quieter backdrop. Their own
   `*-body` class is for page layout; only the backdrop is common. A page that
   needs a different second glow overrides `--page-glow-b`. */
.web-body.page-bg {
  background:
    radial-gradient(900px 520px at 14% -8%, rgba(80, 108, 255, 0.14), transparent 60%),
    radial-gradient(760px 480px at 100% 0%, var(--page-glow-b), transparent 55%),
    url("/static/res/icons/pet_background.webp") repeat,
    #141821;
  background-blend-mode: normal, normal, overlay, normal;
}

/* Close control shared by the history drawer, the demand drawer and the
   script viewer. The first two position it; the script viewer lays it out in
   a flex header instead. */
.account-history-close,
.drawer-close,
.script-viewer-close {
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: #c8d0dc;
  font: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.account-history-close,
.drawer-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

.web-body a {
  color: inherit;
}

.web-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 60px;
  padding: 10px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(15, 18, 26, 0.85);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.web-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.web-brand-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: cover;
}

.web-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.web-nav-links a {
  padding: 7px 10px;
  border-radius: 8px;
  color: #a8b1c2;
  font-size: 13px;
  text-decoration: none;
}

.web-nav-links a:hover,
.web-nav-links a[aria-current="page"] {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.web-user[hidden] {
  display: none;
}

.web-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.web-user form {
  margin: 0;
}

.web-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  object-fit: cover;
}

.web-user-name {
  max-width: 150px;
  overflow: hidden;
  color: #e8ebf2;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  color: #f2f4f8;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.web-btn:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.3);
}

.web-btn-primary {
  border-color: var(--ui-accent-line);
  background: var(--ui-accent-soft);
  color: #fff;
  box-shadow: 0 0 22px -12px var(--ui-accent-glow);
}

.web-btn-primary:hover {
  background: linear-gradient(180deg, rgba(124, 156, 255, 0.4), rgba(124, 156, 255, 0.22));
}

.web-btn-small {
  padding: 6px 9px;
  font-size: 11px;
}

.web-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 34px 22px 80px;
}

.web-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.web-eyebrow {
  margin: 0 0 4px;
  color: #8b94a6;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.1px;
  text-transform: uppercase;
}

.web-hero h1 {
  margin: 0;
  color: #fff;
  text-align: left;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1;
  letter-spacing: -0.8px;
}

.web-muted {
  color: #a8b1c2;
  font-size: 13px;
  line-height: 1.55;
}

.web-hero .web-muted {
  max-width: 620px;
  margin: 10px 0 0;
}

.web-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}

.web-section-head h2,
.web-placeholder h2 {
  margin: 0;
  color: #f2f4f8;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.web-account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.web-account-card {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.035));
}

.web-account-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
}

.web-status {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: #737d90;
  box-shadow: 0 0 8px currentColor;
}

.web-status.online {
  background: #4ade80;
  color: #4ade80;
}

.web-status.stale {
  background: #f6d365;
  color: #f6d365;
}

.web-status.offline {
  background: #ff6b6b;
  color: #ff6b6b;
}

.web-account-name {
  margin: 0;
  overflow: hidden;
  color: #fff;
  font-size: 15px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-account-id {
  margin-left: auto;
  color: #737d90;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.web-account-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
}

.web-account-meta div {
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.14);
}

.web-account-meta dt {
  color: #737d90;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.web-account-meta dd {
  margin: 2px 0 0;
  color: #d8dee9;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.web-account-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.web-stat {
  padding: 3px 6px;
  border-radius: 5px;
  background: rgba(124, 156, 255, 0.09);
  color: #aebcff;
  font-size: 9px;
}

.web-placeholder {
  margin-top: 28px;
  padding: 22px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 14px;
}

.web-placeholder p {
  max-width: 680px;
  margin: 8px 0 0;
}

.web-placeholder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px !important;
}

.web-alert {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: 9px;
  background: rgba(255, 107, 107, 0.08);
  color: #ffb3b3;
  font-size: 12px;
}

.web-empty {
  padding: 34px 16px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  color: #8b94a6;
  font-size: 13px;
  text-align: center;
}

.web-skeleton {
  height: 150px;
  border-radius: 14px;
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0.04) 20%,
    rgba(255, 255, 255, 0.08) 40%,
    rgba(255, 255, 255, 0.04) 60%
  );
  background-size: 220% 100%;
  animation: web-shimmer 1.4s linear infinite;
}

@keyframes web-shimmer {
  from {
    background-position: 180% 0;
  }
  to {
    background-position: -40% 0;
  }
}

/* Login */

.web-auth-page {
  display: grid;
  min-height: calc(100dvh - 60px);
  padding: 30px 16px;
  place-items: center;
}

.web-auth-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.035));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.web-auth-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  object-fit: cover;
}

.web-auth-card h1 {
  margin: 14px 0 6px;
  color: #fff;
  font-size: 30px;
  letter-spacing: -0.5px;
}

.web-auth-card .web-muted {
  margin: 0 0 18px;
}

.web-auth-card .web-btn-primary {
  margin-top: 4px;
}

.web-fine {
  margin: 16px 0 0;
  color: #8b94a6;
  font-size: 10px;
  line-height: 1.5;
}

@media (max-width: 720px) {
  .web-nav {
    padding: 9px 12px;
    gap: 10px;
  }

  .web-nav-links {
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .web-nav-links::-webkit-scrollbar {
    display: none;
  }

  .web-nav-links a {
    padding: 7px 7px;
    font-size: 12px;
    white-space: nowrap;
  }

  .web-nav-links .hide-mobile,
  .web-brand span {
    display: none;
  }

  .web-user {
    padding-left: 8px;
  }

  .web-user-name {
    display: none;
  }

  .web-page {
    padding: 24px 12px 60px;
  }

  .web-hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .web-skeleton {
    animation: none;
  }
}


/* Dashboard recent hatches */

.web-hatches {
  margin-top: 28px;
}

.web-hatch-all {
  margin-left: 8px;
  color: #aebcff;
  font-size: 9px;
  text-decoration: none;
}

.web-hatch-all:hover {
  color: #fff;
}

.web-hatch-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.web-hatch-card {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  color: inherit;
  text-decoration: none;
  transition: border-color 140ms ease, background 140ms ease;
}

.web-hatch-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.055);
}

.web-hatch-card img {
  width: 54px;
  height: 54px;
  flex: none;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  object-fit: contain;
}

.web-hatch-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.web-hatch-copy b {
  overflow: hidden;
  color: #eef1f6;
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-hatch-copy span {
  overflow: hidden;
  color: #7f889a;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-hatch-value {
  color: #aebcff !important;
}

.web-hatch-skeleton {
  height: 72px;
}

@media (max-width: 1000px) {
  .web-hatch-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .web-hatch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


.web-signin {
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  color: #e8ebf2;
  font-size: 11px;
  text-decoration: none;
  white-space: nowrap;
}

.web-signin:hover {
  background: rgba(255, 255, 255, 0.07);
}

.settings-subhead {
  margin: 12px 15px 2px;
  color: #6f7888;
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.settings-field select {
  height: 32px;
  padding: 0 24px 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.2);
  color: #e8ebf2;
  font: inherit;
  font-size: 11px;
}

/* ---------------------------------------------------------------------------
   Control heights
   ---------------------------------------------------------------------------
   Every toolbar control, dropdown and search field shares one height, and
   in-row actions (remove/restore inside a table) share a smaller one. These
   are `body`-scoped so they win over the per-page stylesheets loaded after
   this file, without `!important`.

   `box-sizing: border-box` matters: several controls set `height: 30px` and a
   1px border, which renders 32 — that half-pixel of drift is why the fields
   never lined up. */

:root {
  --ctl-h: 32px;
  --ctl-h-sm: 24px;
}

body input[type="search"],
body input[type="text"],
body input[type="number"],
body select,
body .web-btn,
body .collection-search,
body .segmented,
body .rarity-switch,
body .advanced-toggle,
body .icon-button,
body .pdash-tab,
body .pdash-toggle,
body .profile-edit,
body .poll-detail-pet,
body .variants-toggle,
body .pet-variants button {
  height: var(--ctl-h);
  box-sizing: border-box;
}

/* A fixed height means vertical padding would push the text off-centre. */
body input[type="search"],
body input[type="text"],
body input[type="number"],
body select {
  padding-top: 0;
  padding-bottom: 0;
}

/* Segmented groups: the buttons fill the group minus its 2px inset + border. */
body .segmented button,
body .rarity-switch button {
  height: calc(var(--ctl-h) - 6px);
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
}

/* Standalone buttons that size themselves with padding. */
body .poll-controls button,
body .profile-editor-actions button,
body .poll-breakdown button {
  height: var(--ctl-h);
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
}

/* In-row actions stay compact; a 32px button in every table row is worse UI. */
body .hist-remove,
body .card-edit {
  height: var(--ctl-h-sm);
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
}

/* Container-scoped overrides: a plain `body select` loses to
   `.collection-sort select` on specificity, so name the containers. */
body .collection-sort select,
body .hatch-field select,
body .hatch-toolbar button,
/* Text-like inputs only. Checkboxes in these rows were being stretched to
   160x32 by an earlier, unscoped selector and rendered as an empty box. */
body .pdash-controls input:not([type="checkbox"]):not([type="radio"]),
body .pdash-controls select,
body .pdash-head input:not([type="checkbox"]):not([type="radio"]),
body .pdash-head select {
  height: var(--ctl-h);
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
}

/* The toggle itself. */
body .pdash-toggle input[type="checkbox"] {
  width: 14px;
  height: 14px;
  flex: none;
  accent-color: #7c8cff;
  cursor: pointer;
}

/* Small toggles inside a card (BASE, 7D/30D/90D) belong to the compact tier,
   not the toolbar tier — a 32px pill inside a stat card would dwarf its label. */
body .pet-ranges button,
body .pet-currency-head button {
  height: var(--ctl-h-sm);
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
}

/* Demand bar. Replaces a block-glyph string that only worked because text
   happens to be monospaced — this scales with the card, needs no exact glyph
   count to look right, and carries a tooltip. */
.demand-bar {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 108px;
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(var(--ui-accent-rgb), 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  vertical-align: middle;
}

.demand-bar-fill {
  display: block;
  width: var(--pct, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    var(--ui-accent),
    color-mix(in srgb, var(--ui-accent) 55%, #ffffff)
  );
  transition: width 260ms ease;
}

/* No median yet: an empty track, not a zero-width bar that looks broken. */
.demand-bar.is-empty {
  background: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.05) 0 4px,
    transparent 4px 8px
  );
}

.pdash-row-body .demand-bar,
.poll-bar .demand-bar {
  margin-left: 2px;
}
