: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;
}

* {
  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(160px, 1.7fr) repeat(4, 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 {
  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 {
  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-reverse;
  list-style: none;
}

.battle-log li {
  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 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.72rem;
  font-weight: 600;
  line-height: 1.45;
  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 {
  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 {
  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; }
.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;
}

.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 {
  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;
  opacity: 0;
}

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

.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; }

.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; }

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

.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: 10px; grid-template-columns: repeat(auto-fit, minmax(230px, 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:normal; overflow-wrap:anywhere; }
@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; }
.ad-placement { margin:40px 0 0; padding:24px 0 0; border-top:1px solid #39434c; text-align:center; }
.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; }
}
