/* Enanoclic. Concepto: una galería de mina vista desde dentro; paneles tallados en roca,
   y el material activo tiñe toda la pantalla. Aspecto único y oscuro, a propósito. */
:root {
  color-scheme: dark;
  --rock: #17130f;
  --rock-2: #221c16;
  --rock-3: #2e261e;
  --line: #443829;
  --fg: #f3ebdd;
  --muted: #b9ac98;
  --good: #8fdc7c;
  --bad: #ff9b83;
  /* colores del material activo: los cambia ui.js */
  --a: #b9783f; --b: #7a4a24; --c: #3f2513; --d: #e2b070;
  --display: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --body: "Nunito", "Segoe UI", system-ui, sans-serif;
  --carve: inset 0 2px 0 rgba(255,255,255,.07), inset 0 -3px 0 rgba(0,0,0,.35);
  --top-h: 66px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
img { max-width: 100%; }
.ad.ad-real { background: none; border: 0; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: color-mix(in srgb, var(--c) 34%, var(--rock));
  color: var(--fg);
  font: 16px/1.45 var(--body);
  font-variant-numeric: tabular-nums;
  transition: background-color .6s;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--rock); }
h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; text-wrap: balance; }
h2 { font-size: 26px; }
h3 { font-size: 16px; letter-spacing: .02em; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible, input:focus-visible, label:focus-within { outline: 2px solid var(--d); outline-offset: 2px; }
.muted { color: var(--muted); }

.btn {
  background: var(--rock-3); border: 2px solid var(--line); padding: 7px 12px; box-shadow: var(--carve);
  font-family: var(--display); font-weight: 500; font-size: 15px; white-space: nowrap;
}
.btn:hover { background: #3a3025; }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn-main { background: var(--a); border-color: var(--d); color: #17110a; font-weight: 700; }
.btn-main:hover { background: var(--d); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--d); text-decoration: underline; text-underline-offset: 2px; }
.count { display: inline-block; background: var(--a); color: #17110a; padding: 0 5px; font-size: 12px; font-weight: 700; min-width: 18px; text-align: center; }
.x { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; background: var(--rock-3); border: 2px solid var(--line); font-size: 20px; line-height: 1; }
.x:hover { background: #4a3c2d; }

/* ---------- cabecera ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--rock); border-bottom: 3px solid var(--line);
  padding-block: 8px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand canvas { image-rendering: pixelated; }
.brand-name { font: 700 22px/1 var(--display); color: var(--d); }
.brand-sub { font-size: 12px; color: var(--muted); }
.mats { display: flex; gap: 6px; flex: 1 1 420px; min-width: 0; }
.mat {
  flex: 1 1 0; min-width: 0; text-align: left; padding: 4px 8px; background: var(--rock-2); border: 2px solid var(--line);
  display: grid; grid-template-columns: 20px minmax(0, 1fr); column-gap: 6px; align-items: center;
}
.mat img { width: 20px; height: 20px; image-rendering: pixelated; grid-row: span 2; }
.mat b { font-family: var(--display); font-weight: 600; font-size: 17px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat small { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat.is-on { border-color: var(--d); background: var(--rock-3); }
.mat[disabled] { opacity: .55; cursor: not-allowed; }
.mat[disabled] img { filter: grayscale(1) brightness(.5); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- pagina ---------- */
.page {
  padding-block: 14px 24px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  max-width: 1320px; margin: 0 auto; display: grid; gap: 14px;
}
.layout { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 14px; align-items: start; }
.stage { position: relative; display: grid; gap: 12px; justify-items: center; background: var(--rock-2); border: 2px solid var(--line); padding: 16px; box-shadow: var(--carve); }
.stage-head { text-align: center; }
.stage-head h2 { font-size: 40px; line-height: 1; color: var(--d); }
.tier-amount { font: 700 34px/1.15 var(--display); overflow-wrap: anywhere; }
.unit { font-size: 16px; font-weight: 500; color: var(--muted); }
.tier-rate { color: var(--muted); }
.tier-rate strong { color: var(--fg); }

.block { background: none; border: 0; padding: 10px; width: min(240px, 62vw); aspect-ratio: 1; max-width: 100%; transition: transform .07s; filter: drop-shadow(0 8px 0 rgba(0,0,0,.45)); }
.block canvas, #tier-art { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.block:hover { transform: scale(1.03); }
.block.hit { transform: scale(.93) rotate(-2deg); }
.floats { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.float { position: absolute; font: 700 20px var(--display); color: #fff; text-shadow: 2px 2px 0 #000; animation: rise .9s ease-out forwards; }
@keyframes rise { to { transform: translateY(-70px); opacity: 0; } }

.buffs { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin-top: 6px; }
.buffs:empty { display: none; }
body.mini-open .buffs { justify-content: flex-start; }
.buff { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 3px; font: 600 15px var(--display); background: color-mix(in srgb, var(--good) 22%, var(--rock)); border: 2px solid var(--good); }
.buff.bad { background: color-mix(in srgb, var(--bad) 22%, var(--rock)); border-color: var(--bad); }
.buff img { width: 22px; height: 22px; image-rendering: pixelated; }

/* Objeto brillante: rayos que giran detras del dibujo y un halo con el color del nivel */
.shiny { position: fixed; z-index: 50; width: 96px; height: 96px; padding: 0; background: none; border: 0; display: grid; place-items: center; animation: shiny-in .25s ease-out, shiny-out .6s ease-in 4.4s forwards; }
.shiny-rays { position: absolute; inset: -22px; border-radius: 50%; background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--d) 75%, transparent) 0 14deg, transparent 14deg 40deg); -webkit-mask: radial-gradient(circle, #000 30%, transparent 70%); mask: radial-gradient(circle, #000 30%, transparent 70%); animation: shiny-spin 3s linear infinite; }
.shiny img { position: relative; width: 72px; height: 72px; image-rendering: pixelated; animation: shiny-glow .7s ease-in-out infinite alternate; }
.shiny:hover img { transform: scale(1.12); }
@keyframes shiny-spin { to { transform: rotate(360deg); } }
@keyframes shiny-glow {
  from { filter: drop-shadow(0 0 6px var(--d)) brightness(1); }
  to { filter: drop-shadow(0 0 22px var(--d)) drop-shadow(0 0 8px #fff) brightness(1.3); }
}
@keyframes shiny-in { from { transform: scale(0); } }
@keyframes shiny-out { to { opacity: 0; } }

/* Efectos a pantalla completa: ninguna capa recibe clics, por eso se sigue jugando igual */
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 45; width: 100%; height: 100%; }
#fx-canvas { image-rendering: pixelated; }
.fx-glow { opacity: 0; transition: opacity .5s; box-shadow: inset 0 0 90px 24px var(--fx-c, #fff); }
.fx-glow.on { opacity: 1; animation: fx-pulse 1.4s ease-in-out infinite alternate; }
@keyframes fx-pulse { from { opacity: .45; } to { opacity: 1; } }
.fx-shade { opacity: 0; transition: opacity .8s; background: rgba(70, 74, 82, .26); box-shadow: inset 0 0 120px 40px rgba(25, 27, 32, .75); }
.fx-shade.on { opacity: 1; }
.fx-flash { opacity: 0; }
.fx-flash.bright { background: radial-gradient(circle, #fff 0%, var(--fx-c, #fff) 45%, transparent 90%); animation: fx-flash .9s ease-out; }
.fx-flash.dark { background: rgba(30, 32, 38, .95); animation: fx-flash .9s ease-out; }
@keyframes fx-flash { from { opacity: .8; } to { opacity: 0; } }
.fx-banner { position: fixed; z-index: 46; left: 50%; top: 42%; transform: translate(-50%, -50%); pointer-events: none; display: none; width: min(92vw, 760px); text-align: center; }
.fx-banner.show { display: grid; gap: 2px; animation: fx-banner 1.9s ease-out forwards; }
.fx-banner strong { font: 700 clamp(38px, 8vw, 84px)/1.05 var(--display); color: var(--fx-c, #fff); text-shadow: 0 0 26px var(--fx-c, #fff), 4px 4px 0 #000; overflow-wrap: anywhere; }
.fx-banner span { font: 600 clamp(18px, 3vw, 28px)/1.2 var(--display); color: #fff; text-shadow: 2px 2px 0 #000; }
.fx-banner.bad strong { color: #c9ccd2; text-shadow: 0 0 22px #30333a, 4px 4px 0 #000; }
@keyframes fx-banner {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  24% { transform: translate(-50%, -50%) scale(1); }
  72% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -62%) scale(1); }
}

.obra-card { width: 100%; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 8px 10px; align-items: center; background: color-mix(in srgb, var(--a) 20%, var(--rock)); border: 2px solid var(--a); padding: 10px; }
.obra-card canvas { image-rendering: pixelated; }
.obra-text { display: grid; font-size: 14.5px; color: var(--muted); }
.obra-text strong { font: 600 18px/1.2 var(--display); color: var(--fg); }
.obra-card .btn { grid-column: 1 / -1; font-size: 17px; padding: 9px; }
body.mini-open .obra-card { display: none; }

.unlock { width: 100%; background: var(--rock); border: 2px solid var(--line); padding: 10px; display: grid; gap: 7px; }
.unlock h3 { color: var(--d); }
.req { display: grid; gap: 2px; font-size: 13px; }
.req-top { display: flex; justify-content: space-between; gap: 8px; }
.bar { height: 7px; background: #0d0a08; border: 1px solid var(--line); }
.bar i { display: block; height: 100%; background: var(--a); }
.req.ok .bar i { background: var(--good); }
.guest { width: 100%; font-size: 13px; color: var(--muted); border: 2px dashed var(--line); padding: 8px 10px; }
.guest strong { color: var(--fg); }

/* ---------- tienda ---------- */
.shop { background: var(--rock-2); border: 2px solid var(--line); box-shadow: var(--carve); min-width: 0; }
.shop-tabs { display: flex; flex-wrap: wrap; gap: 4px; align-items: stretch; padding: 8px 8px 0; border-bottom: 2px solid var(--line); }
.tab { background: var(--rock); border: 2px solid var(--line); border-bottom: 0; padding: 7px 12px; font: 500 15px var(--display); }
.tab.is-on { background: var(--rock-3); color: var(--d); }
.qty { margin-left: auto; display: flex; margin-bottom: 6px; }
.qty button { background: var(--rock); border: 2px solid var(--line); padding: 3px 9px; margin-left: -2px; font: 500 14px var(--display); }
.qty button.is-on { background: var(--a); color: #17110a; border-color: var(--d); position: relative; }
.shop-list { display: grid; gap: 6px; padding: 8px; }

/* Tarjeta de compra: a la izquierda cuántas tienes, en medio qué genera, a la derecha qué cuesta. */
.gen {
  width: 100%; text-align: left; display: grid; grid-template-columns: 92px minmax(0, 1fr) minmax(136px, auto); gap: 12px; align-items: stretch;
  background: var(--rock-3); border: 2px solid var(--line); padding: 10px; box-shadow: var(--carve);
}
.gen-pic { display: grid; justify-items: center; align-content: start; gap: 2px; background: rgba(0,0,0,.28); padding: 6px 4px; }
.gen-pic img { width: 56px; height: 56px; image-rendering: pixelated; display: block; }
.gen-lvl { display: grid; justify-items: center; line-height: 1; }
.gen-lvl small { font-size: 13px; color: var(--muted); }
.gen-lvl b { font: 700 32px/1.05 var(--display); color: var(--d); }
.gen-lvl b.bump { animation: bump .3s ease-out; }
@keyframes bump { 40% { transform: scale(1.35); color: #fff; } }
.gen-body { display: grid; gap: 6px; align-content: start; min-width: 0; }
.gen-name { display: block; font: 600 20px/1.15 var(--display); }
.gen-desc { display: block; font-size: 14px; color: var(--muted); }
.gen-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.stat { display: grid; background: rgba(0,0,0,.28); padding: 4px 8px; line-height: 1.2; min-width: 0; }
.stat small { font-size: 13px; color: var(--muted); }
.stat b { font: 700 22px/1.2 var(--display); overflow-wrap: anywhere; }
.stat-add b { color: var(--good); }
.gen-next { display: grid; gap: 2px; font-size: 13.5px; color: var(--muted); }
.gen-state { color: var(--d); font-weight: 700; font-size: 14px; }
.gen-buy { display: grid; gap: 6px; align-content: space-between; }
.gen-cost { display: grid; gap: 2px; justify-items: end; font-size: 16px; font-weight: 700; }
.cost { display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; }
.cost img { width: 16px; height: 16px; background: none; image-rendering: pixelated; }
.cost.no { color: var(--bad); }
.buy-label { display: block; text-align: center; font: 600 16px var(--display); padding: 7px 8px; background: var(--rock); border: 2px solid var(--line); color: var(--muted); white-space: nowrap; }
.gen.can .buy-label { background: var(--a); border-color: var(--d); color: #17110a; }
.gen.off { cursor: default; }
.gen.off .gen-pic img { opacity: .7; }
.gen.can:hover { background: #3b3126; border-color: var(--a); }
.gen.can:hover .buy-label { background: var(--d); }
.gen.can:active { transform: translateY(1px); }
.gen.teaser { grid-template-columns: 56px minmax(0, 1fr); align-items: center; opacity: .55; cursor: default; }
.gen.teaser img { width: 56px; height: 56px; image-rendering: pixelated; filter: brightness(0); }

.goal { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; background: var(--rock-3); border: 2px solid var(--line); padding: 7px 9px; align-items: start; }
.goal-mark { width: 22px; height: 22px; border: 2px solid var(--line); background: var(--rock); display: grid; place-items: center; font: 700 14px var(--display); }
.goal.done { opacity: .8; }
.goal.done .goal-mark { background: var(--good); color: #10240c; border-color: var(--good); }
.goal-title { font-weight: 700; }
.goal-reward { font-size: 12.5px; color: var(--d); }
.goal .bar { margin-top: 4px; }

/* ---------- huecos de anuncio ---------- */
.ad {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center;
  background: repeating-linear-gradient(45deg, #2a2a2a, #2a2a2a 10px, #313131 10px, #313131 20px);
  border: 2px dashed #8d8d8d; color: #e6e6e6;
}
.ad span { font: 700 18px var(--body); letter-spacing: .14em; }
.ad small { font-size: 12px; color: #c2c2c2; }
.ad-banner { min-height: 90px; width: 100%; max-width: 728px; margin: 0 auto; }
.ad-feed { min-height: 100px; }
.ad-pop { width: 300px; max-width: 100%; height: 250px; }
.ad-corner { position: fixed; z-index: 40; width: 240px; height: 80px; left: calc(14px + env(safe-area-inset-left, 0px)); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
.ad-corner .x { top: 2px; right: 2px; width: 26px; height: 26px; font-size: 16px; }

.info { background: var(--rock-2); border: 2px solid var(--line); padding: 18px; display: grid; gap: 10px; max-width: 860px; width: 100%; margin: 0 auto; min-width: 0; }
.info h2 { font-size: 24px; color: var(--d); }
.info h3 { font-size: 19px; margin-top: 6px; }
.info ol { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.info details { background: var(--rock-3); border: 1px solid var(--line); padding: 8px 12px; }
.info summary { cursor: pointer; font-weight: 700; }
.info details p { margin-top: 6px; color: var(--muted); }
.foot-links { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; }
.foot { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }

/* ---------- minijuego: media pantalla ---------- */
.mini {
  position: fixed; z-index: 25; right: 0; bottom: 0; top: var(--top-h); width: 50vw;
  background: var(--rock); border-left: 3px solid var(--line);
  display: flex; flex-direction: column; gap: 8px; overflow-y: auto;
  padding: 10px max(12px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) 12px;
}
.mini-head { display: flex; align-items: flex-start; gap: 10px; padding-right: 38px; position: relative; }
.mini-head > div { flex: 1; min-width: 0; }
.mini-head .x { top: 0; right: -4px; }
.mini-hint { font-size: 13px; color: var(--muted); }
.auto { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; white-space: nowrap; cursor: pointer; padding-top: 4px; }
.mini-map { border: 3px solid var(--line); line-height: 0; background: #000; max-width: min(100%, calc((100dvh - var(--top-h) - 190px) * 1.5)); width: 100%; align-self: center; }
#mini-canvas { width: 100%; height: auto; image-rendering: pixelated; cursor: pointer; touch-action: manipulation; }
.mini-info { min-height: 20px; font-size: 13.5px; }
.mini-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.palette { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.pal { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px 3px 3px; background: var(--rock-3); border: 2px solid var(--line); font-size: 13px; max-width: 100%; text-align: left; }
.pal img { width: 26px; height: 26px; image-rendering: pixelated; }
.pal.is-on { border-color: var(--d); background: #4a3c2d; }
.queue { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.queue li { display: grid; gap: 2px; background: var(--rock-2); border: 1px solid var(--line); padding: 3px 7px; }
.empty { color: var(--muted); font-size: 13px; margin-top: 4px; }

body.mini-open .page { margin-left: 0; margin-right: 50vw; max-width: none; width: 50vw; }
body.mini-open .layout { grid-template-columns: minmax(0, 1fr); }
body.mini-open .stage { grid-template-columns: 112px minmax(0, 1fr); justify-items: stretch; align-items: center; padding: 10px; gap: 8px; }
body.mini-open .unlock p { display: none; }
body.mini-open .block { padding: 4px; }
body.mini-open .stage-head { grid-column: 2; grid-row: 1; text-align: left; }
body.mini-open .block { grid-column: 1; grid-row: 1; width: 100%; }
body.mini-open .unlock, body.mini-open .guest { grid-column: 1 / -1; }
body.mini-open .stage-head h2 { font-size: 30px; }
body.mini-open .tier-amount { font-size: 26px; }
body.mini-open .gen { grid-template-columns: 72px minmax(0, 1fr); gap: 8px; padding: 8px; }
body.mini-open .gen-pic img { width: 40px; height: 40px; }
body.mini-open .gen-buy { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
body.mini-open .gen-cost { justify-items: start; grid-auto-flow: column; justify-content: start; gap: 10px; flex-wrap: wrap; }
body.mini-open .gen-desc { display: none; }

/* ---------- avisos ---------- */
.toasts { position: fixed; z-index: 60; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); display: grid; gap: 5px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--rock); border: 2px solid var(--d); padding: 6px 10px; font-size: 14px; box-shadow: 0 4px 0 rgba(0,0,0,.5); animation: pop .15s ease-out; }
@keyframes pop { from { transform: translateY(-6px); opacity: 0; } }

/* ---------- ventanas ---------- */
.dlg { background: var(--rock-2); color: var(--fg); border: 3px solid var(--d); padding: 20px; width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; box-shadow: 0 10px 0 rgba(0,0,0,.45); }
.dlg::backdrop { background: rgba(8,6,4,.72); }
.dlg-wide { width: min(760px, calc(100vw - 32px)); }
.dlg > h2 { padding-right: 36px; margin-bottom: 8px; }
.dlg-foot { display: flex; justify-content: flex-end; margin-top: 14px; }
.dlg-ad { width: min(360px, calc(100vw - 32px)); display: none; padding-top: 48px; }
.dlg-ad[open] { display: grid; gap: 10px; justify-items: center; }
.dlg-ok { color: var(--good); text-align: center; }
.field { display: grid; gap: 3px; margin-bottom: 10px; }
.field label, .dwarf-form > label { font-weight: 700; font-size: 13.5px; }
input[type="text"], input[type="email"] { width: 100%; font: inherit; color: var(--fg); background: var(--rock); border: 2px solid var(--line); padding: 8px; }
.google-btn { min-height: 44px; display: flex; justify-content: center; color-scheme: light; margin-bottom: 8px; }
.err { color: var(--bad); font-size: 13.5px; min-height: 19px; }
.note { font-size: 12.5px; color: var(--muted); border-left: 3px solid var(--line); padding-left: 8px; margin-top: 10px; }
.acc-tabs { display: flex; gap: 4px; margin-bottom: 12px; padding-right: 36px; }
.stack { display: grid; gap: 7px; margin-top: 12px; }
.warn { color: var(--bad); font-size: 13.5px; }

.dwarf-grid { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 16px; margin-bottom: 14px; }
.dwarf-preview { background: color-mix(in srgb, var(--a) 25%, var(--rock)); border: 2px solid var(--line); padding: 10px; display: grid; justify-items: center; gap: 5px; align-content: center; }
.dwarf-preview canvas { image-rendering: pixelated; width: 168px; height: 210px; max-width: 100%; }
.dwarf-skin-name { font: 700 15px var(--display); text-align: center; }
.opt-row { margin-top: 10px; }
.opt-row > div:first-child { font-weight: 700; font-size: 13.5px; margin-bottom: 3px; }
.opts { display: flex; flex-wrap: wrap; gap: 5px; }
.sw { width: 34px; height: 34px; border: 2px solid var(--line); padding: 0; }
.sw.is-on, .chip.is-on, .skin.is-on { border-color: #fff; box-shadow: 0 0 0 2px var(--a); }
.chip { background: var(--rock-3); border: 2px solid var(--line); padding: 5px 10px; font-size: 13.5px; }
.skins { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; margin-top: 8px; }
.skin { background: var(--rock-3); border: 2px solid var(--line); padding: 6px 4px; display: grid; justify-items: center; gap: 2px; font-size: 12px; text-align: center; }
.skin canvas { image-rendering: pixelated; width: 48px; height: 60px; }
.skin[disabled] { cursor: not-allowed; color: var(--muted); }
.skin[disabled] canvas { filter: brightness(0) opacity(.55); }

.rank-wrap { overflow-x: auto; max-height: 60dvh; overflow-y: auto; margin-top: 8px; }
.rank { width: 100%; border-collapse: collapse; font-size: 14px; }
.rank th { position: sticky; top: 0; background: var(--rock); text-align: left; padding: 6px 8px; font-family: var(--display); font-weight: 500; }
.rank td { padding: 5px 8px; border-top: 1px solid var(--line); white-space: nowrap; }
.rank .num { text-align: right; }
.rank tr.me td { background: color-mix(in srgb, var(--a) 35%, transparent); font-weight: 700; }
.rank tr.top td:first-child { color: var(--d); font-weight: 700; }
.tier-tag { display: inline-flex; align-items: center; gap: 5px; }
.tier-tag img { width: 16px; height: 16px; image-rendering: pixelated; }
.demo-tag { color: var(--muted); font-size: 11.5px; }

.dlg-tier { text-align: center; }
.dlg-tier #tier-art { width: 160px; height: 160px; margin: 0 auto 10px; animation: forge .8s cubic-bezier(.2,1.6,.4,1); }
.dlg-tier h2 { font-size: 36px; color: var(--d); }
.dlg-tier .dlg-foot { justify-content: center; }
@keyframes forge { from { transform: scale(.2) rotate(-25deg); opacity: 0; } }
.dev-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }

/* ---------- pantallas estrechas ---------- */
@media (max-width: 1500px) { .mat-label { display: none; } }
@media (max-width: 1000px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .mats { order: 3; flex-basis: 100%; }
  .mat { padding: 3px 5px; grid-template-columns: minmax(0, 1fr); }
  .mat img { display: none; }
  .mini { top: auto; left: 0; right: 0; width: 100%; height: 52dvh; border-left: 0; border-top: 3px solid var(--line); }
  body.mini-open .page { width: auto; margin: 0; padding-bottom: 54dvh; }
  .mini-cols { grid-template-columns: 1fr; }
  .mini-map { max-width: 100%; }
}
@media (max-width: 560px) {
  .mat-label { display: none; }
  .mat b { font-size: 14px; }
  .mat small { font-size: 12px; }
  .actions { width: 100%; }
  .actions .btn { flex: 1 1 auto; padding: 6px; font-size: 14px; }
  .brand-sub { display: none; }
  .gen { grid-template-columns: 72px minmax(0, 1fr); gap: 8px; padding: 8px; }
  .gen-pic img { width: 40px; height: 40px; }
  .gen-buy { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .gen-cost { justify-items: start; }
  .gen-stats { grid-template-columns: minmax(0, 1fr); }
  .dwarf-grid { grid-template-columns: minmax(0, 1fr); }
  .qty { margin-left: 0; }
  .stage-head h2 { font-size: 32px; }
  .ad-corner { width: 190px; height: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
