/* battle screens: the board, campaign map, friend battle */

/* ---------- board ---------- */
.bb { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.bb-top { height: 84px; flex: none; padding: 0 28px; display: flex; align-items: center; gap: 18px; border-bottom: 1px solid rgba(232,184,90,.14); background: rgba(7,6,12,.6); }
.bb-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bb-hints { margin-left: auto; white-space: nowrap; }
.bb-hints b { color: var(--fg); font-family: var(--head); }
.bb-body { flex: 1; min-height: 0; display: flex; }
.bb-log { width: 300px; flex: none; padding: 22px; border-right: 1px solid rgba(232,184,90,.12); background: rgba(7,6,12,.45); display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.bb-log ul { list-style: none; margin: 0; padding: 0; }
.bb-log li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid rgba(235,233,247,.06); font-size: 14px; line-height: 1.35; animation: fade .3s; }
.bb-log li > i { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; flex: none; background: var(--brass); }
.bb-log li > i.foe { background: #FF7884; } .bb-log li > i.pw { background: #B98CFF; } .bb-log li > i.heal { background: var(--online); } .bb-log li > i.dodge { background: var(--cyan); }
.bb-log .r { color: #FF7884; } .bb-log .y { color: var(--gold-hi); } .bb-log .g { color: var(--online); } .bb-log .c { color: var(--cyan); }
.bb-board { flex: 1; min-width: 0; padding: 22px 30px 20px; display: flex; flex-direction: column; align-items: center; container-type: inline-size; overflow: hidden;
  --tw: min(210px, 30cqw, calc((((100dvh / var(--z, 1)) - 270px) / 2 - 58px) * 1.3)); }
.n2 .bb-board { --tw: min(230px, 40cqw, calc((((100dvh / var(--z, 1)) - 270px) / 2 - 58px) * 1.3)); }
.n1 .bb-board { --tw: min(250px, 60cqw, calc((((100dvh / var(--z, 1)) - 270px) / 2 - 58px) * 1.3)); }
.bb-side { align-self: flex-start; font: 600 12px var(--head); letter-spacing: 3px; text-transform: uppercase; color: #FF7884; }
.bb-row { display: flex; justify-content: center; gap: clamp(8px, 2.4cqw, 26px); margin-top: 10px; }
.bb-row.mine { align-items: flex-end; margin-top: 0; }
.bb-turn { flex: 1; min-height: 50px; display: flex; align-items: center; justify-content: center; }
.bb-turn .pill { padding: 8px 24px; border-radius: 22px; font: 700 15px var(--head); letter-spacing: 3px; text-transform: uppercase; animation: pop .35s cubic-bezier(.3,1.6,.5,1); }
.bb-turn .pill.mine { background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo)); color: #1A0D05; box-shadow: 0 6px 20px rgba(224,161,42,.4); }
.bb-turn .pill.theirs { background: rgba(255,77,94,.15); border: 1px solid rgba(255,77,94,.6); color: #FF7884; }
.bb-teamlabel { align-self: stretch; display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 10px; }
.pip { width: 7px; height: 7px; border-radius: 50%; background: rgba(232,184,90,.2); display: inline-block; }
.pip.on { background: var(--brass); }

/* a card on the board */
.bb-tok { position: relative; width: var(--tw); flex: none; padding: 0; border: 1px solid rgba(154,151,173,.45); border-radius: 14px; overflow: hidden; cursor: pointer; text-align: left; color: var(--fg);
  font-size: clamp(11px, calc(var(--tw) * .075), 16px); -webkit-tap-highlight-color: transparent; }
.bb-tok[aria-disabled] { cursor: default; }
.bb-tok.ready { border-color: var(--brass); animation: ready 2.2s ease-in-out infinite; }
.bb-tok.gold { border: 2px solid var(--gold-hi); box-shadow: 0 0 0 4px rgba(232,184,90,.25), 0 0 26px rgba(232,184,90,.5); }
.bb-tok.red { border: 2px solid #FF4D5E; box-shadow: 0 0 22px rgba(255,77,94,.6); }
.bb-tok.green { border: 2px solid #3DFF8A; box-shadow: 0 0 22px rgba(61,255,138,.6); }
.bb-tok.power { border: 2px solid var(--brass); border-color: #B46BFF; animation: pwr 1.1s ease-in-out infinite alternate; }
.bb-tok.ko { opacity: .4; }
.bb-tok.ko img { filter: grayscale(1); }
.bb-tok.acted { opacity: .45; }
@keyframes ready { 0%, 100% { box-shadow: 0 0 4px rgba(232,184,90,.15); } 50% { box-shadow: 0 0 16px rgba(232,184,90,.55); } }
@keyframes pwr { from { box-shadow: 0 0 10px rgba(180,107,255,.4); } to { box-shadow: 0 0 22px rgba(180,107,255,.85); } }
.bb-art { position: relative; display: block; aspect-ratio: 1.3; overflow: hidden; background: var(--panel); }
.bb-art > img { width: 100%; height: 100%; object-fit: cover; }
.bb-flash { position: absolute; inset: 0; background: rgba(255,77,94,.35); animation: fade .1s; }
.bb-flash.heal { background: rgba(61,255,138,.25); }
.bb-pop { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 2.5em var(--head); color: #fff;
  text-shadow: 0 0 8px #FF4D5E, 0 2px 1px #000; animation: bbpop .35s cubic-bezier(.3,1.6,.5,1); pointer-events: none; }
.bb-pop.heal { text-shadow: 0 0 8px #3DFF8A, 0 2px 1px #000; }
@keyframes bbpop { from { transform: scale(.3); opacity: 0; } }
.bb-ko { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 2.4em var(--head); color: var(--pink); text-shadow: 0 2px 1px #000; animation: kopop .4s ease-out; }
@keyframes kopop { from { transform: scale(2.2); opacity: 0; } }
.bb-prev { position: absolute; left: 6px; right: 6px; bottom: 6px; padding: 3px 0; border-radius: 8px; text-align: center; background: rgba(255,77,94,.92); font: 700 1em var(--head); color: #fff; }
.bb-prev.heal { background: rgba(61,255,138,.92); color: #06210F; }
.bb-chips { position: absolute; top: 6px; left: 6px; right: 6px; display: flex; justify-content: space-between; }
.bb-chip { padding: 2px 7px; border-radius: 6px; background: rgba(7,6,12,.85); color: var(--muted); font: 700 .8em var(--head); }
/* a passive (cyan) or power card (violet) callout: low on the art, under the cooldown chip */
.bb-call { position: absolute; left: 4px; right: 4px; bottom: 8px; margin: 0 auto; width: max-content; max-width: calc(100% - 8px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 3px 7px; border-radius: 8px; background: rgba(7,6,12,.9); border: 1px solid var(--cyan); color: var(--cyan); font: 700 .85em var(--head); letter-spacing: 1px;
  box-shadow: 0 0 6px rgba(63,240,255,.6); animation: bbpop .3s cubic-bezier(.3,1.6,.5,1); }
.bb-call.pw { border-color: #B46BFF; color: #B46BFF; box-shadow: 0 0 6px rgba(180,107,255,.6); }
.bb-status { position: absolute; left: 6px; bottom: 6px; display: flex; gap: 3px; }
.bb-status span { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(7,6,12,.85); color: #B46BFF; }
.bb-info { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px 10px; }
.bb-name { display: flex; align-items: center; gap: 6px; font-family: var(--head); }
.bb-name i { width: .6em; height: .6em; border-radius: 2px; flex: none; }
.bb-name b { flex: 1; min-width: 0; font-size: 1.1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bb-name .num { font-weight: 700; }
.bb-hp { position: relative; height: 7px; border-radius: 4px; background: rgba(255,255,255,.1); overflow: hidden; }
.bb-hp i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; transition: width .45s ease-out; }
.bb-hp i.ghost { background: rgba(255,77,94,.6); transition: none; }
.bb-key { min-width: 24px; height: 24px; padding: 0 6px; border-radius: 6px; border: 1px solid rgba(235,233,247,.25); background: rgba(7,6,12,.7); color: var(--muted);
  font: 600 12px var(--head); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.bb-tok .bb-key { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); opacity: .85; }

/* moves rail */
.bb-moves { width: 340px; flex: none; padding: 22px 24px; border-left: 1px solid rgba(232,184,90,.12); background: rgba(7,6,12,.45); display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.bb-prompt { margin: 0; min-height: 40px; font: 600 15px var(--body); color: var(--fg); }
.bb-prompt.wait { color: #FF7884; } .bb-prompt.err { color: var(--pink); }
.bb-btns { display: flex; flex-direction: column; gap: 10px; }
.bb-move { width: 100%; min-height: 72px; padding: 0 16px; display: flex; align-items: center; gap: 12px; text-align: left; border-radius: 14px; cursor: pointer;
  background: var(--field); border: 1px solid rgba(232,184,90,.55); color: var(--fg); transition: transform .08s; }
.bb-move b { font: 700 17px var(--head); }
.bb-move .sub { font: 600 13px var(--body); color: var(--brass); }
.bb-move:disabled { cursor: default; color: #6E6A88; border-color: rgba(232,184,90,.2); }
.bb-move:disabled .sub { color: #6E6A88; }
.bb-move.dash { border-style: dashed; }
.bb-move.on { background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo)); color: #1A0D05; border-color: transparent; box-shadow: 0 6px 18px rgba(224,161,42,.4); }
.bb-move.on .sub { color: #3A2408; }
.bb-move.on .bb-key { color: #3A2408; border-color: rgba(26,13,5,.35); background: rgba(255,255,255,.25); }
.bb-move:active:not(:disabled) { transform: scale(.98); }
.bb-adv { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: rgba(61,255,138,.08); border: 1px solid rgba(61,255,138,.3); font-size: 13px; }
.bb-adv b { font-family: var(--head); color: #3DFF8A; }
.bb-handwrap { order: 5; }
.bb-hand { display: flex; gap: 12px; flex-wrap: wrap; transition: opacity .2s; }
.bb-hand.off { opacity: .55; }
.bb-pwnote { order: 6; margin: 0; }
.bb-pw { width: 120px; height: 168px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; border-radius: 14px; cursor: pointer; color: var(--fg);
  border: 1px solid var(--rc); background: linear-gradient(170deg, #2A1450, #0B0918); box-shadow: 0 4px 10px rgba(0,0,0,.6); transition: transform .25s cubic-bezier(.3,1.4,.5,1), box-shadow .2s; }
.bb-pw.glow { box-shadow: 0 0 14px rgba(180,107,255,.6); }
.bb-pw.picked { transform: translateY(-10px); box-shadow: 0 0 22px rgba(180,107,255,.9); }
.bb-pw .tag { font: 600 9px var(--head); letter-spacing: 2px; text-transform: uppercase; color: #B46BFF; }
.bb-pw .pic { position: relative; width: 100%; aspect-ratio: 1.3; border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--cyan);
  background: radial-gradient(circle, color-mix(in srgb, var(--rc) 35%, transparent), #120A24 75%); }
.bb-pw .pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bb-pw b { font: 700 14px var(--head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bb-pw .eff { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.2; }

/* result card */
.bb-result { position: absolute; inset: 0; z-index: 5; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .3s; }
.bb-result .box { width: min(360px, 100%); padding: 24px; border-radius: 22px; background: rgba(7,6,12,.92); border: 1px solid rgba(232,184,90,.5); display: flex; flex-direction: column; gap: 14px; text-align: center; animation: pop .35s; }
.bb-result h2 { margin: 0; font: 700 34px var(--head); text-transform: uppercase; }
.bb-result h2.win { color: var(--brass); text-shadow: 0 0 16px rgba(232,184,90,.6); }
.bb-result h2.lose { color: var(--pink); text-shadow: 0 0 16px rgba(255,63,164,.6); }
.bb-result p { margin: 0; font-size: 16px; }

@media (max-width: 1179px) { .bb-log { display: none; } .bb-moves { width: 300px; } }
/* phones: the app's battle screen, the move bar under the board */
@media (max-width: 759px) {
  .bb-top { height: auto; padding: max(8px, env(safe-area-inset-top)) 16px 4px; gap: 12px; border: 0; background: none; }
  .bb-title { flex: 1; align-items: center; text-align: center; margin-right: 44px; }
  .bb-hints, .bb-key { display: none !important; }
  .bb-body { flex-direction: column; }
  .bb-board { padding: 6px 12px 6px; --tw: 112px; }
  .n2 .bb-board { --tw: 150px; } .n1 .bb-board { --tw: 170px; }
  .bb-board .bb-side { font-size: 11px; letter-spacing: 2.5px; }
  .bb-row { gap: 8px; margin-top: 6px; }
  .bb-turn { min-height: 34px; }
  .bb-turn .pill { font-size: 14px; padding: 7px 18px; letter-spacing: 2.5px; }
  .bb-tok { border-radius: 12px; }
  .bb-info { padding: 6px 8px 8px; gap: 5px; }
  .bb-moves { width: auto; border: 0; border-top: 1px solid rgba(232,184,90,.25); background: rgba(7,6,12,.92); padding: 14px 16px max(26px, env(safe-area-inset-bottom)); gap: 10px; overflow: visible; }
  .bb-who, .bb-adv, .bb-pwnote { display: none; }
  .bb-prompt { text-align: center; min-height: 20px; }
  .bb-btns { flex-direction: row; }
  .bb-move { min-height: 66px; flex-direction: column; justify-content: center; text-align: center; gap: 3px; padding: 0 8px; }
  .bb-move b { font-size: 16px; } .bb-move .col { align-items: center; justify-content: center; }   /* name + damage centred both ways */
  .bb-handwrap { order: 0; display: flex; justify-content: flex-end; }
  .bb-hand { gap: 0; flex-wrap: nowrap; }
  .bb-pw { width: 70px; height: 98px; padding: 5px; gap: 3px; border-radius: 8px; transform-origin: bottom center; }
  .bb-hand.two .bb-pw:first-child { transform: rotate(-9deg) translateX(14px); }
  .bb-hand.two .bb-pw:last-child { transform: rotate(7deg); }
  .bb-hand.two .bb-pw.picked:first-child { transform: rotate(-9deg) translate(14px, -16px); } .bb-hand .bb-pw.picked:last-child { transform: rotate(7deg) translateY(-16px); }
  .bb-pw .tag { font-size: 7px; letter-spacing: 1px; } .bb-pw b { font-size: 10px; } .bb-pw .eff { display: none; }
}
@media (max-width: 759px) and (max-height: 700px) { .bb-board { --tw: 96px; } }

/* ---------- campaign map ---------- */
.cm { background: radial-gradient(60% 45% at 50% 40%, rgba(185,140,255,.22), transparent 70%), var(--ink); }
.cm-head { flex: none; padding: 16px 24px 10px; display: flex; flex-direction: column; gap: 12px; width: min(720px, 100%); margin: 0 auto; }
.cm-prog { gap: 10px; padding: 0 6px; }
.cm-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: pan-y; }
.cm-path { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.cm-path::-webkit-scrollbar { display: none; }
.cm-path.in-r { animation: cmr .3s ease-out; } .cm-path.in-l { animation: cml .3s ease-out; }
@keyframes cmr { from { transform: translateX(100%); } } @keyframes cml { from { transform: translateX(-100%); } }
.cm-canvas { position: relative; margin: 0 auto; }
.cm-canvas svg { position: absolute; inset: 0; }
.cm-dot, .cm-next, .cm-boss { position: absolute; transform: translate(-50%, -50%); }
.cm-dot { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font: 700 15px var(--head); color: #6E6A88;
  background: var(--field); border: 2px solid rgba(142,138,168,.25); }
.cm-dot.done { color: var(--brass); border-color: var(--brass); background: radial-gradient(circle at 50% 35%, #3A2A10, #14100A); box-shadow: 0 0 6px rgba(232,184,90,.3); }
.cm-next { width: 66px; height: 66px; }
.cm-next img { width: 66px; height: 66px; border-radius: 50%; object-fit: cover; border: 3px solid var(--cyan); box-shadow: 0 0 12px rgba(63,240,255,.55); background: #12101E; }
.cm-next .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--cyan); animation: ring 1.6s ease-out infinite; }
@keyframes ring { from { transform: scale(1); opacity: .8; } to { transform: scale(1.55); opacity: 0; } }
.cm-tag { position: absolute; left: 50%; transform: translateX(-50%); height: 20px; padding: 0 8px; border-radius: 10px; display: inline-flex; align-items: center; gap: 3px; white-space: nowrap;
  font: 700 10px var(--head); letter-spacing: 1.2px; text-transform: uppercase; }
.cm-tag.next { bottom: -24px; background: var(--cyan); color: #04161A; }
.cm-tag.boss { top: -10px; background: var(--brass); color: #1A0D05; }
.cm-boss { width: 74px; height: 74px; }
.cm-boss > img:first-child { width: 74px; height: 74px; border-radius: 18px; object-fit: cover; background: #12101E; border: 2.5px solid rgba(232,184,90,.55); box-shadow: 0 0 10px rgba(232,184,90,.35); }
.cm-boss.done > img:first-child { border-color: var(--brass); }
.cm-boss.next > img:first-child { border-color: var(--cyan); box-shadow: 0 0 10px rgba(63,240,255,.35); }
.cm-boss.locked > img:first-child { filter: saturate(.35) brightness(.85); }
.cm-boss .cm-tag.next { bottom: -26px; }
.cm-lv { position: absolute; left: 50%; bottom: -20px; transform: translateX(-50%); font: 600 11px var(--head); color: var(--fg); }
.cm-boss.done .cm-lv { color: var(--brass); }
.cm-check { position: absolute; right: -4px; bottom: -4px; width: 22px; height: 22px; border-radius: 50%; background: var(--brass); color: #1A0D05; border: 2px solid var(--ink); display: flex; align-items: center; justify-content: center; }
.cm-pack { position: absolute; right: -28px; bottom: -6px; height: 40px; transform: rotate(10deg); filter: drop-shadow(0 3px 4px rgba(0,0,0,.6)); }
.cm-panel { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 10px 8px; display: flex; justify-content: center; pointer-events: none; }
.cm-card { pointer-events: auto; width: min(560px, 100%); padding: 14px 16px; border-radius: 18px; background: #0E0C18; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border: 1px solid rgba(142,138,168,.35); display: flex; align-items: center; gap: 12px;
  box-shadow: 0 -6px 20px rgba(0,0,0,.6); }
.cm-card.done { border-color: rgba(232,184,90,.45); }
.cm-card.level { flex-direction: column; align-items: stretch; gap: 14px; padding: 16px; border-color: rgba(185,140,255,.35); }
.cm-ic { width: 40px; height: 40px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; background: var(--field); border: 1px solid rgba(142,138,168,.4); color: var(--muted); }
.cm-ic.gold { background: var(--brass); color: #1A0D05; border: 0; }
.cm-fused { flex: none; height: 22px; padding: 0 8px; border-radius: 11px; display: inline-flex; align-items: center; font: 600 11px var(--head); color: var(--brass); background: rgba(232,184,90,.14); border: 1px solid rgba(232,184,90,.45); }
.cm-foes { display: flex; }
.cm-arrow { position: absolute; top: calc(50% - 140px); width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: var(--field); border: 1px solid rgba(185,140,255,.45); color: #B98CFF; z-index: 2; }
.cm-arrow.l { left: max(6px, calc(50% - 400px)); } .cm-arrow.r { right: max(6px, calc(50% - 400px)); }
.cm-arrow:hover { border-color: #B98CFF; }

/* ---------- friend battle ---------- */
.fb-lobby { gap: 16px; padding: 12px 16px 32px; }
.fb-team { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.fb-or { display: flex; align-items: center; gap: 12px; }
.fb-or i { flex: 1; height: 1px; background: rgba(232,184,90,.25); }
.fb-wait { gap: 16px; padding: 24px 20px; text-align: center; align-items: center; }
.fb-code { font: 700 54px var(--head); letter-spacing: 6px; padding: 8px 24px; border-radius: 16px; text-shadow: 0 0 14px rgba(232,184,90,.5); user-select: all; }

.screen:focus { outline: none; }   /* focused on open for keys and screen readers, not to be shown */
