/*
 * ==================================================================
 * HOJA DE ESTILOS 1/4 · BASE, BOTONES, PANELES Y MENÚS
 * Variables, tipografía, botones, paneles, título, campaña, atlas, tienda, cajas, ajustes y HUD de la partida.
 * El orden de los archivos importa (cascada): base → screens → game-layout → extras.
 * ==================================================================
 */

:root {
  --ink: #262fb0;
  --paper: #f4f7fb;
  --mut: #5b66b8;
  --acc: #ffcf3f;
  --blu: #8fd0ff;
  --f: "Patrick Hand","Segoe Print","Comic Sans MS",cursive;
  --h: "Permanent Marker","Segoe Print","Comic Sans MS",cursive;
  --wr: 255px 14px 225px 14px/14px 225px 14px 255px;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top,0px);
  padding-bottom: env(safe-area-inset-bottom,0px);
}

html,
body {
  height: 100%;
}

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

[hidden] {
  display: none!important;
}

body {
  margin: 0;
  color: var(--ink);
  font: 1.12rem/1.3 var(--f);
  background: linear-gradient(90deg,#262fb016 1px,transparent 1px) 0 0/30px 30px,linear-gradient(#262fb016 1px,transparent 1px) 0 0/30px 30px,var(--paper);
  background-attachment: fixed;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 14px 14px 170px;
}

button {
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}

button:focus-visible {
  outline: 3px solid var(--acc);
  outline-offset: 2px;
}

h2,
h3 {
  font: 400 1.35rem var(--h);
  color: var(--ink);
  margin: 0 0 8px;
  letter-spacing: .02em;
}

h2 {
  background: linear-gradient(transparent 62%,#ffcf3f99 62%);
  display: inline-block;
}

.mut {
  color: var(--mut);
  font-size: .95rem;
}

.cen {
  text-align: center;
}

.bt {
  font: 400 1.25rem var(--h);
  letter-spacing: .03em;
  background: var(--acc);
  border: 3px solid var(--ink);
  border-radius: var(--wr);
  padding: 8px 20px;
  box-shadow: 3px 4px 0 var(--ink);
  transform: rotate(-.6deg);
  transition: transform .1s,box-shadow .1s;
}

.bt:hover:not(:disabled) {
  transform: rotate(.9deg) translateY(-2px);
}

.bt:active:not(:disabled) {
  transform: translate(3px,4px);
  box-shadow: 0 0 0 var(--ink);
}

.bt.bl {
  background: var(--blu);
}

.bt:disabled {
  opacity: .5;
  filter: grayscale(.7);
  cursor: not-allowed;
}

.bt.sm {
  padding: 4px 12px;
  font-size: 1rem;
}

.bt.big {
  width: 100%;
  font-size: 1.8rem;
  padding: 12px;
}

.pn {
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: var(--wr);
  padding: 14px;
  margin: 0 0 14px;
  box-shadow: 4px 5px 0 #262fb0cc;
}

.gi {
  display: inline-block;
  width: .75em;
  height: .75em;
  background: #7be8ff;
  border: 2px solid var(--ink);
  transform: rotate(45deg) scale(.9);
  margin: 0 .2em;
  vertical-align: -.05em;
  border-radius: 2px;
}

.gm {
  font: 400 1.1rem var(--h);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 99px;
  padding: 2px 14px;
  box-shadow: 2px 3px 0 var(--ink);
}

.hd {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.hd h2 {
  flex: 1;
  margin: 0;
  font-size: 1.9rem;
}

.ttl {
  margin: 6px 0 0;
  text-align: center;
  position: relative;
  padding-top: 34px;
}

.ttl .tw {
  display: block;
  line-height: .95;
}

.ttl span {
  display: inline-block;
  transform: translateY(var(--y)) rotate(var(--r));
  font: 400 clamp(2.7rem,13vw,4.8rem)/1 var(--h);
  -webkit-text-stroke: 3px var(--ink);
  text-shadow: 4px 0 #fff,-4px 0 #fff,0 4px #fff,0 -4px #fff,3px 3px #fff,-3px 3px #fff,3px -3px #fff,-3px -3px #fff,6px 8px 0 var(--ink);
}

.ttl .t0 span {
  color: #ffcf3f;
  animation: bn 3s ease-in-out infinite;
}

.ttl .t1 span {
  color: #8fd0ff;
  font-size: clamp(2rem,10.4vw,3.8rem);
  animation: bn 3s ease-in-out infinite .4s;
}

.ttl .gem {
  position: absolute;
  left: 50%;
  top: 2px;
  width: 30px;
  height: 30px;
  margin-left: -15px;
  background: #7be8ff;
  border: 4px solid var(--ink);
  transform: rotate(45deg);
  box-shadow: 0 0 0 4px #fff,5px 6px 0 4px var(--ink);
  animation: fl 3s ease-in-out infinite;
}

@keyframes bn {
  50% { transform: translateY(calc(var(--y) - 5px)) rotate(var(--r)); }
}

@keyframes fl {
  50% { transform: rotate(45deg) translate(-4px,-4px); }
}

.mn {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  margin: 20px auto;
  max-width: 320px;
}

.gmw {
  text-align: center;
}

.car {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vp {
  flex: 1;
  overflow: hidden;
  padding: 2px 2px 10px;
}

.tr {
  display: flex;
  transition: transform .45s cubic-bezier(.2,.8,.2,1);
}

.mp {
  flex: 0 0 100%;
  padding: 0 4px;
}

.mc {
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: var(--wr);
  padding: 12px;
  text-align: center;
  box-shadow: 4px 5px 0 #262fb0cc;
}

.mc p {
  margin: 2px 0;
}

.mw {
  position: relative;
}

.mt {
  width: 100%;
  height: auto;
  border: 3px solid var(--ink);
  border-radius: 10px;
  display: block;
  margin: 0 auto 8px;
  background: #fff;
}

.mt.lk {
  filter: grayscale(1) brightness(.85);
}

.lkb {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 3.5rem;
}

.lv {
  display: grid;
  grid-template-columns: repeat(6,1fr);
  gap: 8px;
  max-width: 480px;
  margin: 10px auto 0;
}

.lv button {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 2px;
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: var(--wr);
  box-shadow: 2px 3px 0 var(--ink);
}

.lv button:hover:not(:disabled) {
  background: #fff6cf;
}

.lv button:disabled {
  border-style: dashed;
  box-shadow: none;
  opacity: .55;
  cursor: not-allowed;
}

.lv button.on {
  background: var(--acc);
}

.lv b {
  font: 1.3rem var(--h);
}

.lv span {
  font-size: .8rem;
  color: #d98a00;
}

.dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 8px 0;
}

.dots i {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: #fff;
}

.dots i.on {
  background: var(--acc);
}

.ar {
  padding: 12px 10px;
}

.sls,
.gr {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.hs {
  width: 84px;
  height: 96px;
  border: 3px dashed #262fb066;
  border-radius: var(--wr);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  background: #fff;
}

.hs.f {
  border: 3px solid var(--ink);
  cursor: pointer;
  box-shadow: 2px 3px 0 var(--ink);
}

.hs.ov {
  background: #fff6cf;
}

.hs b {
  font-size: 2rem;
  color: #262fb066;
}

.hc {
  width: 106px;
  border: 3px solid var(--ink);
  border-radius: var(--wr);
  background: #fff;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: grab;
  text-align: center;
  box-shadow: 3px 4px 0 var(--r);
  transition: transform .1s;
}

.hc:hover:not(.hid) {
  transform: rotate(-1.5deg) translateY(-3px);
}

.hc b {
  font-size: .95rem;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.hc small {
  color: var(--mut);
}

.hc.hid {
  border-style: dashed;
  opacity: .75;
  cursor: default;
  box-shadow: none;
}

.rh {
  margin: 14px 0 8px;
  display: inline-block;
  border-bottom: 6px solid;
}

.ov2 {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #f4f7fbcc;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pp {
  text-align: center;
  margin: 0;
  min-width: 240px;
}

.bb {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

.ins {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(280px,1fr));
  gap: 12px;
}

#demo {
  border-radius: 10px;
  border: 3px solid var(--ink);
  background: #fff;
}

.tag {
  display: inline-block;
  padding: 0 12px;
  border: 2.5px solid var(--ink);
  border-radius: 99px;
  color: var(--ink);
  font: 400 .95rem var(--h);
}

table {
  width: 100%;
  border-collapse: collapse;
}

td,
th {
  padding: 6px 8px;
  border-bottom: 2px dashed #262fb040;
  text-align: right;
}

td:first-child,
th:first-child {
  text-align: left;
}

tr.ul td {
  background: #fff3b8;
}

.sc {
  overflow-x: auto;
}

.atk {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(240px,1fr));
  gap: 10px;
}

.atk>div {
  background: #f4f7fb;
  border: 2.5px solid var(--ink);
  border-radius: var(--wr);
  padding: 10px;
}

.atk .u2 {
  background: #fff3b8;
}

.atk p {
  margin: 4px 0;
}

.bxs {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(280px,1fr));
  gap: 14px;
}

.bx {
  text-align: center;
}

.bx canvas {
  width: 170px;
  height: auto;
}

.od {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  justify-content: center;
  font-size: .95rem;
}

.od span {
  border-bottom: 3px solid var(--c);
}

.st2 {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 2px dashed #262fb040;
}

.st2 span {
  flex: 1;
}

.st2 input[type=range] {
  flex: 1.2;
  accent-color: var(--ink);
}

.st2 b {
  width: 2.2em;
  text-align: right;
  font-family: var(--h);
}

.st2 select {
  font: inherit;
  padding: 6px;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  border: 2.5px solid var(--ink);
}

.cdf {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.cdf input {
  flex: 1;
  min-width: 0;
  font: inherit;
  text-transform: uppercase;
  padding: 8px 12px;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  border: 2.5px solid var(--ink);
}

.ro {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: linear-gradient(90deg,#262fb016 1px,transparent 1px) 0 0/30px 30px,linear-gradient(#262fb016 1px,transparent 1px) 0 0/30px 30px,#f4f7fb;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  overflow: auto;
}

.rgm {
  position: absolute;
  top: 12px;
  right: 12px;
}

.ro h2 {
  font-size: 1.9rem;
}

#cs {
  width: min(100%,640px);
  height: auto;
  border: 3px solid var(--ink);
  border-radius: var(--wr);
  background: #fff;
  box-shadow: 5px 6px 0 var(--ink);
}

.cc {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  max-width: 640px;
}

.ci {
  border: 3px solid var(--r);
  border-radius: 50%;
  background: #fff;
  line-height: 0;
}

.nt {
  position: fixed;
  left: 50%;
  bottom: 60px;
  transform: translateX(-50%);
  background: #fff;
  border: 3px solid var(--ink);
  box-shadow: 3px 4px 0 var(--ink);
  padding: 6px 16px;
  border-radius: var(--wr);
  z-index: 200;
}

#ver {
  position: fixed;
  right: calc(10px + env(safe-area-inset-right,0px));
  bottom: calc(8px + env(safe-area-inset-bottom,0px));
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 6px;
  font: .85rem var(--f);
  color: var(--mut);
  pointer-events: none;
  user-select: none;
}

#ver b {
  padding: 0 6px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  color: var(--ink);
  background: var(--acc);
  font-family: var(--h);
  font-weight: 400;
}

.top {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.top button {
  font: 400 1rem var(--h);
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: var(--wr);
  padding: 4px 12px;
  box-shadow: 2px 3px 0 var(--ink);
}

.top button:hover:not(:disabled) {
  background: #fff6cf;
}

.top button:disabled {
  opacity: .45;
}

.top .st {
  order: 3;
  flex: 1 1 100%;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.top .st span {
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: 12px 4px 12px 4px;
  padding: 0 10px;
  font-size: .95rem;
}

.cv {
  position: relative;
  overflow: hidden;
  border: 4px solid var(--ink);
  border-radius: var(--wr);
  box-shadow: 5px 6px 0 var(--ink);
  background: #fff;
}

#start {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  width: max-content;
  margin: auto;
  z-index: 5;
  font-size: 1.6rem;
  padding: 10px 34px;
}

@media (max-width: 600px) {
  #start {
    bottom: 8px;
    font-size: 1rem;
    padding: 5px 16px;
  }
}

canvas {
  width: 100%;
  height: auto;
  display: block;
  touch-action: manipulation;
}

#ov {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #f4f7fbed;
  text-align: center;
  z-index: 10;
}

#ov h2 {
  font: 400 2.6rem var(--h);
  background: linear-gradient(transparent 62%,#ffcf3f99 62%);
  margin: 0;
}

#ov button {
  font: 400 1.1rem var(--h);
  background: var(--acc);
  border: 3px solid var(--ink);
  border-radius: var(--wr);
  padding: 6px 16px;
  box-shadow: 3px 4px 0 var(--ink);
}

.mods {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 0 12px;
}

.mods button {
  max-width: 210px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: var(--wr);
  padding: 8px;
}

#bar {
  display: flex;
  width: fit-content;
  max-width: 100%;
  margin: 12px auto;
  padding: 8px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: var(--wr);
  box-shadow: 4px 5px 0 #262fb0cc;
}

#bar button {
  position: relative;
  width: clamp(46px,12vw,64px);
  aspect-ratio: 1;
  padding: 0;
  margin: 0 3px;
  background: #fffbe6;
  border: 3px solid var(--ink);
  border-bottom: 8px solid var(--r);
  border-radius: 10px;
  transition: transform .1s;
}

#bar button:hover:not(:disabled) {
  transform: translateY(-3px) rotate(-2deg);
}

#bar button.sl {
  background: var(--acc);
  transform: translateY(-5px) rotate(2deg);
}

#bar button.poor {
  filter: grayscale(.7) opacity(.6);
}

#bar canvas {
  width: 80%;
  height: 80%;
  margin: auto;
  display: block;
}

#bar i {
  position: absolute;
  top: 0;
  left: 4px;
  font: .75rem var(--h);
  font-style: normal;
}

#bar small {
  position: absolute;
  right: 3px;
  bottom: -1px;
  font: .75rem var(--h);
}

#sel,
#tp {
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: var(--wr);
  box-shadow: 3px 4px 0 var(--ink);
}

#sel {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 12px;
  height: 104px;
  overflow: auto;
  contain: layout;
}

#sel canvas {
  width: 56px;
  height: 56px;
}

.inf {
  flex: 1;
  min-width: 180px;
}

.inf p {
  margin: 2px 0;
}

.inf small,
.hint {
  color: var(--mut);
}

.inf b {
  font-family: var(--h);
  font-weight: 400;
}

#tp {
  position: absolute;
  z-index: 6;
  width: 212px;
  max-height: calc(100% - 8px);
  overflow: auto;
  padding: 8px;
  font-size: .95rem;
  display: none;
}

#tp .h {
  display: flex;
  gap: 8px;
  align-items: center;
}

#tp canvas {
  width: 44px;
  height: 44px;
}

#tp b {
  font-family: var(--h);
  font-weight: 400;
}

#tp p {
  margin: 6px 0 4px;
}

#tp small {
  color: var(--mut);
}

#tp .b {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

#tp .b button {
  flex: 1;
  padding: 4px;
  font: 400 .9rem var(--h);
  background: var(--acc);
  border: 2.5px solid var(--ink);
  border-radius: var(--wr);
}

#tp .b button:disabled {
  opacity: .5;
}

body[data-q=Baja] * {
  animation: none!important;
}

body[data-q=Baja] .pn,
body[data-q=Baja] .bt {
  box-shadow: none;
}

.trp {
  width: min(92vw,440px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#trl {
  overflow-y: auto;
  min-height: 0;
}

.tr-r {
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 2px dashed #262fb040;
}

.tr-r canvas {
  width: 40px;
  flex: none;
}

.tr-r div {
  flex: 1;
  min-width: 0;
}

.tr-r small {
  display: block;
}

.tr-r .bt {
  font-size: .9rem;
  padding: 4px 10px;
  white-space: nowrap;
}

.mkh {
  margin-top: 18px;
}

.mkh p {
  margin: 4px 0 0;
}

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

.mko {
  position: relative;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  border-top: 6px solid var(--r);
}

.mko canvas {
  width: 64px;
  height: 64px;
}

.mko small {
  opacity: .75;
}

.mko .mkn {
  font-family: var(--h);
  color: #d98a00;
}

.mko.sold {
  opacity: .5;
}

.mkd {
  position: absolute;
  top: -10px;
  right: -8px;
  font-style: normal;
  font: 400 .95rem var(--h);
  background: #ff4f81;
  color: #fff;
  border: 2.5px solid var(--ink);
  border-radius: 99px;
  padding: 0 8px;
  transform: rotate(8deg);
}

/* Iconos propios (ic() en js/04-ink.js) */
.ico {
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  vertical-align: -.24em;
  flex: none;
}

.ico svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.stars {
  display: inline-flex;
  gap: 1px;
  vertical-align: middle;
}

.endstars .ico {
  width: 2.6rem;
  height: 2.6rem;
}

.endstars .ico:nth-child(2) {
  transform: translateY(-8px) scale(1.15);
}

.top .st span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.top .st span b {
  font-weight: 400;
}

#tc.full {
  background: #ffe3df;
}

/* Inspección: anterior / equipar / siguiente */
.inav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 12px;
  flex-wrap: wrap;
}

.inav .bt span {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}

@media (max-width: 560px) {
  .inav .bt span {
    display: none;
  }
}

/* Cinemática de las tropas secretas (js/20-secretos.js) */
.scn {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: #05040c;
  cursor: pointer;
}

.scn canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.scn .scs {
  position: absolute;
  right: 16px;
  bottom: 16px;
}

.swp .hs {
  cursor: pointer;
  font: inherit;
}
