:root {
  color-scheme: dark;
  --ink: #f6f1e5;
  --muted: #a9a28f;
  --night: #090c10;
  --panel: #11161c;
  --panel-2: #171d24;
  --line: rgba(246, 241, 229, 0.14);
  --gold: #d6ae58;
  --gold-bright: #f2cf78;
  --red: #db685f;
  --blue: #65a9cc;
  --green: #78b98c;
  --violet: #a98bd4;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
}

/* Opponent mechanics occupy their own row, never compressing the identity. */
@media (min-width: 721px) {
  .fighter-panel.enemy-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .enemy-panel > .fighter-identity { grid-column: 1; }
  .enemy-panel > .resource-row { grid-column: 2; }
  .enemy-panel > .status-row,
  .enemy-panel > .totem-zone,
  .enemy-panel > .turret-zone,
  .enemy-panel > .puppet-grid63,
  .enemy-panel > .math-zone62,
  .enemy-panel > .garden-zone,
  .enemy-panel > .summon-zone { grid-column: 1 / -1; min-width: 0; width: 100%; }
}
@media (min-width: 721px) and (max-width: 1050px) {
  .fighter-panel.enemy-panel { grid-template-columns: minmax(0, 1fr); }
  .enemy-panel > .resource-row { grid-column: 1; }
}
/* TEST63: persistent two-puppet action display, independent of weapon slots. */
.puppet-grid63:not([hidden]){display:grid;grid-column:1/-1;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;width:100%;min-width:0}
.puppet63{background:#171e24;border:1px solid #46515b;border-radius:10px;padding:8px;min-width:0;font-size:12px}.puppet63 p{margin:6px 0;overflow-wrap:anywhere}.puppet63 summary{cursor:pointer;color:#d9bb75}.puppet-steps63{display:flex;gap:7px;margin-top:7px}.puppet-steps63 span{display:grid;place-items:center;width:24px;height:24px;border-radius:50%;background:#293138;color:#a8afb7}.puppet-steps63 .active{background:#edc764;color:#171e24;font-weight:800}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, rgba(91, 125, 111, 0.14), transparent 27rem),
    radial-gradient(circle at 88% 5%, rgba(185, 126, 61, 0.1), transparent 24rem),
    linear-gradient(155deg, #0b0f14 0%, #080b0f 58%, #101116 100%);
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 3px solid rgba(242, 207, 120, 0.72);
  outline-offset: 3px;
}

.game-shell {
  width: min(1480px, 100%);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 18px clamp(14px, 3vw, 44px) 26px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 70px;
  border-bottom: 1px solid var(--line);
}

.brand-lockup,
.fighter-identity,
.topbar-actions,
.player-summary,
.hand-heading,
.log-heading {
  display: flex;
  align-items: center;
}

.brand-lockup {
  gap: 13px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(214, 174, 88, 0.55);
  color: var(--gold-bright);
  transform: rotate(45deg);
}

.brand-mark::first-letter {
  transform: rotate(-45deg);
}

.eyebrow,
.side-label {
  margin: 0 0 3px;
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-family: Georgia, "Noto Serif KR", serif;
  font-size: clamp(1.4rem, 2vw, 1.85rem);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.topbar-actions {
  gap: 10px;
}

.turn-pill,
.ghost-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
}

.turn-pill {
  padding: 9px 14px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.turn-pill.active {
  border-color: rgba(214, 174, 88, 0.45);
  color: var(--gold-bright);
  box-shadow: 0 0 20px rgba(214, 174, 88, 0.08);
}

.ghost-button {
  padding: 9px 15px;
  color: var(--ink);
  cursor: pointer;
}

.ghost-button:hover {
  border-color: rgba(246, 241, 229, 0.3);
  background: rgba(255, 255, 255, 0.07);
}

.battle-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(210px, 1fr) auto;
  gap: 12px;
  min-height: calc(100vh - 115px);
  min-height: calc(100dvh - 115px);
  padding-top: 14px;
}

.fighter-panel,
.combat-center {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(23, 29, 36, 0.96), rgba(14, 18, 23, 0.96));
  box-shadow: var(--shadow);
}

.fighter-panel {
  position: relative;
  overflow: visible;
  padding: 15px 18px;
}

.combat-effect {
  position: absolute;
  z-index: 20;
  top: 48%;
  left: 50%;
  pointer-events: none;
  text-shadow: 0 0 14px currentColor;
  transform: translate(-50%, -50%);
  animation: combat-impact 760ms ease-out both;
}

.combat-effect-slash {
  color: #ffe6a0;
  font-size: 3.4rem;
  font-weight: 900;
  letter-spacing: -0.35em;
  animation-name: combat-slash;
}

.combat-effect-stab {
  color: #f0d8ff;
  font-size: 3.8rem;
}

.combat-effect-arrow {
  color: #bde7c0;
  font-size: 3.2rem;
  animation-name: combat-arrow;
}

.combat-effect-fire,
.combat-effect-frost,
.combat-effect-poison {
  font-size: 2.6rem;
}

.combat-effect-poison {
  color: #89e46f;
}

@keyframes combat-impact {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.35); }
  32% { opacity: 1; transform: translate(-50%, -50%) scale(1.18); }
  100% { opacity: 0; transform: translate(-50%, -62%) scale(0.9); }
}

@keyframes combat-slash {
  0% { opacity: 0; transform: translate(-75%, -10%) rotate(-24deg) scale(0.5); }
  36% { opacity: 1; transform: translate(-50%, -50%) rotate(-24deg) scale(1.15); }
  100% { opacity: 0; transform: translate(-25%, -85%) rotate(-24deg) scale(0.85); }
}

@keyframes combat-arrow {
  0% { opacity: 0; transform: translate(-140%, -50%) scale(0.7); }
  38% { opacity: 1; transform: translate(-48%, -50%) scale(1.15); }
  100% { opacity: 0; transform: translate(35%, -50%) scale(0.8); }
}

.enemy-panel,
.player-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.fighter-identity {
  gap: 13px;
  min-width: 0;
}

.class-emblem {
  display: grid;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(214, 174, 88, 0.42);
  border-radius: 13px;
  color: var(--gold-bright);
  background: linear-gradient(135deg, rgba(214, 174, 88, 0.12), rgba(214, 174, 88, 0.02));
  font-size: 1.45rem;
}

.enemy-emblem {
  color: #d8dadc;
  border-color: rgba(216, 218, 220, 0.27);
  background: rgba(216, 218, 220, 0.045);
}

.fighter-panel h2 {
  margin-bottom: 2px;
  font-family: Georgia, "Noto Serif KR", serif;
  font-size: 1.25rem;
  font-weight: 600;
}

.passive-copy {
  max-width: 670px;
  margin-bottom: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-row {
  display: grid;
  grid-template-columns: minmax(168px, 1.7fr) repeat(5, auto);
  align-items: stretch;
  gap: 7px;
}

.resource {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 5px;
  min-width: 64px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.16);
}

.resource.hp {
  display: grid;
  min-width: 168px;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 7px 10px 8px;
  overflow: hidden;
  border-color: rgba(236, 93, 90, 0.34);
  background: linear-gradient(145deg, rgba(121, 33, 35, 0.2), rgba(0, 0, 0, 0.18));
}

.resource-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.hp-track {
  display: block;
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45);
}

.hp-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #b5323d, #ff7d72);
  transition: width 220ms ease;
}

.resource.hp.is-critical {
  border-color: rgba(255, 86, 86, 0.72);
  box-shadow: 0 0 20px rgba(220, 49, 59, 0.18);
}

.resource-icon {
  font-size: 0.72rem;
  line-height: 1;
}

.resource.armor {
  border-color: rgba(91, 177, 224, 0.42);
  background: linear-gradient(145deg, rgba(54, 132, 176, 0.2), rgba(0, 0, 0, 0.16));
}

.resource.armor .resource-icon { color: #85c8e8; transform: rotate(45deg); }

.resource.energy {
  position: relative;
  min-width: 112px;
  padding-bottom: 20px;
  border-color: rgba(242, 207, 120, 0.46);
  background: radial-gradient(circle at 18% 20%, rgba(242, 207, 120, 0.18), rgba(0, 0, 0, 0.16));
}

.resource.energy .resource-icon { color: var(--gold-bright); }

.energy-orbs {
  position: absolute;
  right: 8px;
  bottom: 6px;
  left: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.energy-orb {
  width: 8px;
  height: 8px;
  border: 1px solid rgba(242, 207, 120, 0.55);
  border-radius: 50%;
  background: transparent;
}

.energy-orb.filled { background: var(--gold-bright); box-shadow: 0 0 6px rgba(242, 207, 120, 0.55); }
.energy-orb.reserved { border-color: #73d8e8; background: #55b9d0; box-shadow: 0 0 6px rgba(85, 185, 208, 0.55); }

.resource b {
  font-size: 1.1rem;
}

.resource small {
  color: var(--muted);
  font-size: 0.7rem;
}

.resource.hp b { color: #ff7d72; }
.resource.armor b { color: #85c8e8; }
.resource.energy b { color: #f2cf78; }
.resource.cards b { color: #c8a9eb; }

.status-row {
  display: flex;
  min-height: 26px;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.totem-zone {
  margin-top: 8px;
  padding: 9px;
  border: 1px solid rgba(182, 140, 226, 0.3);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(111, 76, 155, 0.12), rgba(63, 138, 139, 0.08));
}

.totem-zone[hidden] { display: none; }

.totem-heading {
  display: flex;
  margin-bottom: 7px;
  align-items: center;
  justify-content: space-between;
  color: #d3b6ef;
  font-size: 0.72rem;
  font-weight: 850;
}

.totem-slots { display: grid; }

.totem-slot {
  display: flex;
  min-height: 48px;
  padding: 8px 10px;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  border: 1px solid rgba(198, 164, 232, 0.3);
  border-radius: 9px;
  color: var(--ink);
  background: rgba(17, 27, 34, 0.82);
}

.totem-slot small { color: var(--muted); font-size: 0.65rem; }
.totem-slot.empty { color: rgba(201, 187, 218, 0.55); }

.turret-zone {
  margin-top: 8px;
  padding: 9px;
  border: 1px solid rgba(104, 190, 205, 0.28);
  border-radius: 12px;
  background: rgba(67, 154, 171, 0.06);
}

.turret-zone[hidden] { display: none; }

.turret-heading {
  display: flex;
  margin-bottom: 7px;
  align-items: center;
  justify-content: space-between;
  color: #a9dce4;
  font-size: 0.72rem;
  font-weight: 850;
}

.turret-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.turret-slot {
  display: flex;
  min-height: 54px;
  padding: 7px;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  overflow: hidden;
  border: 1px solid rgba(124, 205, 218, 0.3);
  border-radius: 9px;
  color: var(--ink);
  background: rgba(17, 27, 34, 0.82);
  text-align: left;
}

.turret-slot strong,
.turret-slot small { overflow-wrap: anywhere; }
.turret-slot strong em {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 5px;
  border-radius: 999px;
  color: #bfe8ef;
  background: rgba(95, 187, 203, 0.18);
  font-size: 0.58rem;
  font-style: normal;
  vertical-align: 1px;
}
.turret-slot small { color: var(--muted); font-size: 0.62rem; line-height: 1.3; }
.turret-slot.empty { align-items: center; color: rgba(180, 198, 203, 0.48); font-size: 0.68rem; }
.turret-slot.selectable { border-color: var(--gold-bright); box-shadow: 0 0 0 2px rgba(242, 207, 120, 0.14); cursor: pointer; }
.turret-slot.selectable:hover { background: rgba(242, 207, 120, 0.14); }

.summon-zone {
  margin-top: 8px;
  padding: 9px;
  border: 1px solid rgba(164, 188, 226, 0.25);
  border-radius: 12px;
  background: rgba(105, 130, 169, 0.07);
}

.summon-zone[hidden] { display: none; }

.summon-heading {
  display: flex;
  margin-bottom: 7px;
  align-items: center;
  justify-content: space-between;
  color: #c0d4f2;
  font-size: 0.72rem;
  font-weight: 850;
}

.summon-slots {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.summon-slot {
  display: grid;
  min-height: 48px;
  padding: 5px 3px;
  place-items: center;
  align-content: center;
  gap: 2px;
  border: 1px solid rgba(164, 188, 226, 0.28);
  border-radius: 9px;
  color: var(--ink);
  background: rgba(17, 27, 34, 0.82);
  text-align: center;
}

.summon-slot strong { font-size: 1rem; }
.summon-slot small { color: var(--muted); font-size: 0.58rem; line-height: 1.2; }
.summon-slot.empty { color: rgba(180, 198, 203, 0.38); }

.status-chip {
  padding: 4px 8px;
  border: 1px solid rgba(169, 139, 212, 0.32);
  border-radius: 999px;
  color: #d9c7f1;
  background: rgba(169, 139, 212, 0.1);
  font-size: 0.72rem;
  font-weight: 700;
}

.stance-meter,
.stance-dots {
  display: inline-flex;
  align-items: center;
}

.stance-meter {
  gap: 7px;
  border-color: rgba(214, 174, 88, 0.42);
  color: var(--gold-bright);
  background: rgba(214, 174, 88, 0.08);
}

.stance-dots {
  gap: 4px;
}

.stance-dot {
  width: 9px;
  height: 9px;
  border: 1px solid rgba(246, 241, 229, 0.38);
  border-radius: 50%;
  background: #050608;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.65);
}

.stance-dot.active {
  border-color: var(--gold-bright);
  background: var(--gold-bright);
  box-shadow: 0 0 8px rgba(242, 207, 120, 0.72);
}

.tooltip-target {
  position: relative;
  cursor: help;
}

.tooltip-target::after {
  display: none;
  position: absolute;
  z-index: 30;
  bottom: calc(100% + 9px);
  left: 50%;
  width: max-content;
  max-width: min(280px, 75vw);
  padding: 8px 10px;
  border: 1px solid rgba(242, 207, 120, 0.38);
  border-radius: 8px;
  color: #f4eee0;
  background: rgba(8, 12, 16, 0.97);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42);
  content: attr(data-tooltip);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: translate(-50%, 5px);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: pre-line;
}

.element-meter::after {
  left: 0;
  width: max-content;
  max-width: min(460px, calc(100vw - 48px));
  transform: translate(0, 5px);
}

.tooltip-target:hover::after,
.tooltip-target:focus-visible::after {
  display: block;
  opacity: 1;
  transform: translate(-50%, 0);
}

.element-meter:hover::after,
.element-meter:focus-visible::after {
  transform: translate(0, 0);
}

.combat-center {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, 0.42fr);
  gap: 14px;
  padding: 14px;
  background:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(145deg, rgba(19, 25, 31, 0.96), rgba(10, 14, 18, 0.96));
  background-size: 32px 32px, 32px 32px, auto;
}

.weapon-zone {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 74px minmax(150px, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 180px;
}

.weapon-slot {
  display: flex;
  min-height: 132px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border: 1px dashed rgba(246, 241, 229, 0.22);
  border-radius: 16px;
  text-align: center;
  background: rgba(0, 0, 0, 0.13);
}

.weapon-slot strong {
  margin: 8px 0 3px;
  font-size: 1.05rem;
}

.weapon-slot small,
.slot-label {
  color: var(--muted);
  font-size: 0.76rem;
}

.slot-label {
  font-weight: 800;
  letter-spacing: 0.12em;
}

.versus-mark {
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  border: 1px solid rgba(214, 174, 88, 0.4);
  border-radius: 50%;
  color: var(--gold-bright);
  background: radial-gradient(circle, rgba(214, 174, 88, 0.15), rgba(0, 0, 0, 0.15) 64%);
  font-family: Georgia, serif;
  font-size: 1.05rem;
}

.weapon-action,
.end-turn-button,
.primary-button {
  border: 0;
  border-radius: 10px;
  color: #17130a;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(214, 174, 88, 0.16);
}

.weapon-action {
  margin-top: 12px;
  padding: 8px 12px;
  font-size: 0.8rem;
}

button:disabled {
  cursor: not-allowed;
  filter: saturate(0.25);
  opacity: 0.42;
  box-shadow: none;
}

.battle-log {
  display: flex;
  min-height: 0;
  flex-direction: column;
  border-left: 1px solid var(--line);
  padding-left: 14px;
}

.log-heading,
.hand-heading {
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.battle-log ol {
  display: flex;
  min-height: 0;
  margin: 10px 0 0;
  padding: 0;
  overflow-y: auto;
  flex-direction: column;
  height: 210px;
  max-height: 210px;
  flex: 0 0 auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-gutter: stable;
  cursor: grab;
  list-style: none;
}

.battle-log li {
  flex: 0 0 auto;
  position: relative;
  padding: 7px 3px;
  border-bottom: 1px solid rgba(246, 241, 229, 0.07);
  color: #cbc6b8;
  font-size: 0.78rem;
  line-height: 1.42;
}

.battle-log li.has-card-preview {
  cursor: help;
}
.battle-log ol.dragging, .battle-log ol.dragging li { cursor:grabbing; user-select:none; }

.battle-log li.has-card-preview:hover,
.battle-log li.has-card-preview:focus-visible {
  color: var(--gold-bright);
  background: rgba(214, 174, 88, 0.07);
  outline: none;
}

.log-card-preview {
  position: fixed;
  z-index: 80;
  min-height: 286px;
  padding: 13px;
  pointer-events: none;
  border: 1px solid rgba(242, 207, 120, 0.5);
  border-radius: 14px;
  color: var(--ink);
  background: linear-gradient(160deg, #242b34, #10151b 72%);
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.65);
}

.log-card-preview[hidden] {
  display: none;
}

.log-preview-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--gold-bright);
  font-size: 0.75rem;
  font-weight: 900;
}

.log-preview-topline b {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  color: #17130a;
  background: var(--gold-bright);
}

.log-card-preview > strong {
  display: block;
  margin-top: 10px;
  font-family: Georgia, "Noto Serif KR", serif;
}

.log-card-preview > p {
  margin: 8px 0 0;
  color: #c3beb1;
  font-size: 0.78rem;
  line-height: 1.5;
}

.battle-log li strong {
  color: var(--ink);
}

.player-panel {
  padding-bottom: 13px;
}

.player-summary {
  align-items: flex-start;
}

.hand-heading {
  margin: 7px 0 10px;
}

.end-turn-button {
  min-width: 104px;
  padding: 9px 16px;
}

.card-hand {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  min-height: 220px;
  gap: 10px;
  padding: 8px 4px 13px;
  overflow: visible;
}

.scope-placement-bar {
  display: flex;
  grid-column: 1 / -1;
  min-width: 0;
  padding: 14px;
  flex-direction: column;
  gap: 8px;
  border: 1px solid rgba(242, 207, 120, 0.6);
  border-radius: 14px;
  background: rgba(26, 31, 38, 0.96);
}

.scope-placement-bar > span {
  color: var(--muted);
  font-size: 0.82rem;
}

.scope-placement-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 7px;
  padding-bottom: 2px;
}

.scope-placement-button {
  display: flex;
  min-width: 0;
  padding: 9px 10px;
  flex-direction: column;
  gap: 3px;
  border: 1px solid rgba(242, 207, 120, 0.42);
  border-radius: 10px;
  color: var(--ink);
  background: rgba(242, 207, 120, 0.1);
  cursor: pointer;
}

.scope-placement-button strong,
.scope-placement-button small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scope-placement-button small { color: var(--muted); font-size: 0.65rem; }

.scope-placement-button:hover,
.scope-placement-button:focus-visible {
  border-color: var(--gold-bright);
  background: rgba(242, 207, 120, 0.2);
}

.game-card {
  position: relative;
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 276px;
  padding: 13px;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--card-line);
  border-radius: 14px;
  color: var(--ink);
  text-align: left;
  background:
    linear-gradient(160deg, var(--card-wash), transparent 48%),
    linear-gradient(160deg, #202730, #11161c 72%);
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.game-card::after {
  position: absolute;
  right: -25px;
  bottom: -35px;
  width: 95px;
  height: 95px;
  border: 1px solid var(--card-line);
  border-radius: 50%;
  content: "";
  opacity: 0.42;
}

.game-card.center-aimed {
  border-color: rgba(242, 207, 120, 0.9);
  box-shadow: inset 0 0 0 1px rgba(242, 207, 120, 0.28), 0 0 22px rgba(214, 174, 88, 0.16);
}

.card-kind-row {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.center-badge {
  padding: 3px 6px;
  border: 1px solid rgba(242, 207, 120, 0.58);
  border-radius: 999px;
  color: #161107;
  background: var(--gold-bright);
  font-size: 0.62rem;
  font-weight: 950;
  letter-spacing: 0.06em;
}

.return-badge {
  padding: 3px 6px;
  border: 1px solid rgba(126, 218, 239, 0.62);
  border-radius: 999px;
  color: #dff9ff;
  background: rgba(42, 127, 151, 0.5);
  font-size: 0.62rem;
  font-weight: 950;
  letter-spacing: 0.06em;
}

.petrified-badge {
  padding: 3px 6px;
  border: 1px solid rgba(190, 203, 213, 0.58);
  border-radius: 999px;
  color: #e3e9ec;
  background: rgba(89, 103, 113, 0.58);
  font-size: 0.62rem;
  font-weight: 950;
}

.game-card.petrified {
  border-color: rgba(184, 198, 207, 0.62);
  background:
    linear-gradient(160deg, rgba(153, 168, 177, 0.2), transparent 48%),
    linear-gradient(160deg, #2a3035, #14181c 72%);
  box-shadow: inset 0 0 24px rgba(211, 222, 228, 0.08);
}

.game-card.counter-available {
  z-index: 4;
  border-color: #73f2d7;
  filter: none;
  opacity: 1;
  box-shadow: 0 0 0 2px rgba(78, 205, 181, 0.24), 0 0 30px rgba(78, 205, 181, 0.3);
  animation: counter-ready-pulse 1.15s ease-in-out infinite alternate;
}

@keyframes counter-ready-pulse {
  from { transform: translateY(0); box-shadow: 0 0 0 2px rgba(78, 205, 181, 0.2), 0 0 18px rgba(78, 205, 181, 0.2); }
  to { transform: translateY(-5px); box-shadow: 0 0 0 2px rgba(115, 242, 215, 0.38), 0 0 34px rgba(78, 205, 181, 0.42); }
}

.game-card.return-active {
  border-color: rgba(126, 218, 239, 0.82);
  box-shadow: inset 0 0 0 1px rgba(126, 218, 239, 0.22), 0 0 24px rgba(61, 167, 194, 0.18);
}

.game-card[data-keyword-tooltip]::before {
  position: absolute;
  z-index: 5;
  right: 8px;
  bottom: 38px;
  left: 8px;
  padding: 9px 10px;
  border: 1px solid rgba(195, 166, 233, 0.5);
  border-radius: 9px;
  color: #f2eafd;
  background: rgba(9, 11, 16, 0.97);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42);
  content: attr(data-keyword-tooltip);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.6;
  opacity: 0;
  pointer-events: none;
  transform: translateY(5px);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: pre-line;
}

.game-card[data-keyword-tooltip]:hover::before,
.game-card[data-keyword-tooltip]:focus-visible::before {
  opacity: 1;
  transform: translateY(0);
}

.game-card:hover:not(:disabled) {
  z-index: 3;
  border-color: var(--card-accent);
  transform: translateY(-7px);
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.34);
}

.game-card.skill {
  --card-line: rgba(219, 104, 95, 0.3);
  --card-accent: #eb837a;
  --card-wash: rgba(219, 104, 95, 0.18);
}

.game-card.weapon {
  --card-line: rgba(214, 174, 88, 0.34);
  --card-accent: #efcb75;
  --card-wash: rgba(214, 174, 88, 0.18);
}

.game-card.equipment {
  --card-line: rgba(101, 169, 204, 0.34);
  --card-accent: #86c7e8;
  --card-wash: rgba(101, 169, 204, 0.17);
}

.game-card.buff {
  --card-line: rgba(169, 139, 212, 0.34);
  --card-accent: #c3a6e9;
  --card-wash: rgba(169, 139, 212, 0.18);
}

.game-card.counter {
  --card-line: rgba(78, 205, 181, 0.38);
  --card-accent: #72e2cd;
  --card-wash: rgba(78, 205, 181, 0.18);
}

.game-card.mix {
  --card-line: rgba(238, 143, 83, 0.42);
  --card-accent: #f3a366;
  --card-wash: rgba(238, 143, 83, 0.2);
}

.game-card.turret {
  --card-line: rgba(104, 190, 205, 0.42);
  --card-accent: #8bd9e5;
  --card-wash: rgba(67, 154, 171, 0.2);
}

.game-card.totem {
  --card-line: rgba(181, 132, 224, 0.42);
  --card-accent: #d2a8f1;
  --card-wash: rgba(131, 86, 173, 0.2);
}

.game-card.contract {
  --card-line: rgba(198, 76, 91, 0.44);
  --card-accent: #f08792;
  --card-wash: rgba(139, 42, 57, 0.22);
}

.card-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.card-cost {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 50%;
  color: #161107;
  background: var(--gold-bright);
  font-weight: 950;
}

.card-type {
  color: var(--card-accent);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.card-name {
  margin: 11px 0 8px;
  font-family: Georgia, "Noto Serif KR", serif;
  font-size: 1rem;
  line-height: 1.25;
}

.card-art-frame {
  display: block;
  position: relative;
  height: 82px;
  margin: 11px -5px 0;
  overflow: hidden;
  border: 1px solid var(--card-line);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.2);
}

.card-art-placeholder,
.card-art-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.card-art-placeholder {
  display: grid;
  place-items: center;
  color: var(--card-accent);
  background:
    radial-gradient(circle at 50% 45%, var(--card-wash), transparent 47%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.045), rgba(0, 0, 0, 0.12));
  font-family: Georgia, serif;
  font-size: 1.7rem;
}

.card-art-image {
  display: block;
  object-fit: cover;
  opacity: 0;
}

.card-art-image.is-loaded { opacity: 1; }

.card-art-image.is-broken {
  display: none;
}

.card-text {
  white-space: pre-line;
  margin: 0;
  color: #c3beb1;
  font-size: 0.78rem;
  line-height: 1.52;
}

.card-footer {
  margin-top: auto;
  padding-top: 12px;
  color: var(--muted);
  font-size: 0.68rem;
}

.game-dialog {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 18px;
  border: 0;
  color: var(--ink);
  background: rgba(5, 7, 9, 0.84);
  backdrop-filter: blur(14px);
}

.game-dialog[open] {
  display: grid;
  place-items: center;
}

.dialog-card {
  width: min(1080px, 100%);
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid rgba(214, 174, 88, 0.28);
  border-radius: 22px;
  background: linear-gradient(145deg, #181e25, #0d1116);
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.6);
}

.dialog-card h2 {
  margin-bottom: 8px;
  font-family: Georgia, "Noto Serif KR", serif;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.04em;
}

.dialog-intro,
.rule-note {
  color: var(--muted);
  line-height: 1.6;
}

.main-menu-card {
  width: min(880px, 100%);
  text-align: center;
}

.main-menu-heading .dialog-intro { margin: 6px auto 0; }

.main-menu-grid {
  display: grid;
  margin-top: 24px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.main-menu-grid button {
  display: flex;
  min-height: 150px;
  padding: 20px 16px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(214, 174, 88, 0.24);
  border-radius: 16px;
  color: var(--ink);
  background: linear-gradient(145deg, rgba(214, 174, 88, 0.09), rgba(169, 139, 212, 0.045));
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.main-menu-grid button:hover,
.main-menu-grid button:focus-visible {
  border-color: var(--gold-bright);
  background: linear-gradient(145deg, rgba(214, 174, 88, 0.18), rgba(169, 139, 212, 0.09));
  transform: translateY(-3px);
}

.main-menu-grid button > span { color: var(--gold-bright); font-size: 1.65rem; }
.main-menu-grid button > strong { font-size: 1rem; }
.main-menu-grid button > small { color: var(--muted); font-size: 0.72rem; }

.utility-card {
  width: min(900px, 100%);
  max-height: calc(100dvh - 36px);
  overflow: hidden;
}

.compact-utility-card { width: min(650px, 100%); }

.catalog-list {
  display: grid;
  max-height: min(68vh, 680px);
  padding: 3px 7px 3px 2px;
  overflow-y: auto;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.catalog-list button {
  display: flex;
  min-width: 0;
  min-height: 82px;
  padding: 11px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.035);
  text-align: left;
  cursor: pointer;
}

.catalog-list button:hover { border-color: rgba(242, 207, 120, 0.65); }
.catalog-list button > span:last-child { min-width: 0; }
.catalog-list strong, .catalog-list small { display: block; }
.catalog-list strong { margin-bottom: 4px; }
.catalog-list small { color: var(--muted); font-size: 0.68rem; line-height: 1.35; }
.catalog-emblem { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border: 1px solid rgba(214, 174, 88, 0.36); border-radius: 10px; color: var(--gold-bright); }

.patch-list,
.option-list { display: grid; margin-top: 20px; gap: 10px; }
.patch-list article,
.option-list label { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.035); }
.patch-list p { margin: 6px 0 0; color: var(--muted); line-height: 1.5; }
#patch-dialog .dialog-card { max-height:calc(100dvh - 48px); display:flex; flex-direction:column; overflow:hidden; }
#patch-dialog .deck-detail-heading { flex-shrink:0; }
#patch-dialog .patch-list { min-height:0; overflow-y:auto; overscroll-behavior:contain; touch-action:pan-y; cursor:grab; }
#patch-dialog .patch-list.dragging { cursor:grabbing; user-select:none; }
.pvp-clocks { display:flex; gap:10px; margin:8px 0; font-variant-numeric:tabular-nums; }
.pvp-clocks[hidden] { display:none; }
.pvp-clocks span { flex:1; padding:9px; border:1px solid var(--line); border-radius:9px; text-align:center; }
.pvp-clocks b { font-size:1.1rem; margin-left:6px; }
.pvp-clocks .clock-active { border-color:var(--gold-bright); background:#342d1c; }
.pvp-clocks .clock-low b { color:#ff7676; }
.option-list label { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.option-list label span, .option-list label strong, .option-list label small { display: block; }
.option-list label small { margin-top: 4px; color: var(--muted); }
.option-list input { width: 24px; height: 24px; accent-color: var(--gold); }

fieldset {
  margin: 24px 0 0;
  padding: 0;
  border: 0;
}

.setup-card {
  display: flex;
  max-height: calc(100vh - 36px);
  max-height: calc(100dvh - 36px);
  flex-direction: column;
  overflow: hidden;
}

/* Desktop only: six complete compact deck cards per side at normal PC heights. */
@media (min-width: 721px) {
  #setup-dialog .setup-card { width:min(1500px,100%); height:calc(100dvh - 36px); padding:18px 22px; }
  #setup-dialog .setup-deck-grid { gap:16px; }
  #setup-dialog fieldset { margin-top:10px; overflow:hidden; }
  #setup-dialog .deck-options { min-height:0; max-height:none; grid-template-columns:repeat(3,minmax(0,1fr)); grid-auto-rows:195px; align-content:start; gap:9px; }
  #setup-dialog .deck-option { min-height:0; }
  #setup-dialog .deck-option label { min-height:0; padding-bottom:6px; }
  #setup-dialog .deck-portrait { height:62px; }
  #setup-dialog .deck-option-copy { padding:6px 8px 0; }
  #setup-dialog .deck-name-row { display:flex!important; flex-wrap:wrap; min-height:0; gap:3px 5px; }
  #setup-dialog .deck-name-row strong { flex:1 0 100%; min-width:0; min-height:0; margin:0; font-size:.78rem; line-height:1.3; word-break:keep-all; overflow-wrap:anywhere; }
  #setup-dialog .deck-option-copy > span:not(.deck-name-row) { min-height:0; margin-top:4px; font-size:.68rem; line-height:1.35; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
  #setup-dialog .deck-view-button { margin-top:4px; padding:5px 6px; }
  #setup-dialog .deck-lock-footer { margin:3px 0 0; }
  #setup-dialog .primary-button { margin-top:10px; padding:11px 14px; }
  #setup-dialog .desktop-rule-note { margin:6px 0 0; font-size:.7rem; line-height:1.3; }
  #setup-dialog .dialog-intro { margin:6px 0 0; }
  #setup-dialog .random-deck-button { margin-bottom:5px; padding:4px 8px; }
}

.setup-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.story-mode-status {
  margin: 8px 0 0;
  color: #d9c7f1;
  font-size: 0.75rem;
  line-height: 1.45;
}

.mobile-rule-details { display: none; }

.tutorial-coach {
  position: fixed;
  z-index: 35;
  right: 18px;
  bottom: 18px;
  display: flex;
  width: min(430px, calc(100vw - 36px));
  padding: 14px;
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(242, 207, 120, 0.55);
  border-radius: 15px;
  background: rgba(16, 20, 26, 0.97);
  box-shadow: var(--shadow);
}

.tutorial-coach[hidden] { display: none; }
.tutorial-coach > div { min-width: 0; flex: 1; }
.tutorial-coach strong { color: var(--gold-bright); }
.tutorial-coach p { margin: 5px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.45; }
.tutorial-coach button { flex: 0 0 auto; }

.setup-deck-grid {
  display: grid;
  flex: 1;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.setup-deck-grid fieldset {
  position: relative;
  display: flex;
  min-height: 0;
  flex-direction: column;
}

legend {
  margin-bottom: 10px;
  font-size: 0.85rem;
  font-weight: 900;
}

.deck-options {
  display: grid;
  flex: 1;
  max-height: min(50vh, 510px);
  padding: 2px 7px 8px 2px;
  overflow-y: auto;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 10px;
  scrollbar-color: rgba(214, 174, 88, 0.48) rgba(255, 255, 255, 0.04);
}

.deck-option {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.random-deck-button {
  position: static;
  align-self: flex-end;
  margin: 0 7px 8px 0;
  padding: 6px 9px;
  border: 1px solid rgba(214, 174, 88, 0.34);
  border-radius: 999px;
  color: var(--gold-bright);
  background: rgba(214, 174, 88, 0.08);
  font-size: 0.7rem;
  font-weight: 850;
  cursor: pointer;
}

.random-deck-button:hover {
  border-color: rgba(242, 207, 120, 0.72);
  background: rgba(214, 174, 88, 0.16);
}

.deck-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.deck-option label {
  display: flex;
  min-height: 198px;
  padding: 0 0 12px;
  flex-direction: column;
  flex: 1;
  align-items: stretch;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.deck-portrait {
  display: block;
  position: relative;
  width: 100%;
  height: 112px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid rgba(214, 174, 88, 0.32);
  border-radius: 12px 12px 0 0;
  background: linear-gradient(145deg, rgba(214, 174, 88, 0.12), rgba(8, 11, 15, 0.88));
}

.deck-portrait-placeholder,
.deck-portrait-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.deck-portrait-placeholder {
  display: grid !important;
  place-items: center;
  color: var(--gold-bright) !important;
  font-size: 1.45rem !important;
}

.deck-portrait-image {
  object-fit: cover;
  object-position: center 30%;
  opacity: 0;
}

.deck-portrait-image.is-loaded { opacity: 1; }

/* UPDATE 69.1: frame each face independently in the wide deck-selection crop. */
.deck-option label[for$="-chieftain"] .deck-portrait-image { object-position: 50% 0%; }
.deck-option label[for$="-titan"] .deck-portrait-image { object-position: 50% 0%; }
.deck-option label[for$="-ninja"] .deck-portrait-image { object-position: 72% 8%; }
.deck-option label[for$="-noble"] .deck-portrait-image { object-position: 70% 0%; }
.deck-option label[for$="-inquisitor"] .deck-portrait-image { object-position: 50% 4%; }
.deck-option label[for$="-sheriff"] .deck-portrait-image { object-position: 50% 0%; }

.deck-portrait-image.is-broken {
  display: none;
}

.deck-option-copy {
  width: 100%;
  min-width: 0;
  padding: 11px 12px 0;
}

.deck-name-row {
  display: flex !important;
  min-height: 2.6em;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.deck-name-row strong { min-height: 0; margin-bottom: 0; }

.deck-difficulty {
  flex: 0 0 auto;
  padding: 2px 5px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.58rem !important;
  font-weight: 850;
  line-height: 1.25 !important;
}

.difficulty-easy { color: #8dd8a0 !important; }
.difficulty-normal { color: #9dcce3 !important; }
.difficulty-hard { color: #e9bd78 !important; }
.difficulty-expert { color: #e990a0 !important; }

.deck-option label:hover {
  border-color: rgba(214, 174, 88, 0.48);
  transform: translateY(-2px);
}

.deck-option input:checked + label {
  border-color: var(--gold);
  background: rgba(214, 174, 88, 0.1);
  box-shadow: inset 0 0 0 1px rgba(214, 174, 88, 0.18);
}

.deck-option input:focus-visible + label {
  outline: 3px solid rgba(242, 207, 120, 0.7);
  outline-offset: 3px;
}

.deck-option.is-locked label {
  opacity: 0.52;
  cursor: not-allowed;
  filter: grayscale(0.45);
}

.deck-option.is-locked label:hover { transform: none; border-color: var(--line); }

.deck-option-badges {
  display: flex !important;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
}

.deck-lock-badge {
  padding: 2px 5px;
  border: 1px solid rgba(230, 105, 105, 0.62);
  border-radius: 999px;
  color: #f0a1aa !important;
  font-size: 0.58rem !important;
  font-weight: 850;
  line-height: 1.25 !important;
}

.deck-option strong,
.deck-option span {
  display: block;
}

.deck-view-button {
  width: 100%;
  margin-top: 6px;
  padding: 7px 8px;
  border: 1px solid rgba(169, 139, 212, 0.3);
  border-radius: 9px;
  color: #d9c7f1;
  background: rgba(169, 139, 212, 0.08);
  font-size: 0.72rem;
  font-weight: 800;
}

.deck-view-button:hover {
  border-color: rgba(195, 166, 233, 0.65);
  background: rgba(169, 139, 212, 0.16);
}

.secondary-button {
  padding: 9px 14px;
  border: 1px solid rgba(214, 174, 88, 0.38);
  border-radius: 10px;
  color: var(--gold-bright);
  background: rgba(214, 174, 88, 0.08);
  font-weight: 850;
  cursor: pointer;
}

.secondary-button:hover {
  border-color: rgba(242, 207, 120, 0.72);
  background: rgba(214, 174, 88, 0.15);
}

.deck-detail-card {
  width: min(900px, 100%);
  max-height: calc(100vh - 36px);
  overflow: hidden;
}

.deck-detail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.deck-detail-list {
  display: grid;
  max-height: min(62vh, 620px);
  padding: 4px 8px 4px 2px;
  overflow-y: auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.element-formula-guide {
  grid-column: 1 / -1;
  padding: 15px;
  border: 1px solid rgba(242, 207, 120, 0.3);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(214, 174, 88, 0.08), rgba(169, 139, 212, 0.07));
}

.element-formula-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
}

.element-formula-heading h3 {
  margin: 0;
  font-size: 1rem;
}

.element-formula-heading span {
  color: var(--muted);
  font-size: 0.74rem;
}

.element-formula-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.element-formula-row {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.14);
}

.element-formula-row strong {
  color: var(--gold-bright);
  font-size: 0.78rem;
}

.element-formula-row span {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.deck-card-row {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.deck-card-title,
.deck-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.deck-card-title span,
.deck-card-meta span {
  color: var(--gold-bright);
  font-size: 0.72rem;
  font-weight: 800;
}

.deck-card-meta {
  justify-content: flex-start;
  margin-top: 6px;
}

.deck-card-row p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.deck-option strong {
  margin-bottom: 7px;
  min-height: 2.6em;
  line-height: 1.3;
}

.deck-option span {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.deck-option-copy > span:not(.deck-name-row) {
  min-height: 4.35em;
}

.primary-button {
  width: 100%;
  margin-top: 26px;
  padding: 14px 18px;
}

.rule-note {
  margin: 12px 0 0;
  text-align: center;
  font-size: 0.76rem;
}

.result-card {
  position: relative;
  overflow: hidden;
  width: min(460px, 100%);
  text-align: center;
}

.result-victory .result-card {
  animation: result-victory-pulse 720ms ease-out both;
  box-shadow: 0 0 0 1px rgba(242, 207, 120, 0.5), 0 0 52px rgba(242, 207, 120, 0.24);
}

.result-defeat .result-card {
  animation: result-defeat-shake 520ms ease-out both;
  box-shadow: 0 0 0 1px rgba(230, 105, 105, 0.45), 0 0 46px rgba(230, 105, 105, 0.2);
}

.result-draw .result-card {
  animation: result-victory-pulse 620ms ease-out both;
}

@keyframes result-victory-pulse {
  0% { opacity: 0; transform: translateY(12px) scale(0.88); }
  55% { opacity: 1; transform: translateY(0) scale(1.035); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes result-defeat-shake {
  0% { opacity: 0; transform: translateX(0) scale(0.94); }
  25% { opacity: 1; transform: translateX(-8px) scale(1); }
  50% { transform: translateX(7px); }
  75% { transform: translateX(-3px); }
  100% { opacity: 1; transform: translateX(0); }
}

@media (max-width: 900px) {
  .combat-center {
    grid-template-columns: 1fr;
  }

  .battle-log {
    min-height: 150px;
    border-top: 1px solid var(--line);
    border-left: 0;
    padding-top: 12px;
    padding-left: 0;
  }

  .battle-log ol {
    max-height: 130px;
  }
}

@media (max-width: 720px) {
  .game-shell {
    padding: 8px;
  }

  .topbar {
    min-height: auto;
    padding: 8px 2px 12px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .brand-lockup {
    min-width: 0;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
  }

  h1 {
    font-size: 1.25rem;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .turn-pill,
  .ghost-button {
    min-height: 40px;
  }

  .battle-board {
    grid-template-rows: auto auto auto;
    min-height: auto;
    padding-top: 8px;
  }

  .topbar,
  .enemy-panel,
  .player-summary {
    align-items: flex-start;
  }

  .enemy-panel,
  .player-summary {
    flex-direction: column;
  }

  .resource-row {
    width: 100%;
    padding-bottom: 4px;
    overflow: visible;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .resource {
    min-width: 0;
    padding: 7px;
  }

  .resource.hp { grid-column: 1 / -1; min-width: 0; }
  .resource.energy { min-width: 0; grid-column: span 3; }
  .resource.cards,
  .resource.deck { grid-column: span 2; justify-content: center; }

  .passive-copy {
    white-space: normal;
  }

  .weapon-zone {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
  }

  .versus-mark {
    display: none;
  }

  .weapon-slot {
    min-height: 118px;
    padding: 10px;
  }

  .combat-center {
    padding: 10px;
  }

  .card-hand {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: 0;
    gap: 8px;
    padding: 10px 3px 13px;
  }

  .game-card {
    min-height: 238px;
    padding: 11px;
  }

  .card-art-frame {
    height: 68px;
  }

  .game-dialog {
    padding: 8px;
  }

  .game-dialog[open] {
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
  }

  #setup-dialog[open] {
    display: grid;
    overflow: hidden;
  }

  .dialog-card {
    padding: 18px 12px;
    border-radius: 16px;
  }

  .main-menu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .main-menu-grid button { min-height: 112px; padding: 13px 8px; }
  .catalog-list { grid-template-columns: 1fr; max-height: 70dvh; }

  .setup-card {
    display: flex;
    width: 100%;
    height: calc(100dvh - 16px);
    min-height: 0;
    max-height: calc(100dvh - 16px);
    overflow: hidden;
  }

  .setup-deck-grid {
    display: grid;
    flex: 1;
    min-height: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .setup-deck-grid fieldset {
    display: flex;
    min-height: 0;
    margin-top: 8px;
    overflow: hidden;
  }

  .deck-options {
    height: auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: max-content;
  }

  .setup-card > .primary-button {
    position: static;
    z-index: auto;
    min-height: 52px;
    margin-top: 8px;
    flex: none;
  }

  .desktop-rule-note { display: none; }

  .mobile-rule-details {
    display: block;
    flex: 0 0 auto;
    margin-top: 5px;
    padding-bottom: max(2px, env(safe-area-inset-bottom));
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1.4;
  }

  .mobile-rule-details summary {
    color: var(--gold-bright);
    text-align: center;
    cursor: pointer;
  }

  .mobile-rule-details p {
    max-height: 78px;
    margin: 5px 0 0;
    overflow-y: auto;
  }

  .story-mode-status {
    margin-top: 5px;
    font-size: 0.66rem;
  }

  .setup-card > .dialog-intro {
    margin: 5px 0 0;
    font-size: 0.72rem;
  }

  .deck-option label { min-height: 164px; padding: 0 0 8px; }

  .deck-portrait { height: 76px; }

  .deck-option-copy {
    padding: 9px 9px 0;
  }

  .deck-option strong {
    min-height: 2.5em;
    font-size: 0.86rem;
  }

  .deck-option-copy > span:not(.deck-name-row) {
    min-height: 3.9em;
    font-size: 0.66rem;
  }

  .deck-name-row { min-height: 2.5em; }
  .deck-name-row strong { min-height: 0; }
  .tutorial-coach { right: 8px; bottom: 8px; width: calc(100vw - 16px); }

  .random-deck-button,
  .deck-view-button {
    min-height: 40px;
  }

  .log-card-preview {
    width: min(176px, calc(100vw - 24px));
    min-height: 250px;
  }

  .deck-detail-list { grid-template-columns: 1fr; }

  .element-formula-grid { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
  .card-hand {
    gap: 7px;
  }

  .game-card {
    min-height: 224px;
    padding: 10px;
  }

  .deck-options {
    gap: 7px;
  }

  .deck-option label {
    min-height: 154px;
  }

  .deck-portrait {
    height: 68px;
  }

  .fighter-panel {
    padding: 13px 12px;
  }
}

@media (max-width: 480px) {
  .setup-card,
  .setup-deck-grid,
  .setup-deck-grid fieldset,
  .deck-options {
    width: 100%;
    min-width: 0;
  }

  .deck-options {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .player-hit-effect.is-active {
    animation: none !important;
    opacity: 0.38;
  }
}

.player-hit-effect {
  position: fixed;
  inset: 0;
  z-index: 500;
  pointer-events: none;
  opacity: 0;
  border: clamp(8px, 1.8vw, 24px) solid rgba(238, 45, 52, 0.9);
  background: rgba(180, 12, 20, 0.18);
  box-shadow: inset 0 0 clamp(45px, 12vw, 150px) rgba(255, 20, 32, 0.72);
}

.player-hit-effect.is-active {
  animation: player-hit-flash 560ms ease-out both;
}

@keyframes player-hit-flash {
  0% { opacity: 0; }
  16% { opacity: 0.82; }
  52% { opacity: 0.46; }
  100% { opacity: 0; }
}

.game-card.selecting-return {
  outline: 3px solid rgba(88, 230, 166, 0.82);
  outline-offset: -3px;
  cursor: pointer;
}

.game-card.selecting-mix {
  outline: 3px solid rgba(109, 221, 191, 0.9);
  box-shadow: 0 0 0 4px rgba(109, 221, 191, 0.12);
}

.game-card.foreign-card {
  border-color: rgba(179, 124, 234, 0.72);
  box-shadow: inset 0 0 0 1px rgba(179, 124, 234, 0.22);
}

.game-card.selecting-discard {
  outline: 3px solid rgba(230, 105, 105, 0.9);
  outline-offset: -3px;
  cursor: pointer;
}

.game-card.selecting-return:hover {
  transform: translateY(-8px);
  box-shadow: 0 14px 34px rgba(44, 214, 144, 0.24);
}

.choice-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  background: rgba(4, 8, 13, 0.72);
  backdrop-filter: blur(5px);
}

.choice-overlay[hidden] { display: none; }

.dual-weapon-holder > :not(.dual-weapons) { display:none !important; }
.dual-weapon-holder { padding:8px; }
.dual-weapons { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; width:100%; }
.dual-weapons[hidden] { display:none; }
.dual-weapon-slot { display:flex; flex-direction:column; gap:7px; position:relative; overflow:hidden; min-width:0; padding:10px; border:1px solid var(--line); border-radius:12px; text-align:left; }
.dual-weapon-slot > :not(.dual-weapon-art) { position:relative; z-index:1; }
.dual-weapon-slot strong { font-size:1rem; overflow-wrap:anywhere; }
.dual-weapon-slot small { font-size:.75rem; }
.dual-weapon-rules { font-size:.875rem; line-height:1.45; overflow-wrap:anywhere; }
.dual-weapon-art { position:absolute; inset:0; opacity:.2; pointer-events:none; }
.dual-weapon-art .card-art-frame { width:100%; height:100%; margin:0; }
.dual-weapon-slot .weapon-action { margin-top:auto; width:100%; min-height:40px; white-space:normal; }
@media(max-width:620px){.dual-weapons{grid-template-columns:minmax(0,1fr);gap:6px}.dual-weapon-slot{padding:8px;gap:4px}.dual-weapon-rules{font-size:.8125rem}}

.choice-panel {
  width: min(620px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px;
  border: 1px solid rgba(235, 194, 94, 0.52);
  border-radius: 22px;
  background: linear-gradient(145deg, #151c24, #0c1118);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.58);
  text-align: center;
}

.choice-panel h2 { margin: 4px 0 18px; }
.paladin88 { display:flex; flex-wrap:wrap; gap:8px 16px; padding:10px 12px; margin-top:10px; border:1px solid #baa06b70; border-radius:10px; background:#eacb7e0a; }
.paladin88 strong { color:#f3d792; }
.paladin88 small { flex-basis:100%; line-height:1.5; color:var(--muted); overflow-wrap:anywhere; }
.choice-options.is-oath88 { gap:6px; grid-template-columns:repeat(3,minmax(0,1fr)); }
.choice-options.is-oath88 .choice-card { min-width:0; min-height:116px; padding:10px 6px; gap:6px; border-radius:10px; }
.choice-options.is-oath88 .choice-icon { display:none; }
.choice-options.is-oath88 .choice-card strong { font-size:.95rem; }
.choice-options.is-oath88 .choice-card span { font-size:.8rem; line-height:1.4; overflow-wrap:anywhere; }
.choice-options.is-oath88 .choice-card:hover { transform:translateY(-2px); }

.choice-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

/* Card illustrations retain the existing layout; missing art keeps its emblem. */
.deck-card-title { display:grid; grid-template-columns:minmax(0,1fr) minmax(80px,150px) auto; position:relative; }
.deck-art-expand summary { cursor:zoom-in; list-style:none; }
.deck-art-expand summary::-webkit-details-marker { display:none; }
.deck-art-expand .card-art-frame { width:100%; height:auto; aspect-ratio:3/1; margin:0; }
.deck-expanded-art { display:none; }
.deck-art-expand[open] .deck-expanded-art { display:block; position:absolute; z-index:4; top:100%; left:0; right:0; padding:8px; border:1px solid var(--gold); border-radius:10px; background:#10171c; box-shadow:0 10px 28px #0009; }
.contract-reward { margin-top:10px; border-top:1px solid var(--line); padding-top:8px; }
.contract-reward summary { cursor:pointer; color:var(--gold-bright); font-size:.85rem; }
.reward-preview { display:grid; gap:6px; padding:12px; margin-top:8px; background:#10171c; border-radius:10px; }
.reward-preview .card-art-frame { height:auto; aspect-ratio:3/1; }
.reward-preview > span { color:var(--gold-bright); font-size:.8rem; }
.class-emblem { width:64px; height:72px; overflow:hidden; }
.class-emblem .deck-portrait { width:100%; height:100%; min-height:0; aspect-ratio:auto; margin:0; border:0; border-radius:inherit; }
.weapon-slot { position:relative; isolation:isolate; overflow:hidden; }
.weapon-slot > :not(.weapon-art) { position:relative; z-index:1; }
.weapon-art { position:absolute; inset:0; z-index:0; pointer-events:none; }
.weapon-art .card-art-frame { width:100%; height:100%; margin:0; border:0; border-radius:inherit; background:transparent; }
.weapon-art .card-art-placeholder { display:none; }
.weapon-art .card-art-image.is-loaded { opacity:.25; object-fit:cover; }
.combat-center { position:relative; }
.played-card-visual { position:absolute; z-index:8; width:200px; max-width:55%; top:10px; left:12px; padding:10px; background:rgba(15,22,28,.97); border:1px solid var(--gold); border-radius:12px; box-shadow:0 8px 28px #0007; pointer-events:none; }
.played-card-visual[hidden] { display:none; }
.played-card-visual small { display:block; color:var(--gold-bright); font-size:.72rem; }
.played-card-visual .card-art-frame { height:auto; aspect-ratio:3/1; margin:7px 0; }
.played-card-visual strong { display:block; font-size:.9rem; }
.played-card-visual p { margin:5px 0 0; font-size:.76rem; line-height:1.4; max-height:5.6em; overflow:hidden; }
.choice-card .card-art-frame { width:100%; height:auto; aspect-ratio:3/1; margin:0; flex-shrink:0; }
@media(max-width:600px){
  .deck-card-title { grid-template-columns:minmax(0,1fr) 90px auto; gap:7px; }
  .class-emblem { width:48px; height:58px; }
  .played-card-visual { width:165px; padding:8px; top:4px; left:4px; }
}

.choice-card {
  min-height: 230px;
  padding: 18px;
  border: 1px solid rgba(235, 194, 94, 0.38);
  border-radius: 18px;
  color: #f7f0dc;
  background: linear-gradient(165deg, rgba(51, 62, 74, 0.98), rgba(22, 28, 36, 0.98));
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.choice-card:hover,
.choice-card:focus-visible {
  transform: translateY(-6px);
  border-color: #ebc25e;
  box-shadow: 0 15px 32px rgba(235, 194, 94, 0.18);
}

.menu-footer { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 18px; margin-top: 24px; border-top: 1px solid #3d4650; padding-top: 16px; }
.menu-footer a, .transfer-card a { color: #dfbf79; font-size: .85rem; }
.catalog-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.catalog-tabs [aria-pressed="true"] { border-color: #dfbf79; color: #dfbf79; }
#rules-catalog { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
#rules-catalog .rules-section891 { min-width: 0; }
#rules-catalog .rules-section891 > h2 { margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid #526070; font-size: 1.12rem; }
#rules-catalog .rules-grid891 { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); }
#rules-catalog[hidden], #catalog-list[hidden] { display: none; }
#rules-catalog article { padding: 14px; background: #192129; border: 1px solid #39434c; border-radius: 12px; }
#rules-catalog h3 { margin: 0 0 8px; color: #dfbf79; }
#rules-catalog p { margin: 0; line-height: 1.6; }
.transfer-card { max-width: 680px; margin: 30px auto; line-height: 1.7; }
.save-import { display: block; margin: 24px 0; }
.save-import input { display: block; max-width: 100%; margin-top: 10px; }
@media (max-width: 700px) {
  .combat-center { gap: 6px; }
  .weapon-zone { grid-template-columns: 1fr 1fr; gap: 6px; }
  .weapon-zone .versus-mark { display: none; }
  .weapon-slot { min-height: 0; padding: 7px 9px; gap: 3px; }
  .weapon-slot strong { font-size: .82rem; }
  .weapon-slot small, .weapon-slot .slot-label { font-size: .65rem; line-height: 1.3; }
  .weapon-action { min-height: 30px; padding: 5px 8px; margin-top: 3px; }
  .battle-log { min-height: 0; height: auto; padding: 6px 9px; }
  .log-heading { margin-bottom: 3px; font-size: .68rem; }
  #log-list { height: 68px; min-height: 0; max-height: 68px; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; font-size: .69rem; }
  #log-list li { margin-bottom: 3px; line-height: 1.4; }
  .transfer-card { margin: 12px; }
}
.pvp-seats { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin:20px 0; }
.battle-board > *, .fighter-identity, .fighter-identity > div { min-width:0; }
.passive-copy { white-space:pre-line; overflow-wrap:anywhere; }
#rules-catalog p, .element-formula-guide > p { white-space:pre-line; }
@media (max-width: 1050px) {
  .enemy-panel, .player-summary { flex-wrap:wrap; gap:12px; }
  .resource-row { max-width:100%; }
  .card-hand { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media (max-width: 720px) {
  .card-hand { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .weapon-zone { min-height:0; }
  .pvp-seats { gap:10px; }
  .pvp-seats > * { min-width:0; }
}
.pvp-seats strong,.pvp-seats small,.pvp-seats select { display:block; margin-top:10px; }
.pvp-seats select,.pvp-join input { width:100%; background:#15212b; color:#f1e7cc; border:1px solid #56616b; border-radius:8px; padding:12px; font:inherit; }
.pvp-join { display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin:20px 0; }
.pvp-join input { flex:1; min-width:120px; text-transform:uppercase; }
.pvp-connection { padding:8px 12px; border:1px solid #56616b; background:#172632; font-size:.85rem; }
.pvp-connection[hidden] { display:none; }
#pvp-code { font-size:1.6rem; letter-spacing:.12em; color:#e8bf65; }
.garden-zone { margin-top:12px; min-width:0; }
.garden-zone[hidden] { display:none; }
.garden-slots { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.garden-slot { display:flex; flex-direction:column; gap:5px; padding:10px; border:1px solid #426d4f; border-radius:10px; background:#15241c; min-width:0; overflow-wrap:anywhere; }
.garden-slot strong { color:#c5e2b7; font-size:14px; }
.garden-slot small { color:#d6dfd7; font-size:12px; line-height:1.5; }
.garden-slot meter { width:100%; height:8px; accent-color:#7fbe77; }
.garden-slot.empty { background:transparent; color:#8e9b92; border-style:dashed; font-size:12px; justify-content:center; text-align:center; }
.botanist-crop-guide { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.botanist-crop-guide section { min-width:0; }
.botanist-crop-guide p { font-size:14px; line-height:1.6; }
@media(max-width:620px) { .garden-slot { padding:7px 5px; } .garden-slots { gap:5px; } .botanist-crop-guide { grid-template-columns:1fr; } }
.ad-placement { margin:150px 0 0; padding:24px 0 0; border-top:1px solid #39434c; text-align:center; width:100%; min-width:0; flex:none; }
.ad-placement .adsbygoogle { width:100%; min-height:90px; }
.ad-placement[hidden] { display:none; }
.ad-placement>small { display:block; margin-bottom:12px; color:#a1aab2; }
.ad-consent { margin:20px 0; padding:16px; border:1px solid #39434c; border-radius:10px; }
.ad-consent button { margin:8px; }
.choice-card .choice-icon { font-size: 3.2rem; }
.choice-card strong { font-size: 1.15rem; }
.choice-card span { color: #c9d3df; line-height: 1.55; }

@media (max-width: 560px) {
  .choice-overlay { padding: 12px; }
  .choice-panel { padding: 18px 12px; }
  .choice-options { gap: 9px; }
  .choice-card { min-height: 190px; padding: 13px 10px; }
  .choice-card .choice-icon { font-size: 2.5rem; }
  .choice-card strong { font-size: 0.98rem; }
  .choice-card span { font-size: 0.78rem; }
}
:root .story-ending-visual .card-art-frame { width:100%; height:auto; aspect-ratio:1; }
:root .story-ending-visual .card-art-image { object-fit:contain; }
#rules-catalog { min-height:0; max-height:65dvh; overflow-y:auto; overscroll-behavior:contain; touch-action:pan-y; cursor:grab; }
#rules-catalog.dragging { cursor:grabbing; user-select:none; }
.deck-option label .deck-lock-footer { display:block; align-self:stretch; flex:none; margin:10px 0 0; text-align:center; }
.deck-option.is-locked .deck-name-row strong { min-width:0; word-break:keep-all; overflow-wrap:anywhere; }
#setup-dialog .ad-placement { margin:18px 0 0; padding:10px 0 0; flex:0 0 auto; }
#setup-dialog .ad-placement .adsbygoogle { height:50px; min-height:50px; }
#setup-dialog .ad-placement>small { margin-bottom:6px; }
.patch-list h3 { margin:0 0 14px; color:var(--gold-bright); font-size:1.15rem; }
.patch-list ol { margin:0; padding-left:24px; }
.patch-list li { margin:0 0 14px; line-height:1.7; color:var(--muted); }
.patch-list li b { color:var(--ink); }
#catalog-dialog .utility-card { display:flex; flex-direction:column; }
#catalog-dialog .deck-detail-heading, #catalog-dialog .catalog-tabs { flex-shrink:0; }
#catalog-dialog #rules-catalog { flex:1 1 auto; }
.resource-row button.resource { cursor:pointer; font:inherit; color:inherit; }
.resource-row button.resource:hover { border-color:var(--gold); }
@media(min-width:721px) {
  .fighter-panel .resource-row { flex:0 0 auto; }
  .fighter-panel .resource-row .resource:not(.hp) { white-space:nowrap; }
  .enemy-panel .fighter-identity, .player-summary .fighter-identity { flex:1 1 0; }
}
.log-turn-divider { color:var(--gold-bright); border-bottom:1px solid #665332; padding:8px 0; font-weight:700; position:sticky; top:0; background:#11171b; }
#archaeologist-arrange[hidden] { display:none; }
.math-zone62 { border:1px solid #8171ac; border-radius:10px; padding:10px; margin:8px 0; display:grid; gap:4px; min-width:0; overflow-wrap:anywhere; background:#191727; }
.math-zone62[hidden], #math-calculate62[hidden] { display:none; }
.math-zone62 strong { font-size:1.1rem; color:#dfd3ff; }
.math-zone62 small { color:#b5a6cf; }
.math-zone62 b { color:var(--gold-bright); }
@media (min-width:721px) and (max-width:1050px) {
  .enemy-panel, .player-summary { flex-wrap:wrap; }
  .enemy-panel .fighter-identity, .player-summary .fighter-identity { flex:1 0 100%; }
  .fighter-panel .resource-row { flex:1 1 100%; flex-wrap:wrap; }
}
#math-calculate62 { margin-left:auto; margin-right:8px; white-space:nowrap; }
#archaeologist-arrange { margin-left:auto; margin-right:8px; white-space:nowrap; }
.status-row .tooltip-target::after { left:0; transform:translateY(5px); }
.status-row .tooltip-target:hover::after, .status-row .tooltip-target:focus-visible::after { transform:translateY(0); }
@media(min-width:721px) { .enemy-panel .status-row .tooltip-target::after { left:auto; right:0; } }
#pile-dialog57 { width:min(920px,94vw); max-height:90dvh; padding:0; border:1px solid #47515a; border-radius:16px; background:#11171b; color:var(--ink); }
.pile-panel57 { padding:20px; }
.pile-cards57 { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:12px; max-height:65dvh; overflow:auto; overscroll-behavior:contain; touch-action:pan-y; }
.pile-cards57 article { min-width:0; padding:12px; border:1px solid #424b53; border-radius:10px; background:#192127; }
.pile-cards57 h3 { font-size:15px; margin:8px 0; }
.pile-cards57 p { font-size:13px; line-height:1.6; white-space:pre-line; }
.pile-cards57 .card-art-frame { width:100%; }
@media(max-width:620px) {
  .fighter-panel .resource-row { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:5px; width:100%; }
  .fighter-panel .resource-row .hp { grid-column:1/-1; width:100%; }
  .fighter-panel .resource-row .resource:not(.hp) { grid-column:auto; grid-row:auto; min-width:0; width:auto; padding:7px 3px; gap:3px; }
  .fighter-panel .resource-row .resource small { font-size:10px; white-space:nowrap; }
  .fighter-panel .resource-row .resource b { font-size:17px; }
  .fighter-panel .resource-row .resource-icon { display:none; }
  .fighter-panel .resource-row .energy-orbs { gap:2px; flex-wrap:wrap; }
  .pile-panel57 { padding:12px; }
  .pile-cards57 { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

/* UPDATE65: readable calculation rewards and read-only choice inspection. */
.math-rewards65{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:10px}
.math-rewards65 section{padding:12px;border:1px solid #46515b;border-radius:10px;background:#171e24}
.math-rules65{display:grid;gap:10px;margin-top:14px}
.math-rules65 section{padding:12px;border:1px solid #46515b;border-radius:10px}
.math-rewards65 h4,.math-rules65 h4{margin:0 0 6px}
#deck-detail-close{flex-shrink:0;white-space:nowrap}
.choice-inspect65{display:block;margin:14px auto 0;font-size:12px;min-height:32px}
.choice-inspect65[hidden]{display:none}
#choice-situation65{width:min(1250px,96vw);max-height:94dvh;overflow:auto;background:#11171b;color:var(--ink);padding:16px}
.situation-panel65>button{position:sticky;top:0;z-index:2}
#situation-content65>section{margin:12px 0;padding:12px;border:1px solid #46515b;border-radius:12px}
#situation-content65 .enemy-panel{display:block}
#situation-content65 .resource-row{flex-wrap:wrap}
#situation-content65 button{pointer-events:none}
#situation-content65 .card-hand{display:grid;grid-template-columns:repeat(auto-fit,minmax(145px,1fr))}
/* Separate evidence items, never hand cards. Full-width to avoid squeezing fighter headings. */
.evidence67 { width:100%; min-width:0; flex:0 0 100%; grid-column:1 / -1; padding:10px; border:1px solid #655335; border-radius:8px; box-sizing:border-box; }
.evidence67[hidden] { display:none; }
.evidence67 header { display:flex; justify-content:space-between; flex-wrap:wrap; gap:6px; font-size:12px; margin-bottom:6px; }
.evidence-items67 { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; }
.evidence-items67 section { padding:8px; min-width:0; border:1px solid #504832; border-radius:6px; background:rgba(35,29,22,.7); }
.evidence-items67 strong, .evidence-items67 small { display:block; overflow-wrap:anywhere; }
.evidence-items67 strong { font-size:12px; color:#f1ce86; }
.evidence-items67 small { font-size:11px; margin-top:4px; }
/* UPDATE73: compact, inspectable stomach slots on both desktop and mobile. */
.ghoul-stomach73 { width:100%; min-width:0; border:1px solid #676044; border-radius:10px; padding:8px; background:#171c18; }
.ghoul-stomach73 summary { cursor:pointer; color:#d6db9b; font-size:12px; }
.ghoul-slots73 { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; margin-top:8px; }
.ghoul-slots73 article { min-width:0; padding:7px; border:1px solid #444c3b; border-radius:8px; overflow-wrap:anywhere; }
.ghoul-slots73 article strong,.ghoul-slots73 article small { display:block; }
.ghoul-slots73 article strong { font-size:12px; }
.ghoul-slots73 article small,.ghoul-slots73 article p { font-size:11px; line-height:1.4; white-space:pre-line; }
.ghoul-slots73 .card-art { height:56px; }
.ghoul-slots73 .empty { display:grid; place-items:center; color:#929b89; min-height:70px; }
/* PATCH 0.76: shared market and in-hand selections. */
.shop76{border:1px solid #74603e;border-radius:12px;padding:12px;margin:10px 0;background:#171c22;color:#eee}
.shop76[hidden]{display:none}
.shop76 header{display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap}
.shop76 details{font-size:12px;margin:8px 0}
.shop-products76{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;max-height:230px;overflow:auto}
.shop-products76 button,.shop-empty76{display:flex;flex-direction:column;gap:6px;text-align:left;min-width:0;padding:10px;border:1px solid #8b754d;border-radius:8px;background:#252b33;color:#f6ead3;white-space:normal;overflow-wrap:anywhere}
.shop-products76 button span{font-size:12px;line-height:1.45;flex:1}
.shop-products76 button:disabled{opacity:.65;cursor:default}
.shop-products76 button b{color:#efc973}
.inline-choice76{grid-column:1/-1;flex-basis:100%;padding:10px;border:1px solid #efc973;border-radius:8px;display:flex;align-items:center;gap:12px;flex-wrap:wrap;background:#3a3326;color:#fff}
.chef-board79{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr));gap:8px;margin:8px 0;grid-column:1/-1;min-width:0}
.chef-board79[hidden]{display:none}
.astro-board82{grid-column:1/-1;min-width:0;width:100%;margin:8px 0;padding:10px;border:1px solid #6c6995;border-radius:10px;background:#141b30;color:#e4e5ff;box-sizing:border-box}
.astro-board82[hidden]{display:none}.astro-board82 header{display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap;font-size:13px}.astro-row82{display:flex;gap:6px;align-items:center;margin-top:6px;min-width:0}.astro-row82>strong{font-size:11px;flex:0 0 48px}.astro-track82{display:flex;gap:4px;flex:1;min-width:0}.astro-star82{flex:1;min-width:0;border:1px solid #393e60;border-radius:6px;padding:5px 2px;text-align:center;font-size:12px;display:flex;flex-direction:column;gap:2px}.astro-star82.current{background:#373654;border-color:#e4c57b}.astro-star82 small{font-size:9px;color:#aeb5cc}.astro-star82 em{font-size:9px;font-style:normal;color:#f4d58c}.astro-board82 details{font-size:11px;max-height:160px;overflow:auto;margin-top:8px}.astro-board82 summary{cursor:pointer;padding:5px}.astro-board82 p{margin:5px 0;overflow-wrap:anywhere}
@media(max-width:480px){.astro-board82{padding:6px}.astro-row82>strong{flex-basis:34px;font-size:10px}.astro-track82{gap:2px}.astro-star82{font-size:11px}.astro-star82 small{font-size:8px}}
.chef-board79 article{background:#272522;border:1px solid #8e774e;border-radius:10px;padding:10px;min-width:0;overflow-wrap:anywhere;font-size:12px}
.chef-board79 header{display:flex;flex-wrap:wrap;gap:8px;justify-content:space-between;color:#f4d39c}
.chef-board79 p{margin:5px 0;line-height:1.5}.chef-guide79 details{margin:8px 0}.chef-guide79 summary{cursor:pointer;padding:8px;color:#f4d39c}
@media(max-width:640px){.shop-products76{grid-template-columns:repeat(2,minmax(0,1fr));max-height:195px}.shop76{padding:8px}.shop76 header{font-size:12px}.shop-products76 button{padding:8px}}
/* PATCH 0.90: a compact mansion board; never participates in effect sizing. */
#mansion90 { border:1px solid #b59b61; border-radius:10px; padding:10px; margin:8px 0; font-size:12px; }
#mansion90[hidden] { display:none; }
#mansion90 p { margin:6px 0; }
#mansion90 button { margin:4px; padding:9px 12px; }
.mansion-map90 { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); grid-template-areas:'study living dining kitchen' '. hall bedroom .'; gap:5px; margin-top:8px; }
.room90:nth-child(1){grid-area:living}.room90:nth-child(2){grid-area:study}.room90:nth-child(3){grid-area:dining}.room90:nth-child(4){grid-area:kitchen}.room90:nth-child(5){grid-area:hall}.room90:nth-child(6){grid-area:bedroom}
.room90 { border:1px solid #566473; padding:7px; border-radius:6px; text-align:center; }
.room90 small { display:block; opacity:.8; }
.room90.here90 { border-color:#ecd081; background:#584b28; }
.mechanic098 { display:flex; flex-wrap:wrap; align-items:center; gap:10px; padding:12px; border:1px solid #657888; border-radius:10px; background:#101e29; }
.mechanic098[hidden] { display:none; }
.mechanic098 span { font-size:12px; }
.mechanic098 button { min-height:44px; }
