/* reversi003.css: Wakabattle scene presentation and battle layout.
 * Simple-mode controls belong in reversi001.css; empty-slot components in reversi002.css.
 * Edit the owning component or breakpoint directly; do not append patch overrides.
 */

@keyframes sb-win-stars-b {
  0% {
    opacity: 0;
    transform: scale(0.25) rotate(10deg);
  }
  15% {
    opacity: 0.9;
    transform: scale(1.08) rotate(-4deg);
  }
  35% {
    opacity: 0.35;
    transform: scale(0.72) rotate(2deg);
  }
  55% {
    opacity: 1;
    transform: scale(1.02) rotate(-2deg);
  }
  75% {
    opacity: 0.42;
    transform: scale(0.76);
  }
  100% {
    opacity: 0;
    transform: scale(0.2);
  }
}

.ability-battle .sb-ability-slot.slot-disabled {
  opacity: 0.55;
}
.ability-battle .sb-ability-slot.slot-disabled::after {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(0, 0, 0, 0.18) 56%,
    rgba(0, 0, 0, 0.38) 100%
  );
}
.ability-battle .sb-ability-slot[class*="slot-cat-"] {
  filter: none !important;
}
.ability-battle
  .sb-ability-slot[class*="slot-cat-"]:not(.slot-used):not(
    .slot-disabled
  ):hover {
  filter: none !important;
  transform: none !important;
}
.ability-battle .sb-ability-slot.slot-used {
  filter: none !important;
}

.ability-battle .sb-inline-ability-name.sb-dom-ability-card.has-remaining {
  padding-bottom: 30px;
}
.ability-battle .sb-slot-title-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
}
.ability-battle .sb-dom-ability-card .sb-slot-name-text {
  width: 100%;
  max-width: 100%;
  padding: 0 2px;
  overflow: visible;
  color: #fff;
  font-family: "DotGothic16", sans-serif;
  font-size: max(var(--wk-font-min, 14px), clamp(9px, var(--sb-name-fit, 16cqw), 15px));
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: 0;
  white-space: normal;
  -webkit-text-stroke: 0.35px #000;
  paint-order: stroke fill;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
  word-break: auto-phrase;
  text-wrap: balance;
}
.ability-battle .sb-dom-ability-card .sb-slot-tags,
.ability-battle .sb-dom-ability-card .sb-slot-meta-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  margin-top: 2px;
  gap: 3px;
  flex-wrap: nowrap;
  overflow: hidden;
}
.ability-battle .sb-dom-ability-card .sb-slot-meta-row .sb-slot-cond-tag {
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.ability-battle .sb-dom-ability-card .sb-slot-remaining {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 3px;
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 2px 4px;
  color: #fff;
  background: rgba(0, 0, 0, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  font-family: "DotGothic16", sans-serif;
  font-size: max(var(--wk-font-min, 14px), clamp(8px, 1.95vw, 10px));
  font-weight: 900;
  line-height: 1.4;
  letter-spacing: 0;
  white-space: nowrap;
  text-shadow: 0 1px 1px #000;
}
.ability-battle .sb-dom-ability-card .sb-slot-remaining.is-empty {
  color: #ffb0b0;
  border-color: rgba(255, 150, 150, 0.72);
}
.ability-battle .sb-ability-slot.slot-used .sb-dom-ability-card {
  opacity: 0.72;
}

.sb-choice-name-row,
.sb-swap-slot-name-row {
  align-items: center !important;
  gap: clamp(12px, 2.6vw, 14px) !important;
}

/* Final CPU intro stat spacing: keep labels and star meters in separate columns. */
.bi-taunt-status-main .bi-taunt-status-row {
  display: grid !important;
  grid-template-columns: 5.6em minmax(8.4em, 1fr) !important;
  column-gap: 1.25em !important;
  align-items: center !important;
  width: 100% !important;
}

.bi-taunt-status-main .bi-taunt-stat-label,
.bi-taunt-status-main .bi-taunt-status-label {
  grid-column: 1 !important;
  min-width: 0 !important;
  width: auto !important;
  max-width: none !important;
  text-align: left !important;
  white-space: nowrap !important;
}

.bi-taunt-status-main .bi-taunt-stat-stars,
.bi-taunt-status-main .bi-taunt-status-stars {
  grid-column: 2 !important;
  min-width: 8.4em !important;
  width: auto !important;
  max-width: none !important;
  margin-left: 0 !important;
  padding-left: 0 !important;
  text-align: left !important;
  letter-spacing: 0 !important;
  white-space: nowrap !important;
}

@media (max-width: 480px) {
  .bi-taunt-status-main .bi-taunt-status-row {
    grid-template-columns: 5.2em minmax(8.2em, 1fr) !important;
    column-gap: 1em !important;
  }
  .bi-taunt-status-main .bi-taunt-stat-stars,
  .bi-taunt-status-main .bi-taunt-status-stars {
    min-width: 8.2em !important;
    font-size: max(var(--wk-font-min, 14px), clamp(12px, 3.2vw, 15px)) !important;
  }
}

/* Skill cards and dialog text. */
.ability-battle .sb-message-bar {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 26px !important;
  padding: 5px 12px 4px !important;
  border: 2px solid #d8e3d9 !important;
  border-radius: 3px !important;
  background: #080b09 !important;
  color: #fff !important;
  font-size: var(--wk-font-body, 16px) !important;
  font-weight: 900 !important;
  line-height: 1.35 !important;
  letter-spacing: 0 !important;
  text-shadow: 2px 2px 0 #000 !important;
  white-space: normal !important;
  word-break: keep-all !important;
  box-shadow:
    0 0 0 2px #17251b,
    0 3px 0 rgba(0, 0, 0, 0.36) !important;
}

.bi-taunt-status-table {
  display: table !important;
  width: 224px !important;
  max-width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 4px !important;
  table-layout: fixed !important;
}
.bi-taunt-status-table .bi-taunt-status-row {
  display: table-row !important;
}
.bi-taunt-status-table .bi-taunt-stat-label,
.bi-taunt-status-table .bi-taunt-status-label {
  display: table-cell !important;
  width: 82px !important;
  min-width: 82px !important;
  max-width: 82px !important;
  padding: 0 16px 0 0 !important;
  text-align: left !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
  letter-spacing: 0 !important;
}
.bi-taunt-status-table .bi-taunt-stat-stars,
.bi-taunt-status-table .bi-taunt-status-stars {
  display: table-cell !important;
  width: 126px !important;
  min-width: 126px !important;
  max-width: 126px !important;
  padding: 0 !important;
  text-align: left !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
  overflow: visible !important;
  font-size: max(var(--wk-font-min, 14px), clamp(13px, 3.35vw, 16px)) !important;
  letter-spacing: 0 !important;
}

.sb-choice-modal .sb-choice-card {
  border: 1px solid rgba(255, 255, 255, 0.42) !important;
  border-bottom: 3px solid rgba(0, 0, 0, 0.22) !important;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.18) !important;
}
.sb-swap-modal.sb-choice-modal {
  width: min(92vw, 386px) !important;
}
.sb-choice-modal .sb-choice-name-row {
  display: grid !important;
  grid-template-columns: minmax(6.9em, max-content) auto minmax(0, 1fr) auto !important;
  align-items: center !important;
  column-gap: 10px !important;
  min-width: 0 !important;
  width: 100% !important;
  margin: 0 !important;
}
.sb-choice-modal .sb-choice-name {
  min-width: 0 !important;
  flex: 0 1 auto !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  font-size: clamp(15px, 3.7vw, 18px) !important;
  letter-spacing: 0 !important;
}
.sb-choice-modal .sb-choice-name-row .sb-choice-cond-tag {
  margin-left: 0 !important;
  grid-column: 4 !important;
  flex: 0 0 auto !important;
}
.sb-choice-modal .sb-choice-desc {
  color: rgba(255, 255, 255, 0.96) !important;
  letter-spacing: 0 !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95) !important;
}
.sb-choice-effect,
.sb-tip-effect {
  display: grid !important;
  gap: 2px !important;
  margin-top: auto !important;
  border-radius: 6px !important;
  background: rgba(0, 0, 0, 0.46) !important;
  border: 1px solid rgba(255, 255, 255, 0.26) !important;
  color: #fff7ca !important;
  font-family: "DotGothic16", sans-serif !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 1) !important;
}
.sb-choice-effect span,
.sb-tip-effect span {
  display: block !important;
}

#sb-result-overlay .sb-result-reward-card .sb-result-reward-cond,
#sb-result-overlay .sb-result-reward-card .sb-swap-slot-cond {
  margin-left: 0 !important;
  flex: 0 0 auto !important;
}

.sb-swap-modal:not(.sb-choice-modal) .sb-swap-title,
.sb-swap-modal:not(.sb-choice-modal) .sb-swap-section-label,
.sb-swap-modal:not(.sb-choice-modal) .sb-swap-slot-name,
.sb-swap-modal:not(.sb-choice-modal) .sb-swap-slot-cond,
.sb-swap-modal:not(.sb-choice-modal) .sb-swap-role-badge {
  letter-spacing: 0 !important;
  word-break: keep-all !important;
}

.sb-ability-tooltip .sb-tip-header {
  display: flex !important;
  align-items: center !important;
  gap: clamp(12px, 2.6vw, 14px) !important;
  flex-wrap: wrap !important;
}
.sb-ability-tooltip .sb-tip-name {
  min-width: 0 !important;
  flex: 0 1 auto !important;
}
.sb-ability-tooltip .sb-tip-stars {
  flex: 0 0 auto !important;
}

@media (max-width: 480px) {
  .sb-swap-modal.sb-choice-modal {
    width: min(88vw, 332px) !important;
    max-width: 332px !important;
  }
}

/* Final polish: stable skill cards, clear placement selection, and frameless CPU stats. */
.ability-battle .sb-ability-slot,
.ability-battle .sb-ability-slot:hover,
.ability-battle .sb-ability-slot:active,
.ability-battle .sb-ability-slot.slot-activating {
  transform: none !important;
}
.ability-battle .sb-ability-slot.slot-activating {
  animation: none !important;
  border-color: #ffd84a !important;
  box-shadow:
    0 0 0 2px #2c1b02,
    0 0 0 4px #ffd84a,
    3px 3px 0 rgba(0, 0, 0, 0.3) !important;
}
.sb-choice-card.selected,
.sb-choice-card.selected:hover {
  transform: none !important;
}
.ability-battle .ot-cell.hint,
.ability-battle .ot-cell.hint-guided,
.ability-battle .ot-cell.hint-block,
.ability-battle .ot-cell.hint-erase,
.ability-battle .ot-cell.hint-flip,
.ability-battle .ot-disc.disc-erase-target,
.ability-battle .ot-disc.disc-flip-target {
  animation-duration: 1.1s !important;
}
.ability-battle .ot-cell.hint.hint-placement:not(.hint-guided) {
  background: rgba(20, 132, 255, 0.2) !important;
  outline: 3px solid rgba(92, 183, 255, 0.98) !important;
  outline-offset: -3px !important;
  border-radius: 4px !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.38),
    0 0 10px 3px rgba(58, 169, 255, 0.36) !important;
  animation: placement-cell-pulse 1.1s ease-in-out infinite !important;
}
.ability-battle .ot-cell.hint.hint-placement:not(.hint-guided):hover {
  background: rgba(36, 151, 255, 0.34) !important;
  outline-color: rgba(160, 220, 255, 1) !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.58),
    0 0 16px 5px rgba(58, 169, 255, 0.55) !important;
  animation: none !important;
}
@keyframes placement-cell-pulse {
  0%,
  100% {
    outline-color: rgba(48, 150, 255, 0.68);
    background: rgba(20, 132, 255, 0.16);
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.24),
      0 0 6px 1px rgba(58, 169, 255, 0.25);
  }
  50% {
    outline-color: rgba(170, 225, 255, 1);
    background: rgba(36, 151, 255, 0.3);
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.56),
      0 0 16px 5px rgba(58, 169, 255, 0.55);
  }
}

.bi-taunt-status-table,
.bi-taunt-status-table tr,
.bi-taunt-status-table th,
.bi-taunt-status-table td {
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.bi-taunt-status,
.bi-taunt-status *,
.bi-taunt-status-main,
.bi-taunt-status-main *,
.bi-taunt-status-main .bi-taunt-status-row,
.bi-taunt-status-main .bi-taunt-stat-label,
.bi-taunt-status-main .bi-taunt-status-label,
.bi-taunt-status-main .bi-taunt-stat-stars,
.bi-taunt-status-main .bi-taunt-status-stars {
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.bi-taunt-status-plain {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 4px !important;
  width: max-content !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.bi-taunt-status-plain .bi-taunt-status-line {
  display: grid !important;
  grid-template-columns: clamp(112px, 18vw, 132px) auto !important;
  align-items: center !important;
  column-gap: 14px !important;
  min-height: 24px !important;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  white-space: nowrap !important;
}
.bi-taunt-status-plain .bi-taunt-status-line-label {
  display: inline-block !important;
  width: clamp(112px, 18vw, 132px) !important;
  min-width: clamp(112px, 18vw, 132px) !important;
  color: #fff !important;
  font-family: "DotGothic16", sans-serif !important;
  font-size: clamp(17px, 4.5vw, 22px) !important;
  font-weight: 900 !important;
  line-height: 1.25 !important;
  letter-spacing: 0 !important;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95) !important;
}
.bi-taunt-status-plain .bi-taunt-status-line-stars {
  display: inline-block !important;
  padding-left: 2px !important;
  color: #ffd546 !important;
  font-family: "DotGothic16", sans-serif !important;
  font-size: clamp(15px, 3.8vw, 18px) !important;
  font-weight: 400 !important;
  line-height: 1.25 !important;
  letter-spacing: 0 !important;
  text-shadow:
    0 1px 2px #000,
    0 0 6px rgba(255, 213, 70, 0.45) !important;
}
.bi-taunt-status-plain .bi-taunt-status-line.best .bi-taunt-status-line-stars {
  color: #ffe577 !important;
}
.wl-cpu-status-plain {
  --wl-cpu-text-size: clamp(10px, 5.2cqi, 20px);
  --wl-cpu-star-size: clamp(8px, 4.4cqi, 15px);
  display: grid !important;
  grid-template-columns: var(--wl-cpu-columns, max-content max-content) !important;
  align-items: start !important;
  justify-content: space-between;
  column-gap: 6px !important;
  width: 100% !important;
  max-width: var(--wl-cpu-width, 410px);
  font-size: var(--wl-cpu-text-size);
  margin: 0 auto !important;
  padding: 0 !important;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.wl-cpu-status-lines {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 4px !important;
}
.wl-cpu-status-type {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  gap: 4px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.wl-cpu-status-meta-row {
  display: grid !important;
  grid-template-columns: 4em max-content !important;
  align-items: center !important;
  column-gap: var(--wl-cpu-meta-gap, 4px) !important;
  min-height: 25px !important;
  white-space: nowrap !important;
}
.wl-cpu-status-type-label {
  color: #fff !important;
  font-family: "DotGothic16", sans-serif !important;
  font-size: var(--wl-cpu-text-size) !important;
  font-weight: 900 !important;
  line-height: 1.25 !important;
  letter-spacing: 0 !important;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95) !important;
  text-align: left !important;
}
.wl-cpu-status-type-value {
  color: #fff !important;
  font-family: "DotGothic16", sans-serif !important;
  font-size: var(--wl-cpu-text-size) !important;
  font-weight: 400 !important;
  line-height: 1.25 !important;
  letter-spacing: 0 !important;
  white-space: nowrap !important;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95) !important;
}
.wl-cpu-status-line {
  display: grid !important;
  grid-template-columns: 3em max-content !important;
  align-items: center !important;
  column-gap: 4px !important;
  min-height: 25px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  white-space: nowrap !important;
}
.wl-cpu-status-label {
  display: block !important;
  color: #fff !important;
  font-family: "DotGothic16", sans-serif !important;
  font-size: var(--wl-cpu-text-size) !important;
  font-weight: 900 !important;
  line-height: 1.25 !important;
  letter-spacing: 0 !important;
  text-align: left !important;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95) !important;
}
.wl-cpu-status-stars {
  padding-left: 2px !important;
  color: #ffd546 !important;
  font-family: "DotGothic16", sans-serif !important;
  font-size: var(--wl-cpu-star-size) !important;
  font-weight: 900 !important;
  line-height: 1.25 !important;
  letter-spacing: 0 !important;
  text-align: left !important;
  text-shadow:
    0 1px 2px #000,
    0 0 6px rgba(255, 213, 70, 0.45) !important;
}
.wl-cpu-status-line.best .wl-cpu-status-stars {
  color: #ffe577 !important;
}
.wl-cpu-status-stars {
  display: inline-flex !important;
  align-items: center !important;
  gap: 1px !important;
}
.wl-cpu-status-star {
  display: inline-block !important;
  width: 0.96em !important;
  text-align: center !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  font-weight: 400 !important;
}
.wl-cpu-status-star.wl-star-on {
  color: #ffd546 !important;
  font-size: max(var(--wk-font-min, 14px), 1.28em) !important;
  text-shadow:
    0 1px 2px #000,
    0 0 6px rgba(255, 213, 70, 0.5) !important;
}
.wl-cpu-status-line.best .wl-cpu-status-star.wl-star-on {
  color: #ffe577 !important;
}
.wl-cpu-status-star.wl-star-off {
  color: #f8fbff !important;
  font-size: max(var(--wk-font-min, 14px), 1.12em) !important;
  text-shadow:
    0 1px 2px #000,
    0 0 5px rgba(255, 255, 255, 0.58) !important;
}

.ability-battle .sb-dom-ability-card .sb-slot-stars,
.sb-choice-icon,
.sb-swap-slot-icon,
.sb-ability-tooltip .sb-tip-stars {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  min-width: 38px !important;
  min-height: 21px !important;
  height: 21px !important;
  padding: 2px 7px 3px !important;
  border: 1px solid rgba(45, 29, 0, 0.95) !important;
  border-bottom: 2px solid rgba(45, 29, 0, 0.88) !important;
  border-radius: 6px !important;
  background: linear-gradient(
    180deg,
    #fff7b7 0%,
    #ffd94f 48%,
    #d59a1b 100%
  ) !important;
  color: #241800 !important;
  font-family: "DotGothic16", sans-serif !important;
  font-size: var(--wk-font-min, 14px) !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  -webkit-text-stroke: 0 !important;
  paint-order: normal !important;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.62) !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.48) inset,
    0 2px 4px rgba(0, 0, 0, 0.45) !important;
}

.sb-choice-modal .sb-choice-card {
  min-height: auto !important;
  padding: 10px 12px !important;
  gap: 5px !important;
}
.sb-choice-modal .sb-choice-desc {
  font-size: var(--wk-font-body, 16px) !important;
  line-height: 1.34 !important;
}
.sb-choice-effect,
.sb-tip-effect {
  padding: 5px 7px !important;
  font-size: var(--wk-font-meta, 14px) !important;
  line-height: 1.25 !important;
}

@media (max-width: 480px) {
  .sb-choice-modal .sb-choice-card {
    min-height: auto !important;
    padding: 8px 9px !important;
    gap: 4px !important;
  }
  .sb-choice-modal .sb-choice-desc {
    font-size: max(var(--wk-font-min, 14px), clamp(10px, 2.6vw, 12px)) !important;
    line-height: 1.3 !important;
  }
  .sb-choice-effect,
  .sb-tip-effect {
    padding: 4px 6px !important;
    font-size: max(var(--wk-font-min, 14px), clamp(8.2px, 2.2vw, 10px)) !important;
    line-height: 1.22 !important;
  }
  .bi-taunt-status-plain .bi-taunt-status-line {
    grid-template-columns: clamp(102px, 30vw, 120px) auto !important;
    column-gap: 12px !important;
    min-height: 22px !important;
  }
  .bi-taunt-status-plain .bi-taunt-status-line-label {
    font-size: clamp(16px, 4.4vw, 20px) !important;
    width: clamp(102px, 30vw, 120px) !important;
    min-width: clamp(102px, 30vw, 120px) !important;
  }
  .bi-taunt-status-plain .bi-taunt-status-line-stars {
    font-size: max(var(--wk-font-min, 14px), clamp(13px, 3.4vw, 16px)) !important;
  }
  .wl-cpu-status-line {
    min-height: 23px !important;
  }
  .wl-cpu-status-type {
    gap: 3px !important;
    margin-top: 0 !important;
  }
  .wl-cpu-status-meta-row {
    min-height: 23px !important;
  }
}

/* Keep PC dialogue text clear of the lower edge while the line is typing. */
@media (min-width: 481px) {
  #reversi .bi-taunt-overlay .bi-msg,
  .reversi-game .bi-taunt-overlay .bi-msg {
    transform: translateY(-28px) !important;
  }

  .wl-cpu-status-plain {
    --wl-cpu-columns: repeat(2, minmax(max-content, 1fr));
    --wl-cpu-width: 448px;
    --wl-cpu-meta-gap: clamp(4px, calc(3cqi - 4px), 10px);
    justify-items: center;
  }
}

/* Continuation screen: one shared portrait card and avatar scale. This lives
   before the theme editor's publish limit and overrides every older variant. */
#reversi .sb-continue-modal,
.reversi-game .sb-continue-modal {
  --sb-continue-bottom-padding: 84px;
  width: min(380px, 88vw);
  max-width: 380px;
  min-height: unset;
  aspect-ratio: 400 / 650;
  box-sizing: border-box;
  padding: 32px 38px var(--sb-continue-bottom-padding);
}

@media (max-width: 480px) {
  #reversi .sb-continue-modal,
  .reversi-game .sb-continue-modal {
    --sb-continue-bottom-padding: 104px;
  }
}

#reversi .sb-continue-face,
.reversi-game .sb-continue-face {
  width: min(68vw, 260px);
  height: min(68vw, 260px);
}

/* Final skill-choice selection state: the category color stays, selection becomes unmistakable. */
.sb-choice-modal .sb-choice-card.selected,
.sb-choice-modal .sb-choice-card.selected:hover {
  position: relative !important;
  transform: none !important;
  border-color: #fff7c2 !important;
  outline: 3px solid rgba(255, 247, 194, 0.96) !important;
  outline-offset: -5px !important;
  box-shadow:
    0 0 0 2px rgba(60, 36, 5, 0.82),
    0 0 18px 5px rgba(255, 224, 82, 0.64),
    inset 0 0 0 1px rgba(255, 255, 255, 0.62) !important;
}
.sb-choice-modal .sb-choice-card.selected::before {
  content: none !important;
  position: absolute !important;
  right: 8px !important;
  bottom: 7px !important;
  z-index: 4 !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 58px !important;
  height: 21px !important;
  padding: 0 8px 1px !important;
  border: 1px solid rgba(45, 29, 0, 0.92) !important;
  border-bottom-width: 2px !important;
  border-radius: 999px !important;
  background: linear-gradient(
    180deg,
    #fff8b7 0%,
    #ffd94f 52%,
    #c98714 100%
  ) !important;
  color: #201300 !important;
  font-family: "DotGothic16", sans-serif !important;
  font-size: var(--wk-font-min, 14px) !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.62) !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.46) inset,
    0 2px 5px rgba(0, 0, 0, 0.42) !important;
  pointer-events: none !important;
}
@media (max-width: 480px) {
  .sb-choice-modal .sb-choice-card.selected,
  .sb-choice-modal .sb-choice-card.selected:hover {
    outline-width: 2px !important;
    outline-offset: -4px !important;
  }
  .sb-choice-modal .sb-choice-card.selected::before {
    right: 7px !important;
    bottom: 6px !important;
    min-width: 52px !important;
    height: 19px !important;
    padding: 0 7px 1px !important;
    font-size: var(--wk-font-min, 14px) !important;
  }
}

/* Mobile choice fixes. */
@media (max-width: 480px) {
  #reversi .sb-choice-modal .sb-choice-name-row,
  .reversi-game .sb-choice-modal .sb-choice-name-row {
    display: grid !important;
    grid-template-columns: minmax(7em, 1fr) auto auto !important;
    align-items: center !important;
    column-gap: 8px !important;
    width: 100% !important;
  }
  #reversi .sb-choice-modal .sb-choice-name,
  .reversi-game .sb-choice-modal .sb-choice-name {
    min-width: 0;
    font-size: clamp(15px, 4.1vw, 16px);
    line-height: 1.12 !important;
    letter-spacing: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: clip !important;
  }
  #reversi .sb-choice-modal .sb-choice-icon,
  .reversi-game .sb-choice-modal .sb-choice-icon {
    min-width: 34px !important;
    height: 20px !important;
    min-height: 20px !important;
    padding: 2px 6px 3px;
    font-size: var(--wk-font-min, 14px);
  }
  #reversi .sb-choice-modal .sb-choice-name-row .sb-choice-cond-tag,
  .reversi-game .sb-choice-modal .sb-choice-name-row .sb-choice-cond-tag {
    grid-column: 3 !important;
    justify-self: end !important;
    margin-left: 0 !important;
    font-size: var(--wk-font-min, 14px) !important;
    padding: 2px 6px 3px !important;
  }
}

/* Replacement dialog: show role badges beside the skill name, not in the lower meta row. */
#reversi
  .sb-swap-modal:not(.sb-choice-modal)
  .sb-swap-slot-name-row
  .sb-swap-role-badge,
.reversi-game
  .sb-swap-modal:not(.sb-choice-modal)
  .sb-swap-slot-name-row
  .sb-swap-role-badge {
  flex: 0 0 auto !important;
  margin-left: 2px !important;
}

#reversi .sb-swap-modal:not(.sb-choice-modal) .sb-swap-fusion-hint,
.reversi-game .sb-swap-modal:not(.sb-choice-modal) .sb-swap-fusion-hint {
  display: block !important;
  width: 100% !important;
  margin: -2px auto 8px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: #3a2010 !important;
  font-family: "DotGothic16", sans-serif !important;
  font-size: clamp(14px, 4vw, 17px) !important;
  font-weight: 700 !important;
  line-height: 1.14 !important;
  letter-spacing: 0 !important;
  text-align: center !important;
  white-space: nowrap !important;
  text-shadow: none !important;
}

#reversi .sb-swap-modal:not(.sb-choice-modal) .sb-swap-fusion-note,
.reversi-game .sb-swap-modal:not(.sb-choice-modal) .sb-swap-fusion-note {
  display: inline-flex !important;
  align-items: center !important;
  width: fit-content !important;
  max-width: 100% !important;
  margin-left: 6px !important;
  padding: 3px 8px 4px !important;
  border: 1px solid rgba(255, 245, 160, 0.84) !important;
  border-radius: 999px !important;
  background: rgba(255, 238, 120, 0.22) !important;
  color: #fff7b8 !important;
  font-size: var(--wk-font-body, 16px) !important;
  font-weight: 900 !important;
  line-height: 1.1 !important;
  letter-spacing: 0 !important;
  white-space: nowrap !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85) !important;
}

#reversi
  .sb-swap-modal:not(.sb-choice-modal)
  .sb-swap-incoming-card.fusion-ready,
.reversi-game
  .sb-swap-modal:not(.sb-choice-modal)
  .sb-swap-incoming-card.fusion-ready {
  box-shadow:
    0 0 0 2px rgba(255, 245, 160, 0.42) inset,
    0 0 16px rgba(255, 230, 110, 0.42),
    0 4px 0 rgba(0, 0, 0, 0.25) !important;
}

.wakabattle-title-tools {
  grid-area: records;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-self: center;
  align-items: center;
  gap: 7px;
  width: min(320px, 100%);
  margin-top: 0;
  position: relative;
  z-index: 2;
}
.wakabattle-title-tool,
.wakabattle-result-tool {
  border: 2px solid #fff;
  border-radius: 4px;
  background: #fff;
  color: #111;
  font-family: "DotGothic16", "Baloo 2", sans-serif;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: none;
}
.wakabattle-title-tool {
  min-width: 0;
  min-height: 44px;
  padding: 6px 12px 7px;
  font-size: var(--wk-font-control, 18px);
  white-space: nowrap;
}
.wakabattle-title-tool[data-wb-panel="ranking"],
.wakabattle-result-tool[data-wb-panel="ranking"] {
  background: #111;
  border-color: #fff;
  color: #fff;
  text-shadow: none;
  box-shadow: none;
}
.wakabattle-result-tools {
  display: flex;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}
.wakabattle-result-tool {
  min-width: 96px;
  padding: 7px 14px 8px;
  font-size: var(--wk-font-control, 18px);
}
.wakabattle-title-tool:not([data-wb-panel="ranking"]):hover,
.wakabattle-result-tool:not([data-wb-panel="ranking"]):hover {
  background: #e8e8e8;
  color: #111;
  border-color: #fff;
  transform: none;
}
.wakabattle-title-tool[data-wb-panel="ranking"]:hover,
.wakabattle-result-tool[data-wb-panel="ranking"]:hover {
  background: #333;
  border-color: #fff;
  color: #fff;
  transform: none;
}
.wakabattle-panel-modal {
  --wk-record-font: "DotGothic16", "Baloo 2", sans-serif;
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: max(14px, calc((100vh - min(96vh, 820px)) / 2)) 18px 14px;
  background: rgba(0, 0, 0, 0.54);
}
.wakabattle-panel-card {
  position: relative;
  width: min(460px, calc(100vw - 28px));
  max-height: min(78vh, 680px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 3px solid #111;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff, #f2f2f2);
  color: #111;
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.45),
    0 0 0 5px rgba(255, 255, 255, 0.7) inset;
  font-family: var(--wk-record-font);
  font-weight: 700;
  line-height: 1.5;
}
.wakabattle-panel-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #333;
  font-size: 22px;
  line-height: 28px;
  cursor: pointer;
  z-index: 2;
  font-family: var(--wk-record-font);
  font-weight: 700;
}
.wakabattle-panel-title {
  padding: 20px 52px 10px;
  text-align: center;
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 900;
  letter-spacing: 0;
  white-space: nowrap;
}
.wakabattle-panel-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 0 16px 14px;
}
.wakabattle-panel-tab {
  min-width: 88px;
  border: 2px solid #111;
  border-radius: 999px;
  min-height: 44px;
  padding: 7px 16px 8px;
  background: #fff;
  color: #111;
  font-family: var(--wk-record-font);
  font-weight: 900;
  cursor: pointer;
  font-size: var(--wk-font-control, 18px);
}
.wakabattle-panel-tab.active {
  background: #111;
  color: #fff;
}
.wakabattle-history-tabs .wakabattle-panel-tab {
  flex: 1 1 0;
  min-width: 0;
  max-width: 170px;
  font-size: var(--wk-font-control, 18px);
  white-space: nowrap;
  min-height: 44px;
}
.wakabattle-history-tabs .wakabattle-panel-tab.active {
  border-color: #111;
  background: #111;
  color: #fff;
  box-shadow: 0 3px 0 #555;
}
.wakabattle-panel-body {
  overflow: auto;
  padding: 0 18px 18px;
}
#wakabattle-history-modal .wakabattle-panel-body {
  overflow-y: auto;
  scrollbar-gutter: stable;
}
@media (min-width: 481px) {
  .wakabattle-history-modal .wakabattle-panel-card {
    max-height: min(96vh, 820px);
  }
}
.wakabattle-empty {
  margin: 10px 0 2px;
  padding: 22px 10px;
  border-radius: 12px;
  border: 2px solid #111;
  background: #fff;
  text-align: center;
  font-size: var(--wk-font-body, 16px);
  font-weight: 900;
}
.wakabattle-ranking-week {
  margin: 2px 0 12px;
  color: #111;
  text-align: center;
  font-size: var(--wk-record-period, 18px);
  font-weight: 900;
}
.wakabattle-ranking-list,
.wakabattle-history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wakabattle-ranking-list {
  gap: 12px;
}
.wakabattle-history-list {
  gap: 12px;
}
.wakabattle-history-best {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
  margin: 0 0 10px;
  padding: 9px 10px 10px;
  border: 3px solid #111;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffef5 0%, #fff4be 100%);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.92) inset,
    0 5px 0 rgba(0, 0, 0, 0.18),
    0 10px 18px rgba(0, 0, 0, 0.16);
}
.wakabattle-history-best-main {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px 12px;
  align-items: center;
  min-width: 0;
}
.wakabattle-history-kicker,
.wakabattle-history-best-code > span {
  display: block;
  color: #3b2a00;
  font-size: var(--wk-font-body, 16px);
  font-weight: 900;
}
.wakabattle-history-kicker {
  grid-column: 1 / -1;
  font-size: var(--wk-font-body, 16px);
  line-height: 1.2;
}
.wakabattle-history-best-result {
  display: contents;
}
.wakabattle-history-best-result > span {
  justify-self: start;
  font-weight: 900;
}
.wakabattle-history-best-main strong {
  display: flex;
  align-items: baseline;
  justify-self: end;
  gap: 5px;
  margin: 0;
  color: #111;
  font-family: var(--wk-record-font);
  font-size: 26px;
  font-weight: 900;
  line-height: 1.15;
  white-space: nowrap;
}
.wakabattle-history-best-main strong small {
  font-family: var(--wk-record-font);
  font-size: var(--wk-font-meta, 14px);
  line-height: 1;
}
.wakabattle-history-best-main p {
  grid-column: 3;
  justify-self: end;
  margin: 0 0 2px;
  color: #4f4122;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.5;
  white-space: nowrap;
  text-align: right;
}
.wakabattle-history-best-code {
  grid-column: 1;
  min-width: 0;
  padding: 8px 9px;
  border: 2px solid rgba(17, 17, 17, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.66);
}
.wakabattle-history-best-code b {
  display: block;
  min-width: 0;
  margin-top: 3px;
  font-family: var(--wk-record-font);
  font-size: var(--wk-record-body, 16px);
  line-height: 1.25;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}
.wakabattle-history-best-code.is-pending {
  border-color: #c73a3f;
  background: #fff7f7;
}
.wakabattle-history-best-code.is-pending b {
  color: #b21f26;
  font-family: var(--wk-record-font);
  font-size: var(--wk-font-meta, 14px);
  line-height: 1.35;
}
.wakabattle-history-x {
  grid-column: 1 / -1;
  width: 100%;
  appearance: none;
  border: 2px solid #111;
  border-radius: 9px;
  background: #111;
  color: #fff;
  min-height: 44px;
  padding: 7px 8px 8px;
  font-size: var(--wk-font-control, 18px);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.22);
  white-space: nowrap;
  font-family: var(--wk-record-font);
}
.wakabattle-history-x:disabled {
  border-color: #8b8b8b;
  background: #b8b8b8;
  color: #f7f7f7;
  cursor: not-allowed;
  box-shadow: none;
  opacity: 1;
}
.wakabattle-hall-list {
  gap: 12px;
}
.wakabattle-hall-card {
  margin-bottom: 0;
  border-color: #111;
  background: linear-gradient(180deg, #fffdf0 0%, #ffe98d 100%);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.92) inset,
    0 5px 0 #444,
    0 10px 18px rgba(0, 0, 0, 0.18);
}
.wakabattle-ranking-row,
.wakabattle-history-row {
  border: 2px solid #111;
  border-radius: 12px;
  background: #fff;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.75) inset,
    0 3px 8px rgba(0, 0, 0, 0.1);

  display: grid;
  position: relative;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 68px;
  padding: 9px 13px 9px 0;
  overflow: hidden;
}
.wakabattle-ranking-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  column-gap: 18px;
  line-height: 1.2;
  min-width: 0;
  row-gap: 6px;
}
.wakabattle-ranking-streak,
.wakabattle-history-streak {
  font-family: var(--wk-record-font);
  font-size: 26px;
  font-weight: 900 !important;
  line-height: 1;
  white-space: nowrap;
  justify-self: end;
}
.wakabattle-ranking-points,
.wakabattle-history-points {
  color: #d71920;
  font-family: var(--wk-record-font);
  font-size: 34px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  line-height: 1;
  white-space: nowrap;
  justify-self: start;
}
.wakabattle-ranking-points .wakabattle-points-unit,
.wakabattle-history-points .wakabattle-points-unit {
  margin-left: 0.18em;
  color: inherit;
  font: inherit;
}
.wakabattle-history-best-result .wakabattle-history-points {
  font-size: 38px;
}
.wakabattle-ranking-time {
  min-width: 0;
  color: #333;
  font-family: var(--wk-record-font);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
  line-height: 1.5;
  grid-column: 3;
  justify-self: end;
}
.wakabattle-ranking-main p {
  display: none;
}
.wakabattle-history-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 3px 9px;
  color: #111;
}
.wakabattle-history-section-head strong {
  font-size: 17px;
  line-height: 1.2;
}
.wakabattle-history-section-head span {
  color: #111;
  font-size: var(--wk-font-meta, 14px);
  font-weight: 900;
}
.wakabattle-ranking-rank,
.wakabattle-history-count-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  min-height: 46px;
  border-radius: 0 9px 9px 0;
  background: #111;
  color: #fff;
  font-weight: 900;
  line-height: 1;
}
.wakabattle-ranking-rank strong,
.wakabattle-history-count-label strong {
  display: flex;
  align-items: baseline;
  gap: 2px;
  color: #fff;
  font-family: var(--wk-record-font);
  font-size: 21px;
}
.wakabattle-ranking-rank small,
.wakabattle-history-count-label small {
  color: #ddd;
  font-family: var(--wk-record-font);
  font-size: var(--wk-font-meta, 14px);
}
.wakabattle-history-row.is-clear {
  border-color: #a87300;
  background: #fffbea;
}
.wakabattle-history-row.is-clear .wakabattle-history-count-label {
  background: #d39a16;
}
.wakabattle-history-row.is-unsynced {
  border-color: #c73a3f;
  background: #fff8f8;
}
.wakabattle-history-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  column-gap: 18px;
  row-gap: 6px;
  min-width: 0;
}
.wakabattle-history-streak {
  flex: 0 0 auto;
  color: #111;

  font-size: 26px;
  justify-self: end;}
.wakabattle-ranking-streak small,
.wakabattle-history-streak small {
  margin-left: 2px;
  font-family: var(--wk-record-font);
  font-size: var(--wk-font-meta, 14px);
}
.wakabattle-history-time {
  justify-self: end;
  color: #444;
  font-family: var(--wk-record-font);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  font-style: normal;
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
  line-height: 1.5;
  grid-column: 3;
}
.wakabattle-history-sync-status {
  position: static;
  right: 8px;
  bottom: 3px;
  color: #b21f26;
  font-size: var(--wk-font-body, 16px);
  font-weight: 900;
  line-height: 1.5;
  white-space: normal;
  grid-column: 1 / -1;
}
@media (max-width: 480px) {
  .wakabattle-title-tools {
    gap: 6px;
  }
  .wakabattle-title-tool {
    min-width: 0;
    min-height: 44px;
    padding: 5px 10px 6px;
    font-size: var(--wk-font-control, 16px);
    touch-action: manipulation;
  }
  .wakabattle-result-tools {
    gap: 6px;
    margin-top: 6px;
  }
  .wakabattle-result-tool {
    min-width: 86px;
    min-height: 44px;
    padding: 6px 10px 7px;
    font-size: var(--wk-font-control, 16px);
  }
  .wakabattle-panel-modal {
    --wakabattle-panel-top: clamp(96px, 13dvh, 112px);
    padding: var(--wakabattle-panel-top) 10px 10px;
    align-items: flex-start;
  }
  .wakabattle-panel-card {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - var(--wakabattle-panel-top) - 10px);
    border-radius: 15px;
  }
  #wakabattle-history-modal {
    padding-top: var(--wakabattle-panel-top);
  }
  .wakabattle-panel-title {
    padding: 17px 38px 9px;
    font-size: clamp(17px, 5.5vw, 21px);
  }
  .wakabattle-panel-body {
    padding: 0 12px 14px;
  }
  .wakabattle-panel-tabs {
    gap: 7px;
    padding: 0 12px 13px;
  }
  .wakabattle-history-tabs .wakabattle-panel-tab {
    min-height: 44px;
    padding: 6px 7px 7px;
    font-size: var(--wk-font-control, 16px);
  }
  .wakabattle-ranking-main,
  .wakabattle-history-main {
    grid-template-columns: minmax(0, 1fr) auto auto;
    column-gap: 6px;
    row-gap: 6px;
  }
  .wakabattle-ranking-streak,
  .wakabattle-history-streak {
    font-size: 24px;
  
  justify-self: end;}
  .wakabattle-ranking-points,
  .wakabattle-history-points {
    font-size: clamp(22px, 7.2vw, 28px);
  }
  .wakabattle-history-best-result .wakabattle-history-points {
    font-size: clamp(24px, 8.2vw, 32px);
  }
  .wakabattle-ranking-time {
    font-size: 14px;
    grid-column: 3;
    line-height: 1.5;
  white-space: nowrap;
  justify-self: end;
  text-align: right;
}
  .wakabattle-ranking-row,
  .wakabattle-history-row {
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 8px;
    min-height: 60px;
    padding: 7px 10px 7px 0;
  }
  .wakabattle-history-time {
    font-size: 14px;
    grid-column: 3;
    line-height: 1.5;
  white-space: nowrap;
  justify-self: end;
  text-align: right;
}
  .wakabattle-history-best {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px 6px;
    padding: 8px 9px 9px;
  }
  .wakabattle-history-best-main {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 6px;
  }
  .wakabattle-history-best-main strong {
    justify-self: end;
    font-size: 24px;
  
  line-height: 1.15;}
  .wakabattle-history-best-main p {
    grid-column: 3;
    font-size: 14px;
    line-height: 1.5;
    justify-self: end;
  text-align: right;
}
  .wakabattle-history-x {
    grid-column: 1 / -1;
    font-family: var(--wk-record-font);
}
  .wakabattle-history-best-code b {
    font-size: var(--wk-record-body, 16px);
  }
  .mode-save-actions {
    gap: 6px;
  }
  .mode-save-btn {
    padding: 5px 6px 6px;
    font-size: var(--wk-font-control, 16px);
  }
}
@media (max-width: 480px) and (max-height: 820px) {
  .wakabattle-panel-modal,
  #wakabattle-history-modal {
    padding: var(--wakabattle-panel-top) 6px 6px;
  }
  .wakabattle-panel-card {
    width: calc(100vw - 12px);
    max-height: calc(100dvh - var(--wakabattle-panel-top) - 6px);
    border-radius: 13px;
  }
  .wakabattle-panel-title {
    padding: 8px 36px 5px;
    font-size: 17px;
  }
  .wakabattle-panel-close {
    top: 6px;
    right: 6px;
    width: 29px;
    height: 29px;
    font-size: 19px;
    line-height: 26px;
    font-family: var(--wk-record-font);
  font-weight: 700;
}
  .wakabattle-panel-tabs {
    gap: 6px;
    padding: 0 9px 6px;
  }
  .wakabattle-panel-tab,
  .wakabattle-history-tabs .wakabattle-panel-tab {
    min-height: 44px;
    padding: 4px 6px 5px;
    font-size: var(--wk-font-control, 16px);
  }
  .wakabattle-panel-body {
    min-height: 0;
    padding: 0 2px 6px;
  }
  #wakabattle-history-modal .wakabattle-panel-body {
    scrollbar-gutter: auto;
    scroll-padding-bottom: 8px;
  }
  .wakabattle-ranking-week {
    margin-bottom: 7px;
    font-size: var(--wk-record-period, 18px);
  }
  .wakabattle-ranking-list {
    gap: 12px;
  }
  .wakabattle-ranking-main {
    column-gap: 5px;
    row-gap: 6px;
  grid-template-columns: minmax(0, 1fr) auto auto;
}
  .wakabattle-ranking-streak,
  .wakabattle-history-streak {
    font-size: 24px;
  
  justify-self: end;}
  .wakabattle-ranking-points,
  .wakabattle-history-points {
    font-size: clamp(22px, 7.2vw, 28px);
  }
  .wakabattle-history-best-result .wakabattle-history-points {
    font-size: clamp(24px, 8.2vw, 32px);
  }
  .wakabattle-ranking-time {
    font-size: 14px;
    line-height: 1.5;
  white-space: nowrap;
  grid-column: 3;
  justify-self: end;
  text-align: right;
}
  .wakabattle-history-best {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px 6px;
    margin-bottom: 4px;
    padding: 4px 6px;
    border-width: 2px;
    border-radius: 10px;
    box-shadow:
      0 2px 0 rgba(255, 255, 255, 0.92) inset,
      0 3px 0 rgba(0, 0, 0, 0.18),
      0 6px 12px rgba(0, 0, 0, 0.13);
  }
  .wakabattle-history-best-main {
    gap: 2px 8px;
    grid-template-columns: minmax(0, 1fr) auto auto;
}
  .wakabattle-history-kicker {
    font-size: 15px;
  }
  .wakabattle-history-best-code > span {
    font-size: var(--wk-font-min, 14px);
  }
  .wakabattle-history-best-main strong {
    gap: 3px;
    font-size: 24px;
    justify-self: end;

  line-height: 1.15;}
  .wakabattle-history-best-main strong small {
    font-size: var(--wk-font-min, 14px);
  }
  .wakabattle-history-best-result {
    gap: 5px;
  }
  .wakabattle-history-best-result > span,
  .wakabattle-history-best-main p {
    line-height: 1.5;
  }
  .wakabattle-history-best-code {
    padding: 5px 6px;
    border-width: 1px;
    border-radius: 7px;
  }
  .wakabattle-history-best-code b {
    margin-top: 1px;
    font-size: var(--wk-record-body, 16px);
    line-height: 1.12;
  }
  .wakabattle-history-best-code.is-pending b {
    font-size: var(--wk-font-min, 14px);
    line-height: 1.2;
  }
  .wakabattle-history-x {
    min-height: 44px;
    padding: 4px 5px 5px;
    font-size: var(--wk-font-control, 16px);
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.22);
    white-space: nowrap;
  width: 100%;
  grid-column: 1 / -1;
  font-family: var(--wk-record-font);
}
  .wakabattle-history-section-head {
    margin: 5px 2px 3px;
  }
  .wakabattle-history-section-head strong {
    font-size: 16px;
  }
  .wakabattle-history-section-head span {
    font-size: var(--wk-font-min, 14px);
  }
  .wakabattle-history-list {
    gap: 12px;
  }
  .wakabattle-ranking-row,
  .wakabattle-history-row {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 5px;
    min-height: 50px;
    padding: 4px 5px 4px 0;
    border-radius: 9px;
  }
  .wakabattle-ranking-rank,
  .wakabattle-history-count-label {
    min-height: 36px;
    border-radius: 0 7px 7px 0;
  }
  .wakabattle-ranking-rank strong,
  .wakabattle-history-count-label strong {
    font-size: 18px;
  }
  .wakabattle-ranking-rank small,
  .wakabattle-history-count-label small {
    font-size: var(--wk-font-min, 14px);
  }
  .wakabattle-history-main {
    align-items: center;
    column-gap: 5px;
    row-gap: 6px;
  grid-template-columns: minmax(0, 1fr) auto auto;
}
  .wakabattle-history-streak small {
    font-size: var(--wk-font-min, 14px);
  }
  .wakabattle-history-time {
    font-size: 14px;
    line-height: 1.5;
  white-space: nowrap;
  grid-column: 3;
  justify-self: end;
  text-align: right;
}
  .wakabattle-history-sync-status {
    right: 4px;
    bottom: 1px;
    font-size: var(--wk-font-min, 14px);
    position: static;
  grid-column: 1 / -1;
  white-space: normal;
  line-height: 1.5;
}
}
@media (max-width: 300px) {
  .wakabattle-panel-card {
    max-height: calc(100dvh - var(--wakabattle-panel-top) - 2px);
  }
  .wakabattle-ranking-main {
    column-gap: 3px;
    row-gap: 6px;
  grid-template-columns: minmax(0, 1fr) auto auto;
}
  .wakabattle-ranking-streak {
    font-size: 24px;
  
  justify-self: end;}
  .wakabattle-history-streak {
    font-size: 24px;
  
  justify-self: end;}
  .wakabattle-ranking-streak small {
    font-size: var(--wk-font-min, 14px);
  }
  .wakabattle-history-streak small {
    font-size: var(--wk-font-min, 14px);
  }
  .wakabattle-ranking-points,
  .wakabattle-history-points {
    font-size: clamp(22px, 7.2vw, 28px);
  }
  .wakabattle-ranking-time {
    font-size: 14px;
    line-height: 1.5;
  white-space: nowrap;
  grid-column: 3;
  justify-self: end;
  text-align: right;
}
  .wakabattle-history-list {
    gap: 12px;
  }
  .wakabattle-ranking-row,
  .wakabattle-history-row {
    grid-template-columns: 38px minmax(0, 1fr);
    min-height: 46px;
  }
  .wakabattle-history-main {
    column-gap: 4px;
    row-gap: 6px;
  grid-template-columns: minmax(0, 1fr) auto auto;
}
  .wakabattle-history-time {
    font-size: 14px;
    line-height: 1.5;
  white-space: nowrap;
  grid-column: 3;
  justify-self: end;
  text-align: right;
}
  .wakabattle-ranking-rank strong,
  .wakabattle-history-count-label strong {
    font-size: 16px;
  }
}
/* The persistent audio control is visible only inside the battle controls. */
#reversi #wakabattle-bgm-toggle {
  display: none !important;
  flex: 0 0 auto;
  pointer-events: auto !important;
}
#reversi #wakabattle-bgm-toggle:active {
  transform: translateY(1px);
}

/* Mobile battle skill cards: skill name, move range, remaining uses. */
@media (max-width: 480px) {
  .ability-battle .sb-inline-ability-name.sb-dom-ability-card,
  .ability-battle .sb-inline-ability-name.sb-dom-ability-card.has-remaining {
    justify-content: center;
    gap: 1px;
    padding: 1px 0;
    inset: 1px;
}

  .ability-battle .sb-dom-ability-card .sb-slot-stars {
    display: none !important;
  }

  .ability-battle .sb-dom-ability-card .sb-slot-title-row {
    order: 0;
    min-height: 0;
    margin: 0;
    flex-shrink: 0;
}

  .ability-battle .sb-dom-ability-card > .sb-slot-name-text {
    order: 1;
    margin: 0;
    white-space: normal;
  word-break: auto-phrase;
  text-wrap: balance;
}

  .ability-battle .sb-dom-ability-card .sb-slot-name-text {
    font-size: var(--wk-font-min, 14px);
    line-height: 1.1;
    white-space: normal;
  word-break: normal;
  text-wrap: balance;
  padding: 0;
  overflow-wrap: anywhere;
  flex-shrink: 0;
}

  .ability-battle .sb-dom-ability-card .sb-slot-tags,
  .ability-battle .sb-dom-ability-card .sb-slot-meta-row {
    order: 2;
    margin: 0;
    transform: none;
    flex-shrink: 0;
  overflow: visible;
}

  .ability-battle .sb-dom-ability-card .sb-slot-meta-row .sb-slot-cond-tag {
    max-width: 100%;
    min-height: 19px;
    height: auto;
    padding: 0 1px;
    font-size: var(--wk-font-min, 14px);
    line-height: 1.1;
    border-radius: 5px;
    white-space: nowrap;
}

  .ability-battle .sb-dom-ability-card .sb-slot-remaining {
    order: 3;
    position: static;
    width: 100%;
    min-height: 19px;
    margin-top: 0;
    padding: 0 1px;
    border-radius: 7px;
    font-size: var(--wk-font-min, 14px);
    line-height: 1.1;
    white-space: nowrap;
    text-wrap: balance;
    flex-shrink: 0;
}
}

/* Title screen visibility rules. */
#screen-title.bg-magic #rv-logo-default,
#screen-title.bg-magic .title-logo-default {
  display: none !important;
}

.wakabattle-panel-modal:not(.show) {
  display: none !important;
  pointer-events: none !important;
}

.wakabattle-panel-modal.show {
  display: flex !important;
  pointer-events: auto !important;
}

#reversi .sb-coin-overlay,
.reversi-game .sb-coin-overlay {
  position: absolute !important;
  inset: 0 !important;
  z-index: 20000 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  overflow: auto !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 18px !important;
  background-color: #000 !important;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.55)),
    url("https://wakabaland.com/wp-content/uploads/2026/10/E001-reversi-screen-001.webp") !important;
  background-position:
    center center,
    center center !important;
  background-size: cover, cover !important;
  background-repeat: no-repeat, no-repeat !important;
}

#reversi .sb-coin-overlay > .sb-coin-overlay-inner,
.reversi-game .sb-coin-overlay > .sb-coin-overlay-inner {
  position: relative !important;
  inset: auto !important;
  display: flex !important;
  align-items: stretch !important;
  justify-content: center !important;
  width: min(88vw, 390px) !important;
  max-width: 390px !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: calc(100svh - 36px) !important;
  aspect-ratio: 1 / 1 !important;
  margin: auto !important;
  padding: 0 !important;
  transform: none !important;
  overflow: visible !important;
  background-color: transparent !important;
  background-image: url("https://wakabaland.com/wp-content/uploads/2026/10/E001-reversi-screen-017.webp") !important;
  background-position: center center !important;
  background-size: 100% 100% !important;
  background-repeat: no-repeat !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  filter: drop-shadow(0 12px 30px rgba(0, 0, 0, 0.48)) !important;
}

#reversi .sb-coin-frame-content,
.reversi-game .sb-coin-frame-content {
  width: 100% !important;
  min-height: 100% !important;
  padding: 12% 14% 16% !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  color: #3a2010 !important;
}

#reversi .sb-coin,
.reversi-game .sb-coin {
  position: relative !important;
  width: clamp(86px, 12vw, 116px) !important;
  height: clamp(86px, 12vw, 116px) !important;
  flex: 0 0 auto !important;
  margin: clamp(14px, 2.4vw, 22px) auto !important;
  perspective: 900px !important;
}

#reversi .sb-coin-inner,
.reversi-game .sb-coin-inner {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: 50% !important;
  transform-style: preserve-3d !important;
  transform-origin: center center !important;
  animation: sbCoinSpin 1.65s cubic-bezier(0.2, 0.8, 0.2, 1) both !important;
}

#reversi .sb-coin-title,
#reversi .sb-coin-result,
.reversi-game .sb-coin-title,
.reversi-game .sb-coin-result {
  font-family: "DotGothic16", sans-serif !important;
  font-weight: 900 !important;
  color: #3a2010 !important;
  text-shadow: none !important;
  letter-spacing: 0.04em !important;
  -webkit-font-smoothing: antialiased !important;
  text-rendering: geometricPrecision !important;
}

#reversi .sb-coin-title,
.reversi-game .sb-coin-title {
  font-size: clamp(21px, 2.8vw, 28px) !important;
  line-height: 1.25 !important;
}

#reversi .sb-coin-result,
.reversi-game .sb-coin-result {
  font-size: clamp(18px, 2.5vw, 27px) !important;
  line-height: 1.45 !important;
}

@media (max-width: 480px) {
  #reversi .sb-coin-overlay,
  .reversi-game .sb-coin-overlay {
    background-image:
      linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.55)),
      url("https://wakabaland.com/wp-content/uploads/2026/10/E001-reversi-screen-002.webp") !important;
  }

  #reversi .sb-coin-overlay > .sb-coin-overlay-inner,
  .reversi-game .sb-coin-overlay > .sb-coin-overlay-inner {
    width: min(84vw, 324px) !important;
    max-width: 324px !important;
    max-height: calc(100svh - 20px);
    max-height: calc(100dvh - 20px) !important;
  }

  #reversi .sb-coin-frame-content,
  .reversi-game .sb-coin-frame-content {
    padding: 11% 12% 15% !important;
    gap: clamp(8px, 1.9svh, 13px) !important;
    justify-content: center !important;
  }

  #reversi .sb-coin-title,
  .reversi-game .sb-coin-title {
    font-size: clamp(24px, 7.2vw, 30px) !important;
    line-height: 1.18 !important;
  }

  #reversi .sb-coin-result,
  .reversi-game .sb-coin-result {
    font-size: clamp(21px, 6.1vw, 28px) !important;
    line-height: 1.34 !important;
  }

  #reversi .sb-choice-modal .sb-choice-cards,
  .reversi-game .sb-choice-modal .sb-choice-cards {
    padding: 4px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  #reversi .sb-choice-modal .sb-choice-card.selected,
  #reversi .sb-choice-modal .sb-choice-card.selected:hover,
  .reversi-game .sb-choice-modal .sb-choice-card.selected,
  .reversi-game .sb-choice-modal .sb-choice-card.selected:hover {
    outline: 0 !important;
    border-color: #fff5b8 !important;
    box-shadow:
      inset 0 0 0 3px rgba(255, 247, 194, 0.98),
      inset 0 0 0 5px rgba(66, 38, 6, 0.88),
      0 3px 10px rgba(0, 0, 0, 0.28) !important;
  }

  #reversi .sb-choice-modal .sb-choice-card.selected::before,
  .reversi-game .sb-choice-modal .sb-choice-card.selected::before {
    inset: 4px !important;
    border-radius: 8px !important;
    box-shadow: none !important;
  }
}

/* Replacement dialog role badges: make 所持中 / 今回追加 readable like rank tags. */
#reversi .sb-swap-modal:not(.sb-choice-modal) .sb-swap-slot-name-row,
.reversi-game .sb-swap-modal:not(.sb-choice-modal) .sb-swap-slot-name-row {
  display: flex !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  gap: 7px !important;
  min-width: 0 !important;
}

#reversi .sb-swap-modal:not(.sb-choice-modal) .sb-swap-slot-name,
#reversi .sb-swap-modal:not(.sb-choice-modal) .sb-swap-incoming-name,
.reversi-game .sb-swap-modal:not(.sb-choice-modal) .sb-swap-slot-name,
.reversi-game .sb-swap-modal:not(.sb-choice-modal) .sb-swap-incoming-name {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

#reversi .sb-swap-modal:not(.sb-choice-modal) .sb-swap-role-badge,
.reversi-game .sb-swap-modal:not(.sb-choice-modal) .sb-swap-role-badge {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 auto !important;
  min-width: 44px !important;
  min-height: 19px !important;
  margin: 0 !important;
  padding: 2px 7px 3px !important;
  border-radius: 5px !important;
  border: 1px solid rgba(255, 255, 255, 0.72) !important;
  border-bottom-width: 2px !important;
  font-family: "DotGothic16", sans-serif !important;
  font-size: var(--wk-font-meta, 14px) !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  white-space: nowrap !important;
  text-shadow: none !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 1px 3px rgba(0, 0, 0, 0.34) !important;
}

#reversi .sb-swap-modal:not(.sb-choice-modal) .sb-swap-role-new,
.reversi-game .sb-swap-modal:not(.sb-choice-modal) .sb-swap-role-new {
  background: linear-gradient(
    180deg,
    #f4fff4 0%,
    #c9f8cf 55%,
    #91dfa0 100%
  ) !important;
  border-color: #2e7a3f !important;
  color: #153d20 !important;
}

#reversi
  .sb-swap-modal:not(.sb-choice-modal)
  .sb-swap-slot:has(.sb-swap-role-new),
.reversi-game
  .sb-swap-modal:not(.sb-choice-modal)
  .sb-swap-slot:has(.sb-swap-role-new) {
  border: 3px solid #c8ffd9 !important;
  box-shadow:
    0 0 0 2px rgba(25, 94, 42, 0.58),
    0 0 0 5px rgba(255, 255, 255, 0.88),
    0 5px 12px rgba(0, 0, 0, 0.28) !important;
}

#reversi .sb-swap-modal:not(.sb-choice-modal) .sb-swap-role-owned,
.reversi-game .sb-swap-modal:not(.sb-choice-modal) .sb-swap-role-owned {
  background: linear-gradient(
    180deg,
    #f7fcff 0%,
    #c8ecff 56%,
    #8fcdeb 100%
  ) !important;
  border-color: #275f83 !important;
  color: #103047 !important;
}

#reversi .sb-swap-modal:not(.sb-choice-modal) .sb-swap-role-fusion,
.reversi-game .sb-swap-modal:not(.sb-choice-modal) .sb-swap-role-fusion {
  background: linear-gradient(
    180deg,
    #fff4a4 0%,
    #ffd25c 54%,
    #e6a632 100%
  ) !important;
  border-color: #7c4a08 !important;
  color: #3b2100 !important;
}

#reversi .sb-swap-modal:not(.sb-choice-modal) .sb-swap-role-blocked,
.reversi-game .sb-swap-modal:not(.sb-choice-modal) .sb-swap-role-blocked {
  background: linear-gradient(
    180deg,
    #f7f7f7 0%,
    #d6d6d6 56%,
    #a8a8a8 100%
  ) !important;
  border-color: #515151 !important;
  color: #242424 !important;
}

@media (max-width: 480px) {
  #reversi .sb-swap-modal:not(.sb-choice-modal) .sb-swap-slot-name-row,
  .reversi-game .sb-swap-modal:not(.sb-choice-modal) .sb-swap-slot-name-row {
    gap: 5px !important;
  }

  #reversi .sb-swap-modal:not(.sb-choice-modal) .sb-swap-role-badge,
  .reversi-game .sb-swap-modal:not(.sb-choice-modal) .sb-swap-role-badge {
    min-width: 40px !important;
    min-height: 18px !important;
    padding: 2px 5px 3px !important;
    font-size: max(var(--wk-font-min, 14px), clamp(8.5px, 2.55vw, 10.5px)) !important;
  }
}

/* Skill choice/replacement dialogs: final layout source for fit and scrolling. */
#reversi .sb-swap-overlay > .sb-swap-modal:not(.sb-choice-modal),
.reversi-game .sb-swap-overlay > .sb-swap-modal:not(.sb-choice-modal) {
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  width: min(94vw, 560px) !important;
  max-width: 560px !important;
  min-height: 0 !important;
  max-height: min(760px, calc(100dvh - 32px)) !important;
  padding: 72px 62px 114px !important;
  overflow: hidden !important;
}

#reversi .sb-swap-modal:not(.sb-choice-modal) .sb-swap-title,
.reversi-game .sb-swap-modal:not(.sb-choice-modal) .sb-swap-title,
#reversi .sb-swap-modal:not(.sb-choice-modal) .sb-swap-actions,
.reversi-game .sb-swap-modal:not(.sb-choice-modal) .sb-swap-actions {
  flex: 0 0 auto !important;
}

#reversi .sb-swap-modal:not(.sb-choice-modal) .sb-swap-incoming-area,
.reversi-game .sb-swap-modal:not(.sb-choice-modal) .sb-swap-incoming-area {
  display: none !important;
}

#reversi .sb-swap-modal:not(.sb-choice-modal) .sb-swap-arrow,
.reversi-game .sb-swap-modal:not(.sb-choice-modal) .sb-swap-arrow {
  display: none !important;
}

#reversi .sb-swap-modal:not(.sb-choice-modal) .sb-swap-slots,
.reversi-game .sb-swap-modal:not(.sb-choice-modal) .sb-swap-slots {
  box-sizing: border-box !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  margin: 6px 0 12px !important;
  padding: 2px 6px 8px !important;
}

#reversi .sb-swap-modal:not(.sb-choice-modal) .sb-swap-incoming-card,
#reversi .sb-swap-modal:not(.sb-choice-modal) .sb-swap-slot,
.reversi-game .sb-swap-modal:not(.sb-choice-modal) .sb-swap-incoming-card,
.reversi-game .sb-swap-modal:not(.sb-choice-modal) .sb-swap-slot {
  box-sizing: border-box !important;
  flex: 0 0 auto !important;
  width: 100% !important;
  height: auto !important;
  min-height: 124px !important;
  padding: 10px 12px 16px !important;
  overflow: visible !important;
}

#reversi .sb-swap-modal:not(.sb-choice-modal) .sb-swap-slot-desc,
.reversi-game .sb-swap-modal:not(.sb-choice-modal) .sb-swap-slot-desc {
  display: block !important;
  flex: 0 0 auto !important;
  overflow: visible !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
  margin: 2px 0 0 !important;
  padding-bottom: 2px !important;
}

/* Skill descriptions: subtle black edging for readability without muddying the cards. */
#reversi .sb-choice-modal .sb-choice-desc,
.reversi-game .sb-choice-modal .sb-choice-desc {
  color: #fff !important;
  font-weight: 900 !important;
  line-height: 1.42 !important;
  letter-spacing: 0 !important;
  text-shadow:
    0 1px 1px rgba(0, 0, 0, 0.72),
    1px 0 1px rgba(0, 0, 0, 0.56),
    -1px 0 1px rgba(0, 0, 0, 0.56),
    0 -1px 1px rgba(0, 0, 0, 0.5),
    0 0 4px rgba(0, 0, 0, 0.34) !important;
}

@media (max-width: 480px) {
  #reversi .sb-choice-modal .sb-choice-desc,
  .reversi-game .sb-choice-modal .sb-choice-desc {
    line-height: 1.34 !important;
    text-shadow:
      0 1px 1px rgba(0, 0, 0, 0.74),
      1px 0 1px rgba(0, 0, 0, 0.58),
      -1px 0 1px rgba(0, 0, 0, 0.58),
      0 -1px 1px rgba(0, 0, 0, 0.5) !important;
  }

  #reversi .sb-choice-modal .sb-choice-name,
  .reversi-game .sb-choice-modal .sb-choice-name {
    -webkit-text-stroke: 0 !important;
    paint-order: normal !important;
    text-shadow: none !important;
    filter: none !important;
  }
}

/* PC BGM button: use the same viewport anchor as mobile. */
@media (min-width: 481px) {
  #reversi .sb-swap-overlay > .sb-choice-modal,
  .reversi-game .sb-swap-overlay > .sb-choice-modal {
    margin-top: 0 !important;
  }

  #reversi #wakabattle-bgm-toggle {
    box-shadow:
      0 3px 0 rgba(255, 255, 255, 0.18),
      0 6px 14px rgba(0, 0, 0, 0.3) !important;
    transform: none;
  }
  #reversi #wakabattle-bgm-toggle:active {
    transform: translateY(1px) !important;
  }
}

/* Full-screen victory sparkle field.  It lives on the battle screen, below
   the result card's controls but across the complete illustrated background. */
#sb-result-overlay.result-win::before,
#sb-result-overlay.result-win::after {
  content: none !important;
  display: none !important;
}
.sb-victory-star-field {
  position: absolute;
  inset: 0;
  z-index: 9501;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  animation: sb-victory-field-fade 5s ease-out forwards;
}
.sb-victory-star-field span {
  position: absolute;
  left: var(--x);
  top: var(--y);
  color: var(--tone);
  font-family: sans-serif;
  font-size: var(--size);
  line-height: 1;
  text-shadow:
    0 0 3px currentColor,
    0 0 9px rgba(255, 235, 129, 0.9);
  animation: sb-victory-star-blink var(--twinkle) steps(2, end) var(--delay)
    infinite;
}
@keyframes sb-victory-field-fade {
  0% {
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  58% {
    opacity: 0.82;
  }
  100% {
    opacity: 0;
  }
}
@keyframes sb-victory-star-blink {
  0%,
  100% {
    opacity: 0.16;
    transform: scale(0.48);
  }
  50% {
    opacity: 1;
    transform: scale(1.28);
  }
}

/* Four-tone family palettes and short, finite pixel sprite sequences. */
.sb-cutin.cutin-cat-placement {
  --ci-base: #101b2c;
  --ci-tint: #244967;
  --ci-accent: #74bbff;
  --ci-title: #e0f1ff;
}
.sb-cutin.cutin-cat-flip {
  --ci-base: #20182e;
  --ci-tint: #493660;
  --ci-accent: #c0a1f3;
  --ci-title: #f1e8ff;
}
.sb-cutin.cutin-cat-erase {
  --ci-base: #2b171b;
  --ci-tint: #643438;
  --ci-accent: #ff9582;
  --ci-title: #fff0df;
}
.sb-cutin.cutin-cat-combo {
  --ci-base: #272313;
  --ci-tint: #5e502b;
  --ci-accent: #f3d46a;
  --ci-title: #fff3c8;
}
.sb-cutin.cutin-cat-block {
  --ci-base: #2c211a;
  --ci-tint: #624831;
  --ci-accent: #e9b985;
  --ci-title: #fff0dc;
}
.sb-cutin.cutin-cat-hint {
  --ci-base: #10272b;
  --ci-tint: #2c5860;
  --ci-accent: #8ee6ec;
  --ci-title: #e3ffff;
}
.sb-cutin.cutin-cat-guard {
  --ci-base: #182c23;
  --ci-tint: #375f49;
  --ci-accent: #99e1ad;
  --ci-title: #e8fff0;
}
.sb-cutin.cutin-cat-null {
  --ci-base: #e9e9df;
  --ci-tint: #cbd6dc;
  --ci-accent: #435367;
  --ci-title: #263447;
}
.sb-cutin-card-inner::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid var(--ci-accent);
  opacity: 0.28;
  pointer-events: none;
  z-index: 7;
}
.sb-cutin-card-inner::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 3px, #0002 3px 4px);
  opacity: 0.25;
}
.sb-cutin-sprites {
  position: absolute;
  left: 45%;
  bottom: 5%;
  width: 52%;
  height: 39%;
  overflow: visible;
  color: var(--ci-accent);
  fill: currentColor;
  z-index: 2;
}
.cutin-cpu .sb-cutin-sprites {
  left: 3%;
}
.ci-tile {
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
  opacity: 0.38;
}
.sb-cutin-sprites [class^="ci-"]:not(.ci-tile) {
  transform-box: fill-box;
  transform-origin: center;
}
.ci-fall-stone {
  animation: ci-drop var(--ci-sprite-duration) steps(6, end)
    calc(var(--ci-reveal) + var(--ci-i) * 70ms) both;
}
.ci-combo-stone {
  animation: ci-drop 450ms steps(4, end)
    calc(var(--ci-reveal) + var(--ci-i) * 170ms) both;
}
.ci-impact {
  animation: ci-strike 400ms steps(4, end)
    calc(var(--ci-reveal) + 250ms + var(--ci-i) * 80ms) both;
}
.ci-link {
  animation: ci-link 400ms steps(3, end)
    calc(var(--ci-reveal) + 280ms + var(--ci-i) * 170ms) both;
}
.ci-flip-before {
  animation: ci-front 700ms steps(5, end)
    calc(var(--ci-reveal) + var(--ci-i) * 70ms) both;
}
.ci-flip-after {
  animation: ci-back 700ms steps(5, end)
    calc(var(--ci-reveal) + var(--ci-i) * 70ms) both;
}
.ci-turn-arrow {
  animation: ci-arrow 800ms steps(5, end)
    calc(var(--ci-reveal) + var(--ci-i) * 70ms) both;
}
.ci-break-stone {
  animation: ci-break 450ms steps(4, end)
    calc(var(--ci-reveal) + var(--ci-i) * 40ms) both;
}
.ci-shard {
  animation: ci-shatter 700ms steps(6, end)
    calc(var(--ci-reveal) + 250ms + var(--ci-i) * 40ms) both;
}
.ci-slash {
  animation: ci-cut 500ms steps(4, end) var(--ci-reveal) both;
}
.ci-gate {
  animation: ci-gate 650ms steps(5, end)
    calc(var(--ci-reveal) + var(--ci-i) * 70ms) both;
}
.ci-gate-mark {
  animation: ci-mark 700ms steps(5, end)
    calc(var(--ci-reveal) + var(--ci-i) * 70ms) both;
}
.ci-reticle {
  transform-box: view-box !important;
  animation: ci-search 850ms steps(5, end) var(--ci-reveal) both;
}
.ci-answer {
  animation: ci-answer 900ms steps(5, end) var(--ci-reveal) both;
}
.ci-shield {
  animation: ci-shield 900ms steps(6, end) var(--ci-reveal) both;
}
.ci-deflect {
  animation: ci-deflect 900ms steps(5, end) var(--ci-reveal) both;
}
.ci-seal-card {
  fill: var(--ci-base);
  stroke: currentColor;
  stroke-width: 1;
}
.ci-lock {
  animation: ci-lock 800ms steps(5, end) var(--ci-reveal) both;
}
.ci-power-spark {
  animation: ci-spark 650ms steps(5, end)
    calc(var(--ci-reveal) + 300ms + var(--ci-i) * 25ms) both;
}
.cutin-rank-3 .sb-cutin-card,
.cutin-rank-4 .sb-cutin-card {
  border-color: color-mix(in srgb, var(--ci-accent) 75%, white);
}
.cutin-rank-4 .sb-cutin-card::before {
  opacity: 0.5;
}
.cutin-rank-5 .sb-cutin-card,
.cutin-atari .sb-cutin-card,
.cutin-boss .sb-cutin-card {
  border-color: #f8d66d;
  box-shadow:
    4px 4px 0 #080b10,
    0 10px 24px rgba(0, 0, 0, 0.28);
  animation: ci-power-hit 500ms steps(5, end) var(--ci-reveal) both;
}
.cutin-atari .ci-power-spark {
  fill: #fff0aa;
}
.cutin-atari .sb-cutin-atari {
  animation: ci-award 400ms steps(4, end) var(--ci-reveal) both;
}
.cutin-boss .sb-cutin-skill-rank {
  background: #682528;
}
@keyframes ci-drop {
  0% {
    opacity: 0;
    transform: translateY(-24px);
  }
  15% {
    opacity: 1;
  }
  55% {
    transform: translateY(0);
  }
  70% {
    transform: translateY(-3px);
  }
  90%,
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes ci-strike {
  0%,
  20% {
    opacity: 0;
    transform: scaleX(0.4);
  }
  35% {
    opacity: 1;
    transform: scaleX(1);
  }
  100% {
    opacity: 0;
    transform: scaleX(1.3);
  }
}
@keyframes ci-link {
  from {
    opacity: 0;
    transform: translateX(-4px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes ci-front {
  0%,
  25% {
    opacity: 1;
    transform: scaleX(1);
  }
  50% {
    opacity: 1;
    transform: scaleX(0);
  }
  51%,
  100% {
    opacity: 0;
    transform: scaleX(0);
  }
}
@keyframes ci-back {
  0%,
  50% {
    opacity: 0;
    transform: scaleX(0);
  }
  51% {
    opacity: 1;
  }
  75%,
  100% {
    opacity: 1;
    transform: scaleX(1);
  }
}
@keyframes ci-arrow {
  0% {
    opacity: 0;
    transform: translateX(-4px);
  }
  35% {
    opacity: 1;
    transform: translateX(0);
  }
  85%,
  100% {
    opacity: 0;
  }
}
@keyframes ci-break {
  0%,
  60% {
    opacity: 1;
  }
  61%,
  100% {
    opacity: 0;
  }
}
@keyframes ci-shatter {
  from {
    opacity: 0;
    transform: translate(0, 0);
  }
  10% {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translate(var(--ci-dx), var(--ci-dy));
  }
}
@keyframes ci-cut {
  from {
    opacity: 0;
    transform: translateX(-28px);
  }
  35% {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translateX(20px);
  }
}
@keyframes ci-gate {
  from {
    opacity: 0;
    transform: translateY(-22px);
  }
  20% {
    opacity: 1;
  }
  65%,
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes ci-mark {
  0%,
  55% {
    opacity: 0;
  }
  65%,
  100% {
    opacity: 1;
  }
}
@keyframes ci-search {
  0% {
    transform: translate(34px, 26px);
  }
  30% {
    transform: translate(130px, 26px);
  }
  60%,
  100% {
    transform: translate(82px, 26px);
  }
}
@keyframes ci-answer {
  0%,
  60% {
    opacity: 0;
  }
  70%,
  100% {
    opacity: 1;
  }
}
@keyframes ci-shield {
  0% {
    opacity: 0;
    transform: scale(0.45);
  }
  30% {
    opacity: 1;
    transform: scale(1);
  }
  55% {
    transform: scale(0.95);
  }
  80%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes ci-deflect {
  0%,
  30% {
    opacity: 0;
  }
  40% {
    opacity: 1;
    transform: translate(0, 0);
  }
  70%,
  100% {
    opacity: 0;
    transform: translate(15px, -8px);
  }
}
@keyframes ci-lock {
  from {
    opacity: 0;
    transform: translateY(-15px);
  }
  25% {
    opacity: 1;
  }
  60%,
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes ci-spark {
  from {
    opacity: 0;
    transform: translateY(0);
  }
  25% {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translateY(var(--ci-dy));
  }
}
@keyframes ci-power-hit {
  0%,
  15% {
    transform: translateX(0);
  }
  30% {
    transform: translateX(-3px);
  }
  50% {
    transform: translateX(3px);
  }
  70%,
  100% {
    transform: translateX(0);
  }
}
@keyframes ci-award {
  from {
    transform: translateY(-4px);
  }
  to {
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .sb-cutin-wrap,
  .sb-cutin-char,
  .sb-cutin-text,
  .sb-cutin-card,
  .sb-cutin-atari {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
  }
  .sb-cutin-sprites * {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
  }
}

/* Mobile Wakabattle layout -------------------------------------------------
   A single coordinate system for every non-board scene.  The illustrated
   background (#screen-spec) is the scroll owner and the active scene is its
   only overlay child, so the complete scene scrolls together without old
   dialogs creating a blank gap before the next one. */
@media (max-width: 767px) {
  #reversi,
  .reversi-game {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  #reversi #screen-spec.screen.active,
  .reversi-game #screen-spec.screen.active {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    box-sizing: border-box !important;

    -webkit-overflow-scrolling: touch !important;
    background-attachment: local !important;
  }

  /* The board owns its pre-existing layout. */
  #reversi #screen-spec.screen.active #spec-game-root,
  .reversi-game #screen-spec.screen.active #spec-game-root {
    position: relative !important;
    z-index: 1 !important;
    box-sizing: border-box !important;
    width: 100% !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
    transform: none !important;
    order: 1 !important;
    flex: 0 0 auto !important;
  }

  #reversi #screen-spec.screen.active > .sb-swap-overlay,
  #reversi #screen-spec.screen.active > .bi-overlay,
  #reversi #screen-spec.screen.active > .bi-encounter-overlay,
  #reversi #screen-spec.screen.active > .sb-coin-overlay,
  #reversi #screen-spec.screen.active > .sb-continue-overlay,
  #reversi #screen-spec.screen.active > #sb-result-overlay,
  #reversi #screen-spec.screen.active > .sb-level-clear-overlay,
  #reversi #screen-spec.screen.active > .sb-level-start-overlay,
  .reversi-game #screen-spec.screen.active > .sb-swap-overlay,
  .reversi-game #screen-spec.screen.active > .bi-overlay,
  .reversi-game #screen-spec.screen.active > .bi-encounter-overlay,
  .reversi-game #screen-spec.screen.active > .sb-coin-overlay,
  .reversi-game #screen-spec.screen.active > .sb-continue-overlay,
  .reversi-game #screen-spec.screen.active > #sb-result-overlay,
  .reversi-game #screen-spec.screen.active > .sb-level-clear-overlay,
  .reversi-game #screen-spec.screen.active > .sb-level-start-overlay {
    /* Dialogs remain in normal flow.  Swiping anywhere moves the complete
       illustrated scene: outer background, cat frame, and its contents. */
    position: relative !important;
    inset: auto !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-height: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: var(
      --wakabattle-scene-padding,
      var(--wakabattle-mobile-dialog-top) 8px
        max(28px, env(safe-area-inset-bottom))
    ) !important;
    overflow: visible !important;
    touch-action: pan-y !important;
    order: 1 !important;
    flex: 0 0 auto !important;
  }

  /* Short scenes are centered in the visible stage. Tall content stays in
     normal flow and can be scrolled from its beginning. */
  #reversi #screen-spec.screen.active > .sb-coin-overlay,
  #reversi #screen-spec.screen.active > .sb-continue-overlay,
  #reversi #screen-spec.screen.active > #sb-result-overlay,
  #reversi #screen-spec.screen.active > .sb-level-clear-overlay,
  #reversi #screen-spec.screen.active > .sb-level-start-overlay,
  .reversi-game #screen-spec.screen.active > .sb-coin-overlay,
  .reversi-game #screen-spec.screen.active > .sb-continue-overlay,
  .reversi-game #screen-spec.screen.active > #sb-result-overlay,
  .reversi-game #screen-spec.screen.active > .sb-level-clear-overlay,
  .reversi-game #screen-spec.screen.active > .sb-level-start-overlay {
    --wakabattle-scene-padding: max(8px, env(safe-area-inset-bottom)) 8px;
    display: flex !important;
    align-items: safe center !important;
    justify-content: center !important;
  }

  #reversi #screen-spec.screen.active > .sb-coin-overlay > *,
  .reversi-game #screen-spec.screen.active > .sb-coin-overlay > * {
    position: relative !important;
    inset: auto !important;
    align-self: auto !important;
    margin: 0 !important;
    transform: none !important;
  }

  #reversi #screen-spec.screen.active > #sb-result-overlay > .ot-result-modal,
  .reversi-game
    #screen-spec.screen.active
    > #sb-result-overlay
    > .ot-result-modal {
    align-self: safe center !important;
    justify-self: auto !important;
  }

  /* Results, coin tosses and dialogue replace the board instead of being
     appended below it in the shared scroll surface. */
  #reversi #screen-spec.screen.active.overlay-open > #spec-game-root,
  .reversi-game #screen-spec.screen.active.overlay-open > #spec-game-root {
    display: none !important;
  }

  /* Choice and replacement share one centered cat-frame area. */
  #reversi #screen-spec.screen.active > .sb-swap-overlay,
  .reversi-game #screen-spec.screen.active > .sb-swap-overlay {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: center !important;
    background:
      linear-gradient(rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.82)),
      url("https://wakabaland.com/wp-content/uploads/2026/10/E001-reversi-screen-002.webp")
        center top / cover no-repeat !important;
  }

  #reversi #screen-spec.screen.active > .sb-swap-overlay > .sb-swap-modal,
  .reversi-game #screen-spec.screen.active > .sb-swap-overlay > .sb-swap-modal {
    box-sizing: border-box !important;
    width: min(88vw, 332px) !important;
    max-width: 332px !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 auto !important;
    transform: none !important;
    overflow: visible !important;
  }

  #reversi
    #screen-spec.screen.active
    > .sb-swap-overlay
    > .sb-skill-choice-dialog,
  .reversi-game
    #screen-spec.screen.active
    > .sb-swap-overlay
    > .sb-skill-choice-dialog {
    width: min(96vw, 370px) !important;
    max-width: 370px !important;
    padding: 42px 18px 116px !important;
    background-size: 100% 100% !important;
  }

  #reversi
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay,
  .reversi-game
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay {
    /* The screen, not the cat frame, owns vertical scrolling. */
    overflow: visible !important;
  }

  #reversi
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay
    > .sb-swap-modal:not(.sb-choice-modal),
  .reversi-game
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay
    > .sb-swap-modal:not(.sb-choice-modal) {
    display: flex !important;
    flex-direction: column !important;
    width: min(96vw, 370px) !important;
    max-width: 370px !important;
    min-height: min(600px, calc(100svh - 32px)) !important;
    padding: clamp(40px, 7svh, 50px) 22px clamp(78px, 12svh, 94px) !important;
    background-size: 100% 100% !important;
  }

  #reversi
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay
    .sb-swap-title,
  .reversi-game
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay
    .sb-swap-title {
    margin: 0 0 9px !important;
    font-size: clamp(16px, 4.4vw, 18px) !important;
    line-height: 1.14 !important;
  }

  #reversi
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay
    .sb-swap-slots,
  .reversi-game
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay
    .sb-swap-slots {
    /* Keep every skill card inside the illustrated cat frame. */
    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;
    margin: 10px auto 8px !important;
    padding: 0 4px 4px 0 !important;
    gap: 6px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    touch-action: pan-y !important;
  }

  #reversi
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay
    .sb-swap-slot,
  .reversi-game
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay
    .sb-swap-slot {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;
    padding: 7px 9px 8px !important;
  }

  #reversi
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay
    .sb-swap-slot-name,
  .reversi-game
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay
    .sb-swap-slot-name {
    font-size: max(var(--wk-font-min, 14px), clamp(12px, 3.45vw, 14px)) !important;
    line-height: 1.15 !important;
  }

  #reversi
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay
    .sb-swap-slot-desc,
  .reversi-game
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay
    .sb-swap-slot-desc {
    margin-top: 2px !important;
    padding: 0 !important;
    font-size: var(--wk-font-min, 14px) !important;
    line-height: 1.6 !important;
  }

  #reversi
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay
    .sb-swap-slot.empty,
  .reversi-game
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay
    .sb-swap-slot.empty {
    min-height: 56px !important;
  }

  #reversi
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay
    .sb-swap-actions,
  .reversi-game
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay
    .sb-swap-actions {
    margin-top: auto !important;
    padding-top: 4px !important;
  }

  /* Dialogue and parameter steps are exclusive views of the same message box. */
  #reversi #screen-spec.screen.active > .bi-overlay,
  .reversi-game #screen-spec.screen.active > .bi-overlay {
    --wakabattle-scene-padding: max(8px, env(safe-area-inset-bottom)) 0;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: safe center !important;
  }

  #reversi .bi-stage,
  #reversi .bi-msgwrap,
  #reversi .bi-taunt-nametag-wrap,
  .reversi-game .bi-stage,
  .reversi-game .bi-msgwrap,
  .reversi-game .bi-taunt-nametag-wrap {
    width: min(86vw, 480px) !important;
    max-width: 480px !important;
  }

  #reversi .bi-overlay:not(.bi-taunt-overlay) .bi-msgbox,
  .reversi-game .bi-overlay:not(.bi-taunt-overlay) .bi-msgbox {
    display: grid !important;
    grid-auto-rows: minmax(1.38em, auto) !important;
    align-content: center !important;
    gap: 3px !important;
    padding: 12px 22px 18px !important;
  }

  #reversi .bi-overlay .bi-msg-line1,
  #reversi .bi-overlay .bi-msg-line2,
  #reversi .bi-overlay .bi-msg-line3,
  .reversi-game .bi-overlay .bi-msg-line1,
  .reversi-game .bi-overlay .bi-msg-line2,
  .reversi-game .bi-overlay .bi-msg-line3 {
    display: block !important;
    width: 100% !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    font-size: clamp(14px, 4vw, 16px) !important;
    line-height: 1.62 !important;
    letter-spacing: 0 !important;
    text-overflow: clip !important;
  }

  #reversi .bi-overlay:not(.bi-taunt-overlay) .bi-msg-line1,
  #reversi .bi-overlay:not(.bi-taunt-overlay) .bi-msg-line2,
  #reversi .bi-overlay:not(.bi-taunt-overlay) .bi-msg-line3,
  .reversi-game .bi-overlay:not(.bi-taunt-overlay) .bi-msg-line1,
  .reversi-game .bi-overlay:not(.bi-taunt-overlay) .bi-msg-line2,
  .reversi-game .bi-overlay:not(.bi-taunt-overlay) .bi-msg-line3 {
    min-height: 1.38em !important;
    line-height: 1.38 !important;
  }

  #reversi .bi-taunt-overlay .bi-msg,
  .reversi-game .bi-taunt-overlay .bi-msg {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 3px !important;
    min-height: 0 !important;
  }

  #reversi .bi-taunt-overlay.bi-taunt-show-status .bi-msg,
  .reversi-game .bi-taunt-overlay.bi-taunt-show-status .bi-msg {
    display: none !important;
  }

  #reversi .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-taunt-status,
  .reversi-game .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-taunt-status {
    display: none !important;
  }

  #reversi .bi-taunt-overlay.bi-taunt-show-status .bi-taunt-status,
  .reversi-game .bi-taunt-overlay.bi-taunt-show-status .bi-taunt-status {
    display: flex !important;
  }

  #reversi .ability-battle .sb-ability-slot.slot-cat-placement {
    background-image: url("https://wakabaland.com/wp-content/uploads/2026/10/E001-reversi-screen-007-hd.webp") !important;
  }
  #reversi .ability-battle .sb-ability-slot.slot-cat-flip {
    background-image: url("https://wakabaland.com/wp-content/uploads/2026/10/E001-reversi-screen-008-hd.webp") !important;
  }
  #reversi .ability-battle .sb-ability-slot.slot-cat-erase {
    background-image: url("https://wakabaland.com/wp-content/uploads/2026/10/E001-reversi-screen-009-hd.webp") !important;
  }
  #reversi .ability-battle .sb-ability-slot.slot-cat-combo {
    background-image: url("https://wakabaland.com/wp-content/uploads/2026/10/E001-reversi-screen-010-hd.webp") !important;
  }
  #reversi .ability-battle .sb-ability-slot.slot-cat-block {
    background-image: url("https://wakabaland.com/wp-content/uploads/2026/10/E001-reversi-screen-011-hd.webp") !important;
  }
  #reversi .ability-battle .sb-ability-slot.slot-cat-guard {
    background-image: url("https://wakabaland.com/wp-content/uploads/2026/10/E001-reversi-screen-012-hd.webp") !important;
  }
  #reversi .ability-battle .sb-ability-slot.slot-cat-hint {
    background-image: url("https://wakabaland.com/wp-content/uploads/2026/10/E001-reversi-screen-013-hd.webp") !important;
  }
  #reversi .ability-battle .sb-ability-slot.slot-cat-null {
    background-image: url("https://wakabaland.com/wp-content/uploads/2026/10/E001-reversi-screen-014-hd.webp") !important;
  }
}

/* Keep CPU taunt dialogue lines inside the shared message box. */
#reversi .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-taunt-msgbox,
#reversi .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msgbox,
.reversi-game .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-taunt-msgbox,
.reversi-game .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msgbox {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

@media (min-width: 481px) {
  #reversi .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-taunt-msgbox,
  #reversi .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msgbox,
  .reversi-game .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-taunt-msgbox,
  .reversi-game .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msgbox {
    height: 179px !important;
    min-height: 179px !important;
    padding: 22px 36px 18px !important;
  }
}

#reversi .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msg,
.reversi-game .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msg {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-auto-rows: minmax(1.42em, auto) !important;
  align-content: center !important;
  gap: 4px !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  transform: none !important;
  white-space: normal !important;
  overflow: visible !important;
  line-height: 1.42 !important;
}

#reversi .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msg-line1,
#reversi .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msg-line2,
#reversi .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msg-line3,
.reversi-game .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msg-line1,
.reversi-game .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msg-line2,
.reversi-game .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msg-line3 {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  min-height: 1.42em !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.42 !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
  transform: none !important;
}

#reversi .bi-taunt-overlay.bi-taunt-show-status .bi-msg,
.reversi-game .bi-taunt-overlay.bi-taunt-show-status .bi-msg {
  display: none !important;
}

@media (max-width: 480px) {
  #reversi .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-taunt-msgbox,
  #reversi .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msgbox,
  .reversi-game .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-taunt-msgbox,
  .reversi-game .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msgbox {
    padding: 20px 22px 18px !important;
  }

  #reversi .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msg,
  .reversi-game .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msg {
    gap: 3px !important;
    line-height: 1.38 !important;
  }

  #reversi .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msg-line1,
  #reversi .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msg-line2,
  #reversi .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msg-line3,
  .reversi-game .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msg-line1,
  .reversi-game .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msg-line2,
  .reversi-game .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msg-line3 {
    line-height: 1.38 !important;
    min-height: 1.38em !important;
  }
}

@media (max-width: 300px) {
  #reversi .bi-overlay:not(.bi-taunt-overlay) .bi-msgbox,
  #reversi .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msgbox,
  .reversi-game .bi-overlay:not(.bi-taunt-overlay) .bi-msgbox,
  .reversi-game .bi-taunt-overlay:not(.bi-taunt-show-status) .bi-msgbox {
    padding-right: 16px !important;
    padding-left: 16px !important;
  }

  #reversi .bi-overlay .bi-msg-line1,
  #reversi .bi-overlay .bi-msg-line2,
  #reversi .bi-overlay .bi-msg-line3,
  .reversi-game .bi-overlay .bi-msg-line1,
  .reversi-game .bi-overlay .bi-msg-line2,
  .reversi-game .bi-overlay .bi-msg-line3 {
    font-size: var(--wk-font-min, 14px) !important;
  }
}

/* Continue screen: make the question label easier to read. */
#reversi .sb-continue-title,
.reversi-game .sb-continue-title,
.sb-continue-title {
  font-size: clamp(18px, 4.3vw, 20px);
  line-height: 1.25;
  font-weight: 900;
  letter-spacing: 0.02em;
}

/* Normal move selection: blink white frames clearly, separate from skill targets. */
#reversi
  .ability-battle
  .ot-cell.hint:not(.hint-placement):not(.hint-guided):not(.hint-block):not(
    .hint-combo
  ):not(.hint-erase):not(.hint-flip),
.reversi-game
  .ot-cell.hint:not(.hint-placement):not(.hint-guided):not(.hint-block):not(
    .hint-combo
  ):not(.hint-erase):not(.hint-flip) {
  background: rgba(255, 255, 255, 0.12) !important;
  outline: 3px solid rgba(255, 255, 255, 0.95) !important;
  outline-offset: -3px !important;
  border-radius: 2px !important;
  box-shadow: 0 0 5px 1px rgba(255, 255, 255, 0.25) !important;
  animation-name: normal-move-hint-blink-steady !important;
  animation-duration: 0.9s !important;
  animation-timing-function: ease-in-out !important;
  animation-iteration-count: infinite !important;
  animation-direction: alternate !important;
  animation-fill-mode: both !important;
}

@keyframes normal-move-hint-blink-steady {
  from {
    background: rgba(255, 255, 255, 0.06);
    outline-color: rgba(255, 255, 255, 0.42);
    box-shadow: 0 0 3px 0 rgba(255, 255, 255, 0.12);
  }
  to {
    background: rgba(255, 255, 255, 0.34);
    outline-color: rgba(255, 255, 255, 1);
    box-shadow: 0 0 16px 5px rgba(255, 255, 255, 0.62);
  }
}

/* Normal selectable cells: blink the frame with a separate layer, so skill targets stay steady. */
#reversi
  .ability-battle
  .ot-cell.hint:not(.hint-placement):not(.hint-guided):not(.hint-block):not(
    .hint-combo
  ):not(.hint-erase):not(.hint-flip),
.reversi-game
  .ot-cell.hint:not(.hint-placement):not(.hint-guided):not(.hint-block):not(
    .hint-combo
  ):not(.hint-erase):not(.hint-flip) {
  position: relative !important;
  overflow: visible !important;
}

#reversi
  .ability-battle
  .ot-cell.hint:not(.hint-placement):not(.hint-guided):not(.hint-block):not(
    .hint-combo
  ):not(.hint-erase):not(.hint-flip)::after,
.reversi-game
  .ot-cell.hint:not(.hint-placement):not(.hint-guided):not(.hint-block):not(
    .hint-combo
  ):not(.hint-erase):not(.hint-flip)::after {
  content: "" !important;
  position: absolute !important;
  inset: 2px !important;
  border: 3px solid #ffffff !important;
  border-radius: 3px !important;
  pointer-events: none !important;
  opacity: 0.25;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.15);
  animation: normal-move-frame-blink 0.72s ease-in-out infinite alternate !important;
  z-index: 4 !important;
}

@keyframes normal-move-frame-blink {
  from {
    opacity: 0.18;
    box-shadow: 0 0 2px rgba(255, 255, 255, 0.1);
  }
  to {
    opacity: 1;
    box-shadow:
      0 0 14px rgba(255, 255, 255, 0.72),
      0 0 4px rgba(255, 255, 255, 0.95) inset;
  }
}

/* Skill target selection: blink by skill color. Combo is yellow. */
#reversi .ability-battle .ot-cell.hint,
.reversi-game.ability-battle .ot-cell.hint {
  --skill-target-rgb: 255, 255, 255;
}

#reversi .ability-battle .ot-cell.hint-placement,
#reversi .ability-battle .ot-cell.hint-combo,
#reversi .ability-battle .ot-cell.hint-block,
#reversi .ability-battle .ot-cell.hint-flip,
#reversi .ability-battle .ot-cell.hint-erase,
#reversi .ability-battle .ot-cell.hint-guided,
.reversi-game.ability-battle .ot-cell.hint-placement,
.reversi-game.ability-battle .ot-cell.hint-combo,
.reversi-game.ability-battle .ot-cell.hint-block,
.reversi-game.ability-battle .ot-cell.hint-flip,
.reversi-game.ability-battle .ot-cell.hint-erase,
.reversi-game.ability-battle .ot-cell.hint-guided {
  position: relative !important;
  overflow: visible !important;
  background: rgba(var(--skill-target-rgb), 0.2) !important;
  outline: 4px solid rgba(var(--skill-target-rgb), 0.95) !important;
  outline-offset: -4px !important;
  border-radius: 2px !important;
  box-shadow:
    0 0 20px 6px rgba(var(--skill-target-rgb), 0.72),
    inset 0 0 0 2px rgba(255, 255, 255, 0.58) !important;
  animation: skill-target-cell-blink 0.72s ease-in-out infinite alternate !important;
  z-index: 2 !important;
}

#reversi .ability-battle .ot-cell.hint-placement,
.reversi-game.ability-battle .ot-cell.hint-placement {
  --skill-target-rgb: 58, 169, 255;
}

#reversi .ability-battle .ot-cell.hint-combo,
.reversi-game.ability-battle .ot-cell.hint-combo {
  --skill-target-rgb: 255, 226, 48;
}

#reversi .ability-battle .ot-cell.hint-block,
.reversi-game.ability-battle .ot-cell.hint-block {
  --skill-target-rgb: 224, 158, 72;
}

#reversi .ability-battle .ot-cell.hint-flip,
.reversi-game.ability-battle .ot-cell.hint-flip {
  --skill-target-rgb: 180, 100, 255;
}

#reversi .ability-battle .ot-cell.hint-erase,
.reversi-game.ability-battle .ot-cell.hint-erase {
  --skill-target-rgb: 255, 95, 95;
}

#reversi .ability-battle .ot-cell.hint-placement::after,
#reversi .ability-battle .ot-cell.hint-combo::after,
#reversi .ability-battle .ot-cell.hint-block::after,
#reversi .ability-battle .ot-cell.hint-flip::after,
#reversi .ability-battle .ot-cell.hint-erase::after,
#reversi .ability-battle .ot-cell.hint-guided::after,
.reversi-game.ability-battle .ot-cell.hint-placement::after,
.reversi-game.ability-battle .ot-cell.hint-combo::after,
.reversi-game.ability-battle .ot-cell.hint-block::after,
.reversi-game.ability-battle .ot-cell.hint-flip::after,
.reversi-game.ability-battle .ot-cell.hint-erase::after,
.reversi-game.ability-battle .ot-cell.hint-guided::after {
  content: "" !important;
  position: absolute !important;
  inset: 1px !important;
  border: 4px solid rgb(var(--skill-target-rgb)) !important;
  border-radius: 3px !important;
  opacity: 0.95 !important;
  pointer-events: none !important;
  box-shadow:
    0 0 14px rgba(var(--skill-target-rgb), 0.78),
    0 0 5px rgba(255, 255, 255, 0.95) inset !important;
  animation: skill-target-frame-blink 0.72s ease-in-out infinite alternate !important;
  z-index: 5 !important;
}

#reversi .ability-battle .ot-disc.disc-flip-target,
#reversi .ability-battle .ot-disc.disc-erase-target,
.reversi-game.ability-battle .ot-disc.disc-flip-target,
.reversi-game.ability-battle .ot-disc.disc-erase-target {
  animation: skill-disc-target-blink 0.72s ease-in-out infinite alternate !important;
}

@keyframes skill-target-cell-blink {
  from {
    background: rgba(var(--skill-target-rgb), 0.1);
    outline-color: rgba(var(--skill-target-rgb), 0.58);
    box-shadow: 0 0 4px 1px rgba(var(--skill-target-rgb), 0.16);
  }
  to {
    background: rgba(var(--skill-target-rgb), 0.34);
    outline-color: rgba(var(--skill-target-rgb), 1);
    box-shadow: 0 0 16px 5px rgba(var(--skill-target-rgb), 0.6);
  }
}

@keyframes skill-target-frame-blink {
  from {
    opacity: 0.24;
    box-shadow: 0 0 3px rgba(var(--skill-target-rgb), 0.18);
  }
  to {
    opacity: 1;
    box-shadow:
      0 0 18px rgba(var(--skill-target-rgb), 0.78),
      0 0 5px rgba(var(--skill-target-rgb), 0.95) inset;
  }
}

@keyframes skill-disc-target-blink {
  from {
    filter: brightness(1);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.3);
  }
  to {
    filter: brightness(1.22);
    box-shadow:
      0 0 16px rgba(255, 255, 255, 0.72),
      0 6px 10px rgba(0, 0, 0, 0.3);
  }
}

/* Combo skill must stay visibly yellow even when normal hint styles are also present. */
#reversi.ability-battle .ot-cell.hint.hint-combo,
#reversi .ability-battle .ot-cell.hint.hint-combo,
.reversi-game.ability-battle .ot-cell.hint.hint-combo {
  --skill-target-rgb: 255, 226, 48 !important;
  background: rgba(255, 226, 48, 0.28) !important;
  outline: 3px solid rgba(255, 226, 48, 1) !important;
  outline-offset: -3px !important;
  box-shadow:
    0 0 18px 5px rgba(255, 226, 48, 0.56),
    inset 0 0 0 1px rgba(255, 255, 255, 0.45) !important;
  animation: skill-target-cell-blink 0.72s ease-in-out infinite alternate !important;
}

#reversi.ability-battle .ot-cell.hint.hint-combo::after,
#reversi .ability-battle .ot-cell.hint.hint-combo::after,
.reversi-game.ability-battle .ot-cell.hint.hint-combo::after {
  content: "" !important;
  position: absolute !important;
  inset: 2px !important;
  border: 3px solid rgb(255, 226, 48) !important;
  border-radius: 3px !important;
  pointer-events: none !important;
  opacity: 0.55;
  box-shadow:
    0 0 10px rgba(255, 226, 48, 0.55),
    0 0 5px rgba(255, 255, 255, 0.85) inset !important;
  animation: skill-target-frame-blink 0.72s ease-in-out infinite alternate !important;
  z-index: 6 !important;
}

/* PC skill choice: widen the cat frame so longer descriptions stay balanced. */
@media (min-width: 835px) {
  #reversi #screen-spec.screen.active > .sb-swap-overlay > .sb-choice-modal,
  .reversi-game
    #screen-spec.screen.active
    > .sb-swap-overlay
    > .sb-choice-modal,
  #reversi .sb-swap-modal.sb-choice-modal,
  .reversi-game .sb-swap-modal.sb-choice-modal,
  .sb-swap-modal.sb-choice-modal {
    box-sizing: border-box !important;
    width: min(66vw, 486px) !important;
    max-width: 486px !important;
    padding: 60px 50px 96px !important;
  }

  #reversi .sb-choice-modal .sb-choice-cards,
  .reversi-game .sb-choice-modal .sb-choice-cards,
  .sb-choice-modal .sb-choice-cards {
    width: 100% !important;
    max-width: 386px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    gap: 16px !important;
  }

  #reversi .sb-choice-modal .sb-choice-card,
  .reversi-game .sb-choice-modal .sb-choice-card,
  .sb-choice-modal .sb-choice-card {
    width: 100% !important;
    min-height: 112px !important;
    padding: 12px 15px !important;
  }

  #reversi .sb-choice-modal .sb-choice-desc,
  .reversi-game .sb-choice-modal .sb-choice-desc,
  .sb-choice-modal .sb-choice-desc {
    font-size: var(--wk-font-body, 16px) !important;
    line-height: 1.34 !important;
    word-break: keep-all !important;
    overflow-wrap: anywhere !important;
  }

  #reversi .sb-choice-modal .sb-swap-actions,
  .reversi-game .sb-choice-modal .sb-swap-actions,
  .sb-choice-modal .sb-swap-actions {
    max-width: 386px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
}

/* Wakabattle highlighted ranking row */
.wakabattle-ranking-row.is-mine {
  position: relative;
  border-color: #f0bd15;
  background: #fff8d8;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.9) inset,
    0 0 0 3px rgba(240, 189, 21, 0.26),
    0 6px 16px rgba(240, 189, 21, 0.28);
}

.wakabattle-ranking-you {
  margin-top: 4px;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.2;
}

/* Five-page thank-you conversation after the 30-win endroll. */
.sb-thanks-overlay {
  --copy-height: 100px;
  --card-height: 170px;
  --safe-top: 16px;
  --safe-bottom: max(16px, env(safe-area-inset-bottom));
  --sb-thanks-height: calc(
    var(--wb-visible-height, 100svh) - var(--wb-header-height, 0px) - 2 *
      var(--wb-stage-gap, 16px)
  );
  position: absolute;
  inset: 0;
  z-index: 10500;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--sb-thanks-height);
  min-height: 100%;
  box-sizing: border-box;
  padding: var(--safe-top) 16px var(--safe-bottom);
  overflow: hidden;
  border-radius: inherit;
  color: #fff;
  background: radial-gradient(
    ellipse at 50% 40%,
    #142124 0%,
    #0b1114 44%,
    #05080b 85%
  );
  font-family: "DotGothic16", sans-serif;
}
.sb-thanks-advance {
  font-family: inherit;
  color: inherit;
  touch-action: manipulation;
  cursor: pointer;
}
.sb-thanks-advance:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 5px;
}
.sb-ending-sky,
.sb-thanks-confetti {
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.sb-ending-star {
  position: absolute;
  width: 3px;
  height: 3px;
  background: #f2e0ae;
  opacity: 0.2;
  animation: sbEndingTwinkle 6s steps(4, end) infinite;
  animation-delay: var(--delay);
}
.sb-ending-star.cross {
  width: 3px;
  height: 9px;
  box-shadow: 0 0 6px #f0d58c88;
}
.sb-ending-star.cross::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 3px;
  top: 3px;
  left: -3px;
  background: inherit;
}
.sb-thanks-confetti i {
  position: absolute;
  top: -15px;
  left: var(--x);
  width: 4px;
  height: 7px;
  background: var(--color);
  opacity: 0;
  animation: sbThanksFall 3.2s linear var(--delay) forwards;
  transform: rotate(20deg);
}
.sb-thanks-scene {
  position: relative;
  z-index: 1;
  width: min(100%, 640px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  isolation: isolate;
  opacity: 0;
  transition: opacity 0.9s ease;
}
.sb-thanks-scene.shown {
  opacity: 1;
}
.sb-thanks-scene.closing {
  opacity: 0;
  transition-duration: 1s;
  pointer-events: none;
}
.sb-thanks-portrait {
  position: relative;
  flex: none;
  width: min(
    100%,
    420px,
    calc(
      var(--sb-thanks-height) - var(--card-height) - var(--safe-top) -
        var(--safe-bottom) - 106px
    )
  );
  aspect-ratio: 1;
  border: 4px solid #e5e7e1;
  border-radius: 14px;
  background: #fff;
  box-shadow:
    0 0 0 2px #3b4645,
    0 0 20px #f7f4dc25;
  overflow: hidden;
  transform: translateY(8px);
  transition:
    transform 1s ease,
    box-shadow 1.2s ease;
}
.shown .sb-thanks-portrait {
  transform: translateY(0);
}
.sb-thanks-portrait-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}
.sb-thanks-wakaba {
  position: absolute;
  left: 4%;
  bottom: 2%;
  width: 92%;
  height: 94%;
  object-fit: contain;
  image-rendering: pixelated;
}
.sb-thanks-scene.last .sb-thanks-portrait {
  box-shadow:
    0 0 0 2px #b89b57,
    0 0 20px #f7df9c66,
    0 0 52px #e7c26e25;
}
.sb-thanks-message-wrap {
  width: 100%;
  position: relative;
}
.sb-thanks-nametag {
  position: absolute;
  z-index: 2;
  left: 14px;
  top: -45px;
  width: 194px;
  height: 92px;
  pointer-events: none;
}
.sb-thanks-nametag img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}
.sb-thanks-nametag span {
  position: absolute;
  left: 48%;
  top: 58%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: 22px;
  line-height: 1;
}
.sb-thanks-dialogue {
  box-sizing: border-box;
  position: relative;
  background: #050909;
  border: 3px solid #dfe5db;
  border-radius: 12px;
  padding: 36px 28px 22px;
  box-shadow:
    0 0 0 2px #394540,
    0 0 18px #f4f1dc16;
  min-height: var(--card-height);
}
.sb-thanks-dialogue::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid #96a39a;
  border-radius: 6px;
  pointer-events: none;
}
.sb-thanks-copy {
  position: relative;
  display: grid;
  gap: 4px;
  font-size: clamp(15px, 3.8vw, 22px);
  line-height: 1.6;
  min-height: var(--copy-height);
  overflow-wrap: anywhere;
}
.sb-thanks-copy span {
  display: block;
  box-sizing: border-box;
  min-height: 1.6em;
  white-space: pre-wrap;
  text-wrap: balance;
  word-break: keep-all;
}
.sb-thanks-controls {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0 3px;
  min-height: 44px;
}
.sb-thanks-page-count {
  color: #a5b2ac;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
}
.sb-thanks-advance {
  border: 1px solid #aaa;
  background: #171717;
  color: #fff;
  border-radius: 5px;
  min-height: 44px;
  padding: 8px 20px;
  font-size: 17px;
  box-shadow: inset 0 0 0 2px #111;
}
.sb-thanks-advance:active {
  background: #383838;
}
.sb-thanks-advance:disabled {
  cursor: default;
  opacity: 0.45;
}
.sb-thanks-arrow {
  display: inline-block;
  color: inherit;
  margin-left: 12px;
  font-size: var(--wk-font-meta, 14px);
}
.sb-thanks-measure {
  position: absolute;
  visibility: hidden;
  pointer-events: none;
  left: 0;
  top: 0;
  min-height: 0;
}
@keyframes sbEndingTwinkle {
  0%,
  100% {
    opacity: 0.12;
  }
  45%,
  60% {
    opacity: 0.65;
  }
}
@keyframes sbThanksFall {
  0% {
    opacity: 0;
    transform: translateY(-15px) rotate(0);
  }
  10% {
    opacity: 0.75;
  }
  75% {
    opacity: 0.5;
  }
  100% {
    opacity: 0;
    transform: translateY(var(--sb-thanks-height)) rotate(270deg);
  }
}
@media (max-width: 480px) {
  .sb-thanks-overlay {
    padding-left: 12px;
    padding-right: 12px;
  }
  .sb-thanks-scene {
    gap: 16px;
  }
  .sb-thanks-dialogue {
    padding: 32px 18px 18px;
  }
  .sb-thanks-copy {
    gap: 3px;
    line-height: 1.55;
  }
  .sb-thanks-copy span {
    min-height: 1.55em;
  }
  .sb-thanks-nametag {
    width: 170px;
    height: 81px;
    top: -39px;
    left: 9px;
  }
  .sb-thanks-nametag span {
    font-size: 20px;
  }
  .sb-thanks-portrait {
    border-width: 3px;
    border-radius: 11px;
  }
  .sb-thanks-advance {
    font-size: 15px;
    padding: 8px 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sb-ending-star,
  .sb-thanks-confetti i {
    animation: none;
  }
  .sb-thanks-confetti {
    display: none;
  }
  .sb-thanks-scene,
  .sb-thanks-portrait {
    transition: none;
  }
  .sb-thanks-portrait {
    transform: none;
  }
}

/* Wakabattle endroll: one background, readable copy and a persistent control. */
#reversi .sb-endroll-overlay,
.reversi-game .sb-endroll-overlay {
  position: absolute;
  inset: 0;
  z-index: 26000;
  display: flex;
  align-items: stretch;
  padding: 0;
  background: transparent;
  color: #fff;
  overflow: visible;
  pointer-events: none;
}

#reversi .sb-endroll-overlay::before,
#reversi .sb-endroll-overlay::after,
.reversi-game .sb-endroll-overlay::before,
.reversi-game .sb-endroll-overlay::after {
  display: none;
}

#reversi .sb-endroll-shell,
.reversi-game .sb-endroll-shell {
  position: relative;
  pointer-events: auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  overflow: hidden;
  background: #080f18;
  box-shadow:
    inset 0 0 0 2px #a28d54,
    inset 0 0 0 6px #080f18;
}

#reversi .sb-endroll-shell::before,
.reversi-game .sb-endroll-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(circle, #65745e 1px, transparent 1px) 0 0 / 32px 32px,
    repeating-linear-gradient(0deg, transparent 0 3px, #000 3px 4px);
  opacity: 0.16;
}

#reversi .sb-endroll-shell::after,
.reversi-game .sb-endroll-shell::after {
  content: "";
  position: absolute;
  inset: 12px;
  z-index: 8;
  pointer-events: none;
  border: 1px solid #5b5339;
  background:
    linear-gradient(#e5cd87, #e5cd87) left top / 24px 2px no-repeat,
    linear-gradient(#e5cd87, #e5cd87) left top / 2px 24px no-repeat,
    linear-gradient(#e5cd87, #e5cd87) right bottom / 24px 2px no-repeat,
    linear-gradient(#e5cd87, #e5cd87) right bottom / 2px 24px no-repeat;
}

#reversi .sb-endroll-progress,
.reversi-game .sb-endroll-progress {
  position: absolute;
  z-index: 3;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  color: #e5cd87;
  font: 16px/1.3 "DotGothic16", sans-serif;
  white-space: nowrap;
}
#reversi .sb-endroll-progress-count,
.reversi-game .sb-endroll-progress-count {
  min-width: 4.5em;
  border-left: 1px solid #776740;
  padding-left: 12px;
  color: #fff;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
#reversi .sb-endroll-shell.is-final-card::after,
.reversi-game .sb-endroll-shell.is-final-card::after {
  border-color: #e5cd87;
}

#reversi .sb-endroll-overlay.hiding,
.reversi-game .sb-endroll-overlay.hiding {
  pointer-events: none;
  background: #000;
}

#reversi .sb-endroll-overlay.hiding .sb-endroll-shell,
.reversi-game .sb-endroll-overlay.hiding .sb-endroll-shell {
  animation: sb-endroll-shell-fadeout 0.96s linear forwards;
  pointer-events: none;
}

#reversi .sb-endroll-overlay.hiding .sb-endroll-skip,
.reversi-game .sb-endroll-overlay.hiding .sb-endroll-skip {
  pointer-events: none;
}

@keyframes sb-endroll-shell-fadeout {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

#reversi .sb-endroll-track,
.reversi-game .sb-endroll-track {
  position: absolute;
  inset: 0;
  z-index: 6;
  overflow: hidden;
}

#reversi .sb-endroll-card,
.reversi-game .sb-endroll-card {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 42%) minmax(0, 1fr);
  align-items: center;
  justify-items: center;
  gap: clamp(20px, 3vw, 38px);
  padding: clamp(28px, 4vw, 48px) clamp(26px, 4vw, 52px) 88px;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  animation: none;
  transition: none;
  transform: none;
}

#reversi .sb-endroll-card.is-active,
.reversi-game .sb-endroll-card.is-active {
  opacity: 1;
  animation: sb-endroll-card-wipe 0.28s steps(8, end) both;
}

@keyframes sb-endroll-card-wipe {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0);
  }
}

#reversi .sb-endroll-skip,
.reversi-game .sb-endroll-skip {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  right: 26px;
  bottom: max(26px, env(safe-area-inset-bottom));
  min-width: 112px;
  min-height: 44px;
  margin: 0;
  padding: 9px 20px;
  border: 2px solid #e8e8e8;
  border-radius: 0;
  background: #171717;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 12;
  box-shadow: 3px 3px 0 #000;
}

#reversi .sb-endroll-skip:hover,
#reversi .sb-endroll-skip:focus-visible,
.reversi-game .sb-endroll-skip:hover,
.reversi-game .sb-endroll-skip:focus-visible {
  border-color: #fff;
  outline: 2px solid #fff;
  outline-offset: 3px;
}

#reversi .sb-endroll-copy,
.reversi-game .sb-endroll-copy {
  position: relative;
  width: 100%;
  min-width: 0;
  display: grid;
  align-content: center;
  row-gap: clamp(14px, 1.8vw, 22px);
  padding: 8px 0 8px clamp(16px, 2vw, 26px);
  border-left: 2px solid #776740;
  box-sizing: border-box;
}

#reversi .sb-endroll-copy-group,
.reversi-game .sb-endroll-copy-group {
  width: 100%;
  min-width: 0;
  opacity: 0;
  visibility: hidden;
  transform: none;
  filter: none;
}

#reversi .sb-endroll-copy-identity,
.reversi-game .sb-endroll-copy-identity {
  display: grid;
  row-gap: 8px;
}

#reversi .sb-endroll-card.copy-reveal-match .sb-endroll-copy-match,
.reversi-game .sb-endroll-card.copy-reveal-match .sb-endroll-copy-match,
#reversi .sb-endroll-card.copy-reveal-identity .sb-endroll-copy-identity,
.reversi-game .sb-endroll-card.copy-reveal-identity .sb-endroll-copy-identity,
#reversi .sb-endroll-card.copy-reveal-score .sb-endroll-copy-score,
.reversi-game .sb-endroll-card.copy-reveal-score .sb-endroll-copy-score,
#reversi .sb-endroll-card.copy-reveal-result .sb-endroll-copy-result,
.reversi-game .sb-endroll-card.copy-reveal-result .sb-endroll-copy-result {
  opacity: 1;
  visibility: visible;
  animation: none;
}

#reversi .sb-endroll-portrait-stage,
.reversi-game .sb-endroll-portrait-stage {
  position: relative;
  width: min(100%, 350px);
  height: min(48svh, 405px);
  min-height: 0;
  overflow: hidden;
  border: 2px solid #776740;
  border-radius: 0;
  box-sizing: border-box;
  background: #101d26;
  box-shadow: 4px 4px 0 #03080c;
}

#reversi .sb-endroll-char,
.reversi-game .sb-endroll-char {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  opacity: 0;
  animation: none;
  transition: opacity 0.2s linear;
  transform: none;
  filter: none;
  mask-image: none;
  -webkit-mask-image: none;
}

#reversi .sb-endroll-char-face,
.reversi-game .sb-endroll-char-face {
  object-fit: cover;
}

#reversi .sb-endroll-char.is-char-active,
.reversi-game .sb-endroll-char.is-char-active {
  opacity: 1;
}

#reversi .sb-endroll-match,
#reversi .sb-endroll-copy h3,
#reversi .sb-endroll-animal,
#reversi .sb-endroll-result,
.reversi-game .sb-endroll-match,
.reversi-game .sb-endroll-copy h3,
.reversi-game .sb-endroll-animal,
.reversi-game .sb-endroll-result {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  line-height: 1.2;
  letter-spacing: 0;
  color: #fff;
  text-shadow: 2px 2px 0 #000;
  overflow-wrap: anywhere;
}

#reversi .sb-endroll-match,
.reversi-game .sb-endroll-match {
  color: #f7df97;
  font-size: clamp(21px, 2.25vw, 28px);
}

#reversi .sb-endroll-copy h3,
.reversi-game .sb-endroll-copy h3 {
  font-size: clamp(34px, 4.2vw, 46px);
}

#reversi .sb-endroll-animal,
.reversi-game .sb-endroll-animal {
  color: #dce4df;
  font-size: clamp(20px, 2.4vw, 28px);
}

#reversi .sb-endroll-result,
.reversi-game .sb-endroll-result {
  font-size: clamp(25px, 3vw, 34px);
}

#reversi .sb-endroll-score,
.reversi-game .sb-endroll-score {
  width: 100%;
  margin: 0;
  padding: 12px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(6px, 0.8vw, 10px);
  border: solid #776740;
  border-width: 1px 0;
  border-radius: 0;
  background: transparent;
  box-sizing: border-box;
  white-space: normal;
}

#reversi .sb-endroll-score strong,
.reversi-game .sb-endroll-score strong {
  min-width: 1.05em;
  font-size: clamp(28px, 3.6vw, 40px);
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

#reversi .sb-endroll-score-name,
.reversi-game .sb-endroll-score-name {
  min-width: 0;
  color: #dce4df;
  font-size: clamp(15px, 1.65vw, 19px);
  font-weight: 900;
  line-height: 1.3;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  text-shadow: 1px 1px 0 #000;
}

#reversi .sb-endroll-score em,
.reversi-game .sb-endroll-score em {
  margin: 0;
  color: #f7df97;
  font-size: clamp(18px, 2.2vw, 24px);
  font-style: normal;
  line-height: 1;
}

@media (max-width: 640px) {
  #reversi .sb-endroll-card,
  .reversi-game .sb-endroll-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 2svh, 18px);
    padding: 24px 24px calc(84px + env(safe-area-inset-bottom));
    text-align: center;
  }

  #reversi .sb-endroll-portrait-stage,
  .reversi-game .sb-endroll-portrait-stage {
    flex: 0 1 auto;
    width: min(54vw, 240px);
    height: min(28svh, 240px);
  }

  #reversi .sb-endroll-copy,
  .reversi-game .sb-endroll-copy {
    flex: 0 0 auto;
    row-gap: 8px;
    padding: 0;
    border-left: 0;
    text-align: center;
  }

  #reversi .sb-endroll-copy h3,
  .reversi-game .sb-endroll-copy h3 {
    font-size: clamp(28px, 8vw, 36px);
  }

  #reversi .sb-endroll-match,
  .reversi-game .sb-endroll-match {
    font-size: clamp(18px, 5vw, 22px);
  }

  #reversi .sb-endroll-animal,
  .reversi-game .sb-endroll-animal {
    font-size: clamp(17px, 4.8vw, 22px);
  }

  #reversi .sb-endroll-result,
  .reversi-game .sb-endroll-result {
    font-size: clamp(21px, 6.2vw, 28px);
  }

  #reversi .sb-endroll-score,
  .reversi-game .sb-endroll-score {
    padding: 9px 0;
    gap: 6px;
  }

  #reversi .sb-endroll-score strong,
  .reversi-game .sb-endroll-score strong {
    font-size: clamp(24px, 7vw, 30px);
  }

  #reversi .sb-endroll-score-name,
  .reversi-game .sb-endroll-score-name {
    font-size: max(var(--wk-font-min, 14px), clamp(12px, 3.5vw, 15px));
  }

  #reversi .sb-endroll-score em,
  .reversi-game .sb-endroll-score em {
    font-size: clamp(16px, 4.8vw, 20px);
  }

  #reversi .sb-endroll-skip,
  .reversi-game .sb-endroll-skip {
    left: 50%;
    right: auto;
    bottom: max(24px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  #reversi .sb-endroll-card.is-active,
  .reversi-game .sb-endroll-card.is-active {
    animation: none !important;
  }

  #reversi .sb-endroll-char,
  .reversi-game .sb-endroll-char {
    transition: none !important;
  }
}

@media (max-width: 480px) and (max-height: 720px) {
  #reversi #screen-spec.screen.active,
  .reversi-game #screen-spec.screen.active {
    --wakabattle-mobile-dialog-top: clamp(1.05cm, 6.8svh, 1.55cm);
  }

  #reversi #screen-spec.screen.active #spec-game-root,
  .reversi-game #screen-spec.screen.active #spec-game-root {
    gap: clamp(2px, 0.7svh, 4px) !important;
  }

  #reversi .ability-battle,
  .reversi-game.ability-battle {
    gap: clamp(2px, 0.7svh, 4px) !important;
    max-width: 100vw !important;
  }

  #reversi .ability-battle .sb-top-row,
  #reversi .ability-battle .sb-bottom-row,
  #reversi .ability-battle .sb-score-bar,
  .reversi-game.ability-battle .sb-top-row,
  .reversi-game.ability-battle .sb-bottom-row,
  .reversi-game.ability-battle .sb-score-bar {
    max-width: min(96vw, 314px) !important;
    padding-left: 5px !important;
    padding-right: 5px !important;
    gap: 3px !important;
  }
  #reversi .ability-battle .sb-top-row,
  .reversi-game.ability-battle .sb-top-row {
    --sb-top-gap: 3px;
  }

  #reversi .ability-battle .ot-board-wrap,
  .reversi-game.ability-battle .ot-board-wrap {
    width: min(96vw, calc(var(--wb-visible-height, 100svh) - var(--wb-header-height, 60px) - 400px), 308px) !important;
    max-width: 308px !important;
    padding: clamp(28px, 7.8vw, 34px) !important;
  }

  #reversi .ability-battle .sb-message-bar,
  .reversi-game.ability-battle .sb-message-bar {
    min-height: 23px !important;
    padding: 3px 10px !important;
    font-size: max(var(--wk-font-min, 14px), clamp(11px, 2.8vw, 12px)) !important;
    line-height: 1.25 !important;
  }

  #reversi .ability-battle .sb-score-box,
  .reversi-game.ability-battle .sb-score-box {
    padding: 2px 3px !important;
  }

  #reversi .ability-battle .sb-score-box-num,
  .reversi-game.ability-battle .sb-score-box-num {
    font-size: clamp(18px, 6.2vw, 23px) !important;
  }

  #reversi .ability-battle .sb-score-box-label,
  .reversi-game.ability-battle .sb-score-box-label {
    font-size: var(--wk-font-meta, 14px) !important;
    white-space: normal;
  text-wrap: balance;
  min-height: 20px;
}
}

@media (max-width: 380px) and (max-height: 640px) {
  #reversi .ability-battle .sb-top-row,
  #reversi .ability-battle .sb-bottom-row,
  #reversi .ability-battle .sb-score-bar,
  .reversi-game.ability-battle .sb-top-row,
  .reversi-game.ability-battle .sb-bottom-row,
  .reversi-game.ability-battle .sb-score-bar {
    max-width: min(96vw, 300px) !important;
  }

  #reversi .ability-battle .ot-board-wrap,
  .reversi-game.ability-battle .ot-board-wrap {
    width: min(94vw, calc(var(--wb-visible-height, 100svh) - var(--wb-header-height, 60px) - 400px), 292px) !important;
    max-width: 292px !important;
    padding: clamp(24px, 7.2vw, 30px) !important;
  }
}

@media (max-width: 300px) {
  .ability-battle .sb-dom-ability-card .sb-slot-name-text {
    padding: 0 1px;
    overflow: hidden;
    font-size: var(--wk-font-min, 14px);
    line-height: 1.05;
    white-space: normal;
    word-break: auto-phrase;
  text-wrap: balance;
}

  .ability-battle .sb-dom-ability-card .sb-slot-meta-row {
    margin-top: 2px;
  }

  .ability-battle .sb-dom-ability-card .sb-slot-meta-row .sb-slot-cond-tag,
  .ability-battle .sb-dom-ability-card .sb-slot-remaining {
    font-size: var(--wk-font-min, 14px);
    min-height: 24px;
  line-height: 1.4;
}

  .ability-battle .sb-dom-ability-card .sb-slot-remaining {
    bottom: 0;
    min-height: 24px;
  line-height: 1.4;
}
}

/* Wakabattle command buttons: keep the palette and switch the silhouette to pixel UI. */
#reversi #screen-spec .ot-btn,
#reversi #screen-spec .sb-surrender-confirm-btn,
#reversi #screen-spec .sb-skill-choice-action,
.reversi-game #screen-spec .ot-btn,
.reversi-game #screen-spec .sb-surrender-confirm-btn,
.reversi-game #screen-spec .sb-skill-choice-action {
  border-radius: 4px !important;
  border-width: 2px 2px 5px !important;
  transition:
    transform 80ms steps(2, end),
    background-color 80ms steps(2, end) !important;
  box-shadow:
    2px 2px 0 rgba(255, 255, 255, 0.18) inset,
    -2px -2px 0 rgba(0, 0, 0, 0.22) inset,
    3px 4px 0 rgba(42, 22, 10, 0.78) !important;
}

#reversi #screen-spec .ot-btn:active,
#reversi #screen-spec .sb-surrender-confirm-btn:active,
#reversi #screen-spec .sb-skill-choice-action:active,
.reversi-game #screen-spec .ot-btn:active,
.reversi-game #screen-spec .sb-surrender-confirm-btn:active,
.reversi-game #screen-spec .sb-skill-choice-action:active {
  transform: translate(2px, 3px) !important;
  box-shadow:
    1px 1px 0 rgba(255, 255, 255, 0.14) inset,
    -1px -1px 0 rgba(0, 0, 0, 0.24) inset,
    1px 1px 0 rgba(42, 22, 10, 0.78) !important;
}

#reversi #screen-spec .ot-btn.secondary,
#reversi #screen-spec .sb-surrender-no,
#reversi #screen-spec .sb-skill-choice-action.secondary,
.reversi-game #screen-spec .ot-btn.secondary,
.reversi-game #screen-spec .sb-surrender-no,
.reversi-game #screen-spec .sb-skill-choice-action.secondary {
  box-shadow:
    2px 2px 0 rgba(255, 255, 255, 0.52) inset,
    -2px -2px 0 rgba(92, 58, 28, 0.16) inset,
    3px 4px 0 rgba(92, 58, 28, 0.4) !important;
}

/* Mobile battle dialogue and opponent status share one readable type scale. */
@media (max-width: 480px) {
  #reversi .bi-msg,
  #reversi .bi-msg-line1,
  #reversi .bi-msg-line2,
  #reversi .bi-msg-line3,
  #reversi .bi-taunt-status-plain .bi-taunt-status-line-label,
  .reversi-game .bi-msg,
  .reversi-game .bi-msg-line1,
  .reversi-game .bi-msg-line2,
  .reversi-game .bi-msg-line3,
  .reversi-game .bi-taunt-status-plain .bi-taunt-status-line-label {
    font-size: clamp(15px, 4.1vw, 18px) !important;
  }

  #reversi
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay
    > .sb-swap-modal:not(.sb-choice-modal),
  .reversi-game
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay
    > .sb-swap-modal:not(.sb-choice-modal) {
    padding-bottom: clamp(70px, 11svh, 84px) !important;
  }

  #reversi
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay
    .sb-swap-actions,
  .reversi-game
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay
    .sb-swap-actions {
    padding: 6px 30px 0 10px !important;
    box-sizing: border-box !important;
  }

  #reversi
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay
    .sb-swap-confirm-btn,
  .reversi-game
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay
    .sb-swap-confirm-btn {
    width: min(100%, 210px) !important;
    min-width: 0 !important;
    font-size: max(var(--wk-font-control, 16px), clamp(13px, 3.55vw, 15px)) !important;
    white-space: nowrap !important;
  }
}
/* Scene contents stay behind one opaque frame until every image and font is
   decoded. Removing this class reveals the background, frame, and text in the
   same paint instead of letting individual assets pop in. */
#reversi #screen-spec.screen.active > .wakabattle-scene-pending,
.reversi-game #screen-spec.screen.active > .wakabattle-scene-pending {
  background-color: #050505 !important;
  background-image: none !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: none !important;
  animation-play-state: paused !important;
}

#reversi #screen-spec.screen.active > .wakabattle-scene-pending::before,
#reversi #screen-spec.screen.active > .wakabattle-scene-pending::after,
#reversi #screen-spec.screen.active > .wakabattle-scene-pending > *,
.reversi-game #screen-spec.screen.active > .wakabattle-scene-pending::before,
.reversi-game #screen-spec.screen.active > .wakabattle-scene-pending::after,
.reversi-game #screen-spec.screen.active > .wakabattle-scene-pending > * {
  visibility: hidden !important;
  opacity: 0 !important;
  animation-play-state: paused !important;
}

/* スマホの「最初から／途中から」も押しやすいサイズにする。 */
@media (max-width: 480px) {
  .magic-sub-btns.open .magic-sub-btn {
    min-height: 44px;
    touch-action: manipulation;
  }
}

/* 端末への保存とランキング送信の状態 */
#reversi .wakabattle-save-status {
  margin: 6px auto;
  max-width: 560px;
  padding: 0 8px;
  font-size: var(--wk-font-meta, 14px);
  line-height: 1.5;
  color: #555;
  overflow-wrap: anywhere;
  text-align: center;
}
#reversi .wakabattle-save-status:empty {
  display: none;
}

/* Approved battle layout: keep the illustrated frames at their original size. */
#reversi #screen-spec > .game-header,
#reversi #screen-spec #sb-test-bar {
  display: none !important;
}
#reversi #spec-game-root {
  padding-top: 0 !important;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}
#reversi .sb-game-controls {
  display: grid;
  container-type: inline-size;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  width: min(calc(100% - 28px), 360px);
  gap: 8px;
  margin: 4px auto 0;
}
#reversi .sb-game-controls > button,
#reversi #screen-spec .sb-game-controls #wakabattle-bgm-toggle {
  position: static !important;
  inset: auto !important;
  z-index: auto !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100% !important;
  max-width: none !important;
  height: 44px !important;
  min-height: 44px !important;
  margin: 0 !important;
  padding: 6px 4px !important;
  border: 2px solid #eee !important;
  border-radius: 3px !important;
  background: var(--rv-control-bg, var(--wk-button-neutral)) !important;
  color: var(--rv-control-ink, var(--wk-button-neutral-ink)) !important;
  font-family: "DotGothic16", sans-serif;
  font-size: clamp(12px, 5cqi, var(--wk-font-control, 18px)) !important;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-shadow: none;
  box-shadow:
    0 0 0 1px #171717,
    0 3px 0 rgba(0, 0, 0, 0.3);
  cursor: pointer;
  touch-action: manipulation;
}
#reversi .sb-game-controls .sb-surrender-btn,
#reversi .sb-game-controls #wakabattle-bgm-toggle[aria-pressed="true"] {
  --rv-control-bg: var(--rv-button-bg);
  --rv-control-ink: #fff;
}
#reversi .sb-game-controls button:disabled {
  opacity: 0.5;
  cursor: default;
}
#reversi .sb-game-controls button:focus-visible,
#reversi .sb-activate-btn:focus-visible,
#reversi .wb-control-overlay button:focus-visible {
  outline: 3px solid #fff !important;
  outline-offset: 3px;
}
/* The persistent audio node lives here between games, until buildDOM moves it. */
#reversi #screen-spec > #wakabattle-bgm-toggle {
  display: none !important;
}

#reversi .wb-control-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 61000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.65);
}
#reversi .wb-control-overlay .sb-surrender-modal {
  width: min(440px, calc(100vw - 32px));
  padding: 24px 16px;
  border: 3px solid #fff;
  border-radius: 3px;
  outline: 3px solid #111;
  background: #111;
  color: #fff;
  box-shadow:
    inset 0 0 0 3px #111,
    inset 0 0 0 5px #e3e3e3,
    0 8px 0 rgba(0, 0, 0, 0.4);
}
#reversi .wb-control-overlay .sb-surrender-title {
  color: #fff;
  font-size: clamp(18px, 4.8vw, 24px);
}
#reversi .sb-pause-description {
  margin: 0 0 20px;
  font-size: var(--wk-font-body, 16px);
  line-height: 1.6;
}
#reversi .wb-control-overlay .sb-surrender-actions {
  gap: 12px;
}
#reversi .wb-control-overlay .sb-surrender-no { --rv-button-bg: var(--wk-button-neutral); --rv-button-ink: var(--wk-button-neutral-ink); }
#reversi .wb-control-overlay .sb-surrender-confirm-btn {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 8px 4px;
  border: 2px solid #e3e3e3;
  border-radius: 2px;
  background: var(--rv-button-bg, #171717);
  color: var(--rv-button-ink, #fff);
  font-size: var(--wk-font-control, 18px);
  text-shadow: none;
  box-shadow: 0 3px 0 #000;
}

#reversi .ability-battle .sb-character-nameplate,
#reversi .ability-battle .sb-score-pc-label {
  display: none;
}

@media (min-width: 768px) {
  #reversi #spec-game-root.wb-wide-layout {
    /* Three card/button groups share the full sidebar height. */
    --sb-side-skill-rows: repeat(2, 122.25px 42px minmax(0, 1fr)) 122.25px 42px;
    display: grid !important;
    width: 788.5px !important;
    max-width: 788.5px !important;
    grid-template-columns: 122.25px 520px 122.25px;
    grid-template-rows: auto auto 520px auto;
    column-gap: 12px;
    row-gap: 6px;
    align-items: start;
    margin: 8px auto;
  }
  #reversi .wb-wide-layout > .sb-score-bar {
    grid-column: 2;
    grid-row: 1;
  }
  #reversi .wb-wide-layout > .sb-message-bar {
    grid-column: 2;
    grid-row: 2;
  }
  #reversi .wb-wide-layout > .ot-board-wrap {
    grid-column: 2;
    grid-row: 3;
    width: 520px;
  }
  #reversi .wb-wide-layout > .sb-game-controls {
    grid-column: 2;
    grid-row: 4;
    width: 504px;
    margin-top: 0;
  }
  #reversi .wb-wide-layout > .wakabattle-save-status {
    grid-column: 1 / 4;
    grid-row: 5;
  }
  #reversi .wb-wide-layout > .sb-top-row,
  #reversi .wb-wide-layout > .sb-bottom-row {
    width: 122.25px;
    max-width: 122.25px;
    padding: 0;
    margin: 0;
    gap: 5px;
    grid-row: 1 / 5;
    align-self: stretch;
  }
  #reversi .wb-wide-layout > .sb-top-row {
    grid-column: 3;
    display: flex;
    flex-direction: column;
  }
  #reversi .wb-wide-layout .sb-top-char-box {
    width: 122.25px;
    height: 175.25px;
    flex: none;
  }
  #reversi .wb-wide-layout .sb-top-char-box .sb-char-frame,
  #reversi .wb-wide-layout .sb-bottom-char-box .sb-char-frame {
    width: 122.25px;
    height: 122.25px;
    flex: none;
  }
  #reversi .wb-wide-layout .sb-top-ability-col {
    width: 122.25px;
    flex: 1;
    min-height: 0;
    gap: 0;
  }
  #reversi .wb-wide-layout .sb-top-ability-area {
    grid-template-columns: 1fr;
    /* Reserve the player's button rows so both sets of cards align. */
    grid-template-rows: var(--sb-side-skill-rows);
    gap: 0;
    min-height: 0;
  }
  #reversi .wb-wide-layout .sb-top-ability-area > :nth-child(1) {
    grid-row: 1;
  }
  #reversi .wb-wide-layout .sb-top-ability-area > :nth-child(2) {
    grid-row: 4;
  }
  #reversi .wb-wide-layout .sb-top-ability-area > :nth-child(3) {
    grid-row: 7;
  }
  #reversi .wb-wide-layout > .sb-bottom-row {
    grid-column: 1;
    display: grid;
    grid-template-columns: 122.25px;
    grid-template-rows: 175.25px minmax(0, 1fr);
  }
  #reversi .wb-wide-layout .sb-bottom-char-box {
    grid-column: 1;
    grid-row: 1;
    display: block;
  }
  #reversi .wb-wide-layout .sb-bottom-ability-col {
    display: grid;
    grid-column: 1;
    grid-row: 2;
    grid-template-columns: 122.25px;
    grid-template-rows: var(--sb-side-skill-rows);
    gap: 0;
    min-height: 0;
  }
  #reversi .wb-wide-layout .sb-bottom-ability-area,
  #reversi .wb-wide-layout .sb-player-activate-row {
    display: contents;
  }
  #reversi .wb-wide-layout #sb-player-slot-1 {
    grid-row: 1;
  }
  #reversi .wb-wide-layout #sb-activate-btn-1 {
    grid-row: 2;
  }
  #reversi .wb-wide-layout #sb-player-slot-2 {
    grid-row: 4;
  }
  #reversi .wb-wide-layout #sb-activate-btn-2 {
    grid-row: 5;
  }
  #reversi .wb-wide-layout #sb-player-slot-3 {
    grid-row: 7;
  }
  #reversi .wb-wide-layout #sb-activate-btn-3 {
    grid-row: 8;
  }
  #reversi .wb-wide-layout .sb-bottom-ability-area > *,
  #reversi .wb-wide-layout .sb-player-activate-row > * {
    grid-column: 1;
  }
  #reversi .wb-wide-layout .sb-ability-slot {
    width: 122.25px;
    height: 122.25px;
  }
  #reversi .wb-wide-layout .sb-activate-btn {
    height: 38px;
    min-height: 38px;
    margin-top: 4px;
  }
  #reversi .wb-wide-layout .sb-score-full-label {
    display: none;
  }
  #reversi .wb-wide-layout .sb-score-pc-label {
    display: inline;
  }
  #reversi .wb-wide-layout .sb-character-nameplate {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 122.25px;
    height: 28px;
    margin-top: 5px;
    padding: 2px 4px;
    border: 2px solid #e2e9e2;
    border-radius: 3px;
    background: #080b09;
    color: #fff;
    font-family: "DotGothic16", sans-serif;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.2;
    white-space: nowrap;
    text-shadow: 1px 1px #000;
    box-shadow:
      0 0 0 1px #17251b,
      0 2px 0 rgba(0, 0, 0, 0.3);
  }
}
@media (max-width: 767px) {
  #reversi #spec-game-root .sb-bottom-row {
    --sb-action-height: 44px;
    margin-bottom: 0 !important;
  }
  #reversi #spec-game-root .sb-bottom-char-box {
    grid-row: 1;
    grid-template-rows: auto;
    align-self: start;
  }
  #reversi #spec-game-root .sb-activate-btn {
    height: 44px;
    min-height: 44px;
    touch-action: manipulation;
  }
}

/* Fit the illustrated stage to its content, with the same outer padding on
   all four sides. Scene dialogs and the board share this page anchor. */
#reversi:has(#screen-spec.screen.active) {
  min-height: 0 !important;
  background: transparent !important;
}
#reversi:has(#screen-spec.screen.active)::before {
  display: none !important;
}
#reversi #screen-spec.screen.active {
  --wb-content-width: 520px;
  --wb-gutter: 24px;
  --wb-stage-gap: 16px;
  --wb-header-height: 0px;
  width: min(
    100%,
    calc(var(--wb-content-width) + 2 * var(--wb-gutter))
  ) !important;
  max-width: none !important;
  min-height: 0 !important;
  height: auto !important;
  padding: var(--wb-gutter) !important;
  margin: var(--wb-stage-gap) auto !important;
  overflow: visible !important;
  background-position: center !important;
  background-size: cover !important;
}
#reversi #screen-spec.screen.active.wb-stage-wide {
  --wb-content-width: 788.5px;
  --wb-gutter: clamp(0px, calc((100% - 788.5px) / 2), 24px);
}
#reversi #screen-spec.screen.active #spec-game-root {
  margin: 0 !important;
  padding: 0 !important;
}
#reversi #screen-spec.screen.active.overlay-open {
  height: calc(
    var(--wb-visible-height, 100svh) - var(--wb-header-height) - 2 *
      var(--wb-stage-gap)
  ) !important;
  padding: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}
#reversi #screen-spec.screen.active.overlay-open > #spec-game-root {
  display: none !important;
}
#reversi #screen-spec.screen.active.overlay-open > .wakabattle-scene-pending,
#reversi #screen-spec.screen.active.overlay-open > .sb-swap-overlay,
#reversi #screen-spec.screen.active.overlay-open > .bi-overlay,
#reversi #screen-spec.screen.active.overlay-open > .bi-encounter-overlay,
#reversi #screen-spec.screen.active.overlay-open > .sb-coin-overlay,
#reversi #screen-spec.screen.active.overlay-open > .sb-continue-overlay,
#reversi #screen-spec.screen.active.overlay-open > #sb-result-overlay,
#reversi #screen-spec.screen.active.overlay-open > .sb-level-clear-overlay,
#reversi #screen-spec.screen.active.overlay-open > .sb-level-start-overlay,
#reversi #screen-spec.screen.active.overlay-open > .sb-thanks-overlay {
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  height: auto !important;
  min-height: 100% !important;
  max-height: none !important;
  overflow: visible !important;
  box-sizing: border-box !important;
}
@media (min-width: 768px) {
  #reversi .ability-battle .sb-score-box {
    min-height: 74px !important;
  }
}
@media (min-width: 768px) and (max-height: 780px) {
  #reversi #screen-spec.screen.active {
    --wb-gutter: 16px;
    --wb-stage-gap: 8px;
  }
  #reversi #screen-spec.screen.active.wb-stage-wide {
    --wb-gutter: clamp(0px, calc((100% - 788.5px) / 2), 16px);
  }
}
@media (max-width: 767px) {
  #reversi:has(#screen-spec.screen.active) {
    width: 100vw !important;
    max-width: none !important;
    margin-inline: calc((100% - 100vw) / 2) !important;
  }
  #reversi #screen-spec.screen.active {
    --wb-content-width: min(calc(100vw - 28px), 360px);
    --wb-safe-bottom: env(safe-area-inset-bottom, 0px);
    --wb-gutter: 8px;
    --wb-stage-gap: 8px;
    --wb-header-height: 60px;
    --wakabattle-mobile-dialog-top: 16px;
  }
}
@media (max-width: 480px) and (max-height: 720px) {
  #reversi #screen-spec.screen.active {
    --wb-content-width: min(96vw, 314px);
    --wb-stage-gap: 4px;
    --wakabattle-mobile-dialog-top: 8px;
  }
  #reversi #screen-spec.screen.active #spec-game-root {
    gap: 2px !important;
  }
  #reversi #spec-game-root .sb-game-controls {
    margin-top: 0;
  }
}
@media (max-width: 380px) and (max-height: 640px) {
  #reversi #screen-spec.screen.active {
    --wb-content-width: min(96vw, 300px);
  }
}
/* A narrow result frame must not grow to the reward card's unwrapped width. */
#reversi #sb-result-overlay .ot-result-modal {
  min-width: 0;
  max-width: calc(100% - 16px);
}
#reversi #sb-result-overlay .sb-result-reward-card {
  min-width: 0;
  max-width: 100%;
}
#reversi #sb-result-overlay .sb-result-reward-card .sb-swap-slot-name-row {
  flex-wrap: wrap;
}
#reversi #sb-result-overlay .sb-result-choice-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
#reversi #sb-result-overlay .sb-result-choice-actions .ot-btn {
  width: 100%;
  min-width: 0;
  padding-inline: 4px;
  font-size: var(--wk-font-control, 18px);
}
@media (max-width: 767px) {
  #reversi
    #screen-spec.screen.active
    > .sb-swap-overlay
    > .sb-skill-choice-dialog {
    width: 100% !important;
    max-width: 370px !important;
    height: min(
      568px,
      calc(
        var(--wb-visible-height, 100svh) - var(--wb-header-height) - 2 *
          var(--wb-stage-gap) - var(--wakabattle-mobile-dialog-top) -
          max(28px, env(safe-area-inset-bottom))
      )
    );
  }
}
@media (max-width: 767px) {
  #reversi #sb-result-overlay .ot-result-modal {
    max-width: 100%;
  }
  #reversi #sb-result-overlay .ot-result-modal-body {
    flex: 0 0 auto;
  }
  #reversi #sb-result-overlay .ot-result-step1 {
    height: auto;
  }
  #reversi #sb-result-overlay .ot-result-step1 .ot-result-title,
  #reversi #sb-result-overlay .ot-result-step1 #sb-next-btn {
    margin-top: 0;
  }
  #reversi #screen-spec .sb-continue-modal {
    max-width: 100%;
  }
}
@media (max-width: 480px) and (max-height: 720px) {
  #reversi #sb-result-overlay .ot-result-modal {
    padding: 36px 24px 64px;
    gap: 8px;
  }
  #reversi #sb-result-overlay .ot-result-char-pane img {
    width: min(40vw, 144px);
    height: min(40vw, 144px);
  }
  #reversi #screen-spec .sb-continue-modal {
    width: 100%;
    padding: 36px 24px 72px;
    gap: 10px;
  }
  #reversi #screen-spec .sb-continue-face {
    width: min(46vw, 160px);
    height: min(46vw, 160px);
  }
  #reversi #screen-spec .sb-continue-wins {
    font-size: 28px;
  }
  #reversi #screen-spec .sb-continue-title {
    font-size: 14px;
  }
  #reversi #screen-spec .sb-continue-actions {
    gap: 8px;
  }
  #reversi #screen-spec .sb-continue-actions .ot-btn {
    width: 100%;
    min-width: 0;
    min-height: 44px;
  }
}
#reversi
  #screen-spec.active
  > .sb-swap-overlay
  > .sb-swap-modal:not(.sb-choice-modal) {
  max-height: min(
    760px,
    calc(
      var(--wb-visible-height, 100svh) - var(--wb-header-height) - 2 *
        var(--wb-stage-gap) - 32px
    )
  ) !important;
  margin-top: 0 !important;
}
@media (max-width: 767px) {
  #reversi
    #screen-spec.screen.active
    > .sb-swap-overlay.sb-swap-replace-overlay
    > .sb-swap-modal:not(.sb-choice-modal) {
    width: 100% !important;
    max-width: 370px !important;
    min-height: 0 !important;
    height: min(
      600px,
      calc(
        var(--wb-visible-height, 100svh) - var(--wb-header-height) - 2 *
          var(--wb-stage-gap) - var(--wakabattle-mobile-dialog-top) -
          max(28px, env(safe-area-inset-bottom))
      )
    ) !important;
    max-height: none !important;
  }
}
@media (max-width: 480px) and (max-height: 720px) {
  #reversi #screen-spec.screen.active.overlay-open > .sb-swap-overlay,
  #reversi #screen-spec.screen.active.overlay-open > .sb-continue-overlay,
  #reversi #screen-spec.screen.active.overlay-open > #sb-result-overlay {
    --wakabattle-scene-padding: var(--wakabattle-mobile-dialog-top) 8px
      max(8px, env(safe-area-inset-bottom));
  }
  #reversi #screen-spec .sb-continue-modal {
    aspect-ratio: auto;
    min-height: min(
      487.5px,
      calc(
        var(--wb-visible-height, 100svh) - var(--wb-header-height) - 2 *
          var(--wb-stage-gap) - 16px
      )
    );
  }
}
/* PC dialogue reserves room for its text box below the illustration. */
@media (min-width: 768px) {
  #reversi #screen-spec.screen.active.overlay-open > .bi-overlay {
    --wb-dialog-width: min(
      640px,
      100%,
      calc(
        var(--wb-visible-height, 100svh) - var(--wb-header-height) - 2 *
          var(--wb-stage-gap) - 240px
      )
    );
    padding: 16px 12px !important;
  }
  #reversi #screen-spec.screen.active.overlay-open > .bi-taunt-overlay {
    --wb-dialog-width: min(
      640px,
      100%,
      max(
        280px,
        calc(
          var(--wb-visible-height, 100svh) - var(--wb-header-height) - 2 *
            var(--wb-stage-gap) - 288px
        )
      )
    );
    padding: 56px 12px 8px !important;
  }
  #reversi #screen-spec .bi-overlay .bi-stage,
  #reversi #screen-spec .bi-overlay .bi-msgwrap,
  #reversi #screen-spec .bi-overlay .bi-name-tag-wrap,
  #reversi #screen-spec .bi-overlay .bi-taunt-nametag-wrap {
    width: var(--wb-dialog-width) !important;
    max-width: var(--wb-dialog-width) !important;
  }
}
