/* ---------- home ---------- */
.touch #btn-fs { display: none; }
.touch .roster { scrollbar-width: none; }   /* touch devices go fullscreen on the first tap */
#screen-select { overflow-x: hidden; align-items: stretch; justify-content: safe center; gap: clamp(8px, 1.6vh, 18px); padding: 10px clamp(12px, 3vw, 36px); }
.home-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }   /* title centered, tools tucked to the right */
#screen-select .logo { grid-column: 2; font-size: clamp(26px, 5vw, 48px); letter-spacing: 2px; white-space: nowrap; }
.home-tools { display: flex; align-items: center; gap: 8px; grid-column: 3; justify-self: end; }
.home-body { display: grid; grid-template-columns: minmax(0, 1fr) clamp(240px, 30vw, 340px); gap: clamp(10px, 2vw, 28px); align-items: start; }
.home-left, .home-right { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.home-right { align-self: center; }
.home-left { padding: 8px clamp(8px, 2vw, 24px) 6px; border-radius: 22px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(224, 24, 45, .25); }
#screen-select .section { display: block; margin: 4px 0 0; text-align: center; }
#pick-for { color: var(--accent); }

.duel { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; justify-items: center; gap: 4px; }
.enemies { display: flex; align-items: flex-end; justify-content: center; gap: 6px; }
.fighter { position: relative; display: flex; flex-direction: column; align-items: center; padding: 4px 10px 6px; border: 2px solid transparent; border-radius: 18px; cursor: pointer; transition: opacity .2s, background .15s, border-color .15s; }
.fighter.active { border-color: var(--accent); background: rgba(224, 24, 45, .12); box-shadow: 0 0 22px rgba(224, 24, 45, .3); }
.fighter h2 { margin: 0; font-size: 13px; letter-spacing: 2px; text-transform: uppercase; opacity: .7; }
.art { height: clamp(110px, 27vh, 250px); filter: drop-shadow(0 8px 10px rgba(224, 24, 45, .3)); }
#screen-select .fname { min-height: 1lh; font-size: clamp(16px, 2.4vw, 22px); margin: 0; }   /* the empty second slot keeps a name line, so it is as tall as a filled card */

/* the second enemy always has its place reserved (an empty card with a plus), so adding one never moves the layout */
.enemy2-slot { display: grid; }
.enemy2-slot > * { grid-area: 1 / 1; }
.fighter.empty { visibility: hidden; }
.add-enemy { margin: 0; border: 2px dashed rgba(255, 255, 255, .3); border-radius: 18px; background: rgba(255, 255, 255, .04); color: #fff; font-size: clamp(26px, 4vw, 40px); font-weight: 900; transition: background .15s, border-color .15s; }
@media (hover: hover) { .add-enemy:hover { background: rgba(224, 24, 45, .2); border-color: var(--accent); } }
.remove-enemy { position: absolute; top: -8px; right: -6px; z-index: 2; width: 26px; height: 26px; padding: 0; border: 2px solid rgba(255, 255, 255, .3); border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; font-weight: 900; line-height: 1; }
.duel.three .art { height: clamp(90px, 21vh, 190px); }
.duel.three .fighter { padding: 4px 4px 6px; }
#screen-select .vs { align-self: center; font-size: clamp(22px, 4vw, 44px); transition: opacity .2s; }   /* centered on the character cards */

/* one strip for every character: scrolls sideways, so it keeps working with many fighters */
.roster { display: flex; justify-content: safe center; gap: 8px; padding: 8px 16px 10px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin; -webkit-overflow-scrolling: touch; mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent); }
#screen-select .roster .card { flex: none; width: 78px; scroll-snap-align: center; }
#screen-select .roster .card img { height: 66px; }

#screen-select .maps { display: grid; grid-template-columns: repeat(auto-fit, minmax(62px, 1fr)); gap: 8px; margin: 0; }
#screen-select .map { width: 100%; }
.map.random i { display: grid; place-items: center; font-style: normal; font-size: 30px; font-weight: 900; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
button { -webkit-tap-highlight-color: transparent; }
.act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 64px; padding: 8px; border: 2px solid rgba(255, 255, 255, .18); border-radius: 16px; background: #26202a; color: #fff; box-shadow: 0 5px 0 #000; transition: transform .1s, box-shadow .1s; }
.act i { font-style: normal; font-size: 24px; line-height: 1; }
.act b { font-size: 16px; font-weight: 900; line-height: 1; }
@media (hover: hover) { .act:hover { transform: translateY(-3px); border-color: var(--accent); } }   /* on touch a long press would leave it stuck */
.act:active { transform: translateY(3px); box-shadow: 0 2px 0 #000; }
.act.play { grid-column: 1 / -1; flex-direction: row; gap: 14px; min-height: 84px; border-color: transparent; background: linear-gradient(#f0293c, #c4111f); box-shadow: 0 6px 0 #7a0c18, 0 0 30px rgba(224, 24, 45, .45); }
.act.play i { font-size: 38px; }
.act.play i svg { display: block; width: 1.5em; height: auto; fill: #fff; }
.act.play span { display: flex; flex-direction: column; align-items: flex-start; }
.act.play b { font-size: 30px; line-height: 1; }
.act.play em { font-style: normal; font-size: 12px; font-weight: 700; opacity: .85; }
.act.play:active { box-shadow: 0 2px 0 #7a0c18; }

@media (min-width: 720px) {   /* wide screens: same columns as .home-body, so the title is centered over the card panel */
  .home-top { grid-template-columns: minmax(0, 1fr) clamp(240px, 30vw, 340px); column-gap: clamp(10px, 2vw, 28px); }
  #screen-select .logo { grid-column: 1; text-align: center; }
  .home-tools { grid-column: 2; justify-self: stretch; justify-content: flex-end; }
}
@media (max-width: 560px) {
  .home-top { grid-template-columns: 1fr; justify-items: center; gap: 6px; }
  #screen-select .logo, .home-tools { grid-column: 1; justify-self: center; }
}

/* phone in portrait: a single column */
@media (max-width: 719px) {
  #screen-select .logo { font-size: 28px; }
  .home-body { grid-template-columns: minmax(0, 1fr); }
  .art { height: clamp(120px, 24vh, 220px); }
  .duel.three .art { height: clamp(50px, 15vw, 150px); }   /* player, enemy and the plus slot must fit the width */
  .fighter h2 { font-size: 10px; letter-spacing: 1px; }
  .duel.three .fighter { padding: 4px 2px 6px; }
}

/* phone in landscape: everything must fit in a short screen */
@media (max-height: 520px) {
  .duel.three .art { height: clamp(50px, min(24vh, 15vw), 110px); }
  #screen-select { gap: 0; padding: 6px 12px; }
  #screen-select .logo { font-size: 24px; }
  .art { height: clamp(90px, 34vh, 160px); }
  .fighter h2 { font-size: 11px; }
  #screen-select .section { font-size: 10px; margin: 0; }
  .roster { padding: 4px 14px 6px; }
  #screen-select .roster .card { width: 60px; }
  #screen-select .roster .card img { height: 46px; }
  #screen-select .roster .card span { font-size: 10px; }
  .home-body { gap: 10px; }
  .home-left { padding: 4px 10px; border-radius: 16px; }
  #screen-select .maps { grid-template-columns: repeat(auto-fit, minmax(48px, 1fr)); gap: 6px; }
  #screen-select .map { font-size: 9px; padding: 3px; border-width: 2px; }
  .actions { gap: 8px; margin-top: 2px; }
  .act { min-height: 44px; padding: 4px; border-radius: 12px; box-shadow: 0 3px 0 #000; }
  .act i { font-size: 18px; }
  .act b { font-size: 13px; }
  .act.play { min-height: 58px; box-shadow: 0 4px 0 #7a0c18; }
  .act.play i { font-size: 28px; }
  .act.play b { font-size: 22px; }
  #screen-select .help { display: none; }
}

/* phones: the maps stay in two rows and scroll sideways, like the character strip */
@media (max-width: 719px), (max-height: 520px) {
  #screen-select .maps { grid-template-columns: none; grid-template-rows: repeat(2, auto); grid-auto-flow: column; grid-auto-columns: 72px; justify-content: safe center; overflow-x: auto; padding: 4px 14px 8px; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent); }
  #screen-select .map { scroll-snap-align: start; }
}
@media (max-height: 520px) {
  #screen-select .maps { grid-auto-columns: 56px; }
}

/* training ignores the enemy choice: dim it while the Training button is hovered */
.side, .vs { transition: opacity .2s; }
#screen-select.training-preview .fighter[data-side="enemy"],
#screen-select.training-preview .fighter[data-side="enemy2"],
#screen-select.training-preview .add-enemy,
#screen-select.training-preview .vs { opacity: .12; pointer-events: none; }
