/* Original jelly-toy squad builder. The host owns time, points and persistence. */
body[data-game="tactics"] #stage-wrap { max-width: 1060px; background: #f1f8ff; }
body[data-game="tactics"] #controls:empty,
body[data-game="tactics"] #options:empty { display: none; }
.jelly-tactics {
  --jelly-ink: #243f60;
  --jelly-muted: #516780;
  padding: clamp(10px, 2vw, 22px);
  color: var(--jelly-ink);
  background: #f1f8ff;
  overflow-wrap: anywhere;
  container-type: inline-size;
}
.jelly-tactics *, .jelly-tactics *::before, .jelly-tactics *::after { box-sizing: border-box; }
.jelly-tactics button { min-width: 44px; min-height: 44px; font: inherit; color: var(--jelly-ink); cursor: pointer; touch-action: manipulation; }
.jelly-tactics button:disabled { cursor: default; }
.jelly-tactics button:focus-visible, .jelly-tactics summary:focus-visible { outline: 3px solid #2564ad; outline-offset: 3px; z-index: 2; }
.jelly-tactics [hidden] { display: none !important; }
.jelly-tactics-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.jelly-tactics-heading-copy { min-width: 0; }
.jelly-tactics-eyebrow { display: block; margin-bottom: 6px; font-size: 10px; font-weight: 800; letter-spacing: 1.1px; }
.jelly-tactics-title { margin: 0; font-family: var(--display-font, inherit); font-size: clamp(20px, 2.7vw, 29px); line-height: 1.2; letter-spacing: -.7px; }
.jelly-tactics-round { display: grid; place-items: center; flex: 0 0 auto; width: 65px; height: 58px; padding: 7px; border: 2px solid var(--jelly-ink); border-radius: 17px; background: #d6ccf7; box-shadow: 0 3px 0 #b9b7d4; transform: rotate(3deg); font-size: 19px; white-space: nowrap; }
.jelly-tactics-round::before { content: "ROUND"; font-size: 8px; letter-spacing: 1px; }
.jelly-tactics-hud { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 9px; margin-bottom: 16px; }
.jelly-tactics-stat { min-width: 0; position: relative; padding: 10px 12px; border: 1.5px solid #99b7cc; border-radius: 14px; background: #fffefa; box-shadow: 0 3px 0 #d4e3ef; }
.jelly-tactics-stat > span:first-child { display: block; font-size: 10px; font-weight: 750; line-height: 1.3; }
.jelly-tactics-stat > strong { display: block; margin-top: 4px; font-size: 24px; letter-spacing: -.6px; line-height: 1.15; }
.jelly-tactics-coin-stat { background: #fff3cc; }
.jelly-tactics-campaign-health { display: block; height: 6px; margin-top: 6px; border: 1px solid #47715f; border-radius: 5px; overflow: hidden; background: #e3efe8; }
.jelly-tactics-campaign-health i { display: block; height: 100%; background: #72bd99; }
.jelly-tactics-health-stat.is-low .jelly-tactics-campaign-health i { background: #e89881; }
.jelly-tactics-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.jelly-tactics-arena { min-width: 0; padding: 11px; border: 2px solid var(--jelly-ink); border-radius: 22px; background: #e0eef8; box-shadow: 0 4px 0 #becfdf; }
.jelly-tactics-section-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 10px; margin-bottom: 9px; }
.jelly-tactics-section-heading h3, .jelly-tactics-synergy-section > h3 { margin: 0; font-size: 14px; font-weight: 800; letter-spacing: -.3px; }
.jelly-tactics-section-heading > span { color: var(--jelly-muted); font-size: 10px; line-height: 1.5; font-weight: 650; }
.jelly-tactics-section-heading .jelly-tactics-phase { padding: 3px 7px; border: 1px solid #91a8bd; border-radius: 7px; background: #fff9ee; color: var(--jelly-ink); font-size: 9px; font-weight: 800; letter-spacing: .5px; }
.jelly-tactics-enemies, .jelly-tactics-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.jelly-tactics-unit { display: flex; align-items: center; flex-direction: column; position: relative; min-width: 0; padding: 5px; border: 1px solid #93adc2; border-radius: 13px; background: #fffef9; text-align: center; transition: background-color .1s, box-shadow .1s; }
.jelly-tactics-unit.is-empty { border: 1px dashed #9ab2c5; background: #f1f8fc99; color: #526c84; }
.jelly-tactics-slot-label { align-self: flex-start; color: var(--jelly-muted); font-size: 8px; font-weight: 750; line-height: 1.5; }
.jelly-tactics-art { display: block; width: 66px; max-width: 90%; height: 64px; margin: -2px 0 0; }
.jelly-tactics-character { display: block; width: 100%; height: 100%; overflow: visible; }
.jelly-tactics-stars { position: absolute; top: 6px; right: 6px; z-index: 1; padding: 0 2px; border-radius: 4px; background: #fffef9d9; color: #946c1c; font-size: 9px; letter-spacing: -.5px; line-height: 1.3; }
.jelly-tactics-name { display: block; max-width: 100%; min-height: 15px; margin-top: 2px; font-size: 11px; font-weight: 800; line-height: 1.3; }
.jelly-tactics-type { display: block; max-width: 100%; margin-top: 3px; color: var(--jelly-muted); font-size: 9px; line-height: 1.4; font-weight: 650; }
.jelly-tactics-unit-health { display: block; width: 100%; height: 5px; margin-top: 5px; overflow: hidden; border-radius: 4px; background: #dce7eb; }
.jelly-tactics-unit-health i { display: block; height: 100%; background: #6eb78d; transition: width .1s linear; }
.jelly-tactics-unit-stats { display: block; margin-top: 4px; color: #3d5873; font-size: 10px; line-height: 1.4; }
.jelly-tactics-shield { margin-top: 3px; padding: 2px 5px; border-radius: 5px; color: #2d5d87; background: #d8edff; font-size: 9px; font-weight: 750; line-height: 1.2; }
.jelly-tactics-empty-mark { display: grid; place-items: center; flex: 1; min-height: 34px; color: #819aaf; font-size: 25px; line-height: 1; }
.jelly-tactics-empty-copy { display: block; font-size: 10px; line-height: 1.5; color: #526c84; }
.jelly-tactics-enemy { min-height: 96px; background: #fff0eb; border-color: #d2a99e; }
.jelly-tactics-enemy.is-empty { min-height: 77px; background: #f6f2f099; border-color: #c8bcb6; }
.jelly-tactics-enemy .jelly-tactics-art { width: 42px; height: 40px; margin-top: -7px; }
.jelly-tactics-enemy .jelly-tactics-name { font-size: 10px; min-height: 13px; }
.jelly-tactics-enemy .jelly-tactics-type { font-size: 8px; margin-top: 1px; }
.jelly-tactics-enemy .jelly-tactics-unit-health { margin-top: 4px; }
.jelly-tactics-enemy .jelly-tactics-unit-stats { margin-top: 2px; }
.jelly-tactics-enemy .jelly-tactics-unit-health i { background: #d28f82; }
.jelly-tactics-enemy .jelly-tactics-slot-label { font-size: 7px; }
.jelly-tactics-divider { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 0; color: #526c84; font-size: 8px; font-weight: 800; letter-spacing: .5px; }
.jelly-tactics-divider strong { display: grid; place-items: center; width: 30px; height: 27px; border: 1.5px solid var(--jelly-ink); border-radius: 10px; color: var(--jelly-ink); background: #ffdeb5; box-shadow: 0 2px 0 #c7c9c7; transform: rotate(-6deg); font-size: 10px; }
.jelly-tactics-tile { min-height: 151px !important; box-shadow: 0 3px 0 #b6cbdc; }
.jelly-tactics-tile:nth-child(-n+3) { background: #f7fbf1; }
.jelly-tactics-tile.is-empty { min-height: 106px !important; box-shadow: none; }
.jelly-tactics-unit.is-selected { outline: 3px solid #a96e2e; outline-offset: -2px; background: #fff0c1 !important; box-shadow: 0 3px 0 #c89d61; }
.jelly-tactics-unit.is-destination { border: 2px dashed #3c83b2; padding: 4px; background: #e9f6ff; }
.jelly-tactics-unit.is-destination:hover { background: #d6edff; }
.jelly-tactics-unit.is-attacking .jelly-tactics-art { transform: translateY(-4px) rotate(-4deg); }
.jelly-tactics-unit.is-hit { background: #ffe4dc; box-shadow: inset 0 0 0 2px #c97c68; }
.jelly-tactics-unit.is-healed { background: #ddf5df; box-shadow: inset 0 0 0 2px #6baf80; }
.jelly-tactics-unit.is-fainted .jelly-tactics-art { opacity: .35; transform: translateY(3px) rotate(8deg); }
.jelly-tactics-unit.is-fainted .jelly-tactics-unit-health i { background: #a4aebb; }
.jelly-tactics-row-labels { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px; margin-top: 9px; color: #526c84; font-size: 9px; line-height: 1.5; }
.jelly-tactics-market { min-width: 0; padding: 13px; border: 2px solid var(--jelly-ink); border-radius: 21px; background: #fffaf0; box-shadow: 0 4px 0 #d7d5cd; }
.jelly-tactics-shop { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.jelly-tactics-offer { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; width: 100%; min-width: 0 !important; padding: 7px 5px; border: 1.5px solid #8dabc0; border-radius: 14px; background: #fffefb; text-align: center; box-shadow: 0 3px 0 #d6d9d8; }
.jelly-tactics-offer:disabled { background: #f6f3ed; box-shadow: none; }
.jelly-tactics-offer[data-kind="empty"] { justify-content: center; opacity: .7; }
.jelly-tactics-offer-art { display: block; width: 67px; max-width: 100%; height: 65px; }
.jelly-tactics-offer-copy { display: flex; flex: 1; flex-direction: column; gap: 4px; min-width: 0; max-width: 100%; }
.jelly-tactics-offer-copy strong { font-size: 11px; line-height: 1.3; font-weight: 800; }
.jelly-tactics-offer-copy > span { font-size: 9px; line-height: 1.45; color: var(--jelly-muted); }
.jelly-tactics-price { display: block; width: 100%; margin-top: 8px; padding: 5px 2px; border: 1px solid #c9ac6b; border-radius: 8px; background: #ffedb5; font-size: 9px; line-height: 1.45; font-weight: 800; }
.jelly-tactics-offer-empty { margin-top: 5px; font-size: 10px; line-height: 1.6; }
.jelly-tactics-button, .jelly-tactics-primary { padding: 10px 13px; border: 1.5px solid var(--jelly-ink); border-radius: 12px; background: #fffefa; box-shadow: 0 3px 0 #c6d4df; font-size: 11px !important; font-weight: 800 !important; line-height: 1.35; }
.jelly-tactics-button:disabled, .jelly-tactics-primary:disabled { opacity: .5; box-shadow: none; }
.jelly-tactics-button:hover:not(:disabled), .jelly-tactics-offer:hover:not(:disabled) { background: #edf7ff; }
.jelly-tactics-reroll { display: block; width: 100%; margin-top: 11px; background: #f0eaff; }
.jelly-tactics-coin-note { margin: 10px 1px 0; color: var(--jelly-muted); font-size: 10px; line-height: 1.65; }
.jelly-tactics-inspector { padding: 13px 0 0; margin-top: 13px; border-top: 1px dashed #b6bcbf; }
.jelly-tactics-inspector-title { font-size: 13px; line-height: 1.5; }
.jelly-tactics-inspector-copy { min-height: 48px; margin: 7px 0 11px; font-size: 11px; color: var(--jelly-muted); line-height: 1.65; }
.jelly-tactics-inspector-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.jelly-tactics-inspector-actions > button { padding: 8px 7px; font-size: 10px !important; }
.jelly-tactics-sell { background: #ffe8dc; }
.jelly-tactics-reserve { min-width: 0; margin-top: 18px; padding: 12px; border: 1.5px solid #91acc2; border-radius: 18px; background: #e9f0fa; }
.jelly-tactics-bench { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.jelly-tactics-bench-tile { min-height: 132px !important; box-shadow: 0 2px 0 #c6d4df; }
.jelly-tactics-bench-tile.is-empty { min-height: 70px !important; box-shadow: none; }
.jelly-tactics-bench-tile .jelly-tactics-art { width: 51px; height: 49px; }
.jelly-tactics-bench-tile .jelly-tactics-unit-stats { font-size: 10px; }
.jelly-tactics-synergy-section { margin-top: 18px; }
.jelly-tactics-synergies { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 9px; }
.jelly-tactics-synergy { min-width: 0; padding: 8px 10px; border: 1px dashed #a3b5c6; border-radius: 11px; background: #ffffffa6; }
.jelly-tactics-synergy.is-active { border-style: solid; border-color: #7ea792; background: #ecf8ee; box-shadow: inset 3px 0 0 var(--jelly-synergy-color, #86c69e); }
.jelly-tactics-synergy strong { display: block; font-size: 10px; line-height: 1.5; }
.jelly-tactics-synergy span { display: block; margin-top: 3px; color: var(--jelly-muted); font-size: 10px; line-height: 1.55; }
.jelly-tactics-synergy-empty { grid-column: 1 / -1; margin: 0; padding: 10px 12px; border: 1px dashed #a3b5c6; border-radius: 11px; color: var(--jelly-muted); font-size: 11px; line-height: 1.6; }
.jelly-tactics-message { min-height: 44px; margin: 15px 0 9px; padding: 10px 12px; border-radius: 12px; background: #ffffffc9; font-size: 12px; font-weight: 650; line-height: 1.65; }
.jelly-tactics-battle-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 11px; padding: 4px 0 12px; }
.jelly-tactics-primary { min-width: 143px !important; background: #ade0c5; box-shadow: 0 4px 0 #83af99; font-size: 13px !important; }
.jelly-tactics-primary:hover:not(:disabled) { background: #c4efd7; }
.jelly-tactics-progress-copy { color: var(--jelly-muted); font-size: 11px; line-height: 1.6; }
.jelly-tactics-result { padding: 13px 14px; margin-bottom: 12px; border: 1.5px solid #aa8d6b; border-radius: 14px; background: #fff0d7; }
.jelly-tactics-result[data-outcome="won"] { background: #e1f4e7; border-color: #7ea78c; }
.jelly-tactics-result > strong { font-size: 15px; line-height: 1.5; }
.jelly-tactics-result > p { margin: 5px 0 0; font-size: 11px; line-height: 1.7; }
.jelly-tactics-log-details, .jelly-tactics-guide { padding: 0 12px; margin-top: 9px; border: 1px solid #a6bbcb; border-radius: 12px; background: #ffffffb3; }
.jelly-tactics summary { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 0; font-size: 11px; font-weight: 750; cursor: pointer; touch-action: manipulation; }
.jelly-tactics summary::before { content: "+"; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; background: #e2eef9; font-size: 14px; }
.jelly-tactics details[open] > summary::before { content: "−"; }
.jelly-tactics-log, .jelly-tactics-guide ul { margin: 0; padding: 0 0 12px 18px; color: var(--jelly-muted); font-size: 11px; line-height: 1.8; }
.jelly-tactics-log:empty::before { content: "Battle details appear here when the squads meet."; display: block; margin-left: -18px; }
.jelly-tactics-guide li + li { margin-top: 6px; }
@container (min-width: 740px) {
  .jelly-tactics-layout { grid-template-columns: minmax(0, 1.45fr) minmax(280px, 1fr); align-items: start; }
  .jelly-tactics-shop { grid-template-columns: 1fr; }
  .jelly-tactics-offer { flex-direction: row; gap: 8px; min-height: 83px; padding: 8px; text-align: left; }
  .jelly-tactics-offer-art { flex: 0 0 57px; width: 57px; height: 58px; }
  .jelly-tactics-price { flex: 0 0 60px; width: 60px; margin-top: 0; padding: 6px 3px; text-align: center; }
  .jelly-tactics-offer[data-kind="empty"] { flex-direction: column; gap: 0; }
  .jelly-tactics-bench { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .jelly-tactics-synergies { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  body[data-game="tactics"] main { padding-left: 4px; padding-right: 4px; }
  body[data-game="tactics"] .play-panel { padding: 5px; }
  .jelly-tactics { padding: 9px 6px; }
  .jelly-tactics-heading { gap: 7px; margin-bottom: 12px; }
  .jelly-tactics-eyebrow { font-size: 8px; letter-spacing: .5px; }
  .jelly-tactics-title { font-size: 19px; }
  .jelly-tactics-round { width: 53px; height: 51px; border-radius: 14px; font-size: 15px; }
  .jelly-tactics-hud { gap: 6px; margin-bottom: 12px; }
  .jelly-tactics-stat { padding: 8px; border-radius: 11px; }
  .jelly-tactics-stat > span:first-child { font-size: 9px; }
  .jelly-tactics-stat > strong { font-size: 21px; }
  .jelly-tactics-arena { padding: 8px; border-radius: 17px; }
  .jelly-tactics-section-heading h3, .jelly-tactics-synergy-section > h3 { font-size: 13px; }
  .jelly-tactics-section-heading > span { font-size: 9px; }
  .jelly-tactics-enemies, .jelly-tactics-board, .jelly-tactics-bench { gap: 5px; }
  .jelly-tactics-unit { padding: 4px; border-radius: 10px; }
  .jelly-tactics-unit.is-destination { padding: 3px; }
  .jelly-tactics-art { width: 57px; height: 56px; }
  .jelly-tactics-name { font-size: 10px; }
  .jelly-tactics-type { font-size: 8px; }
  .jelly-tactics-unit-stats { font-size: 10px; }
  .jelly-tactics-tile { min-height: 139px !important; }
  .jelly-tactics-market { padding: 10px 8px; }
  .jelly-tactics-shop { gap: 5px; }
  .jelly-tactics-offer { padding: 6px 4px; border-radius: 11px; }
  .jelly-tactics-offer-art { height: 56px; width: 58px; }
  .jelly-tactics-offer-copy strong { font-size: 10px; }
  .jelly-tactics-offer-copy > span { font-size: 8px; }
  .jelly-tactics-price { font-size: 8px; padding: 5px 1px; }
  .jelly-tactics-reserve { padding: 10px 8px; }
  .jelly-tactics-bench-tile { min-height: 126px !important; }
  .jelly-tactics-bench-tile .jelly-tactics-unit-stats { font-size: 10px; }
}
/* This is a scrolling DOM game, so a short screen must not size its board by
   viewport height like the host's square canvas games. Keep normal page scroll. */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 1000px) {
  body.focus-play[data-game="tactics"] .play-panel { display: block; }
  body.focus-play[data-game="tactics"] #stage-wrap { width: 100%; max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .jelly-tactics *, .jelly-tactics *::before, .jelly-tactics *::after { transition: none !important; }
}
