/* GAM-39: the fight board under the arena: HERO | ENEMY, and the LOG across the full width below them.
   Its height is fixed, so stacking tokens never moves the arena. */
.fboard { --sides: 262px; --log: 104px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: var(--sides) var(--log); gap: 6px; flex: none; }
.fside { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 6px 2px; gap: 4px; background: var(--page); border: 1px solid var(--panel-line); border-radius: 10px; overflow: hidden; }
.fside.log { grid-column: 1 / -1; padding: 5px 10px; gap: 2px; }
.fside-name { margin: 0; height: 16px; line-height: 16px; flex: none; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fside.log .fside-name { font-size: 10px; height: 12px; line-height: 12px; text-align: left; color: var(--muted); }
.fcols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); flex: 1 1 0; min-height: 0; }
.fcol { display: flex; flex-direction: column; align-items: center; min-width: 0; min-height: 0; gap: 2px; }
.fcol + .fcol { border-left: 1px dashed var(--panel-line); }
.fcol-name { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--muted); }
.fcol.atk .fcol-name, .fcol.atk .ftotal { color: #ffb35c; }
.fcol.def .fcol-name, .fcol.def .ftotal { color: #8fd0ff; }
.fcol.boost .fcol-name { color: #9fe6a8; }
.fstack { display: flex; flex-direction: column; align-items: center; flex: 1 1 0; min-height: 0; width: 100%; overflow: hidden; }
.ftotal { height: 26px; line-height: 26px; flex: none; font-size: 21px; border-radius: 6px; padding: 0 6px; min-width: 26px; text-align: center; }
.ftok { position: relative; display: flex; flex-direction: column; align-items: center; flex: none; visibility: hidden; }
.ftok.in { visibility: visible; animation: ftok-drop 0.35s ease-out both; }
.ftok-body { display: flex; align-items: center; gap: 3px; }
/* The arrow that leads the stack down to its total. */
.ftok + .ftok::before { content: '▾'; height: 8px; line-height: 8px; font-size: 10px; color: var(--muted); }
.ftok-face { display: grid; place-items: center; flex: none; width: 29px; height: 29px; box-sizing: border-box; border-radius: 50%; border: 2px solid var(--ring, var(--panel-line)); background: var(--panel); overflow: hidden; font-size: 11px; font-weight: 800; }
.ftok-face canvas { width: 21px; height: 21px; }
.ftok-face.word { font-size: 8px; text-transform: uppercase; }
.ftok-face.secret { border-style: dashed; color: #ffd84a; font-size: 17px; }
.ftok-face.revealed { animation: ftok-flip 0.5s ease-out both; }
.ftok-value { font-size: 13px; font-weight: 800; white-space: nowrap; }
.ftok.minus .ftok-value { color: var(--bad); }
/* A bonus: its word over its number. */
.ftok-body.pill { flex-direction: column; justify-content: center; gap: 0; height: 29px; min-width: 40px; padding: 0 4px; line-height: 1.1; border: 1px solid var(--panel-line); border-radius: 8px; background: var(--panel); }
.pill .ftok-face.word { width: auto; height: auto; border: 0; border-radius: 0; background: none; color: var(--muted); }
/* More than five tokens (only the boosts can) sit closer, a bonus in one line. */
.fstack.dense .ftok-face { width: 20px; height: 20px; }
.fstack.dense .ftok-face canvas { width: 14px; height: 14px; }
.fstack.dense .ftok-body.pill { flex-direction: row; gap: 2px; height: 20px; min-width: 0; padding: 0 3px; }
.fstack.dense .pill .ftok-face.word { width: auto; height: auto; font-size: 7px; }
.fstack.dense .ftok-value { font-size: 11px; }
.fstack.dense .ftok + .ftok::before { content: ''; height: 2px; }
.ftotal.flash { animation: ftok-flash 0.7s ease-out; }
.ftok.in.flash { animation: ftok-flash 0.7s ease-out; }
.fside .fight-log { flex: 1 1 0; min-height: 0; height: auto; margin: 0; padding: 0; list-style: none; overflow: hidden; font-size: 12px; line-height: 1.3; }
.fside .fight-log li { padding: 3px 0; border-bottom: 1px solid var(--panel-line); opacity: 0.65; }
.fside .fight-log li:first-child { opacity: 1; font-size: 15px; font-weight: 700; animation: ftok-line 0.25s ease-out both; }
.fside .fight-log li.warn { color: var(--bad); }
.fside .fight-log small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.fside .fight-log li:not(:first-child) small { display: none; }
@keyframes ftok-line { from { opacity: 0.2; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes ftok-drop { from { transform: translateY(-14px) scale(1.5); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ftok-flip { from { transform: rotateY(180deg) scale(1.4); } to { transform: none; } }
@keyframes ftok-flash { 0%, 100% { transform: none; filter: none; } 30% { transform: scale(1.4); filter: brightness(1.8) drop-shadow(0 0 6px var(--accent)); } }
/* A big screen has room for bigger tokens and a longer log. */
@media (min-width: 600px) and (min-height: 820px) {
  .fboard { --sides: 304px; --log: 124px; }
  .ftok-face { width: 36px; height: 36px; }
  .ftok-face canvas { width: 27px; height: 27px; }
  .ftok-face.word { font-size: 10px; }
  .ftok-value { font-size: 16px; }
  .ftok-body { gap: 6px; }
  .ftok-body.pill { flex-direction: row; gap: 6px; height: 36px; padding: 0 10px; }
  .pill .ftok-face.word { width: auto; height: auto; font-size: 11px; }
  .fstack.dense .ftok-face { width: 25px; height: 25px; }
  .fstack.dense .ftok-body.pill { height: 25px; }
  .fcol-name { font-size: 13px; }
}
/* A short phone keeps the arena visible: smaller tokens, a shorter log. */
@media (max-height: 740px) {
  .fboard { --sides: 224px; --log: 70px; }
  .fside:not(.log) { padding: 4px 2px; gap: 2px; }
  .ftotal { height: 22px; line-height: 22px; font-size: 18px; }
  .ftok-face, .ftok-body.pill { height: 22px; }
  .ftok-face { width: 22px; }
  .ftok-face canvas { width: 15px; height: 15px; }
  .ftok-face.word { font-size: 6px; }
  .pill .ftok-face.word { height: auto; width: auto; font-size: 7px; }
  .ftok-body.pill .ftok-value { font-size: 11px; }
  .ftok + .ftok::before { height: 5px; line-height: 5px; font-size: 8px; }
  .fstack.dense .ftok-face { width: 16px; height: 16px; }
  .fstack.dense .ftok-face canvas { width: 11px; height: 11px; }
  .fstack.dense .ftok-body.pill { height: 16px; }
  .fstack.dense .ftok + .ftok::before { height: 1px; }
}
@media (prefers-reduced-motion: reduce) { .ftok.in, .ftok-face.revealed, .ftotal.flash, .ftok.in.flash, .fside .fight-log li:first-child { animation: none; } }
