/* Farm Heaven. Portrait layout: banner slot, bank, panel, tab bar. */
:root {
  --banner-h: 60px;
  --bg: #15120e;
  --surface: #211b14;
  --surface-2: #322819;
  --ink: #f4ead6;
  --ink-soft: #b3a286;
  --line: #43362a;
  --accent: #e0a040;
  --accent-ink: #1d1203;
  --teal: #5fc9a8;
  --blue: #7aa8ff;
  --gold: #ffc940;
  --gold-d: #d9a21c;
  --m1: #d2c6b4;
  --m2: #8a7a66;
  --bad: #ff7b6b;
  --ph: #1d1812;
  --c0: #d99a4e;
  --c1: #a6d65a;
  --c2: #b4bcc6;
  --c3: #7fbaff;
  --c4: #e58a5e;
  --c5: #ffd84a;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}
body[data-theme='light'] {
  --bg: #f3e9d2;
  --surface: #fff9ea;
  --surface-2: #ecdcbb;
  --ink: #2a2012;
  --ink-soft: #7a6644;
  --line: #dcc89c;
  --accent: #b9741a;
  --accent-ink: #ffffff;
  --teal: #1f9a7a;
  --blue: #3f6fe0;
  --gold: #e8a91c;
  --gold-d: #b97d08;
  --m1: #b5a58e;
  --m2: #7a6a56;
  --bad: #c93a2a;
  --ph: #ecdcbb;
  --c0: #a8651c;
  --c1: #5a9a1c;
  --c2: #6f7882;
  --c3: #2f78d0;
  --c4: #c0542a;
  --c5: #c89400;
  --shadow: 0 2px 10px rgba(60, 40, 10, 0.16);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
.hidden { display: none !important; }
svg { display: block; }

#app {
  position: relative;
  height: 100vh;
  height: 100dvh;
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Banner slot: reserved from first paint so nothing jumps when the ad loads. */
.banner {
  flex: 0 0 auto;
  height: var(--banner-h);
  margin-bottom: 8px; /* gap so no control touches the ad */
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.banner.collapsed { display: none; }
.banner-ph {
  position: absolute;
  inset: 0;
  background: var(--ph);
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
}
.banner .adsbygoogle { position: relative; z-index: 1; }
.banner.filled .banner-ph { display: none; }

/* Bank */
.top { flex: 0 0 auto; padding: 2px 16px 6px; text-align: center; position: relative; }
.bank { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; }
.bank-ic { width: 26px; height: 26px; }
.rates { color: var(--ink-soft); font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rates .dot { margin: 0 6px; }
.boosts { position: absolute; left: 8px; top: 8px; z-index: 3; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; pointer-events: none; }
.boost { background: var(--accent); color: var(--accent-ink); font-size: 11.5px; font-weight: 800; padding: 3px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.boost.war { background: var(--blue); color: #fff; }
.boost.gold { background: var(--gold); color: #3a2800; }

/* Panel */
.panel { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 10px 12px 14px; -webkit-overflow-scrolling: touch; }
.buybar { display: flex; gap: 6px; margin-bottom: 10px; }
.buybar button { flex: 1; min-height: 34px; border-radius: 10px; background: var(--surface); font-weight: 700; font-size: 14px; color: var(--ink-soft); border: 1px solid var(--line); }
.buybar button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.row { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 9px 10px; margin-bottom: 8px; position: relative; overflow: hidden; }
.row .ic { flex: 0 0 46px; width: 46px; height: 46px; border-radius: 11px; background: var(--surface-2); display: grid; place-items: center; position: relative; }
.row .ic svg, .row .ic img { width: 34px; height: 34px; }
.row .ic .tier { position: absolute; right: -4px; bottom: -4px; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.row .info { flex: 1 1 auto; min-width: 0; }
.row .name { font-weight: 700; font-size: 15px; display: flex; align-items: baseline; gap: 8px; }
.row .name span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .owned { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 800; flex: 0 0 auto; white-space: nowrap; font-size: 13px; }
.row .sub { color: var(--ink-soft); font-size: 12px; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .bar { height: 4px; background: var(--surface-2); border-radius: 2px; margin-top: 5px; overflow: hidden; }
.row .bar i { display: block; height: 100%; background: var(--teal); width: 0; }
.row.locked { opacity: 0.6; }
.row.flash { animation: flash 0.25s ease-out; }
@keyframes flash { from { background: var(--surface-2); } }

.cost { flex: 0 0 auto; min-width: 96px; min-height: 48px; padding: 5px 10px; border-radius: 12px; background: var(--surface-2); color: var(--ink-soft); display: flex; flex-direction: column; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; transition: transform 0.08s; }
.cost b { font-size: 14.5px; display: flex; align-items: center; gap: 4px; }
.cost b svg { width: 13px; height: 13px; }
.cost small { font-size: 11px; font-weight: 600; opacity: 0.9; }
.cost.can { background: var(--accent); color: var(--accent-ink); }
.cost.can b svg { filter: brightness(0.3); }
.cost.relic.can b svg { filter: none; }
.cost.can:active { transform: scale(0.95); }

.note { color: var(--ink-soft); font-size: 13.5px; text-align: center; padding: 14px 10px; line-height: 1.45; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.card h2 { margin: 0 0 6px; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.card h2 svg { width: 26px; height: 26px; }
.card p { margin: 0; color: var(--ink-soft); font-size: 13.5px; line-height: 1.45; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.kv:last-child { border-bottom: 0; }
.kv span:last-child { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.kv.big span:last-child { color: var(--blue); font-size: 17px; }
.btn { width: 100%; min-height: 52px; padding: 10px 18px; border-radius: 14px; background: var(--surface-2); font-size: 16.5px; font-weight: 700; transition: transform 0.08s; }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:disabled { background: var(--surface-2); color: var(--ink-soft); }
.btn.danger { color: var(--bad); }
.tip { font-size: 13px; color: var(--ink-soft); text-align: center; margin: 10px 4px 0; line-height: 1.4; }
.tip.good { color: var(--teal); font-weight: 700; }

.awards-head { text-align: center; font-weight: 700; font-size: 14px; margin: 2px 0 10px; }
.awards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.award { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px; display: flex; align-items: center; gap: 8px; min-width: 0; opacity: 0.5; }
.award.got { opacity: 1; border-color: var(--gold-d); }
.award svg, .award img { width: 28px; height: 28px; flex: 0 0 28px; }
.award div { min-width: 0; font-size: 12.5px; font-weight: 700; line-height: 1.25; }
.award small { display: block; color: var(--ink-soft); font-weight: 600; font-size: 11px; font-variant-numeric: tabular-nums; }
.award.got small { color: var(--gold-d); }

h3.sec { margin: 16px 4px 8px; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
h3.sec:first-child { margin-top: 2px; }
.set { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); font-size: 15px; min-height: 52px; }
.set:last-child { border-bottom: 0; }
.seg { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; flex-wrap: wrap; justify-content: flex-end; }
.seg button { padding: 7px 11px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.switch { width: 50px; height: 30px; border-radius: 15px; background: var(--surface-2); position: relative; flex: 0 0 auto; transition: background 0.15s; }
.switch::after { content: ''; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.15s; }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(20px); }
.link { color: var(--blue); font-weight: 600; text-align: left; flex: 1; min-height: 32px; }
.about { text-align: center; color: var(--ink-soft); font-size: 12px; margin: 14px 0 4px; }

/* Tab bar */
.tabs { flex: 0 0 auto; display: flex; background: var(--surface); border-top: 1px solid var(--line); }
.tabs button { flex: 1; min-width: 0; padding: 7px 2px 8px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--ink-soft); position: relative; }
.tabs button svg { width: 24px; height: 24px; opacity: 0.55; }
.tabs button span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs button.on { color: var(--ink); }
.tabs button.on svg { opacity: 1; }
.tabs button.on::before { content: ''; position: absolute; top: 0; left: 22%; right: 22%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.badge { position: absolute; top: 3px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; display: grid; place-items: center; }
#badge-prestige { background: var(--blue); color: #fff; }

/* Modal */
.modal { position: absolute; inset: 0; background: rgba(8, 11, 17, 0.62); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 20; }
.modal-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 18px; padding: 22px 20px 18px; box-shadow: var(--shadow); text-align: center; animation: pop2 0.18s ease-out; }
@keyframes pop2 { from { transform: scale(0.92); opacity: 0; } }
.modal-card h2 { margin: 0 0 8px; font-size: 20px; }
.modal-card p { margin: 0 0 6px; color: var(--ink-soft); font-size: 14.5px; line-height: 1.45; }
.modal-card .gain { font-size: 28px; font-weight: 800; color: var(--gold); margin: 10px 0 4px; display: flex; align-items: center; justify-content: center; gap: 8px; font-variant-numeric: tabular-nums; }
.modal-card .gain svg { width: 26px; height: 26px; }
.modal-card .btns { display: flex; gap: 10px; margin-top: 16px; }
.modal-card .btn.go { background: var(--accent); color: var(--accent-ink); }

@media (max-height: 620px) {
  .bank { font-size: 26px; }
  .panel { padding-top: 8px; }
  .tabs button { padding: 5px 2px 6px; }
}
@media (max-width: 360px) {
  .tabs button { font-size: 10px; }
  .row { gap: 8px; padding: 8px; }
  .row .ic { flex-basis: 40px; width: 40px; height: 40px; }
  .row .ic svg, .row .ic img { width: 30px; height: 30px; }
  .cost { min-width: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  .row.working .ic .pick, .crate svg, .crate { animation: none !important; }
}



/* ---- Outpost Heaven ---- */
.g { width: 100%; height: 100%; fill: currentColor; }
.r0 { color: var(--c0); } .r1 { color: var(--c1); } .r2 { color: var(--c2); } .r3 { color: var(--c3); } .r4 { color: var(--c4); } .r5 { color: var(--c5); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 14px 8px; text-align: left; }
.pill-h { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 8px; font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; }
.pill-h svg { width: 18px; height: 18px; fill: var(--accent); }
.top .ttl { font-weight: 800; font-size: 15px; color: var(--ink-soft); letter-spacing: 0.02em; text-align: right; }
.top .ttl small { display: block; font-size: 11.5px; font-weight: 700; color: var(--accent); }

.scene { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); margin-bottom: 8px; background: var(--surface); }
.scene canvas { display: block; width: 100%; height: 132px; }
.hint { text-align: center; color: var(--ink-soft); font-size: 13px; margin: 2px 6px 10px; line-height: 1.4; min-height: 18px; }
.hint:empty { display: none; }
.hint b { color: var(--accent); }

.gather { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.gbtn { position: relative; min-height: 58px; border-radius: 16px; background: var(--accent); color: var(--accent-ink); font-size: 16px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.28); transition: transform 0.06s; padding: 6px 10px; }
.gbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.28); }
.gbtn svg { width: 24px; height: 24px; flex: 0 0 24px; fill: currentColor; }
.gbtn.alt { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.gbtn.alt svg { fill: var(--c1); }
.gbtn span { line-height: 1.15; text-align: left; }

.res { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 4px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 7px 10px; margin-bottom: 6px; }
.res .gi { width: 28px; height: 28px; }
.res .nm { font-weight: 700; font-size: 14.5px; display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.res .nm span:last-child { font-variant-numeric: tabular-nums; color: var(--ink-soft); font-weight: 700; font-size: 13px; white-space: nowrap; }
.res .rt { font-weight: 800; font-size: 13.5px; font-variant-numeric: tabular-nums; color: var(--teal); text-align: right; min-width: 64px; }
.res .rt.neg { color: var(--bad); }
.res .bar { grid-column: 2 / 4; height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.res .bar i { display: block; height: 100%; width: 0; background: var(--c); border-radius: 3px; }
.res.full .bar i { background: var(--gold); }
.res.full .nm span:last-child { color: var(--gold); }

.wander { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--gold-d); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; animation: pulse 1.6s ease-in-out infinite alternate; }
.wander .wt { flex: 1; min-width: 0; font-weight: 700; font-size: 14px; }
.wander .wt small { display: block; color: var(--ink-soft); font-weight: 600; font-size: 12px; font-variant-numeric: tabular-nums; }
.wander .btn { width: auto; min-width: 96px; min-height: 44px; font-size: 15px; background: var(--gold); color: #3a2800; }
@keyframes pulse { from { box-shadow: 0 0 0 0 rgba(255, 201, 64, 0.0); } to { box-shadow: 0 0 10px 1px rgba(255, 201, 64, 0.4); } }

.logbox { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; margin-top: 4px; }
.logbox h3 { margin: 0 0 6px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.logl { font-family: Georgia, 'Iowan Old Style', 'Times New Roman', serif; font-style: italic; font-size: 14.5px; line-height: 1.45; padding: 5px 0; border-top: 1px solid var(--line); color: var(--ink); }
.logl:first-of-type { border-top: 0; }
.logl:nth-of-type(n+3) { opacity: 0.85; }
.logl:nth-of-type(n+6) { opacity: 0.65; }
.logl:nth-of-type(n+10) { opacity: 0.5; }

.buybar { margin-bottom: 8px; }
.row .ic.g0 { background: var(--surface-2); }
.row .ic svg { fill: var(--ink); width: 30px; height: 30px; }
.row .desc { color: var(--ink-soft); font-size: 12.5px; margin-top: 2px; line-height: 1.3; }
.row .warn { color: var(--gold); font-size: 12px; font-weight: 700; margin-top: 3px; }
.cost { min-width: 86px; gap: 1px; }
.cost .c { display: flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 800; }
.cost .c svg { width: 14px; height: 14px; }
.cost .c.short { color: var(--bad); }
.cost.can .c svg { fill: currentColor; }
.cost.can .c { color: var(--accent-ink); }
.cost.dis { opacity: 0.55; }
.cost small { font-size: 11px; font-weight: 700; }
.cost.known { background: transparent; border: 1px solid var(--line); font-weight: 700; font-size: 13px; }

.stepper { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.stepper button { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); font-size: 24px; font-weight: 800; line-height: 1; color: var(--ink); }
.stepper button.pl { background: var(--accent); color: var(--accent-ink); }
.stepper button:disabled { opacity: 0.35; }
.stepper b { min-width: 30px; text-align: center; font-size: 17px; font-variant-numeric: tabular-nums; }
.ptop { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 2px 8px; font-weight: 700; font-size: 14px; }
.ptop small { color: var(--ink-soft); font-weight: 600; font-size: 12.5px; }
.ptop .seg button { padding: 5px 9px; font-size: 12.5px; }

.excard { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; }
.excard h4 { margin: 0 0 6px; font-size: 14px; }
.exsend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.exsend button { min-height: 58px; border-radius: 12px; background: var(--surface-2); font-size: 13px; font-weight: 700; padding: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; line-height: 1.2; }
.exsend button small { color: var(--ink-soft); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.exsend button.can { background: var(--accent); color: var(--accent-ink); }
.exsend button.can small { color: var(--accent-ink); opacity: 0.8; }
.exsend button:disabled { opacity: 0.5; }
.exaway { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.exaway .prog { margin: 6px 0 0; }
.excard .btn { min-height: 46px; font-size: 15px; margin: 0; }
.relics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.relic { font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); }
.relic.got { background: var(--gold); color: #3a2800; }

.tierh { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 4px 6px; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); font-weight: 800; }
.tierh small { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 700; }
.tierh:first-of-type { margin-top: 2px; }
.row.known { opacity: 0.6; }
.row .fx { color: var(--teal); font-size: 12.5px; font-weight: 700; margin-top: 2px; line-height: 1.3; }

.perk .lvl { color: var(--accent); font-weight: 800; font-size: 12.5px; }
.aw .award small { font-size: 10.5px; }
.card .legbig { font-size: 26px; font-weight: 800; color: var(--accent); text-align: center; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.card .legsub { text-align: center; color: var(--ink-soft); font-size: 13px; margin-bottom: 8px; }
.btn.found { background: var(--accent); color: var(--accent-ink); margin-top: 8px; }
.btn.found:disabled { background: var(--surface-2); color: var(--ink-soft); }
.award { opacity: 0.55; }
.award.got { opacity: 1; }

.choice { width: 100%; min-height: 54px; border-radius: 12px; background: var(--surface-2); margin-top: 8px; font-size: 15px; font-weight: 700; padding: 8px 12px; }
.choice:active { background: var(--accent); color: var(--accent-ink); }
.gainlist { margin: 10px 0 4px; font-weight: 800; font-size: 16px; line-height: 1.7; font-variant-numeric: tabular-nums; }

.tabs button { padding: 7px 0 8px; font-size: 10.5px; }
.tabs button .badge { left: calc(50% + 6px); }
@media (max-width: 360px) { .tabs button { font-size: 9.5px; } .gbtn { font-size: 14.5px; } }

.btn.go { background: var(--accent); color: var(--accent-ink); }
.btn.go:disabled { background: var(--surface-2); color: var(--ink-soft); }
.prog { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin: 10px 0 4px; }
.prog i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 4px; }
.floats { position: absolute; inset: 0; pointer-events: none; z-index: 8; overflow: hidden; }
.float { position: absolute; font-weight: 800; font-size: 16px; color: var(--gold); text-shadow: 0 0 3px #000, 0 1px 2px #000; animation: floatUp 0.85s ease-out forwards; white-space: nowrap; transform: translate(-50%, -50%); }
@keyframes floatUp { to { transform: translate(-50%, -64px); opacity: 0; } }
.toast { position: absolute; left: 12px; right: 12px; top: calc(var(--banner-h) + 62px); z-index: 12; background: rgba(12, 9, 6, 0.93); color: #fff; padding: 10px 14px; border-radius: 12px; font-size: 14px; font-weight: 600; text-align: center; box-shadow: var(--shadow); animation: toastIn 0.2s ease-out; pointer-events: none; }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } }
.btns.stack { flex-direction: column; gap: 0; }
.gainlist .g { width: 18px; height: 18px; display: inline-block; vertical-align: -3px; margin-right: 6px; }
.modal-card .btns .btn { min-height: 48px; }
.res .gi svg, .res svg.gi { width: 28px; height: 28px; }
.row .ic { color: var(--ink); }
.row .ic svg { fill: currentColor; }
.cost.can .c svg { color: var(--accent-ink); fill: currentColor; }
.cost.can .c.short { color: var(--accent-ink); }
.perk .cost .c svg { color: var(--gold); }
.perk .cost.can .c svg { color: var(--accent-ink); }
.sub-note { color: var(--ink-soft); font-size: 12.5px; text-align: center; margin: 4px 6px 10px; line-height: 1.4; }
.badge { top: 2px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }

/* music volume slider (settings) */
input.vol { width: 130px; max-width: 45vw; accent-color: var(--accent); }
.set .np-title { font-size: 12px; color: var(--ink-soft); max-width: 55vw; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- start screen (shared "hm-" kit, see tools/home) ---- */
.hm-wrap { --hm-pad: 14px; padding: 0 var(--hm-pad) 10px; }
.hm-hero { position: relative; height: 176px; margin: 0 calc(var(--hm-pad) * -1) 12px; overflow: hidden; border-radius: 0 0 26px 26px; background: linear-gradient(160deg, var(--h0, #274a8c), var(--h1, #0f1d3f)); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3); color: #fff; }
.hm-hero::after { content: ''; position: absolute; inset: 0; background: radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.16), transparent 60%); pointer-events: none; z-index: 2; }
.hm-art { position: absolute; inset: 0; z-index: 1; overflow: hidden; }
.hm-art > svg { width: 100%; height: 100%; display: block; }
.hm-txt { position: absolute; left: 18px; right: 18px; top: 18px; z-index: 3; text-align: left; }
.hm-txt h1 { margin: 0; font-size: 31px; line-height: 1.05; font-weight: 900; letter-spacing: 0.01em; color: #fff; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35), 0 0 22px rgba(255, 255, 255, 0.3); }
.hm-txt h1 span { background: linear-gradient(180deg, #fff2a8, #ffc940 70%, #f29b1c); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.35)); }
.hm-txt p { margin: 6px 0 0; font-size: 13px; color: rgba(255, 255, 255, 0.92); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6); letter-spacing: 0.03em; }
.hm-icons { position: absolute; z-index: 4; right: 10px; top: 10px; display: flex; gap: 8px; }
.hm-ic { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: rgba(6, 14, 32, 0.5); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; backdrop-filter: blur(4px); position: relative; }
.hm-ic svg, .hm-np svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.hm-ic .hm-dot { position: absolute; top: 5px; right: 5px; width: 9px; height: 9px; border-radius: 50%; background: #ff5d6c; border: 2px solid rgba(6, 14, 32, 0.8); }
.hm-np { position: absolute; z-index: 4; left: 12px; right: 12px; bottom: 10px; display: flex; align-items: center; gap: 8px; padding: 6px 12px; border: 0; border-radius: 999px; background: rgba(6, 14, 32, 0.62); color: #fff; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; backdrop-filter: blur(4px); }
.hm-np svg { width: 14px; height: 14px; flex: 0 0 14px; color: #ffd23f; }
.hm-np span { flex: 1; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-np b { font-size: 9px; opacity: 0.7; letter-spacing: -1px; }
.hm-np.off svg { color: #8a9bb8; }
.hm-art .hm-logo { position: absolute; right: 16px; top: 44px; width: 78px; height: 78px; border-radius: 20px; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(255, 255, 255, 0.5); animation: hm-bob 4.2s ease-in-out infinite; }

.hm-banner { display: flex; align-items: center; gap: 12px; width: 100%; margin: 0 0 12px; padding: 12px 14px; text-align: left; font: inherit; color: var(--ink); cursor: pointer; border: 1.5px solid var(--accent); border-radius: 16px; background: linear-gradient(90deg, rgba(255, 201, 64, 0.2), var(--surface) 72%); box-shadow: var(--shadow, 0 2px 10px rgba(0, 0, 0, 0.2)); }
.hm-banner:active { transform: scale(0.985); }
.hm-banner.done { border-color: var(--line); background: var(--surface); opacity: 0.92; }
.hm-banner .bi { flex: 0 0 38px; width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--accent); color: var(--accent-ink, #fff); }
.hm-banner.done .bi { background: var(--line); color: var(--ink-soft); }
.hm-banner .bi svg { width: 20px; height: 20px; fill: currentColor; }
.hm-banner .hm-bt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hm-banner .hm-bt b { font-size: 15px; line-height: 1.15; }
.hm-banner .hm-bt small { font-size: 12px; color: var(--ink-soft); line-height: 1.25; }
.hm-banner .bg { flex: 0 0 auto; padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 800; background: var(--accent); color: var(--accent-ink, #fff); }
.hm-banner.done .bg { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.hm-banner .dots { display: flex; gap: 4px; margin-top: 3px; }
.hm-banner .dots i { width: 14px; height: 6px; border-radius: 3px; background: var(--line); display: block; }
.hm-banner .dots i.on { background: var(--accent); }

.hm-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 12px; }
.hm-stats div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 8px 6px; text-align: center; min-width: 0; }
.hm-stats b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.hm-stats small { display: block; margin-top: 2px; font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hm-card { margin: 0 0 12px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow, 0 2px 10px rgba(0, 0, 0, 0.2)); color: var(--ink); text-align: left; }
.hm-card h3 { margin: 0; font-size: 16px; }
.hm-card p { margin: 6px 0 0; font-size: 13px; color: var(--ink-soft); line-height: 1.4; }
.hm-card .bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: 10px; }
.hm-card .bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #ffd23f, #ff9a3d); }
.hm-row { display: flex; align-items: center; gap: 12px; }
.hm-row > .pv { flex: 0 0 auto; }
.hm-row > .tx { flex: 1; min-width: 0; }
.hm-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.hm-chips button { flex: 1 1 0; min-width: 64px; padding: 9px 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2, var(--bg)); color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.hm-chips button:active { transform: scale(0.96); }
.hm-chips button small { display: block; font-size: 10.5px; font-weight: 500; color: var(--ink-soft); margin-top: 1px; }

.hm-wrap .hm-cta { margin: 0 calc(var(--hm-pad, 14px) * -1); }
.hm-cta { position: sticky; bottom: 0; z-index: 5; margin: 0; padding: 14px var(--hm-pad, 14px) 14px; background: linear-gradient(180deg, rgba(0, 0, 0, 0), var(--bg) 40%); display: flex; flex-direction: column; gap: 8px; }
.hm-btn { width: 100%; padding: 15px 16px; border: 0; border-radius: 16px; font: inherit; font-size: 17px; font-weight: 800; letter-spacing: 0.03em; cursor: pointer; color: #2a1a00; background: linear-gradient(180deg, #ffe27a, #ffbf2f); box-shadow: 0 6px 18px rgba(255, 190, 40, 0.35); animation: hm-glow 2.2s ease-in-out infinite; display: flex; align-items: center; justify-content: center; gap: 8px; flex-direction: column; line-height: 1.15; }
.hm-btn small { font-size: 12px; font-weight: 600; opacity: 0.8; letter-spacing: 0; }
.hm-btn:active { transform: scale(0.98); }
.hm-btn.alt { background: var(--surface-2, var(--surface)); color: var(--ink); box-shadow: none; animation: none; border: 1px solid var(--line); font-size: 15px; padding: 12px 16px; }
.hm-btn.hidden { display: none; }

/* idle games: Home tab lives in the panel */
.hm-panel { padding: 0 !important; display: flex; flex-direction: column; }
.hm-panel .hm-wrap { flex: 1 0 auto; display: flex; flex-direction: column; }
.hm-panel .hm-cta { margin-top: auto; }
.hm-art .pt { position: absolute; bottom: -14px; z-index: 1; width: 11px; height: 11px; border-radius: 3px; background: var(--c, #ffd23f); opacity: 0.75; box-shadow: 0 0 10px var(--c, #ffd23f); animation: hm-rise 9s linear infinite; }
.on-home #stage, .on-home .top, .on-home #mine-tabs { display: none !important; }
@keyframes hm-glow { 0%, 100% { box-shadow: 0 6px 18px rgba(255, 190, 40, 0.3); } 50% { box-shadow: 0 6px 28px rgba(255, 190, 40, 0.65); } }
@keyframes hm-bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-7px) rotate(2deg); } }
@keyframes hm-drift { from { transform: translateX(0); } to { transform: translateX(560px); } }
@keyframes hm-twinkle { from { opacity: 0.25; } to { opacity: 0.95; } }
@keyframes hm-rise { 0% { transform: translateY(20px); opacity: 0; } 15% { opacity: 0.9; } 100% { transform: translateY(-190px); opacity: 0; } }
@keyframes hm-spin { to { transform: rotate(360deg); } }
@keyframes hm-flicker { 0%, 100% { transform: scale(1, 1); opacity: 1; } 30% { transform: scale(0.94, 1.08); opacity: 0.9; } 60% { transform: scale(1.04, 0.95); opacity: 1; } }
.hm-art .dg { position: absolute; bottom: -10px; font-weight: 900; color: rgba(255, 255, 255, 0.45); font-size: 26px; animation: hm-rise 9s linear infinite; z-index: 1; }
.hm-art .ar { position: absolute; bottom: -14px; z-index: 1; animation: hm-rise 9s linear infinite; }
.hm-art .ar i { display: block; width: 0; height: 0; border-left: 17px solid var(--c, #ff6b6b); border-top: 10px solid transparent; border-bottom: 10px solid transparent; opacity: 0.8; }
.hm-art .tl { position: absolute; bottom: -34px; z-index: 1; animation: hm-rise 10s linear infinite; }
.hm-art .tl i { display: block; width: 22px; height: 30px; border-radius: 6px; background: linear-gradient(160deg, #fffdf2, #e3dcc2); box-shadow: 2px 2px 0 var(--c, #1f9e7a); opacity: 0.8; }
.hm-bob { animation: hm-bob 4.2s ease-in-out infinite; }
.hm-twinkle { animation: hm-twinkle 3s ease-in-out infinite alternate; }
.hm-spin { animation: hm-spin 14s linear infinite; }
.hm-svg { transform-box: fill-box; transform-origin: center; }
.hm-cloud { position: absolute; z-index: 1; height: 26px; width: 90px; border-radius: 40px; background: rgba(255, 255, 255, 0.55); filter: blur(1px); opacity: 0.8; animation: hm-drift 38s linear infinite; left: -110px; }
.hm-cloud::before, .hm-cloud::after { content: ''; position: absolute; background: inherit; border-radius: 50%; }
.hm-cloud::before { width: 42px; height: 42px; left: 14px; top: -20px; }
.hm-cloud::after { width: 32px; height: 32px; left: 46px; top: -12px; }
.hm-cloud.c1 { top: 100px; }
.hm-cloud.c2 { top: 62px; animation-duration: 52s; animation-delay: -20s; transform: scale(0.7); opacity: 0.55; }
.hm-cloud.c3 { top: 126px; animation-duration: 44s; animation-delay: -33s; transform: scale(1.15); opacity: 0.45; }
.hm-rise { position: absolute; bottom: 0; z-index: 1; font-weight: 800; color: rgba(255, 255, 255, 0.85); text-shadow: 0 0 10px rgba(255, 255, 255, 0.6); animation: hm-rise 9s linear infinite; pointer-events: none; }

@media (max-width: 360px) {
  .hm-txt h1 { font-size: 25px; }
  .hm-txt p { font-size: 12px; }
  .hm-art .hm-logo { width: 58px; height: 58px; top: 56px; right: 12px; border-radius: 15px; }
  .hm-ic { width: 32px; height: 32px; }
}
@media (max-height: 600px) {
  .hm-hero { height: 128px; margin-bottom: 8px; }
  .hm-txt { top: 12px; }
  .hm-txt h1 { font-size: 24px; }
  .hm-txt p { display: none; }
  .hm-art .hm-logo { width: 56px; height: 56px; top: 36px; border-radius: 14px; }
  .hm-rise { animation-name: hm-rise-s; }
}
@keyframes hm-rise-s { 0% { transform: translateY(20px); opacity: 0; } 15% { opacity: 0.9; } 100% { transform: translateY(-140px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .hm-cloud, .hm-rise, .hm-bob, .hm-twinkle, .hm-spin, .hm-btn, .hm-art .hm-logo { animation: none !important; }
}

/* Tablets: let the column grow beyond the phone cap (boards size themselves from the column). Phones (< 700 px) are unchanged. */
@media (min-width: 700px) {
  #app { max-width: 760px; }
}

/* painted art (optional): image icons replace the SVG glyphs */
img.g { width: 100%; height: 100%; object-fit: contain; fill: none; -webkit-user-drag: none; user-select: none; pointer-events: none; }
.gbtn img { width: 30px; height: 30px; flex: 0 0 30px; }
.cost .c img { width: 15px; height: 15px; vertical-align: -3px; }
.row .ic img { width: 42px; height: 42px; object-fit: contain; }
.res img.gi { width: 30px; height: 30px; }
.gainlist img.g { width: 20px; height: 20px; display: inline-block; vertical-align: -4px; margin-right: 6px; }
@media (max-width: 360px) { .row .ic img { width: 32px; height: 32px; } }

/* v1.2: banners and effects */
.fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 9; }
#panel.shake { animation: shake 0.32s ease-out; }
@keyframes shake { 0% { transform: translate(0, 0); } 15% { transform: translate(-5px, 3px); } 35% { transform: translate(4px, -3px); } 55% { transform: translate(-3px, 2px); } 75% { transform: translate(2px, -1px); } 100% { transform: translate(0, 0); } }
@media (prefers-reduced-motion: reduce) { #panel.shake { animation: none !important; } }
.bnbar { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 6px 8px 6px 10px; margin-bottom: 8px; }
.bnbar .bimg { flex: 0 0 40px; width: 40px; height: 40px; display: grid; place-items: center; }
.bnbar .bimg svg, .bnbar .bimg img { width: 40px; height: 40px; object-fit: contain; }
.bnbar .binfo { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.bnbar .binfo b { font-size: 14px; line-height: 1.15; }
.bnbar .binfo small { color: var(--ink-soft); font-size: 11.5px; font-weight: 600; line-height: 1.15; }
.bnbar .bbtn { flex: 0 0 auto; min-height: 40px; padding: 4px 12px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 800; white-space: nowrap; }
.bnbar .bbtn:active { transform: scale(0.96); }
.modal-card.bans { max-height: 86vh; overflow-y: auto; text-align: left; padding: 18px 14px 14px; }
.modal-card.bans h2, .modal-card.bans .csum { text-align: center; }
.modal-card.bans .csum { margin-bottom: 10px; }
.modal-card.bans .row { margin-bottom: 6px; padding: 7px 8px; }
.modal-card.bans .row .ic { flex: 0 0 44px; width: 44px; height: 44px; }
.modal-card.bans .note { padding: 8px 4px 0; font-size: 12.5px; text-align: left; }
.modal-card.bans .btns { margin-top: 8px; position: sticky; bottom: -14px; padding: 8px 0 2px; background: var(--surface); }
.modal-card.bans .cost { min-width: 66px; min-height: 40px; padding: 4px 8px; }
.modal-card.bans .cost b { font-size: 13px; }
.modal-card.bans .row .sub { white-space: normal; }
.row .ic.weap { background: radial-gradient(circle at 50% 40%, var(--surface), var(--surface-2)); box-shadow: inset 0 0 0 2px var(--wc, transparent); }
.row .ic.weap svg, .row .ic.weap img { width: 40px; height: 40px; object-fit: contain; }
.row.locked .ic.weap { box-shadow: none; }
.row.locked .ic.weap svg:not(.lock), .row.locked .ic.weap img { filter: grayscale(1) brightness(0.55); }
.row .ic.weap .lock { position: absolute; right: -4px; bottom: -4px; width: 20px; height: 20px; padding: 3px; border-radius: 10px; background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line); }
.row.weap-on { border-color: var(--wc, var(--accent)); }
.row .ic.weap + .info .name span:first-child { white-space: normal; }
.cost.equip { min-width: 84px; }
.cost.equipped { background: transparent; color: var(--teal); min-width: 84px; font-weight: 800; box-shadow: inset 0 0 0 2px var(--teal); }
.cost.equip.can { background: var(--accent); color: var(--accent-ink); }
.cost.prog { background: transparent; box-shadow: inset 0 0 0 1px var(--line); min-width: 84px; }
.cost.prog b { font-size: 12.5px; }
@media (max-width: 360px) {
  .cost.equip, .cost.equipped, .cost.prog { min-width: 70px; }
  .bnbar .bbtn { padding: 4px 9px; font-size: 12px; }
  .bnbar .binfo b { font-size: 13px; }
}
.modal:has(.modal-card.bans) { padding: 12px; }
.modal-card.bans .row .ic.weap + .info .name span:first-child { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.15; }
.modal-card.bans .row .sub { line-height: 1.2; }
.bnbar .binfo small { overflow-wrap: anywhere; }
