:root{
  /* Grid shape (static) */
  --cols: 6;
  --rows: 13;
  --gap: 1px;

  /* JS updates these values together so every responsive crop stays aligned. */
  --cell: 28px;
  --sprite-inset: 1px;
  --sprite-step: calc(var(--cell) + 2px);
  --sheet-w: calc(var(--sprite-step) * 4);
  --sheet-h: calc(var(--sprite-step) * 6);

  /* === “Lighter dark-green” smoke theme === */
  /* Use a gradient as the page background (dark green, but not near-black) */
  --bg:
    radial-gradient(1200px 900px at 14% 10%, #1a5a42 0%, #113f2f 44%, #071d16 100%),
    radial-gradient(900px 700px at 86% 86%, rgba(46, 153, 108, 0.18) 0%, rgba(46, 153, 108, 0.00) 60%),
    linear-gradient(135deg, #0b2d22 0%, #08241b 55%, #071b14 100%);
  --panel: rgba(255,255,255,0.08);           /* glassy chrome for boards/sidebar */
  --line: rgba(236, 253, 245, 0.18);         /* minty borders/dividers */
  --grid-bg: rgba(6, 16, 12, 0.92);          /* keep the play grid dark */
  --text: #ecfdf5;                            /* readable on green */

  /* layout chrome */
  --inv-w: 56px;
  --divider-w: 1px;

  /* breathing room */
  --window-gap: 48px;
  --board-pad-y: 12px;

  /* glows (unchanged) */
  --glow-off: rgba(255, 220, 80, 0.25);
  --glow-def: rgba(120, 220, 255, 0.25);
  --glow-off-strong: rgba(255, 220, 80, 0.45);
  --glow-def-strong: rgba(120, 220, 255, 0.45);
}

html { background: var(--bg); }

body{
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, Segoe UI, Roboto, Arial, sans-serif;
  position: relative; /* needed for the smoke layer */
}

/* ===== Static smoke swirls (no animation) ===== */
body::before{
  content:"";
  position: fixed;
  inset: -18%;
  pointer-events: none;
  z-index: -1;

  /* Green-tinted “smoke” shapes */
  background:
    radial-gradient(62vmax 46vmax at 12% 18%, rgba(167, 243, 208, 0.10) 0%, rgba(167, 243, 208, 0.00) 64%),
    radial-gradient(56vmax 42vmax at 86% 12%, rgba(110, 231, 183, 0.08) 0%, rgba(110, 231, 183, 0.00) 66%),
    radial-gradient(74vmax 58vmax at 72% 80%, rgba(153, 246, 228, 0.07) 0%, rgba(153, 246, 228, 0.00) 68%),
    radial-gradient(54vmax 40vmax at 20% 84%, rgba(187, 247, 208, 0.06) 0%, rgba(187, 247, 208, 0.00) 62%),
    conic-gradient(from 220deg at 56% 54%,
      rgba(167, 243, 208, 0.07),
      rgba(167, 243, 208, 0.00) 22%,
      rgba(110, 231, 183, 0.05) 40%,
      rgba(110, 231, 183, 0.00) 58%,
      rgba(153, 246, 228, 0.06) 76%,
      rgba(153, 246, 228, 0.00) 100%
    );

  /* Make it “smoke-like” instead of neon */
  filter: blur(12px) saturate(0.80);
  opacity: 0.72;

  mix-blend-mode: soft-light;
}



/* ------ Layout: two boards, tight, with a 1px divider ------ */
.arena3{
  height: 100vh;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 0;               /* no gulf in the middle */
  padding: var(--window-gap) clamp(18px, 2vw, 34px);
  position: relative;
  width: 100%; 
  padding-bottom: 8px;
}

body.game-active{
  height: 100vh;
  overflow: hidden;
}

.board-game-title{
  position:absolute;
  top:10px;
  left:clamp(10px, 2vw, 24px);
  z-index:5;
  color:#60a5fa;
  font-size:clamp(1.05rem, 1.8vw, 1.45rem);
  font-weight:850;
  letter-spacing:.025em;
  line-height:1;
  white-space:nowrap;
  text-shadow:0 0 12px rgba(59,130,246,.22);
  pointer-events:none;
}

.board-game-title span{
  margin-left:.2em;
  font-size:.48em;
  font-weight:700;
  letter-spacing:.08em;
  opacity:.78;
  text-transform:lowercase;
}

.room-info{
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 10px;

  font-size: clamp(13px, 1.5vw, 17px);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;

  /* Softer gold text */
  color: #f7e0a3;
  text-shadow:
    0 0 4px rgba(247, 224, 163, 0.4);

  /* Subtle gold underline instead of big badge */
  border-bottom: 1px solid rgba(247, 224, 163, 0.6);
  background: transparent;

  pointer-events: none; /* don't block grid clicks */
}

.player-wrap{
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

.username{
  font-weight: 700;
  opacity: .9;
  margin: 0 0 6px 4px;
  display:flex;
  align-items:center;
  gap:8px;
}

.player-header-meta{
  display: contents;
}

/* Main player scores */
.match-counters { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.previous-score {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: #bed7c9;
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.previous-score > .previous-label { font-size: 9px; color: #9ab8a8; }
@media (max-width: 560px) {
  .arena3 .username { flex-wrap: wrap; }
  .match-counters { gap: 3px; }
  .previous-score {
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 3px 5px;
    font-size: 10px;
    line-height: 1.05;
  }
  .previous-score > .previous-label { font-size: 8px; }
}
.counter-chip{
  display: inline-flex;
  min-width: 52px;
  min-height: 34px;
  padding: 3px 10px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(96, 165, 250, 0.58);
  border-radius: 9px;
  background: rgba(30, 64, 175, 0.2);
  color: #7dd3fc;
  font-size: clamp(1.2rem, 2.2vw, 1.55rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.34);
  box-shadow: inset 0 0 10px rgba(59, 130, 246, 0.08);
  transform-origin: center;
}

.counter-chip.score-increased{
  animation: scoreIncreasePop 520ms ease-out;
}

.grid-number-chip{
  display: none;
}

body.net-mode .grid-number-chip{
  display: inline-flex;
  min-height: 30px;
  padding: 3px 10px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(167, 139, 250, 0.72);
  border-radius: 999px;
  background: rgba(91, 33, 182, 0.25);
  color: #ddd6fe;
  font-size: clamp(0.78rem, 1.4vw, 0.92rem);
  font-weight: 850;
  line-height: 1;
  letter-spacing: 0.025em;
  white-space: nowrap;
}

@keyframes scoreIncreasePop{
  0%{
    transform: scale(1);
  }
  32%{
    transform: scale(1.24);
    border-color: #bae6fd;
    background: rgba(37, 99, 235, 0.42);
    color: #e0f2fe;
    box-shadow:
      0 0 0 4px rgba(56, 189, 248, 0.16),
      0 0 18px rgba(56, 189, 248, 0.48);
  }
  100%{
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce){
  .counter-chip.score-increased{
    animation: none;
  }
}

.controls-hint{
  flex: 0 0 clamp(156px, 14vw, 210px);
  box-sizing: border-box;
  padding: 8px clamp(10px, 1vw, 16px);
  color: rgba(236, 253, 245, 0.86);
}

.controls-hint .controls-title {
    font-weight: 600;
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
  }
  
.controls-hint .controls-section {
    margin-bottom: 0.4rem;
  }
  
.controls-hint strong {
    font-size: 0.95rem;
    display: block;
    margin-bottom: 0.1rem;
  }

.controls-timer{
  border-top: 3px solid rgba(236, 253, 245, 0.18);
}

.controls-timer .timer-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.65rem;
  opacity: 0.7;
}

.controls-timer .timer-value {
  font-weight: 800;
  font-size: 2.4rem;        /* BIG like a digital clock */
  line-height: 1;
  font-family: "Courier New", Consolas, monospace;
  letter-spacing: 0.12em;   /* digital-style spacing */
  padding: 0.15rem 0.35rem;
  border-radius: 0.35rem;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.4);
  color: #facc15;           /* gold to match theme */
}

/* JS applies this only when all eight grids cannot fit on one row. */
.arena3 .sidebar.sidebar-space-hidden{
  display: none;
}

.arena3 .sidebar.sidebar-user-hidden{
  display: none;
}

.mini-grid-toggle{
  position: absolute;
  top: 10px;
  right: clamp(18px, 2vw, 34px);
  z-index: 6;
  padding: 4px 8px;
  border: 1px solid rgba(236, 253, 245, 0.2);
  border-radius: 6px;
  background: rgba(6, 16, 12, 0.48);
  color: rgba(236, 253, 245, 0.66);
  font: inherit;
  font-size: 0.72rem;
  line-height: 1.2;
  cursor: pointer;
}

.mini-grid-toggle:hover,
.mini-grid-toggle:focus-visible{
  border-color: rgba(186, 230, 253, 0.48);
  background: rgba(6, 16, 12, 0.72);
  color: #ecfdf5;
}

.mini-grid-toggle[hidden]{
  display: none;
}

.mobile-player-controls{
  display: none;
}

/* Only collapse the side instructions when the window is genuinely narrow.
   The active mode's timer remains at the top while the main boards stay first. */
@media (max-width: 900px){
  :root{
    --window-gap: 74px;
  }

  .arena3{
    padding-inline: clamp(8px, 2vw, 18px);
  }

  .arena3 .board-game-title{
    top: 8px;
    left: 8px;
    max-width: 30vw;
    overflow: hidden;
    font-size: clamp(0.82rem, 2.4vw, 1.05rem);
    text-overflow: ellipsis;
  }

  .arena3 .mini-grid-toggle{
    top: 6px;
    right: 8px;
    padding: 3px 6px;
    font-size: 0.66rem;
  }

  .arena3 .controls-hint{
    position: absolute;
    top: 35px;
    left: 50%;
    z-index: 7;
    width: max-content;
    max-width: calc(100vw - 16px);
    min-width: 0;
    padding: 0;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    text-align: center;
    transform: translateX(-50%);
    pointer-events: none;
  }

  .arena3 .controls-hint.is-active{
    display: flex !important;
  }

  #pvpControls > .controls-title,
  #pvpControls > .controls-section,
  #pvpControls > br,
  #cpuControls > .controls-title,
  #cpuControls > .controls-section,
  #cpuControls > br,
  #netControls > .controls-title,
  #netControls > .controls-section:not(.net-timer-section),
  #netControls > .controls-timer,
  #netControls > br{
    display: none;
  }

  #netControls > .net-timer-section{
    display: block;
    margin: 0;
  }

  .arena3 .sound-effects-control{
    width: auto;
    max-width: calc(100vw - 16px);
    min-width: 0;
    margin: 0;
    flex: 1 1 100%;
    pointer-events: auto;
    justify-content: center;
  }

  .arena3 .sound-effects-toggle{
    padding: 3px 5px;
    font-size: 0.62rem;
  }

  .arena3 .controls-timer{
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-top: 0;
  }

  .arena3 .controls-timer .timer-label{
    font-size: 0.62rem;
  }

  .arena3 .controls-timer .timer-value{
    min-width: 0;
    padding: 0.1rem 0.22rem;
    font-size: 1.08rem;
    letter-spacing: 0.035em;
    box-shadow: 0 0 8px rgba(250, 204, 21, 0.28);
  }

  .arena3 .room-info{
    top: 7px;
    right: auto;
    left: 50%;
    max-width: 32vw;
    padding: 1px 5px;
    overflow: hidden;
    font-size: clamp(0.68rem, 1.8vw, 0.82rem);
    transform: translateX(-50%);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .arena3 .username{
    min-width: 0;
    margin: 0 2px 4px;
    gap: 5px;
    font-size: 0.82rem;
    white-space: nowrap;
  }

  .arena3 .username > span:first-child{
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .arena3 .counter-chip{
    min-width: 40px;
    min-height: 27px;
    padding: 2px 6px;
    flex: 0 0 auto;
    border-radius: 7px;
    font-size: 0.95rem;
  }

  body.net-mode .arena3 .previous-score {
    min-height: 21px;
    padding: 2px 6px;
    font-size: .7rem;
  }
}

@media (max-width: 560px){
  :root{
    --window-gap: 94px;
  }

  .arena3{
    display: grid !important;
    height: 100dvh;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: max-content auto;
    column-gap: 0;
    row-gap: 12px;
    align-content: start;
    justify-content: stretch;
    padding-top: var(--window-gap);
    padding-right: 3px;
    padding-bottom: 10px;
    padding-left: 3px;
  }

  .arena3 #p1{
    grid-column: 1;
    grid-row: 1;
  }

  .arena3 #p2{
    grid-column: 2;
    grid-row: 1;
  }

  .arena3 .sidebar,
  .arena3 .mini-grid-toggle{
    display: none !important;
  }

  .arena3 .board-game-title{
    max-width: calc(100vw - 94px);
    font-size: 0.88rem;
  }

  .arena3 .room-info{
    top: 31px;
    right: 8px;
    left: 8px;
    max-width: none;
    padding: 0;
    font-size: 0.66rem;
    transform: none;
  }

  .arena3 .controls-hint{
    top: 55px;
    gap: 4px;
  }

  .arena3 .sound-effects-control{
    gap: 3px;
  }

  .arena3 .sound-effects-toggle{
    padding: 2px 4px;
    font-size: 0.57rem;
  }

  .arena3 .sound-effects-toggle-icon{
    font-size: 0.68rem;
  }

  .arena3 .controls-timer{
    gap: 4px;
  }

  .arena3 .controls-timer .timer-label{
    font-size: 0.54rem;
  }

  .arena3 .controls-timer .timer-value{
    padding: 0.08rem 0.18rem;
    font-size: 0.88rem;
    letter-spacing: 0.02em;
  }

  .arena3 .username{
    gap: 3px;
    font-size: 0.7rem;
  }

  body:not(.net-mode) .arena3 #name1{
    font-size: 0;
  }

  body:not(.net-mode) .arena3 #name1::after{
    content: attr(data-mobile-label);
    font-size: 0.7rem;
  }

  .arena3 .counter-chip{
    min-width: 31px;
    min-height: 22px;
    padding: 1px 4px;
    border-radius: 5px;
    font-size: 0.76rem;
  }


}

/* Online names get a full row; secondary details wrap within the board width. */
body.net-mode .arena3 > .player-wrap { flex-shrink: 0; }
body.net-mode .arena3 .username {
  box-sizing: border-box;
  width: calc((var(--cols) + 1) * var(--cell) + (var(--cols) - 1) * var(--gap) + 16px);
  max-width: 100%;
  margin: 0 0 6px;
  padding-inline: 4px;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  opacity: 1;
}
body.net-mode .arena3 .player-header-meta {
  display: contents;
}
body.net-mode .arena3 .username > span:first-child {
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #ecfdf5;
  font-size: clamp(.8rem, 1.1vw, .95rem);
  font-weight: 750;
  line-height: 1.3;
}
body.net-mode .arena3 .match-counters {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
}
body.net-mode #p1 .grid-number-chip {
  transform: translateX(calc((var(--cell) + 14px) / 2));
}
body.net-mode #p2 .grid-number-chip {
  transform: translateX(calc((var(--cell) + 14px) / -2));
}
body.net-mode .arena3 .counter-chip,
body.net-mode .arena3 .previous-score,
body.net-mode .arena3 .grid-number-chip {
  box-sizing: border-box;
  min-width: 0;
  min-height: 26px;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: .78rem;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  text-shadow: none;
  box-shadow: none;
}
body.net-mode .arena3 .counter-chip {
  min-width: 62px;
  min-height: 34px;
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 8px;
  color: #bae6fd;
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 900;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
body.net-mode .arena3 .previous-score {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 3px;
  align-items: baseline;
}
body.net-mode .arena3 .previous-label { font-size: .6rem; }
body.net-mode .arena3 .grid-number-chip {
  margin: 0 auto;
  min-height: 28px;
  padding-inline: 10px;
  font-size: clamp(.8rem, 1.4vw, .98rem);
  flex: 0 0 auto;
  color: #cbbfe2;
  border-color: rgba(167, 139, 250, .4);
  background: rgba(91, 33, 182, .14);
}
/* Keep score feedback inside its chip so it cannot cover a neighboring label. */
body.net-mode .arena3 .counter-chip.score-increased {
  animation-name: onlineScoreIncrease;
}
@keyframes onlineScoreIncrease {
  32% { border-color: #bae6fd; background: #255ba2; color: #f0f9ff; }
}

@media (max-width: 900px) {
  body.net-mode .arena3 .username {
    gap: 2px;
    margin-bottom: 4px;
  }
  body.net-mode .arena3 .counter-chip {
    min-height: 29px;
    padding: 3px 8px;
    font-size: clamp(.9rem, 2vw, 1.15rem);
  }
  body.net-mode .arena3 .grid-number-chip {
    min-height: 24px;
    padding: 3px 8px;
    font-size: clamp(.76rem, 1.4vw, .86rem);
  }
}

/* Short landscape windows have room beside the grids for wider headers. */
@media (min-width: 561px) and (max-height: 500px) {
  body.net-mode .arena3 { padding-bottom: 8px; }
  body.net-mode .arena3:not(.all-text-hidden) > .player-wrap {
    width: max(160px, calc((var(--cols) + 1) * var(--cell) + (var(--cols) - 1) * var(--gap) + 16px));
  }
  body.net-mode .arena3:not(.all-text-hidden) .username { width: 100%; }
  body.net-mode .arena3 .board-row { width: max-content; align-self: center; }
}

/* Display controls stay available when the surrounding text is hidden. */
.arena3 { padding-top: 48px; }
.arena-view-controls {
  position: absolute;
  top: 40px;
  right: 8px;
  z-index: 8;
  display: flex;
  gap: 6px;
}
.arena-view-toggle,
.arena-view-controls .mini-grid-toggle {
  position: static;
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid #538b76;
  border-radius: 6px;
  background: #123e30;
  color: #ecfdf5;
  font: 600 .75rem/1.2 system-ui, sans-serif;
  cursor: pointer;
}
.arena-view-toggle:hover { background: #1e5541; }
.arena-view-toggle:focus-visible,
.arena-view-controls .mini-grid-toggle:focus-visible {
  outline: 2px solid #a7f3d0;
  outline-offset: 2px;
}
.arena-view-toggle[hidden] { display: none; }
.arena-view-controls .sound-effects-control {
  width: auto;
  margin: 0;
  gap: 3px;
}
.arena3 .arena-view-controls .sound-effects-toggle {
  min-width: 28px;
  min-height: 32px;
  margin: 0;
  padding: 3px;
  font-size: .85rem;
  opacity: 1;
}
.arena-view-controls .sound-effects-toggle-label { display: none; }
.arena-timer-overlay {
  display: none;
  position: absolute;
  top: 8px;
  left: var(--boards-center-x, 50%);
  z-index: 7;
  align-items: center;
  justify-content: center;
  transform: translateX(-50%);
  pointer-events: none;
}
.arena-timer-overlay.is-visible { display: flex; }
.arena-timer-overlay .controls-timer {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  border-top: 0;
}
.arena-timer-overlay .controls-timer .timer-value {
  font-size: clamp(1rem, 2.2vw, 1.8rem);
  letter-spacing: 0.06em;
}
.arena3.instructions-hidden #pvpControls > .controls-title,
.arena3.instructions-hidden #pvpControls > .controls-section,
.arena3.instructions-hidden #pvpControls > br,
.arena3.instructions-hidden #cpuControls > .controls-title,
.arena3.instructions-hidden #cpuControls > .controls-section,
.arena3.instructions-hidden #cpuControls > br,
.arena3.instructions-hidden #netControls > .controls-title,
.arena3.instructions-hidden #netControls > .controls-section:not(.net-timer-section),
.arena3.instructions-hidden #netControls > br {
  display: none !important;
}
.arena3.all-text-hidden .controls-hint,
.arena3.all-text-hidden .board-game-title,
.arena3.all-text-hidden .room-info,
.arena3.all-text-hidden .mini-name,
.arena3.all-text-hidden .multiplayer-capacity {
  display: none !important;
}
/* Keep the live score useful in the compact view: center the numeric counter
   over each grid while leaving usernames and other labels hidden. */
.arena3.all-text-hidden .username {
  display: flex !important;
  box-sizing: border-box;
  width: 100%;
  margin: 0 0 6px;
  padding: 0;
  align-items: center;
  justify-content: center;
}
.arena3.all-text-hidden .username > span:first-child,
.arena3.all-text-hidden .previous-score,
.arena3.all-text-hidden .grid-number-chip {
  display: none !important;
}
.arena3.all-text-hidden .player-header-meta {
  display: flex !important;
  width: 100%;
  align-items: center;
  justify-content: center;
}
.arena3.all-text-hidden .match-counters {
  width: 100%;
  justify-content: center;
}
.arena3.all-text-hidden .sidebar-mobile .mini-wall {
  gap: 4px;
  padding: 4px;
}
.arena3.all-text-hidden .sidebar-mobile .mini-wrap {
  gap: 2px;
  padding: 2px;
}
.arena3.all-text-hidden .board[data-grid-label]::before,
.arena3.all-text-hidden .mini-wrap[data-grid-label]::before { content: none; }
.arena3.all-text-hidden .mini-wrap { grid-template-rows: minmax(0, 1fr) auto; }
@media (max-width: 560px) {
  .arena-timer-overlay .controls-timer .timer-value { font-size: 1.02rem; }
  .arena-timer-overlay .controls-timer .timer-label { font-size: 0.54rem; }
  /* Reserve a compact header slot without pushing the mobile grids down. */
  .arena3.all-text-hidden > .player-wrap {
    padding-top: 34px;
  }
  .arena3.all-text-hidden > .player-wrap .username {
    position: absolute;
    inset: 0 0 auto;
    margin: 0;
  }
  .arena3.all-text-hidden .counter-chip {
    min-height: 28px;
    padding: 3px 8px;
    font-size: 1rem;
  }
}
@media (max-width: 900px) {
  .arena3 { padding-top: 108px; }
  .arena-view-controls { top: 68px; }
}
@media (max-width: 560px) {
  .arena3 { padding-top: 120px; }
  .arena-view-controls { top: 80px; }
}
.arena3.compact-layout {
  height: 100dvh;
  padding-top: var(--arena-header-height, 48px);
  padding-bottom: 8px;
}
.arena3.compact-layout .controls-hint.is-active {
  display: none !important;
}
.arena3.compact-layout .arena-view-controls {
  top: 8px;
  right: 8px;
  left: auto;
  max-width: calc(100% - var(--boards-center-x, 50%) - var(--timer-clearance, 64px));
}
.arena3.compact-layout .arena-view-controls .sound-effects-control {
  flex: 0 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 100%;
}
.arena3.compact-layout .game-home-button {
  top: 8px;
  left: 8px;
  box-sizing: border-box;
  height: 34px;
  min-width: 34px;
  padding: 5px;
  transform: none;
  font-size: 0;
}
.arena3.compact-layout .game-home-button::after { content: '\2302'; font-size: 22px; }
.arena3.compact-layout .board-game-title,
.arena3.compact-layout .room-info {
  left: 50px;
  right: auto;
  max-width: max(0px, calc(var(--boards-center-x, 50%) - 50px - var(--timer-clearance, 64px)));
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transform: none;
}
.arena3.compact-layout .board-game-title { top: 10px; font-size: .85rem; }
.arena3.compact-layout .room-info { top: 28px; padding: 0; font-size: .65rem; }
.arena3.compact-layout .controls-timer[hidden] { display: none; }

/* ----- Right sidebar with six small grids ----- */
.mobile-mini-hint { display: none; }
.mobile-mini-toggle { display: none; }
.sidebar{
  display: flex;
  width: clamp(250px, 21vw, 340px);
  flex: 0 1 clamp(250px, 21vw, 340px);
  min-width: 0;
  align-self: stretch;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  padding: 0 clamp(4px, 0.7vw, 12px);
  /* match board background/chrome */
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: none;              /* the P1|P2 divider is already present */
}

.multiplayer-capacity{
  align-self: center;
  margin: clamp(4px, 0.7vh, 9px) 8px 0;
  color: #bae6fd;
  font-size: clamp(0.68rem, 1.1vw, 0.82rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
}

.mini-wall{
  display: grid;
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: clamp(3px, 0.7vh, 8px) clamp(4px, 0.6vw, 9px);
  padding: clamp(4px, 1vh, var(--board-pad-y)) clamp(2px, 0.35vw, 5px);
  box-sizing: border-box;
}

/* Mini grids: force sprite scale for anything rendered inside */
.grid.mini{
  /* Keep the guarded sprite slices proportional to the mini-board cells. */
  --sprite-step: calc(var(--cell) + 2px);
  --sheet-w: calc(var(--sprite-step) * 4);
  --sheet-h: calc(var(--sprite-step) * 6);
}

/* Ensure any cell-sized element uses the mini block size */
.grid.mini .cell,
.grid.mini .cell.preview,
.grid.mini .inv-icon{
  width: var(--cell);
  height: var(--cell);
}

/* If any effects use absolutely positioned cell clones, make sure their sheet scales too */
.grid.mini .burst-particle,
.grid.mini .crumb-piece,
.grid.mini .tracer{
  background-size: var(--sheet-w) var(--sheet-h);
}


/* Each mini grid gets a tiny name chip + the grid */
.mini-wrap{
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  justify-items: center;
  align-items: center;
  gap: clamp(2px, 0.45vh, 4px);
  padding: clamp(2px, 0.35vw, 5px);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.mini-name{
  font-size: clamp(9px, 0.75vw, 11px);
  font-weight: 800;
  opacity: 0.85;
  text-align: center;
  padding: 1px 5px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
}

/* Each preview remains a six-column board. The larger scale uses the space
   made available by the two-row mini-wall while preserving square cells. */
.grid.mini{
  --cell: var(--mini-cell, 13px);
  /* keep the same rows/cols from :root (6 × 13) */
  border-radius: 4px;
  outline: 1px solid rgba(255,255,255,.06);
}

.sidebar .mini-net-controls .btn-primary{
  padding: 3px 6px;
  border-radius: 5px;
  font-size: 10px;
  line-height: 1.1;
}

/* keep mini cells’ borders subtle */
.grid.mini .cell{
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,.05);
}

.board-row{
  display: grid;
  gap: 0;
  min-width: 0;
  align-items: start;
}

#p1 .board-row{
  grid-template-columns: auto minmax(0, 1fr); /* inventory | grid */
}

#p2 .board-row{
  grid-template-columns: minmax(0, 1fr) auto; /* grid | inventory */
}

/* single thin divider between P1 and P2 */
#p1 { position: relative; }
#p1::after{
  content:"";
  position:absolute;
  top:0;
  right: calc(var(--divider-w) * -0.5);
  width: var(--divider-w);
  height: 100%;
  background: var(--line);
}

/* board frame: only vertical padding for the little top/bottom gap */
.board{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
  padding-block: var(--board-pad-y);
  padding-inline: 0;
  display: grid;
  grid-template-rows: 1fr;
  justify-items: center;
  min-height: 0;
  position: relative; /* for pseudo-element */
  overflow: visible;
}

/* Base for any numbered container (main boards + mini groups) */
.board[data-grid-label],
.mini-wrap[data-grid-label] {
  position: relative;
}

/* Giant outlined, semi-transparent number in the background */
.board[data-grid-label]::before,
.mini-wrap[data-grid-label]::before {
  content: attr(data-grid-label);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  font-size: clamp(64px, 6rem, 150px);
  font-weight: 800;
  letter-spacing: 0.05em;

  color: transparent;
  -webkit-text-stroke: 2px rgba(255, 255, 255, 0.28);
  text-shadow:
    0 0 4px rgba(0, 0, 0, 0.35),
    0 0 10px rgba(0, 0, 0, 0.6);
  opacity: 0.24;              /* a bit stronger so it reads */

  pointer-events: none;
  z-index: 2;                  /* <- was 0, now above the grid */
}


/* Make sure grids and cells sit above the number */
.board[data-grid-label] .grid,
.mini-wrap[data-grid-label] .grid {
  position: relative;
  z-index: 1;
}

.inventory{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;            /* small gap between preview and inventory list */
}
/* Directional sweep carrier */
.board.electric-left::after,
.board.electric-right::after{
  content: "";
  position: absolute;
  inset: var(--board-pad-y) 0;         /* align to the grid box */
  border-radius: 0;
  pointer-events: none;
  /* base border so the sweep reads like electricity on the rim */
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.08);
}

/* Animated gradient “bolt” that travels along the rim */
.board.electric-left::before,
.board.electric-right::before{
  content: "";
  position: absolute;
  inset: calc(var(--board-pad-y) - 2px) -2px;  /* hug outside the grid */
  pointer-events: none;
  border-radius: 2px;
  background:
    conic-gradient(
      from 0deg,
      rgba(255,255,255,0) 0deg 20deg,
      rgba(255,255,255,.35) 45deg,
      rgba(120,220,255,.55) 90deg,
      rgba(255,220,80,.55) 135deg,
      rgba(255,255,255,.35) 180deg,
      rgba(255,255,255,0) 200deg 360deg
    );
  filter: blur(1px) contrast(1.1);
  opacity: .9;
  animation-duration: 560ms;
  animation-timing-function: cubic-bezier(.2,.8,.2,1);
  animation-fill-mode: forwards;
}


/* Existing inventory glow + shake (keep from your last step) */
.inv-grid.bump-off,
.inv-grid.bump-def{
  position: relative;
  animation: invPopShake 600ms ease-out both;
  will-change: transform, box-shadow;
}
.inv-grid.bump-off{
  outline: 2px solid var(--glow-off-strong);
  box-shadow: 0 0 22px var(--glow-off), 0 0 6px var(--glow-off-strong) inset;
}
.inv-grid.bump-def{
  outline: 2px solid var(--glow-def-strong);
  box-shadow: 0 0 22px var(--glow-def), 0 0 6px var(--glow-def-strong) inset;
}
@keyframes invPopShake {
  0%   { transform: scale(1) translateX(0); }
  10%  { transform: scale(1.04) translateX(-1px); }
  20%  { transform: scale(1.05) translateX(2px); }
  35%  { transform: scale(1.03) translateX(-2px); }
  50%  { transform: scale(1.02) translateX(1px); }
  70%  { transform: scale(1.01) translateX(-1px); }
  100% { transform: scale(1) translateX(0); }
}

/* ===== Hard-drop column tracers — Smoke Trail ===== */
.tracer{
  position: absolute;
  pointer-events: none;
  z-index: 7;                 /* above cells, below overlays */
  background: none;
  opacity: 0.95;
  transform: translateZ(0);
  animation: smokeWobble 260ms ease-out both;
}

/* Main smoke body: stacked puffs that taper upward */
.tracer::before{
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  /* a bit taller than one cell so it reads as a trail */
  width: 70%;
  height: 140%;
  transform: translate(-50%, -64%);
  /* 4 overlapping radial gradients = soft puffs */
  background:
    radial-gradient(50% 55% at 50% 80%, rgba(255,255,255,0.55) 0 35%, rgba(220,225,230,0.34) 35% 60%, rgba(200,205,210,0.0) 60% 100%),
    radial-gradient(46% 50% at 58% 50%, rgba(240,244,247,0.45) 0 32%, rgba(210,215,220,0.28) 32% 58%, rgba(200,205,210,0.0) 58% 100%),
    radial-gradient(42% 46% at 42% 30%, rgba(240,244,247,0.38) 0 28%, rgba(205,210,215,0.22) 28% 54%, rgba(200,205,210,0.0) 54% 100%),
    radial-gradient(40% 44% at 50% 10%, rgba(240,244,247,0.28) 0 26%, rgba(205,210,215,0.16) 26% 50%, rgba(200,205,210,0.0) 50% 100%);
  /* taper the whole stack so it looks like a trail */
  -webkit-mask: linear-gradient(to top, transparent 0%, #000 18%, #000 86%, transparent 100%);
          mask: linear-gradient(to top, transparent 0%, #000 18%, #000 86%, transparent 100%);
  filter: blur(0.6px) grayscale(100%) saturate(0.8);
  mix-blend-mode: screen;
  animation: smokeDrift 700ms ease-out forwards, smokeFlicker 420ms steps(3,end) infinite;
  will-change: transform, opacity, filter;
}

/* Wispy edges */
.tracer::after{
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 84%;
  height: 150%;
  transform: translate(-50%, -66%);
  background:
    radial-gradient(60% 60% at 40% 70%, rgba(235,240,245,0.18) 0 40%, rgba(235,240,245,0) 55% 100%),
    radial-gradient(55% 55% at 60% 35%, rgba(235,240,245,0.14) 0 38%, rgba(235,240,245,0) 56% 100%);
  -webkit-mask: linear-gradient(to top, transparent 0%, #000 22%, #000 78%, transparent 100%);
          mask: linear-gradient(to top, transparent 0%, #000 22%, #000 78%, transparent 100%);
  filter: blur(1px) grayscale(100%);
  opacity: 0.6;
  animation: smokeFeather 900ms ease-out forwards;
  will-change: transform, opacity;
}

/* ===== Animations ===== */
@keyframes smokeDrift{
  0%{
    transform: translate(-50%, -64%) scale(0.96);
    opacity: 0.95;
    filter: blur(0.5px) grayscale(100%);
  }
  100%{
    transform: translate(-50%, -78%) translateX(0.6px) scale(1.06);
    opacity: 0.25;
    filter: blur(1.2px) grayscale(100%);
  }
}

/* tiny lateral shimmy so the plume feels alive */
@keyframes smokeWobble{
  0%   { transform: translateZ(0) translateX(0px) scale(0.98); }
  50%  { transform: translateZ(0) translateX(0.4px) scale(1.00); }
  100% { transform: translateZ(0) translateX(0px) scale(0.99); }
}

/* subtle turbulent flicker (brightness + micro-movement) */
@keyframes smokeFlicker{
  0%   { filter: blur(0.6px) grayscale(100%) brightness(0.98); transform: translate(-50%, -64%) scale(0.98); }
  50%  { filter: blur(0.7px) grayscale(100%) brightness(1.02); transform: translate(-50%, -65%) scale(1.00); }
  100% { filter: blur(0.8px) grayscale(100%) brightness(0.99); transform: translate(-50%, -64.5%) scale(0.99); }
}

/* outer wisps lift + fade */
@keyframes smokeFeather{
  0%   { transform: translate(-50%, -66%) scaleY(1.00); opacity: 0.6; }
  100% { transform: translate(-50%, -84%) translateX(-0.5px) scaleY(1.08); opacity: 0.08; }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce){
  .tracer{ animation: none; opacity: .85; }
  .tracer::before,
  .tracer::after{ animation: none; opacity: 0.6; }
}


.net-mode .power-target {
  outline: 3px solid #ffb347;
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .inv-grid.bump-off,
  .inv-grid.bump-def{
    animation: none !important;
    transform: none !important;
  }
}

@media (max-height: 640px) and (min-width: 901px){
  .arena3{ padding-top: 28px; }
}

/* Top title and artwork */
.start-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.8fr);
  gap: 28px;
  align-items: start;
  margin-bottom: 24px;
  padding: 12px 12px 24px;
  border-bottom: 1px solid rgba(167, 243, 208, 0.22);
}

.start-title-block {
  min-width: 0;
  padding-top: 8px;
  text-align: left;
}

.game-title-simple {
  display: flex;
  max-width: 100%;
  align-items: baseline;
  gap: 0.2em;
  margin: 0;
  color: #d39a22;
  font-size: clamp(2.25rem, 4vw, 3.6rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 2px 0 #5b3510, 0 0 14px rgba(180, 119, 15, 0.24);
}

.game-title-simple span {
  display: inline-block;
  font-size: 0.34em;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  vertical-align: baseline;
}

.title-screenshot-wrap {
  margin-top: 20px;
  overflow: hidden;
  border: 1px solid rgba(167, 243, 208, 0.3);
  border-radius: 12px;
  background: rgba(3, 24, 17, 0.42);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.title-screenshot-img {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 560px) {
  #startPvpBtn { display: none; }
  .title-screenshot-wrap { max-width: 390px; margin-inline: auto; }
}

.screenshot-play-note {
  margin: 12px 0 0;
  text-align: center;
  font-size: clamp(14px, 1.4vw, 17px);
  font-weight: 600;
  line-height: 1.5;
  color: #d1fae5;
}

.front-banner-wrap {
  display: flex;
  min-width: 0;
  justify-content: flex-end;
  padding: 8px;
  border: 1px solid rgba(167, 243, 208, 0.3);
  border-radius: 16px;
  background: rgba(3, 24, 17, 0.42);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.front-banner-img {
  display: block;
  width: 100%;
  max-width: 380px;
  height: auto;
  border-radius: 11px;
  opacity: 0;
  transition: opacity 250ms ease-out;
  background-color: transparent;
}

.front-banner-img.is-loaded {
  opacity: 1;
}


/* ------ Grid & cells ------ */
.grid{
  background: var(--grid-bg);
  border-radius: 0;
  padding: 0;
  min-height: 0;
  position: relative;

  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(var(--cols), var(--cell));
  grid-template-rows:    repeat(var(--rows), var(--cell));
  grid-auto-rows: 0;
  align-content: start;
}

/* Clear, drop, and combo effects live outside the grid's placement flow.
   This prevents rapid effect bursts from ever creating an implicit row. */
.grid-effects{
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: visible;
  pointer-events: none;
}

.cell{
  width:100%; height:100%;
  box-sizing: border-box;
  border:1px solid rgba(255,255,255,.06);
  border-radius:4px;
  image-rendering: auto;
  background-repeat:no-repeat;
  background-image:var(--game-art, url("../assets/block_sprites.webp"));
  background-size: var(--sheet-w) var(--sheet-h);
  background-origin: border-box;
  background-clip: border-box;
}

/* Cells about to clear: brief scale-up + glow */
.cell[data-fx="preclear"] {
  transform: scale(1.06);
  outline: 2px solid rgba(255,255,255,0.85);
  box-shadow:
    0 0 12px rgba(255,255,255,0.40),
    inset 0 0 20px rgba(255,255,255,0.22);
  animation: preclearPulse 520ms ease-out;
  z-index: 2;
}

@keyframes preclearPulse {
  0%   { transform: scale(1.00); filter: brightness(1.00); }
  70%  { transform: scale(1.07); filter: brightness(1.06); }
  100% { transform: scale(1.06); filter: brightness(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  .cell[data-fx="preclear"] {
    animation: none;
    transform: none;
  }
}


.cell[data-type="empty"]{
  background-image:none;
  background-color:rgba(255,255,255,.04);
}

/* sprite sheet mapping: 4 cols (variants) × 6 rows (letters) */
.cell[data-var="reg"]   { --vx: 0; }
.cell[data-var="mflash"]{ --vx: 0; }
.cell[data-var="off"]   { --vx: 1; }
.cell[data-var="def"]   { --vx: 2; }
.cell[data-var="solid"] { --vx: 3; }

.cell[data-type="B"] { --vy: 0; }
.cell[data-type="U"] { --vy: 1; }
.cell[data-type="R"] { --vy: 2; }
.cell[data-type="N"] { --vy: 3; --cell-filter: brightness(1.04); filter: var(--cell-filter); }
.cell[data-type="E"] { --vy: 4; }
.cell[data-type="r"] { --vy: 5; }

.cell:not([data-type="empty"]){
  background-position:
    calc(var(--vx) * -1 * var(--sprite-step) - var(--sprite-inset))
    calc(var(--vy) * -1 * var(--sprite-step) - var(--sprite-inset));
}

/* Temporary flash for Midas conversions */
.cell[data-var="mflash"] {
  outline: 2px solid rgba(255, 215, 0, 0.85);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.5) inset, 0 0 6px rgba(255, 215, 0, 0.35);
}

/* optional inventory thumbnails */
.inv-cell{
  width:100%; height:100%;
  box-sizing: border-box;
  border:1px solid rgba(255,255,255,.06);
  border-radius:6px;
  image-rendering: auto;
  background-repeat:no-repeat;
  background-image:var(--game-art, url("../assets/block_sprites.webp"));
  background-size: var(--sheet-w) var(--sheet-h);
  background-origin: border-box;
  background-clip: border-box;
}
/* PREVIEW: 3 full-size cells (each exactly one block) */
.next-stack{
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: var(--cell);      /* full block height */
  gap: var(--gap);
}

/* INVENTORY occupies the remaining column height */
.inv-stack{
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: 100%;
  flex: 1 1 auto;     /* <- take all remaining height under preview */
  overflow: visible; /* Let the power-use pulse swell just outside the rim. */
}

/* Simple inventory row visuals (replace with icons later) */
.inv-item{
  font-size: 12px;
  line-height: 1.1;
  text-align: center;
  padding: 2px 4px;
}

/* Make preview cells full block size */
.cell.preview{
  width: var(--cell);
  height: var(--cell);
}

/* Inventory queue: single vertical column under preview */
.inv-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap);
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  width: var(--cell);
  min-height: calc(var(--cell) * 8 + var(--gap) * 7); /* room for 8 cells */
  box-sizing: content-box;
}

.cell.inv-icon {
  width: var(--cell);
  height: var(--cell);
}

.inv-empty{ grid-column: 1 / -1; text-align: center; opacity: .6; }

/* A power travels through the inventory border; the contents stay still. */
.inventory-pulse-active { position: relative; border-color: transparent !important; }
.inventory-plasma {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 3;
  --plasma: #80e5ff;
}
.inventory-plasma[data-variant="off"] { --plasma: #ffd46b; }
/* Match the pulse to the actual powerup block being consumed. The variant
   colors above remain fallbacks for older/tutorial events without a letter. */
.inventory-plasma[data-letter="B"] { --plasma: #e1e3e5; }
.inventory-plasma[data-letter="U"] { --plasma: #73dc70; }
.inventory-plasma[data-letter="R"] { --plasma: #76bcf0; }
.inventory-plasma[data-letter="N"] { --plasma: #8e53d0; }
.inventory-plasma[data-letter="E"] { --plasma: #f8f57b; }
.inventory-plasma[data-letter="r"] { --plasma: #ffbe24; }
.inventory-plasma path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.inventory-plasma-rail { stroke: var(--line); stroke-width: 1; }
.inventory-plasma-halo { stroke: var(--plasma); stroke-width: 6; filter: blur(3px); }
.inventory-plasma-tail { stroke: var(--plasma); stroke-width: 2.5; }
.inventory-plasma-core { stroke: var(--plasma); stroke-width: 1.5; filter: drop-shadow(0 0 2px var(--plasma)); }

/* =========================
   Special blocks: use col 3
   Sprites live in the same sheet already defined above.
   Type is "M"; variant picks the row.
   - Midas: rows 0..2  -> midas0, midas1, midas2
   - Medusa: row 3     -> medusa
   ========================= */

/* Column 3 (x index = 3) for all "M" specials */
.cell[data-type="M"][data-var^="midas"],
.cell[data-type="M"][data-var="medusa"]{
  --vx: 3; /* reuse your existing background-position formula */
}

/* Midas skins (rows 0..2) */
.cell[data-type="M"][data-var="midas0"]{ --vy: 0; } /* col 3, row 0 */
.cell[data-type="M"][data-var="midas1"]{ --vy: 1; } /* col 3, row 1 */
.cell[data-type="M"][data-var="midas2"]{ --vy: 2; } /* col 3, row 2 */

/* Medusa (row 3) — unclearable */
.cell[data-type="M"][data-var="medusa"]{
  --vy: 3; /* col 3, row 3 */
  /* Optional faint aura to distinguish it */
  outline: 1px solid rgba(173, 255, 47, 0.25);
  border-radius: 2px;
}

/* Base prep (no translate/rotation) */
.cell[data-var="off"],
.cell[data-var="def"] {
  position: relative;
  will-change: box-shadow, outline-color, filter;
}

/* Offensive: slow breathing glow */
.cell[data-var="off"] {
  box-shadow: 0 0 6px var(--glow-off);
  animation: pulseOff 3200ms ease-in-out infinite;
}

/* Defensive: slightly different cadence to distinguish */
.cell[data-var="def"] {
  box-shadow: 0 0 6px var(--glow-def);
  animation: pulseDef 3600ms ease-in-out infinite;
}

/* Offensive: clearer breathing glow */
@keyframes pulseOff {
  0%, 100% {
    box-shadow: 0 0 6px var(--glow-off);
    outline: 1px solid rgba(255, 220, 80, 0.12);
    filter: brightness(1.00);
  }
  50% {
    box-shadow:
      0 0 14px var(--glow-off-strong),
      0 0 28px var(--glow-off);
    outline: 1px solid rgba(255, 220, 80, 0.28);
    filter: brightness(1.08);  /* slightly stronger highlight */
  }
}

/* Defensive: similar, different cadence */
@keyframes pulseDef {
  0%, 100% {
    box-shadow: 0 0 6px var(--glow-def);
    outline: 1px solid rgba(120, 220, 255, 0.12);
    filter: brightness(1.00);
  }
  50% {
    box-shadow:
      0 0 14px var(--glow-def-strong),
      0 0 28px var(--glow-def);
    outline: 1px solid rgba(120, 220, 255, 0.28);
    filter: brightness(1.08);
  }
}

/* Inventory icons: no animation, faint static glow only */
.cell.inv-icon[data-var="off"] { box-shadow: 0 0 4px var(--glow-off);  animation: none; }
.cell.inv-icon[data-var="def"] { box-shadow: 0 0 4px var(--glow-def);  animation: none; }

/* Accessibility: honor reduced motion */
@media (prefers-reduced-motion: reduce) {
  .cell[data-var="off"],
  .cell[data-var="def"] {
    animation: none !important;
    filter: none;
  }
}
