/* design/SKILL.md §4.2 / §4.3 / §6.4 — physical offsets and expanded selectors
   keep legacy Android WebViews in the same fitted stage as modern hosts. */
/* design/SKILL.md §4.2 / §4.3 — a small gold seal has a 44px hit area;
   the authoritative total stays visually dominant and already includes it. */
.battle-column.formations-enabled { position: relative; }
.formation-marker {
  position: absolute;
  left: calc(50% + 22px);
  width: 44px;
  height: 44px;
  min-width: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #e1c487;
  font: 700 16px/1 var(--font, serif);
  text-shadow: 0 1px 2px #000;
  cursor: pointer;
  touch-action: manipulation;
  isolation: isolate;
}
.formation-marker::before {
  content: "";
  position: absolute;
  top: 9px; right: 9px; bottom: 9px; left: 9px;
  z-index: -1;
  border: 1px solid #a18a58;
  border-radius: 3px;
  background: #29271e;
  box-shadow: inset 0 0 0 2px #3f3929, 0 1px 3px #0009;
}
.formation-marker.is-preview { color: #c6eee3; }
.formation-marker.is-preview::before { border-style: dashed; border-color: #8bbeb2; background: #24342d; }
.formations-enabled .lane-total-preview { outline: 1px dashed #9ff3ee; outline-offset: 2px; }
.formation-marker:focus-visible::before { outline: 2px solid #f2dda3; outline-offset: 3px; }

/* design/SKILL.md §4.1 / §6.4 — only active generic rules appear in an
   anchored, nonmodal panel; outside actions and Escape dismiss it. */
#game-screen > #formation-details,
#game-screen > #hidden-tactic-details {
  position: absolute;
  z-index: 430;
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: 336px;
  overflow-y: auto;
  padding: 16px 18px 14px;
  border: 1px solid #a68e5b;
  border-radius: 5px;
  background: #232823;
  color: #dfd7bf;
  box-shadow: 0 6px 20px #0008, inset 0 0 0 3px #b59b6010;
  font: 14px/1.65 var(--font, serif);
  overflow-wrap: anywhere;
  scrollbar-width: thin;
  scrollbar-color: #9d895d #232823;
}
.formation-details-panel h3 { margin: 0; color: #e9cf91; font-size: 17px; line-height: 1.4; }
.formation-details-panel p { margin: 0; }
.formation-details-panel strong { color: #e4c98e; }
.formation-details-panel .formation-details-note { margin-top: -5px; color: #ada68d; font-size: 12px; }
.formation-details-panel .formation-details-tip { padding-top: 7px; border-top: 1px solid #a68e5b40; color: #bfb49a; font-size: 12px; }

/* design/SKILL.md §2.3 / §4.3 / §6.4 — supplied tips retain native dimensions,
   active-rule filtering and text equivalents; the existing anchored dismissal stays shared. */
.lane-details-accessible-text {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
/* design/SKILL.md §4.3 / §6.2 — active rules determine the panel height;
   keep the stacking note close instead of reserving space for an inactive rule. */
#game-screen > #formation-details.official-formation-details {
  box-sizing: border-box; width: 250px; min-height: 0; padding: 10px; gap: 3px;
  border: 0; border-radius: 0; box-shadow: none;
  background-color: transparent; background-position: center; background-size: 100% 100%; background-repeat: no-repeat;
}
.official-formation-details h3 { display: flex; align-items: center; gap: 8px; height: 18px; flex: none; }
.official-formation-details img { display: block; flex: none; }
.official-formation-details .formation-details-note { margin: 0; font-size: 11px; line-height: 12px; color: #b6bdc1; }
.official-formation-details .formation-details-rule { height: 35px; flex: none; line-height: 1; }
.official-formation-details .formation-details-tip {
  margin-top: 6px; padding-top: 5px; border: 0; flex: none;
  background-position: left top; background-size: 230px 1px; background-repeat: no-repeat;
}
#game-screen > #hidden-tactic-details.official-hidden-tactic-details {
  width: 250px; height: 50px; padding: 0; gap: 0; border: 0; border-radius: 0;
  background: none; box-shadow: none;
}
.official-hidden-tactic-details > img { display: block; width: 250px; height: 50px; flex: none; }

/* design/SKILL.md §4.1 / §4.3 — native text replaces the body bitmap only.
   The approved frame/title/buttons stay at their existing art dimensions. */
#rules-modal.unified-rules #rules-content {
  display: block;
  padding: 8px 16px;
  background-image: none !important;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
#rules-modal.unified-rules #rules-content > .rules-text-page,
.official-ui-active #rules-modal.unified-rules #rules-content > .rules-text-page {
  display: block !important;
  color: #d5c39b;
  font: 15px/1.65 var(--font, serif);
  text-shadow: 0 1px 2px #0009;
  overflow-wrap: anywhere;
}
.rules-text-page h3 { margin: 0 0 6px; color: #ebcd8a; font-size: 18px; line-height: 1.5; letter-spacing: 2px; }
.rules-text-page section + section { margin-top: 14px; }
#rules-modal.unified-rules .rules-text-page ul { margin: 0; padding-left: 20px; }
#rules-modal.unified-rules .rules-text-page li { margin: 3px 0; }
.rules-text-page strong { color: #e4ce99; }
.rules-text-page .rules-footnote { margin: 14px 0 0; padding-top: 9px; border-top: 1px solid #ac915b40; color: #ac9f80; font-size: 13px; }

@media (hover: hover) {
  .formation-marker:hover, .formation-marker[aria-expanded="true"] { color: #fff0c9; }
  .formation-marker:hover::before, .formation-marker[aria-expanded="true"]::before { border-color: #dec183; background: #403928; }
}
@media (max-width: 600px) {
  html:not(.official-ui-active) #rules-modal.unified-rules #rules-content { padding: 4px; }
  html:not(.official-ui-active) #rules-modal.unified-rules #rules-content > .rules-text-page { font-size: 13px; }
}
.formation-marker[hidden], .formation-marker.hidden,
#game-screen > #formation-details[hidden], #game-screen > #formation-details.hidden { display: none !important; }
