/* Steal An Egg Calculator – mobile-first stylesheet. No external fonts. */
:root {
  --bg: #fffaf0;
  --bg-card: #ffffff;
  --bg-soft: #fff3d6;
  --text: #1f2430;
  --muted: #5b6372;
  --border: #e6dfd0;
  --accent: #d97706;
  --accent-dark: #b45309;
  --accent-soft: #fde7b8;
  --link: #9a5203;
  --ok: #15803d; --ok-bg: #dcfce7;
  --warn: #b45309; --warn-bg: #fef3c7;
  --grey: #4b5563; --grey-bg: #eef0f3;
  --err: #b91c1c; --err-bg: #fee2e2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(31, 36, 48, .06), 0 4px 14px rgba(31, 36, 48, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171c; --bg-card: #1e2128; --bg-soft: #2a2416; --text: #e8e6e1; --muted: #a2a8b4; --border: #363a45;
    --accent: #f5b53f; --accent-dark: #ffc85c; --accent-soft: #3b2f12; --link: #f3c36b;
    --ok: #6ee7a0; --ok-bg: #13301f; --warn: #fcd27a; --warn-bg: #3a2c0d; --grey: #c3c8d2; --grey-bg: #2b2f38; --err: #fca5a5; --err-bg: #3b1515;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--accent-dark); }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.75rem; margin-top: .4em; }
h2 { font-size: 1.4rem; margin-top: 1.8em; }
h3 { font-size: 1.12rem; margin-top: 1.4em; }
p, ul, ol { margin: 0 0 1em; }
ul, ol { padding-left: 1.3em; }
li { margin-bottom: .35em; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; background: var(--grey-bg); padding: .1em .35em; border-radius: 4px; }
pre { background: var(--grey-bg); padding: .8em; border-radius: var(--radius); overflow-x: auto; font-size: .9rem; }
pre code { background: none; padding: 0; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: #000; padding: .5em 1em; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.icon { vertical-align: -0.2em; }

/* Header / nav */
.site-header { background: var(--bg-card); border-bottom: 1px solid var(--border); z-index: 20; }
.header-inner { display: flex; flex-direction: column; gap: 4px; padding-top: 10px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; color: var(--text); font-size: 1.05rem; }
.brand .icon { color: var(--accent); }
.main-nav ul, .footer-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px; }
.main-nav li { margin: 0; flex: 0 0 auto; }
.main-nav a { display: block; padding: 8px 8px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .92rem; border-bottom: 3px solid transparent; white-space: nowrap; }
.main-nav .nav-short { display: none; }
@media (max-width: 759px) { .main-nav .nav-long { display: none; } .main-nav .nav-short { display: inline; } .main-nav a { padding: 8px 6px; font-size: .88rem; } }
.main-nav a:hover { color: var(--text); }
.main-nav a[aria-current="page"] { color: var(--accent-dark); border-bottom-color: var(--accent); }
@media (min-width: 760px) {
  .site-header { position: sticky; top: 0; }
  .header-inner { flex-direction: row; align-items: center; justify-content: space-between; padding-top: 0; }
  .main-nav a { padding: 16px 12px; }
}

/* Footer */
.site-footer { margin-top: 3rem; padding: 1.5rem 0 2rem; border-top: 1px solid var(--border); background: var(--bg-card); font-size: .9rem; color: var(--muted); }
.footer-nav ul { flex-wrap: wrap; gap: 4px 14px; margin-bottom: .6em; }
.footer-nav li { margin: 0; }
.footer-note { margin: .5em 0; }
.legend-compact { margin-bottom: 1em; }

/* Cards, tags, badges */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); margin-bottom: 1rem; }
.tag { display: inline-block; font-size: .74rem; font-weight: 700; padding: .12em .5em; border-radius: 999px; line-height: 1.5; white-space: nowrap; vertical-align: middle; }
.tag-verified { color: var(--ok); background: var(--ok-bg); }
.tag-estimated { color: var(--warn); background: var(--warn-bg); }
.tag-unverified { color: var(--grey); background: var(--grey-bg); }
.rar { display: inline-block; font-size: .74rem; font-weight: 700; padding: .1em .5em; border-radius: 4px; line-height: 1.5; white-space: nowrap; vertical-align: middle; color: #fff; background: #6b7280; }
.rar-common { background: #8a8f99; } .rar-uncommon { background: #3f9d4b; } .rar-rare { background: #2f6fd6; } .rar-epic { background: #b23fb0; }
.rar-legendary { background: #d19a12; color: #1a1300; } .rar-mythic { background: #d03a3a; } .rar-cosmic { background: #5b2aa0; }
.rar-secret { background: #2b2f3a; border: 1px solid #9aa0ad; } .rar-eternal { background: linear-gradient(90deg, #138b7e, #7a3fd1); } .rar-divine { background: linear-gradient(90deg, #c9b11a, #e7d64a); color: #1f1a00; }
.rar-unknown { background: #9aa0ad; }
.note { background: var(--bg-soft); border-left: 4px solid var(--accent); padding: 10px 12px; border-radius: 6px; margin: 1em 0; }
.note-plain { background: var(--grey-bg); border-left-color: var(--grey); }
.legend { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin: 1.5em 0; }
.legend h3 { margin-top: 0; }
.legend ul { padding-left: 1.1em; }

/* Forms */
label { font-weight: 600; display: block; margin-bottom: .3em; }
input[type="text"], input[type="search"], input[type="number"], select { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-card); color: var(--text); min-height: 44px; }
input:focus, select:focus, button:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 1px; border-color: var(--accent); }
input:disabled, select:disabled { background: var(--grey-bg); color: var(--muted); }
.field { margin-bottom: 14px; }
.hint { font-size: .86rem; color: var(--muted); margin: .3em 0 0; }
.error { color: var(--err); background: var(--err-bg); padding: 6px 10px; border-radius: 6px; font-size: .9rem; margin: .4em 0 0; }
.error:empty { display: none; }
.choices { display: flex; flex-wrap: wrap; gap: 6px; }
.choice { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-card); cursor: pointer; font-weight: 500; font-size: .95rem; min-height: 40px; }
.choice input { margin: 0; accent-color: var(--accent); width: 18px; height: 18px; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice .tag { font-size: .66rem; }
.choice-note { font-size: .8rem; color: var(--muted); }
.btn { font: inherit; font-weight: 700; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--accent-dark); background: var(--accent); color: #1a1300; cursor: pointer; min-height: 44px; }
.btn-secondary { background: var(--bg-card); color: var(--text); border-color: var(--border); }
.grid-2 { display: grid; gap: 12px; }
@media (min-width: 700px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* Calculator layout */
.calc { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); margin: 1rem 0 1.5rem; }
.calc h2 { margin-top: 0; }
.calc-intro { margin-top: .2em; color: var(--muted); }
.results { background: var(--bg-soft); border-radius: var(--radius); padding: 14px; margin-top: 10px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.stat { background: var(--bg-card); border-radius: 8px; padding: 10px 8px; text-align: center; border: 1px solid var(--border); }
.stat .lbl { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); display: block; }
.stat .val { font-size: 1.12rem; font-weight: 800; display: block; word-break: break-word; line-height: 1.25; }
.stat .sub { font-size: .8rem; color: var(--muted); display: block; }
@media (min-width: 600px) { .stat .val { font-size: 1.4rem; } }
.result-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px dashed var(--border); flex-wrap: wrap; }
.result-row:first-of-type { border-top: 0; }
.result-row .k { font-weight: 600; }
.result-row .v { font-weight: 800; font-variant-numeric: tabular-nums; }
.formula { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86rem; background: var(--bg-card); padding: 8px 10px; border-radius: 8px; overflow-x: auto; white-space: pre-wrap; word-break: break-word; border: 1px solid var(--border); margin-top: 8px; }
.ingame-display { font-size: 1.05rem; margin: 10px 0 0; }
.ingame-display strong { font-size: 1.35rem; }

/* Pet picker (combobox) */
.picker { position: relative; }
.picker-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; max-height: 55vh; overflow-y: auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); margin-top: 4px; }
.picker-group-title { position: sticky; top: 0; background: var(--grey-bg); color: var(--muted); font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 6px 12px; }
.pet-option { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none; font: inherit; color: var(--text); cursor: pointer; min-height: 42px; }
.pet-option:hover, .pet-option.is-active { background: var(--accent-soft); }
.pet-option .nm { flex: 1 1 auto; }
.pet-option .rar, .pet-option .tag { flex: 0 0 auto; }
.picker-group[hidden], .pet-option[hidden] { display: none; }
.picker-empty { padding: 12px; color: var(--muted); }
.pet-card { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; background: var(--bg-soft); border-radius: 8px; padding: 10px 12px; margin: 10px 0; }
.pet-card .pname { font-weight: 800; font-size: 1.05rem; }
.pet-card .pmeta { color: var(--muted); font-size: .9rem; flex-basis: 100%; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1em 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--grey-bg); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable::after { content: " ↕"; color: var(--muted); font-weight: 400; }
th.sortable[aria-sort="ascending"]::after { content: " ↑"; color: var(--accent-dark); }
th.sortable[aria-sort="descending"]::after { content: " ↓"; color: var(--accent-dark); }
tr[hidden] { display: none; }
.filters { display: grid; gap: 10px; margin: 1em 0; }
@media (min-width: 640px) { .filters { grid-template-columns: 2fr 1fr 1fr; align-items: end; } }
.table-count { font-size: .9rem; color: var(--muted); margin: .4em 0 0; }

/* Trade compare */
.compare { display: grid; gap: 14px; }
@media (min-width: 760px) { .compare { grid-template-columns: 1fr 1fr; } }
.side { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: var(--bg-card); }
.side h3 { margin-top: 0; }
.slot { border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 10px; }
.slot:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.slot summary { cursor: pointer; font-weight: 600; font-size: .92rem; color: var(--link); }
.slot .choices { margin-top: 6px; }
.slot .choice { font-size: .88rem; padding: 6px 10px; min-height: 36px; }
.slot-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.slot-total { font-size: .9rem; color: var(--muted); margin-top: 6px; }
.compare-result { margin-top: 14px; }

/* Biome cards */
.biome-grid { display: grid; gap: 12px; }
@media (min-width: 700px) { .biome-grid { grid-template-columns: 1fr 1fr; } }
.biome-card h3 { margin-top: 0; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 .8em; font-size: .93rem; }
.dl dt { font-weight: 600; color: var(--muted); }
.dl dd { margin: 0; }
.rarity-dist { display: flex; flex-wrap: wrap; gap: 4px; }
.pet-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.pet-chips li { margin: 0; font-size: .85rem; background: var(--grey-bg); border-radius: 6px; padding: 3px 8px; }

/* FAQ */
.faq details { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; background: var(--bg-card); }
.faq summary { font-weight: 700; cursor: pointer; }
.faq details p { margin: .6em 0 0; }

.toc { font-size: .92rem; }
.toc ul { display: flex; flex-wrap: wrap; gap: 4px 14px; list-style: none; padding: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.notfound { text-align: center; padding: 3rem 0; }
.notfound h1 { font-size: 2.2rem; }

/* Narrow screens: every table becomes a stack of cards (one card per row, column headers as small labels). */
@media (max-width: 640px) {
  pre { white-space: pre-wrap; word-break: break-word; }
  .table-wrap { overflow: visible; border: 0; background: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  table caption { display: none; }
  thead { display: none; }
  tbody tr { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px 6px; margin-bottom: 8px; }
  tbody tr[hidden] { display: none !important; }
  td, td.num { display: flex; align-items: baseline; gap: 10px; padding: 3px 0; border-bottom: 0; text-align: left; white-space: normal; }
  td::before { content: attr(data-label); flex: 0 0 38%; font-size: .74rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
  td:first-child { display: block; font-weight: 700; font-size: 1rem; padding: 0 0 6px; margin-bottom: 4px; border-bottom: 1px dashed var(--border); }
  td:first-child::before { display: none; }
  /* Sortable value tables keep their headers as a row of sort buttons. */
  table.value-table thead { display: block; margin-bottom: 8px; }
  table.value-table thead tr { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
  table.value-table thead tr::before { content: "Sort by:"; font-size: .8rem; font-weight: 600; color: var(--muted); }
  table.value-table th { display: inline-block; position: static; background: var(--bg-card); border: 1px solid var(--border); border-radius: 999px; padding: 6px 10px; font-size: .78rem; text-transform: none; letter-spacing: 0; white-space: nowrap; }
  table.value-table th[aria-sort] { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
  .table-empty { padding: 4px 0 !important; }
}
