:root {
  --bg: #0f1419;
  --surface: #1a222c;
  --surface2: #232d3a;
  --text: #e8eef4;
  --muted: #8b9aab;
  --accent: #6ecf8c;
  --accent-dim: #4a9e63;
  --warn: #e8b86a;
  --danger: #e07a7a;
  --bar-bg: #2a3544;
  --radius: 14px;
  --font: system-ui, "Segoe UI", Roboto, Ubuntu, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  background: radial-gradient(120% 80% at 50% -20%, #1e2a22 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.45;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand__logo {
  font-size: 2rem;
  color: var(--accent);
  line-height: 1;
}

.brand__title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand__tag {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.panel--settings {
  margin-bottom: 1rem;
}

.panel--settings h2,
.section-title {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
}

.panel--dash h2 {
  margin: 0 0 0.2rem;
  font-size: 1.15rem;
}

.dash-nav {
  display: flex;
  gap: 0.3rem;
  flex-wrap: nowrap;
  margin: 0.75rem 0 1rem;
  padding: 0.2rem;
  background: var(--surface2);
  border-radius: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.dash-nav__btn {
  flex: 1 1 0;
  min-width: 0;
  border: none;
  padding: 0.45rem 0.35rem;
  border-radius: 8px;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
}

.dash-nav__btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
}

.dash-page {
  min-height: 4rem;
}

.tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  padding: 0.2rem;
  background: var(--surface2);
  border-radius: 10px;
}

.tabs__btn {
  flex: 1;
  border: none;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.tabs__btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field__label {
  font-size: 0.82rem;
  color: var(--muted);
}

.field__input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--surface2);
  color: var(--text);
  font: inherit;
}

.field__input:focus {
  outline: 2px solid var(--accent-dim);
  outline-offset: 1px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.btn {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--surface2);
  color: var(--text);
  padding: 0.55rem 1rem;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--primary {
  background: linear-gradient(165deg, var(--accent) 0%, var(--accent-dim) 100%);
  border-color: transparent;
  color: #0a120d;
}

.btn--block {
  width: 100%;
  padding: 0.75rem;
}

.btn--ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.15);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.45rem 0.65rem;
}

.btn--danger {
  border-color: rgba(224, 122, 122, 0.45);
  color: var(--danger);
}

.btn--tiny {
  padding: 0.28rem 0.4rem;
  font-size: 0.68rem;
  font-weight: 600;
}

.card__debug {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.4rem 0 0.25rem;
}

.banner {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  font-size: 0.88rem;
}

.banner--error {
  background: rgba(224, 122, 122, 0.12);
  border: 1px solid rgba(224, 122, 122, 0.35);
  color: #f5c2c2;
}

.banner--ok {
  background: rgba(110, 207, 140, 0.12);
  border: 1px solid rgba(110, 207, 140, 0.35);
  color: #c8f5d4;
}

.hint {
  margin: 1rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.hint code {
  font-size: 0.72rem;
  background: var(--surface2);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.muted {
  color: var(--muted);
  font-size: 0.88rem;
}

.item-effects {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.35;
}

.dash-head {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.5rem;
  align-items: start;
  margin-bottom: 1.25rem;
}

@media (max-width: 420px) {
  .dash-head {
    grid-template-columns: 1fr 1fr;
  }

  .dash-head > div:first-child {
    grid-column: 1 / -1;
  }
}

.section-title {
  margin-top: 0.5rem;
}

.creatures {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  background: var(--surface2);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.card__name {
  margin: 0 0 0.15rem;
  font-size: 1.05rem;
}

.card__meta {
  margin: 0 0 1rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.card__feed {
  margin-top: 0.75rem;
}

.stat {
  margin-bottom: 0.55rem;
}

.stat:last-child {
  margin-bottom: 0;
}

.stat__row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  margin-bottom: 0.25rem;
  color: var(--muted);
}

.stat__bar {
  height: 8px;
  border-radius: 99px;
  background: var(--bar-bg);
  overflow: hidden;
}

.stat__fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  transition: width 0.35s ease;
}

.stat--happiness .stat__fill {
  background: linear-gradient(90deg, #6a8cce, #9ab8f0);
}

.stat--energy .stat__fill {
  background: linear-gradient(90deg, #c49a5c, var(--warn));
}

.stat--health .stat__fill {
  background: linear-gradient(90deg, #8b5a9e, #c49fd4);
}

.footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}

.empty-hint {
  text-align: center;
  padding: 1rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0.75rem;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.52);
  box-sizing: border-box;
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal-panel {
  width: 100%;
  max-width: 440px;
  max-height: min(88vh, 640px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1rem 1.1rem 1.25rem;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.45);
}

.modal-panel__title {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.modal-panel__foot {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-pick-row {
  text-align: left;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.5rem;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.modal-pick-row:hover {
  border-color: rgba(110, 207, 140, 0.35);
}

.modal-pick-row.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.modal-pick-row__stats {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.card__actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.shop__row-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.shop__row-head p {
  margin: 0;
  flex: 1;
}

.shop__info-egg {
  flex-shrink: 0;
  min-width: 2rem;
  border-radius: 999px;
  font-weight: 700;
}

.egg-hatch-info__name {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
}

.egg-hatch-info__section {
  margin: 0.85rem 0 0.35rem;
  font-size: 0.95rem;
  color: var(--text, #fff);
}

.egg-hatch-info__hint {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
}

.egg-shop-price-card {
  border: 1px solid rgba(124, 77, 255, 0.35);
  border-radius: 1rem;
  padding: 0.75rem 0.85rem;
  margin: 0.5rem 0 0.75rem;
  background: rgba(255, 255, 255, 0.04);
}

.egg-shop-price-card__head {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.egg-shop-price-card__icon {
  font-size: 1.35rem;
  line-height: 1;
}

.egg-shop-price-card__intro {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
}

.egg-shop-price-card__table {
  width: 100%;
  margin: 0;
}

.egg-shop-price-card__th-icon {
  width: 2.5rem;
}

.egg-shop-price-card__row--a td {
  background: rgba(124, 77, 255, 0.07);
}

.egg-shop-price-card__row--b td {
  background: rgba(0, 150, 136, 0.06);
}

.egg-shop-price-card__amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
  color: #ffb74d;
}

.egg-hatch-odds-bar-row {
  margin-bottom: 0.55rem;
}

.egg-hatch-odds-bar-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  margin-bottom: 0.2rem;
}

.egg-hatch-odds-pct {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.egg-hatch-odds-bar-track {
  height: 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.egg-hatch-odds-bar-fill {
  height: 100%;
  border-radius: 4px;
  width: 0;
  transition: width 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}

.egg-hatch-bar--common {
  background: linear-gradient(90deg, #66bb6a, #81c784);
}

.egg-hatch-bar--rare {
  background: linear-gradient(90deg, #1e88e5, #42a5f5);
}

.egg-hatch-bar--epic {
  background: linear-gradient(90deg, #8e24aa, #ab47bc);
}

.egg-hatch-bar--legendary {
  background: linear-gradient(90deg, #f57c00, #ffb74d);
}

.egg-hatch-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.35rem;
  font-size: 0.88rem;
}

.egg-hatch-table th,
.egg-hatch-table td {
  padding: 0.35rem 0.45rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

.egg-hatch-table th {
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
}

.egg-hatch-table td:last-child,
.egg-hatch-table th:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.egg-hatch-table__rarity--common td:first-child {
  color: #a5d6a7;
}

.egg-hatch-table__rarity--rare td:first-child {
  color: #90caf9;
}

.egg-hatch-table__rarity--epic td:first-child {
  color: #ce93d8;
}

.egg-hatch-table__rarity--legendary td:first-child {
  color: #ffcc80;
}

.egg-odds-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.35rem;
  font-size: 0.9rem;
}

.egg-odds-table td {
  padding: 0.25rem 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.egg-odds-table td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.egg-pool-list {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.egg-interactive-config__hero {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.35rem;
  border-radius: 14px;
  background: linear-gradient(120deg, rgba(255, 183, 77, 0.22), rgba(171, 71, 188, 0.2), rgba(100, 181, 246, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.egg-interactive-config__hero-egg {
  font-size: 1.75rem;
  line-height: 1;
}

.egg-interactive-config__tagline {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.35;
}

.egg-interactive-config__block {
  margin-top: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.egg-interactive-config__block--taxonomy {
  border-color: rgba(100, 181, 246, 0.35);
  box-shadow: 0 0 0 1px rgba(100, 181, 246, 0.08);
}

.egg-interactive-config__block--rarity {
  border-color: rgba(186, 104, 200, 0.4);
  box-shadow: 0 0 0 1px rgba(186, 104, 200, 0.1);
}

.egg-interactive-config__block-title {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
  color: var(--text, #fff);
}

.egg-interactive-config__mode-label {
  display: block;
  margin-top: 0.35rem;
  cursor: pointer;
}

.egg-interactive-config__block label {
  display: block;
  margin: 0.35rem 0 0;
  cursor: pointer;
}

.egg-interactive-config__select {
  margin-top: 0.5rem;
  width: 100%;
  max-width: 16rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
}

.egg-interactive-config__rarity-pick {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
}

.egg-interactive-config__rarity-opt {
  cursor: pointer;
  font-size: 0.92rem;
  padding: 0.2rem 0.35rem;
  border-radius: 8px;
  border: 1px solid transparent;
}

.egg-interactive-config__rarity-opt--common {
  color: #a5d6a7;
  border-color: rgba(129, 199, 132, 0.45);
}

.egg-interactive-config__rarity-opt--rare {
  color: #90caf9;
  border-color: rgba(66, 165, 245, 0.5);
}

.egg-interactive-config__rarity-opt--epic {
  color: #ce93d8;
  border-color: rgba(171, 71, 188, 0.55);
}

.egg-interactive-config__rarity-opt--legendary {
  color: #ffcc80;
  border-color: rgba(255, 152, 0, 0.55);
  font-weight: 600;
}

.egg-interactive-config__price {
  margin: 0.85rem 0 0;
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.egg-interactive-config__price--pop {
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(255, 183, 77, 0.18), rgba(240, 98, 146, 0.16), rgba(149, 117, 205, 0.18));
  border: 2px solid rgba(255, 183, 77, 0.45);
}
