:root {
  color-scheme: dark;
  --bg: #111318;
  --panel: #1b2028;
  --panel-2: #242b36;
  --line: #344052;
  --text: #f6f2e9;
  --muted: #aab2bf;
  --gold: #f6c85f;
  --red: #ff5f57;
  --blue: #58a6ff;
  --green: #73d88a;
  --wind: #b7f06a;
  --earth: #c89c65;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  height: 100vh;
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 95, 87, 0.16), transparent 30%),
    radial-gradient(circle at 92% 18%, rgba(88, 166, 255, 0.18), transparent 32%),
    linear-gradient(135deg, #10131a 0%, #17171d 48%, #111820 100%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #28303c;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

button,
.title-menu-button {
  text-decoration: none;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--gold);
  background: #303a49;
}

.title-menu-button:hover {
  transform: translateY(-1px);
  border-color: var(--gold);
  background: #303a49;
}

button:disabled,
button.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.app-shell {
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr;
  gap: 0;
  padding: 8px;
  overflow: hidden;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.18rem, 2vw, 1.72rem);
  line-height: 1.05;
}

.console-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-bottom: 7px;
}

.icon-button {
  min-width: 52px;
  height: 30px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.icon-button.is-on {
  border-color: rgba(246, 200, 95, 0.72);
  color: #1a1300;
  background: var(--gold);
}

body.title-active .app-shell {
  opacity: 0.24;
  filter: blur(5px);
  transform: scale(0.985);
  pointer-events: none;
}

.title-screen {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 24px;
  color: var(--text);
  background:
    linear-gradient(115deg, rgba(5, 7, 11, 0.98) 0%, rgba(10, 13, 18, 0.88) 43%, rgba(39, 22, 29, 0.92) 100%),
    #080b10;
  transition:
    opacity 360ms ease,
    visibility 360ms ease;
}

.title-screen::before {
  content: "";
  position: absolute;
  inset: -20%;
  background:
    linear-gradient(90deg, rgba(246, 200, 95, 0.12) 1px, transparent 1px),
    linear-gradient(rgba(88, 166, 255, 0.1) 1px, transparent 1px);
  background-size: 56px 56px;
  transform: rotate(-8deg);
  opacity: 0.34;
}

.title-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(90deg, rgba(4, 5, 8, 0.86) 0%, rgba(4, 5, 8, 0.42) 46%, rgba(4, 5, 8, 0.78) 100%),
    linear-gradient(0deg, rgba(4, 5, 8, 0.88) 0%, transparent 34%, rgba(4, 5, 8, 0.5) 100%);
}

.title-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.title-visuals {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.title-logo-backdrop {
  position: absolute;
  top: 48%;
  left: 50%;
  z-index: 1;
  width: min(1120px, 106vw);
  max-height: min(640px, 78vh);
  object-fit: contain;
  opacity: 0.9;
  filter: drop-shadow(0 34px 46px rgba(0, 0, 0, 0.66)) drop-shadow(0 0 34px rgba(88, 166, 255, 0.18));
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.title-card {
  position: absolute;
  top: var(--title-top, auto);
  right: var(--title-right, auto);
  bottom: var(--title-bottom, auto);
  left: var(--title-left, auto);
  z-index: var(--title-layer, 1);
  width: var(--title-width, clamp(118px, 14vw, 232px));
  border-radius: 8px;
  opacity: var(--title-opacity, 0.62);
  object-fit: cover;
  transform: rotate(var(--title-rotate, 0deg));
  box-shadow: 0 26px 52px rgba(0, 0, 0, 0.55);
  animation: titleCardDrift var(--title-duration, 7200ms) ease-in-out infinite;
  animation-delay: var(--title-delay, 0ms);
}

.title-content {
  position: relative;
  z-index: 3;
  width: min(980px, calc(100vw - 48px));
  padding-top: clamp(220px, 42vh, 390px);
}

.title-kicker {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: clamp(0.8rem, 1.5vw, 1rem);
  font-weight: 900;
}

.title-logo-title {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.title-subtitle {
  width: min(520px, 100%);
  margin: 12px 0 28px;
  color: rgba(246, 242, 233, 0.82);
  font-size: clamp(1rem, 2.4vw, 1.3rem);
  font-weight: 800;
}

.title-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.title-start {
  min-width: 220px;
  min-height: 48px;
  padding: 0 26px;
  border-color: rgba(246, 200, 95, 0.86);
  color: #120d00;
  background: linear-gradient(180deg, #ffe19a, var(--gold));
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.42), 0 0 30px rgba(246, 200, 95, 0.18);
}

.title-menu-button {
  display: inline-grid;
  place-items: center;
  min-width: 170px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid rgba(246, 242, 233, 0.3);
  border-radius: 8px;
  color: var(--text);
  border-color: rgba(246, 242, 233, 0.3);
  background: rgba(31, 37, 47, 0.84);
  font: inherit;
  font-weight: 700;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.34);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.deck-editor,
.gallery-view {
  position: fixed;
  inset: 0;
  z-index: 90;
  padding: 18px;
  color: var(--text);
  background: rgba(5, 7, 11, 0.78);
  backdrop-filter: blur(14px);
}

.deck-editor.hidden,
.gallery-view.hidden {
  display: none;
}

.opening-movie-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(12px);
}

.opening-movie-modal.hidden {
  display: none;
}

.opening-movie-frame {
  width: min(1180px, calc(100vw - 36px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.opening-movie-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--gold);
  font-size: 0.84rem;
  font-weight: 900;
}

.opening-movie-video {
  width: 100%;
  max-height: calc(100vh - 92px);
  border: 1px solid rgba(246, 200, 95, 0.34);
  border-radius: 8px;
  background: #000;
  box-shadow: var(--shadow);
}

.deck-editor-shell,
.gallery-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(246, 200, 95, 0.28);
  border-radius: 8px;
  background: rgba(17, 20, 27, 0.96);
  box-shadow: var(--shadow);
}

.deck-editor-shell {
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

.deck-editor-header,
.deck-editor-actions,
.gallery-header,
.gallery-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.deck-editor-header,
.gallery-header {
  justify-content: space-between;
}

.deck-editor-header h2,
.deck-editor-panel h3,
.gallery-stage-panel h3,
.gallery-library-panel h3,
.gallery-music-panel h3 {
  margin: 0;
}

.deck-editor-panel-head {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.deck-editor-panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.deck-editor-actions,
.gallery-header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.deck-slot-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

.deck-slot-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
}

.deck-slot-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.deck-slot-button {
  width: 38px;
  min-height: 34px;
  padding: 0;
  border-color: rgba(246, 200, 95, 0.34);
  color: var(--text);
  background: rgba(0, 0, 0, 0.22);
  font-weight: 1000;
}

.deck-slot-button.is-active {
  border-color: var(--gold);
  color: #111318;
  background: var(--gold);
}

.deck-slot-button.is-dirty {
  box-shadow: 0 0 0 2px rgba(255, 95, 87, 0.42);
}

.deck-editor-actions button,
.gallery-header-actions button,
.panel-toggle {
  min-height: 34px;
  padding: 0 12px;
}

.panel-toggle {
  min-width: 82px;
  border-color: rgba(246, 200, 95, 0.28);
  font-size: 0.76rem;
}

.panel-toggle.is-on {
  border-color: var(--gold);
  color: #10131a;
  background: var(--gold);
}

.library-sort-button {
  min-width: 82px;
}

.deck-count {
  min-width: 72px;
  padding: 7px 10px;
  border: 1px solid rgba(246, 200, 95, 0.34);
  border-radius: 8px;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.24);
  font-weight: 900;
  text-align: center;
}

.deck-editor-status {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.deck-editor-status.is-ready {
  color: var(--green);
}

.deck-editor-grid {
  --deck-column: minmax(260px, 0.74fr);
  --library-column: minmax(0, 1.26fr);
  --main-panels-row: minmax(0, 1fr);
  --exchange-row: minmax(180px, 0.52fr);
  min-height: 0;
  display: grid;
  grid-template-columns: var(--deck-column) var(--library-column);
  grid-template-rows: var(--main-panels-row) var(--exchange-row);
  gap: 10px;
}

.gallery-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(250px, 0.78fr) minmax(320px, 1.15fr) minmax(230px, 0.72fr);
  gap: 10px;
}

.deck-editor-panel,
.gallery-stage-panel,
.gallery-library-panel,
.gallery-music-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(31, 37, 47, 0.72);
}

.deck-editor-panel.is-collapsed {
  min-height: auto;
  grid-template-rows: auto;
  align-self: start;
  align-content: start;
}

.deck-editor-panel.is-collapsed .deck-list,
.deck-editor-panel.is-collapsed .card-library,
.deck-editor-panel.is-collapsed .exchange-summary,
.deck-editor-panel.is-collapsed .deck-exchange-list {
  display: none;
}

#libraryPanel.is-collapsed #ownedOnlyLibraryBtn,
#libraryPanel.is-collapsed #librarySortBtn {
  display: none;
}

.gallery-music-panel {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.deck-list,
.card-library,
.deck-exchange-list {
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.deck-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px;
}

.exchange-panel {
  grid-column: 1 / -1;
  grid-template-rows: auto auto minmax(0, 1fr);
}

@media (min-width: 761px) {
  .card-library {
    align-content: start;
  }

  .card-library .deck-edit-card {
    min-height: 190px;
  }

  .card-library .deck-edit-card-inner {
    min-height: 188px;
    grid-template-rows: auto auto auto auto;
  }

  .card-library .deck-card-skill span {
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
  }

  .deck-editor-grid.is-deck-collapsed {
    --deck-column: fit-content(152px);
    --library-column: minmax(0, 1fr);
  }

  .deck-editor-grid.is-library-collapsed {
    --deck-column: minmax(260px, 1fr);
    --library-column: fit-content(176px);
  }

  .deck-editor-grid.is-deck-collapsed.is-library-collapsed {
    grid-template-columns: fit-content(152px) fit-content(176px) minmax(0, 1fr);
    --main-panels-row: auto;
    --exchange-row: minmax(0, 1fr);
  }

  .deck-editor-grid.is-exchange-collapsed {
    --main-panels-row: minmax(0, 1fr);
    --exchange-row: auto;
  }

  .deck-editor-grid.is-deck-collapsed.is-library-collapsed.is-exchange-collapsed {
    --main-panels-row: auto;
    --exchange-row: auto;
  }
}

.exchange-summary {
  min-height: 42px;
  padding: 8px;
  border: 1px solid rgba(246, 200, 95, 0.18);
  border-radius: 8px;
  background: rgba(10, 13, 18, 0.42);
}

.exchange-balance {
  display: grid;
  gap: 4px;
}

.exchange-balance strong {
  color: var(--gold);
  font-size: 1.15rem;
  line-height: 1;
}

.exchange-balance span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.35;
}

.deck-exchange-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  align-content: start;
  gap: 8px;
}

.deck-exchange-card {
  --element: var(--gold);
  min-height: 92px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.68), rgba(0, 0, 0, 0.34)),
    var(--card-image) right 22% / 112px auto no-repeat,
    linear-gradient(135deg, color-mix(in srgb, var(--element) 26%, #222831), #161a21 68%);
}

.exchange-card-main {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 4px;
}

.exchange-card-kicker,
.exchange-card-main small {
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 900;
}

.exchange-card-main strong {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.18;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.72);
}

.exchange-card-main small {
  color: rgba(246, 242, 233, 0.76);
  line-height: 1.25;
}

.exchange-card-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  align-content: center;
  width: 74px;
}

.exchange-card-actions button {
  min-height: 30px;
  padding: 0 8px;
  border-color: rgba(246, 200, 95, 0.38);
  color: #111318;
  background: var(--gold);
  font-size: 0.72rem;
  font-weight: 1000;
}

.exchange-card-actions button:last-child {
  color: var(--text);
  background: rgba(40, 48, 60, 0.92);
}

.exchange-confirm-card {
  max-width: 420px;
}

.new-game-confirm-card {
  max-width: 440px;
}

.deck-slot-confirm-card {
  max-width: 460px;
}

.exchange-confirm-text {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.55;
}

.new-game-confirm-text,
.deck-slot-confirm-text {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.55;
}

.new-game-confirm-actions button:last-child {
  border-color: rgba(255, 95, 87, 0.72);
  color: #fff;
  background: rgba(255, 95, 87, 0.2);
}

.new-game-confirm-actions button:last-child:hover:not(:disabled) {
  border-color: rgba(255, 95, 87, 0.92);
  background: rgba(255, 95, 87, 0.34);
}

.deck-slot-confirm-actions button:last-child {
  color: #111318;
  background: var(--gold);
}

.gallery-card-stage,
.gallery-card-grid,
.gallery-bgm-list {
  min-height: 0;
  overflow: auto;
  border: 1px solid rgba(246, 200, 95, 0.18);
  border-radius: 8px;
  background: rgba(10, 13, 18, 0.62);
}

.gallery-card-stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
}

.gallery-card-preview {
  min-height: 0;
  display: grid;
  place-items: center;
}

.gallery-card-preview img {
  width: min(100%, 330px);
  max-height: 100%;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.45);
}

.gallery-card-info {
  padding-top: 4px;
}

.gallery-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  align-content: start;
  gap: 8px;
  padding: 8px;
}

.gallery-card-button {
  position: relative;
  min-height: 178px;
  padding: 8px;
  overflow: hidden;
  display: grid;
  align-content: space-between;
  gap: 6px;
  text-align: left;
  background:
    linear-gradient(180deg, rgba(8, 10, 14, 0.1), rgba(8, 10, 14, 0.82)),
    var(--card-image) center 25% / cover no-repeat,
    rgba(31, 37, 47, 0.84);
}

.gallery-card-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.7));
  pointer-events: none;
}

.gallery-card-button span,
.gallery-card-button strong,
.gallery-card-button small {
  position: relative;
  z-index: 1;
}

.gallery-card-button span,
.gallery-card-button small {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
}

.gallery-card-button strong {
  align-self: end;
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.2;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.82);
}

.gallery-card-button.is-selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(246, 200, 95, 0.22), 0 18px 34px rgba(0, 0, 0, 0.32);
}

.gallery-music-now {
  min-height: 24px;
  margin: 0;
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 900;
}

.gallery-bgm-list {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 8px;
}

.gallery-bgm-button {
  min-height: 58px;
  padding: 8px 10px;
  display: grid;
  gap: 3px;
  text-align: left;
}

.gallery-bgm-button span {
  color: var(--text);
  font-size: 0.86rem;
}

.gallery-bgm-button small {
  color: var(--muted);
  font-size: 0.68rem;
  word-break: break-all;
}

.gallery-bgm-button.is-active {
  border-color: var(--gold);
  background: rgba(246, 200, 95, 0.16);
  box-shadow: 0 0 0 2px rgba(246, 200, 95, 0.16);
}

.deck-empty {
  margin: 0;
  padding: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: var(--muted);
}

.card-library .deck-empty {
  grid-column: 1 / -1;
}

.deck-edit-card {
  --element: var(--gold);
  --deck-card-position: center 28%;
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 40%),
    var(--card-image) var(--deck-card-position) / cover no-repeat,
    linear-gradient(135deg, color-mix(in srgb, var(--element) 30%, #222831), #161a21 62%);
  transition: transform 140ms ease, border-color 140ms ease, filter 140ms ease;
  touch-action: manipulation;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
}

.deck-edit-card:hover,
.deck-edit-card:focus-visible {
  transform: translateY(-1px);
  border-color: var(--gold);
  outline: none;
}

.deck-edit-card.is-detail-active {
  transform: translateY(-1px);
  border-color: var(--gold);
  box-shadow:
    0 0 0 2px rgba(246, 200, 95, 0.34),
    0 0 18px rgba(246, 200, 95, 0.22);
}

.deck-edit-card.is-unavailable {
  cursor: not-allowed;
}

.deck-edit-card.is-empty {
  filter: grayscale(0.78);
}

.deck-edit-card.is-unavailable:hover,
.deck-edit-card.is-unavailable:focus-visible {
  transform: none;
}

.deck-edit-card-inner {
  min-height: 116px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 6px;
  padding: 8px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.76));
}

.deck-list .deck-edit-card-inner {
  min-height: 86px;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
}

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

.deck-card-top {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
}

.deck-card-mode-btn {
  position: relative;
  z-index: 2;
  min-width: 58px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border-color: rgba(246, 200, 95, 0.46);
  color: #151922;
  background: var(--gold);
  font-size: 0.64rem;
  font-weight: 1000;
  letter-spacing: 0;
  flex: 0 0 auto;
}

.deck-card-mode-btn:hover {
  background: #ffe08a;
}

.deck-card-mobile-face {
  display: none;
}

.deck-card-name {
  margin: 0;
  align-self: end;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.18;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.62);
}

.deck-list .deck-card-name {
  align-self: center;
}

.deck-card-skill {
  min-width: 0;
  align-self: end;
  display: grid;
  gap: 3px;
  color: var(--text);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.68);
}

.deck-card-skill strong {
  color: var(--gold);
  font-size: 0.82rem;
  line-height: 1.15;
}

.deck-card-skill span {
  display: -webkit-box;
  overflow: hidden;
  color: rgba(246, 242, 233, 0.88);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.deck-list .deck-card-skill span {
  -webkit-line-clamp: 2;
}

.deck-card-bottom {
  color: rgba(246, 242, 233, 0.8);
  font-size: 0.72rem;
  font-weight: 800;
}

.deck-card-stat-line {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.deck-card-count {
  min-width: 38px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #111318;
  background: var(--gold);
  font-weight: 900;
  text-align: center;
}

.deck-edit-card.is-empty .deck-card-count {
  color: var(--text);
  background: #3a4454;
}

.duel-layout {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 8px;
  overflow: hidden;
}

.battle-zone,
.side-panel,
.hand-dock {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(17, 20, 27, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.battle-zone {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 6px;
  padding: 8px;
  overflow: hidden;
}

.duelist-hud {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 46px;
  padding: 7px 10px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(38, 45, 56, 0.98), rgba(28, 33, 42, 0.92));
}

.duelist-hud.opponent {
  border-left: 4px solid var(--red);
}

.duelist-hud.player {
  border-left: 4px solid var(--blue);
}

.duelist-name {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  font-weight: 900;
}

.duelist-stats {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.78rem;
}

.stat-pill {
  min-width: 56px;
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
}

.energy-pill {
  position: relative;
  min-width: 78px;
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  overflow: hidden;
  padding: 4px 9px 4px 8px;
  border-color: rgba(246, 200, 95, 0.36);
  color: #fff4c7;
  background:
    linear-gradient(135deg, rgba(246, 200, 95, 0.2), rgba(88, 166, 255, 0.14)),
    rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 0 12px rgba(246, 200, 95, 0.08);
  transform-origin: center;
}

.energy-pill-label {
  color: rgba(246, 200, 95, 0.86);
  font-size: 0.68rem;
  font-weight: 900;
}

.energy-pill-current {
  color: #fff9df;
  font-size: 1.08rem;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 0 10px rgba(246, 200, 95, 0.42);
}

.energy-pill-max {
  color: rgba(246, 242, 233, 0.74);
  font-size: 0.76rem;
  font-weight: 800;
}

.energy-pill.is-current-turn {
  border-color: rgba(246, 200, 95, 0.66);
  box-shadow:
    inset 0 0 14px rgba(246, 200, 95, 0.14),
    0 0 14px rgba(246, 200, 95, 0.1);
}

.energy-pill::after {
  content: "";
  position: absolute;
  inset: -35% -20%;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 28%, rgba(255, 255, 255, 0.72) 50%, transparent 72%);
  transform: translateX(-120%);
}

.energy-pill.is-turn-start {
  animation: energy-turn-pulse 1.25s ease-out both;
}

.energy-pill.is-turn-start::after {
  animation: energy-turn-shine 1.05s ease-out 0.08s both;
}

@keyframes energy-turn-pulse {
  0% {
    transform: scale(1);
    box-shadow:
      inset 0 0 10px rgba(246, 200, 95, 0.1),
      0 0 0 rgba(246, 200, 95, 0);
  }
  18% {
    transform: scale(1.14);
    border-color: rgba(255, 236, 158, 0.95);
    box-shadow:
      inset 0 0 18px rgba(246, 200, 95, 0.3),
      0 0 24px rgba(246, 200, 95, 0.45),
      0 0 42px rgba(88, 166, 255, 0.2);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes energy-turn-shine {
  0% {
    opacity: 0;
    transform: translateX(-120%);
  }
  25% {
    opacity: 0.72;
  }
  100% {
    opacity: 0;
    transform: translateX(120%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .energy-pill.is-turn-start,
  .energy-pill.is-turn-start::after {
    animation: none;
  }
}

.hidden-hand {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
}

.card-back {
  width: 28px;
  height: 40px;
  border: 1px solid rgba(246, 200, 95, 0.45);
  border-radius: 6px;
  background:
    linear-gradient(45deg, rgba(246, 200, 95, 0.22) 25%, transparent 25% 50%, rgba(246, 200, 95, 0.22) 50% 75%, transparent 75%),
    #27242d;
  background-size: 14px 14px;
}

.field-wrap {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(108px, 1fr) minmax(132px, 1.13fr) auto minmax(132px, 1.13fr) minmax(108px, 1fr);
  gap: 6px;
  padding: 8px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(246, 200, 95, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(246, 200, 95, 0.06) 1px, transparent 1px),
    radial-gradient(circle at center, rgba(246, 200, 95, 0.12), transparent 36%),
    rgba(10, 13, 18, 0.7);
  background-size: 26px 26px, 26px 26px, auto, auto;
}

.support-play-overlay {
  position: absolute;
  inset: 8px;
  z-index: 46;
  display: grid;
  place-items: center;
  padding: 14px;
  pointer-events: none;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--element) 28%, transparent), transparent 44%),
    linear-gradient(180deg, rgba(3, 5, 9, 0.1), rgba(3, 5, 9, 0.46));
}

.support-play-overlay.hidden {
  display: none;
}

.support-play-panel {
  width: min(640px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  display: grid;
  grid-template-columns: clamp(132px, 24%, 190px) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 14px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--element) 52%, rgba(255, 255, 255, 0.2));
  border-radius: 8px;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(12, 16, 24, 0.95), rgba(28, 34, 46, 0.91)),
    color-mix(in srgb, var(--element) 12%, #111318);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.52), 0 0 46px color-mix(in srgb, var(--element) 28%, transparent);
  backdrop-filter: blur(10px);
  animation: supportPanelIn 300ms cubic-bezier(0.2, 0.9, 0.24, 1) both;
}

.support-play-overlay.is-leaving .support-play-panel {
  animation: supportPanelOut 240ms ease forwards;
}

.support-play-card {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--element) 58%, rgba(255, 255, 255, 0.24));
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 28%),
    var(--card-image) center 25% / cover no-repeat,
    linear-gradient(135deg, color-mix(in srgb, var(--element) 38%, #222831), #161a21 62%);
  box-shadow: 0 24px 44px rgba(0, 0, 0, 0.42), 0 0 26px color-mix(in srgb, var(--element) 36%, transparent);
  transform-origin: center;
  animation: supportCardReveal 960ms cubic-bezier(0.16, 0.92, 0.24, 1) both;
}

.support-play-card::before,
.support-play-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.support-play-card::before {
  background:
    linear-gradient(180deg, rgba(4, 6, 10, 0.7), rgba(4, 6, 10, 0.05) 34%, rgba(4, 6, 10, 0.82)),
    radial-gradient(circle at 50% 16%, rgba(255, 255, 255, 0.24), transparent 28%);
}

.support-play-card::after {
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--element) 45%, rgba(255, 255, 255, 0.2)),
    inset 0 -62px 42px rgba(0, 0, 0, 0.4);
}

.support-play-card-top,
.support-play-cost,
.support-play-type {
  position: absolute;
  z-index: 1;
  font-weight: 950;
}

.support-play-card-top {
  top: 8px;
  left: 8px;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  background: rgba(6, 8, 12, 0.7);
  font-size: 0.72rem;
}

.support-play-cost {
  top: 8px;
  right: 8px;
  width: 28px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #111318;
  background: var(--gold);
  font-size: 0.92rem;
}

.support-play-type {
  right: 8px;
  bottom: 10px;
  max-width: 46px;
  padding: 6px 5px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(6, 8, 12, 0.72);
  font-size: 0.66rem;
  line-height: 1.05;
  writing-mode: vertical-rl;
  text-orientation: upright;
}

.support-play-copy {
  min-width: 0;
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.46);
}

.support-play-kicker {
  margin: 0 0 6px;
  color: var(--element);
  font-size: 0.78rem;
  font-weight: 950;
}

.support-play-copy h3 {
  margin: 0 0 8px;
  font-size: 1.54rem;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.support-play-skill,
.support-play-text,
.support-play-target {
  margin: 0;
  overflow-wrap: anywhere;
}

.support-play-skill {
  color: var(--gold);
  font-size: 0.9rem;
  font-weight: 900;
}

.support-play-text {
  display: -webkit-box;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.support-play-target {
  margin-top: 9px;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 900;
}

.slot-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(105px, 1fr));
  gap: 6px;
  align-items: stretch;
}

.back-row {
  grid-template-columns: repeat(2, minmax(105px, 1fr));
  padding-inline: 9%;
}

.arena-line {
  min-height: 38px;
  display: grid;
  grid-template-columns: 104px 1fr 104px;
  gap: 6px;
  align-items: center;
}

.phase-banner {
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(246, 200, 95, 0.3);
  border-radius: 8px;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.28);
  font-weight: 900;
  text-transform: uppercase;
}

.lp-target {
  height: 34px;
  position: relative;
  overflow: hidden;
  background: #3b2730;
}

.slot {
  min-height: 108px;
  position: relative;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.035);
}

.slot::after {
  content: attr(data-label);
  position: absolute;
  inset: auto 8px 7px;
  color: rgba(255, 255, 255, 0.28);
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
  pointer-events: none;
}

.slot:has(.field-card)::after {
  display: none;
}

.slot.playable,
.field-card.targetable,
.lp-target.targetable {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(246, 200, 95, 0.22), 0 0 22px rgba(246, 200, 95, 0.12);
}

.side-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(150px, auto) 1fr;
  gap: 8px;
  padding: 8px;
  overflow: hidden;
}

.turn-console,
.inspect-panel,
.log-panel {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(31, 37, 47, 0.78);
}

.turn-console {
  position: relative;
  z-index: 18;
}

.turn-console,
.inspect-panel {
  padding: 9px;
}

.console-header,
.hand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.command-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.command-row button,
.inspect-panel button,
.modal-card button {
  min-height: 34px;
  padding: 0 12px;
}

.hint-text {
  min-height: 30px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.inspect-panel {
  min-height: 150px;
  max-height: 215px;
  overflow: auto;
}

.inspect-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.inspect-title h2 {
  margin: 0;
  font-size: 0.96rem;
}

.inspect-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.tag {
  padding: 2px 6px;
  border-radius: 999px;
  color: #111318;
  background: var(--gold);
  font-size: 0.68rem;
  font-weight: 900;
}

.tag.muted {
  color: var(--text);
  background: #3a4454;
}

.inspect-text {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.42;
}

.log-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 8px 0 0;
}

.log-panel h2 {
  margin: 0 10px 6px;
  font-size: 0.86rem;
}

.battle-log {
  min-height: 0;
  overflow: auto;
  padding: 0 10px 10px;
}

.log-entry {
  padding: 6px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

.log-entry strong {
  color: var(--text);
}

.hand-dock {
  position: fixed;
  left: 50%;
  bottom: 8px;
  z-index: 17;
  width: 230px;
  height: 42px;
  min-height: 0;
  padding: 7px 10px;
  overflow: hidden;
  outline: none;
  transform: translateX(-50%);
  cursor: pointer;
  transition:
    width 180ms ease,
    height 180ms ease,
    padding 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.hand-dock .hand-header {
  margin-bottom: 0;
}

.hand-dock:hover,
.hand-dock:focus-within,
.hand-dock.is-open {
  width: min(1040px, calc(100vw - 24px));
  height: 296px;
  padding: 10px;
  border-color: rgba(246, 200, 95, 0.48);
  background: rgba(17, 20, 27, 0.94);
}

.hand-dock:hover .hand-header,
.hand-dock:focus-within .hand-header,
.hand-dock.is-open .hand-header {
  margin-bottom: 7px;
}

.hand-scroll-top {
  height: 13px;
  margin: 0 2px 4px;
  overflow-x: auto;
  overflow-y: hidden;
  opacity: 0;
  pointer-events: none;
  scrollbar-color: rgba(246, 200, 95, 0.62) rgba(255, 255, 255, 0.08);
  scrollbar-width: thin;
  transition: opacity 160ms ease;
}

.hand-scroll-top-spacer {
  width: 1px;
  height: 1px;
}

.hand-dock:hover .hand-scroll-top,
.hand-dock:focus-within .hand-scroll-top,
.hand-dock.is-open .hand-scroll-top {
  opacity: 1;
  pointer-events: auto;
}

.hand-scroll-top::-webkit-scrollbar {
  height: 9px;
}

.hand-scroll-top::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.hand-scroll-top::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(246, 200, 95, 0.62);
}

.hand-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  scrollbar-width: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.hand-row::-webkit-scrollbar {
  display: none;
}

.hand-dock:hover .hand-row,
.hand-dock:focus-within .hand-row,
.hand-dock.is-open .hand-row {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.hand-row .game-card {
  flex: 0 0 168px;
  min-height: 246px;
}

.game-card,
.field-card {
  --element: var(--gold);
  --card-image: none;
  --card-position: center;
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(58px, 1fr) auto;
  min-height: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  overflow: hidden;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 28%),
    linear-gradient(135deg, color-mix(in srgb, var(--element) 34%, #222831), #161a21 60%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  user-select: none;
}

.game-card > *,
.field-card > * {
  position: relative;
  z-index: 1;
}

.has-card-art {
  grid-template-rows: auto minmax(50px, 1fr) auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 28%),
    var(--card-image) var(--card-position) / cover no-repeat,
    linear-gradient(135deg, color-mix(in srgb, var(--element) 34%, #222831), #161a21 60%);
}

.has-card-art::before,
.has-card-art::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.has-card-art::before {
  background:
    linear-gradient(180deg, rgba(5, 7, 11, 0.82), rgba(5, 7, 11, 0.12) 28%, rgba(5, 7, 11, 0.22) 56%, rgba(5, 7, 11, 0.9)),
    radial-gradient(circle at 50% 16%, rgba(255, 255, 255, 0.18), transparent 28%);
}

.has-card-art::after {
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--element) 46%, rgba(255, 255, 255, 0.22)),
    inset 0 -48px 40px rgba(0, 0, 0, 0.3);
}

.game-card {
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.game-card:hover,
.game-card.selected,
.field-card.selected {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.26), 0 0 0 2px rgba(246, 200, 95, 0.18);
}

.field-card {
  width: 100%;
  height: 100%;
  min-height: 108px;
  cursor: pointer;
}

.field-card.has-card-art {
  --card-position: center 22%;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 22px;
  padding: 4px 6px 0;
  font-size: 0.64rem;
  font-weight: 900;
}

.has-card-art .card-top {
  padding: 5px 6px 0;
}

.has-card-art .card-top > span:first-child {
  padding: 3px 6px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  background: rgba(6, 8, 12, 0.68);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(8px);
}

.cost-badge {
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 50%;
  color: #111318;
  background: var(--gold);
}

.card-art {
  display: grid;
  place-items: center;
  min-height: 0;
  margin: 4px 6px 3px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.card-art svg {
  width: 100%;
  height: 100%;
  display: block;
}

.has-card-art .card-art {
  margin: 0;
  border: 0;
  background: transparent;
}

.has-card-art .card-art svg {
  display: none;
}

.card-body {
  min-width: 0;
  padding: 0 6px 3px;
}

.has-card-art .card-body {
  margin: 0 5px 4px;
  padding: 5px 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(9, 12, 18, 0.64), rgba(9, 12, 18, 0.82));
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(8px);
}

.card-name {
  margin: 0 0 2px;
  font-size: 0.72rem;
  font-weight: 950;
  line-height: 1.16;
  overflow-wrap: anywhere;
}

.card-skill {
  margin: 0;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.6rem;
  line-height: 1.14;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.card-stats {
  pointer-events: none;
}

.card-stats span {
  min-width: 0;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.24);
  text-align: center;
  font-weight: 900;
}

.character-stats {
  position: absolute;
  inset: 34px 5px 48px;
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  align-items: center;
  z-index: 2;
  padding: 0;
}

.character-stats span {
  width: 32px;
  min-height: 30px;
  display: grid;
  place-items: center;
  padding: 3px 2px;
  font-size: 0.78rem;
  line-height: 1;
}

.character-stats span::before {
  content: attr(data-label);
  display: block;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.44rem;
  line-height: 1;
}

.stat-atk {
  grid-column: 1;
  grid-row: 2;
}

.stat-def {
  grid-column: 3;
  grid-row: 1;
}

.stat-hp {
  grid-column: 3;
  grid-row: 3;
}

.support-stats {
  position: absolute;
  top: 36px;
  right: 5px;
  z-index: 2;
  display: flex;
  padding: 0;
}

.support-stats span {
  max-width: 42px;
  padding: 5px 4px;
  font-size: 0.56rem;
  line-height: 1.05;
  writing-mode: vertical-rl;
  text-orientation: upright;
}

.has-card-art .card-stats span {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(6, 8, 12, 0.72);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
}

.field-card.has-card-art .card-top {
  padding: 4px 5px 0;
  font-size: 0.56rem;
}

.field-card.has-card-art .cost-badge {
  min-width: 20px;
  height: 20px;
}

.field-card.has-card-art .card-body {
  margin-inline: 4px;
  padding: 4px 5px;
}

.field-card.has-card-art .card-skill {
  -webkit-line-clamp: 1;
}

.support-card {
  grid-template-rows: auto minmax(58px, 1fr) auto;
}

.field-card .character-stats {
  inset: 28px 4px 42px;
  grid-template-columns: 28px 1fr 28px;
}

.field-card .character-stats span {
  width: 28px;
  min-height: 26px;
  font-size: 0.68rem;
}

.field-card .character-stats span::before {
  font-size: 0.4rem;
}

.field-card .support-stats {
  top: 30px;
  right: 4px;
}

.rarity-UR {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 0 20px rgba(246, 200, 95, 0.18);
}

.rarity-SR {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 0 16px rgba(179, 122, 255, 0.16);
}

.status-strip {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 46px;
  display: flex;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
  pointer-events: none;
}

.status-chip {
  padding: 1px 4px;
  border-radius: 5px;
  color: #111318;
  background: #d9f99d;
  font-size: 0.56rem;
  font-weight: 900;
}

.exhausted {
  filter: grayscale(0.45) brightness(0.78);
}

.is-stunned {
  outline: 2px solid #b37aff;
  outline-offset: -3px;
}

.damage-pop,
.heal-pop {
  position: absolute;
  inset: 36% 0 auto;
  z-index: 5;
  display: grid;
  place-items: center;
  pointer-events: none;
  min-width: 46px;
  min-height: 46px;
  margin: auto;
  font-size: 1.6rem;
  font-weight: 950;
  isolation: isolate;
  animation: floatPop 940ms ease forwards;
}

.damage-pop {
  --impact-color: #ffdf7a;
  --impact-core: rgba(255, 223, 122, 0.82);
  color: #ffdf7a;
  text-shadow: 0 3px 0 #7d1715;
}

.damage-pop::before,
.damage-pop::after {
  content: "";
  position: absolute;
  inset: 50%;
  z-index: -1;
  width: var(--impact-size, 58px);
  height: var(--impact-size, 58px);
  border-radius: 999px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.damage-pop::before {
  background:
    radial-gradient(circle, var(--impact-core) 0 12%, transparent 13% 100%),
    repeating-conic-gradient(from 12deg, var(--impact-color) 0 7deg, transparent 8deg 20deg);
  filter: drop-shadow(0 0 14px var(--impact-color));
  animation: impactBurst 620ms ease-out forwards;
}

.damage-pop::after {
  border: 2px solid var(--impact-color);
  opacity: 0.7;
  animation: impactRing 680ms ease-out forwards;
}

.damage-pop.impact-low {
  --impact-color: #ffdf7a;
  --impact-core: rgba(255, 223, 122, 0.86);
  --impact-size: 52px;
  font-size: 1.45rem;
}

.damage-pop.impact-mid {
  --impact-color: #ff8a4c;
  --impact-core: rgba(255, 138, 76, 0.9);
  --impact-size: 74px;
  color: #ffd0a8;
  font-size: 1.75rem;
  text-shadow: 0 3px 0 #84220f, 0 0 16px rgba(255, 138, 76, 0.58);
}

.damage-pop.impact-mid::after {
  width: 92px;
  height: 12px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--impact-color), transparent);
  transform: translate(-50%, -50%) rotate(-18deg);
}

.damage-pop.impact-high {
  --impact-color: #ff4d6d;
  --impact-core: rgba(255, 245, 178, 0.95);
  --impact-size: 106px;
  color: #fff0ad;
  font-size: 2.05rem;
  text-shadow: 0 4px 0 #6e1022, 0 0 24px rgba(255, 77, 109, 0.75);
}

.damage-pop.impact-high::before {
  background:
    radial-gradient(circle, var(--impact-core) 0 9%, rgba(255, 77, 109, 0.7) 10% 22%, transparent 23%),
    repeating-conic-gradient(from 4deg, var(--impact-color) 0 8deg, transparent 9deg 16deg);
}

.damage-pop.impact-high::after {
  width: 118px;
  height: 118px;
  border-style: double;
  border-width: 5px;
  box-shadow: 0 0 34px rgba(255, 77, 109, 0.48);
}

.heal-pop {
  inset: 12% 0 auto;
  color: #9dffb2;
  text-shadow: 0 3px 0 #14532d;
}

.skill-popup {
  position: fixed;
  z-index: 120;
  width: min(320px, calc(100vw - 24px));
  padding: 10px 12px;
  border: 1px solid rgba(246, 200, 95, 0.5);
  border-radius: 8px;
  color: var(--text);
  background: rgba(18, 22, 29, 0.96);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  backdrop-filter: blur(12px);
}

.skill-popup.hidden {
  display: none;
}

.battle-intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(246, 200, 95, 0.07) 1px, transparent 1px),
    linear-gradient(rgba(246, 200, 95, 0.07) 1px, transparent 1px),
    rgba(3, 5, 9, 0.9);
  background-size: 32px 32px;
  backdrop-filter: blur(12px);
}

.battle-intro-overlay.hidden {
  display: none;
}

.battle-intro-overlay.is-leaving {
  animation: introFadeOut 320ms ease forwards;
}

.battle-intro-copy,
.coin-stage {
  grid-area: 1 / 1;
}

.battle-intro-copy {
  width: min(920px, calc(100vw - 48px));
  text-align: center;
  transition: opacity 360ms ease, transform 360ms ease, filter 360ms ease;
}

.battle-intro-overlay.is-coin-stage .battle-intro-copy {
  opacity: 0;
  transform: translateY(-16px);
  filter: blur(3px);
}

.battle-intro-kicker {
  margin: 0 0 18px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
}

.battle-intro-line {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.6rem, 4.4vw, 4.4rem);
  font-weight: 950;
  line-height: 1.05;
  text-wrap: balance;
  text-shadow: 0 18px 44px rgba(0, 0, 0, 0.62), 0 0 30px rgba(246, 200, 95, 0.18);
  animation: introLineIn 520ms cubic-bezier(0.2, 0.88, 0.24, 1) both;
}

.coin-stage {
  display: grid;
  justify-items: center;
  gap: 20px;
  opacity: 0;
  transform: translateY(18px) scale(0.94);
  transition: opacity 300ms ease, transform 300ms ease;
}

.battle-intro-overlay.is-coin-stage .coin-stage {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.intro-coin {
  width: min(190px, 44vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #1c1402;
  background-image: url("assets/ui/duel-coin-sheet.png");
  background-position: 3% 49%;
  background-size: 214% auto;
  box-shadow: 0 28px 56px rgba(0, 0, 0, 0.48), 0 0 36px rgba(246, 200, 95, 0.22);
  transform-style: preserve-3d;
}

.intro-coin span {
  display: grid;
  place-items: center;
  width: 54%;
  aspect-ratio: 1;
  border: 2px solid rgba(97, 60, 6, 0.32);
  border-radius: 50%;
  color: rgba(58, 34, 7, 0.86);
  background: rgba(255, 246, 203, 0.24);
  font-size: clamp(1.8rem, 7vw, 3.1rem);
  font-weight: 950;
  opacity: 0;
}

.intro-coin.is-tossing {
  animation: coinToss 1180ms cubic-bezier(0.18, 0.88, 0.22, 1) forwards;
}

.intro-coin.is-tails {
  color: #eef5ff;
  background-position: 97% 49%;
  box-shadow: 0 28px 56px rgba(0, 0, 0, 0.48), 0 0 36px rgba(88, 166, 255, 0.22);
}

.battle-intro-result {
  min-height: 28px;
  margin: 0;
  color: var(--gold);
  font-size: clamp(0.96rem, 2.4vw, 1.24rem);
  font-weight: 950;
  letter-spacing: 0;
  text-align: center;
  opacity: 0.78;
}

.battle-intro-result.is-visible {
  animation: resultFlash 420ms ease both;
}

.skill-popup h3 {
  margin: 0 0 6px;
  font-size: 0.94rem;
  line-height: 1.22;
}

.skill-popup p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.42;
}

.skill-popup .popup-meta {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 7px;
}

.skill-popup .popup-chip {
  padding: 2px 6px;
  border-radius: 999px;
  color: #111318;
  background: var(--gold);
  font-size: 0.66rem;
  font-weight: 900;
}

.shake {
  animation: shake 360ms ease;
}

.lunge {
  animation: lunge 380ms ease;
}

.attack-lift {
  z-index: 9;
  animation: attackLift 520ms cubic-bezier(0.2, 0.92, 0.24, 1.05);
}

.summon-out {
  z-index: 10;
  pointer-events: none;
  animation: summonOut 280ms cubic-bezier(0.2, 0.8, 0.26, 1) forwards;
}

.summon-drop {
  z-index: 8;
  animation: summonDrop 640ms cubic-bezier(0.18, 0.95, 0.24, 1.08);
}

.pulse-win {
  animation: pulseWin 900ms ease;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.62);
}

.modal.hidden {
  display: none;
}

#exchangeConfirmModal {
  z-index: 120;
}

#newGameConfirmModal {
  z-index: 120;
}

#deckSlotConfirmModal {
  z-index: 120;
}

.modal-card {
  width: min(720px, 100%);
  padding: 22px;
  border: 1px solid rgba(246, 200, 95, 0.36);
  border-radius: 8px;
  background: #161b24;
  box-shadow: var(--shadow);
}

.modal-card h2 {
  margin-bottom: 14px;
}

.how-to-play-modal {
  z-index: 120;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px);
}

.how-to-play-card {
  width: min(840px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.how-to-play-header,
.level-select-header,
.data-transfer-header,
.system-voice-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.level-select-modal {
  z-index: 120;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px);
}

.level-select-card {
  width: min(860px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.data-transfer-modal {
  z-index: 120;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px);
}

.system-voice-modal {
  z-index: 120;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px);
}

.data-transfer-card {
  width: min(560px, 100%);
}

.system-voice-card {
  width: min(720px, 100%);
  max-height: calc(100vh - 36px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.data-transfer-body {
  display: grid;
  gap: 12px;
}

.system-voice-body {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 12px;
}

.system-voice-current {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(246, 200, 95, 0.28);
  border-radius: 8px;
  background: rgba(5, 7, 11, 0.34);
}

.system-voice-current span {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.system-voice-current strong {
  font-size: 1.04rem;
  line-height: 1.25;
}

.system-voice-current small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.35;
}

.system-voice-status {
  min-height: 21px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

.system-voice-status.is-ready {
  color: var(--green);
}

.system-voice-status.is-error {
  color: var(--red);
}

.system-voice-list {
  min-height: 220px;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 8px;
  padding-right: 4px;
}

.system-voice-option {
  min-width: 0;
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-color: rgba(246, 200, 95, 0.24);
  background: rgba(31, 37, 47, 0.78);
  text-align: left;
}

.system-voice-option:hover:not(:disabled) {
  border-color: rgba(246, 200, 95, 0.7);
}

.system-voice-option.is-selected {
  border-color: var(--gold);
  background: rgba(246, 200, 95, 0.14);
  box-shadow: 0 0 0 2px rgba(246, 200, 95, 0.12);
}

.system-voice-option.is-unavailable {
  opacity: 0.58;
}

.system-voice-mark {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(246, 200, 95, 0.68);
  border-radius: 50%;
}

.system-voice-option.is-selected .system-voice-mark {
  background: var(--gold);
  box-shadow: inset 0 0 0 3px #161b24;
}

.system-voice-option-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.system-voice-option-copy strong {
  overflow: hidden;
  font-size: 0.92rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-voice-option-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-voice-empty {
  margin: 0;
  padding: 18px 12px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-align: center;
}

.system-voice-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.system-voice-actions button {
  min-height: 42px;
  padding: 0 12px;
  border-color: rgba(246, 200, 95, 0.34);
  font-size: 0.86rem;
}

.deck-sort-modal {
  z-index: 130;
  place-items: stretch;
  padding: 0;
  background: rgba(5, 7, 11, 0.9);
  backdrop-filter: blur(12px);
}

.deck-sort-card {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  border-radius: 0;
  background: rgba(17, 20, 27, 0.98);
}

.deck-sort-header,
.deck-sort-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.deck-sort-header h2 {
  margin: 0;
}

.deck-sort-target {
  min-width: 120px;
  display: grid;
  gap: 3px;
  padding: 9px 12px;
  border: 1px solid rgba(246, 200, 95, 0.32);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.26);
  text-align: right;
}

.deck-sort-target span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
}

.deck-sort-target strong {
  color: var(--gold);
  font-size: 1rem;
}

.deck-sort-options {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(128px, 0.36fr) minmax(128px, 0.36fr) minmax(180px, 0.5fr) minmax(0, 1.9fr);
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
  align-items: start;
}

.deck-sort-section {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto;
  gap: 8px;
  align-self: start;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(31, 37, 47, 0.72);
}

.deck-sort-section-series {
  align-self: stretch;
  grid-template-rows: auto minmax(0, 1fr);
}

.deck-sort-section h3 {
  margin: 0;
  color: var(--gold);
  font-size: 0.95rem;
}

.deck-sort-choice-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  align-content: start;
  overflow: visible;
}

.deck-sort-section-series .deck-sort-choice-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  overflow: auto;
}

.deck-sort-section-series .deck-sort-choice span {
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.deck-sort-choice {
  position: relative;
  min-width: 0;
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid rgba(246, 200, 95, 0.24);
  border-radius: 8px;
  color: var(--text);
  background: rgba(5, 7, 11, 0.42);
  cursor: pointer;
  user-select: none;
}

.deck-sort-choice input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.deck-sort-choice span,
.deck-sort-choice small {
  position: relative;
  z-index: 1;
}

.deck-sort-choice span {
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deck-sort-choice small {
  min-width: 42px;
  padding: 3px 6px;
  border-radius: 999px;
  color: var(--gold);
  background: rgba(246, 200, 95, 0.12);
  font-size: 0.68rem;
  font-weight: 900;
  text-align: center;
}

.deck-sort-choice.is-checked {
  border-color: var(--gold);
  color: #10131a;
  background: var(--gold);
}

.deck-sort-choice.is-checked small {
  color: #10131a;
  background: rgba(0, 0, 0, 0.16);
}

.deck-sort-choice.is-empty:not(.is-checked) {
  opacity: 0.46;
}

.deck-sort-actions {
  justify-content: flex-end;
}

.deck-sort-actions button {
  min-width: 104px;
}

.deck-sort-actions button:last-child {
  color: #10131a;
  background: var(--gold);
}

.data-transfer-field {
  display: grid;
  gap: 7px;
}

.data-transfer-field span {
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.data-transfer-field input {
  min-height: 44px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid rgba(246, 200, 95, 0.34);
  border-radius: 8px;
  color: var(--text);
  background: rgba(10, 13, 18, 0.82);
  font: inherit;
  font-weight: 800;
}

.data-transfer-field input:focus {
  outline: 2px solid rgba(246, 200, 95, 0.34);
  outline-offset: 2px;
}

.data-transfer-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.data-transfer-actions button {
  min-height: 44px;
  padding: 0 12px;
  border-color: rgba(246, 200, 95, 0.34);
  font-size: 0.88rem;
}

.data-transfer-status {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.45;
}

.data-transfer-status.is-ready {
  color: var(--green);
}

.data-transfer-status.is-error {
  color: var(--red);
}

.level-select-summary {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.level-select-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.level-select-button {
  min-height: 148px;
  padding: 10px;
  display: grid;
  align-content: space-between;
  gap: 7px;
  text-align: left;
  background:
    linear-gradient(180deg, rgba(246, 200, 95, 0.13), rgba(12, 15, 21, 0.82)),
    rgba(31, 37, 47, 0.9);
}

.level-select-button strong {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.15;
}

.level-select-button span,
.level-select-button small {
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 900;
}

.level-select-button .level-select-concept {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

.level-select-button .level-select-curve {
  color: var(--text);
  font-size: 0.76rem;
  letter-spacing: 0;
}

.level-select-button.is-latest {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(246, 200, 95, 0.18);
}

.how-to-play-header h2,
.level-select-header h2 {
  margin: 0;
}

.how-to-play-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid rgba(246, 200, 95, 0.22);
  border-left: 1px solid rgba(246, 200, 95, 0.16);
}

.how-to-play-body section {
  padding: 14px;
  border-right: 1px solid rgba(246, 200, 95, 0.16);
  border-bottom: 1px solid rgba(246, 200, 95, 0.16);
}

.how-to-play-body h3 {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.92rem;
}

.how-to-play-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.65;
}

.reward-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.reward-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.choice-option {
  display: block;
  min-height: 260px;
  padding: 0;
  border: 0;
  background: transparent;
}

.choice-option:hover {
  transform: translateY(-2px);
}

.choice-option .game-card {
  height: 100%;
}

.reward-cards .game-card {
  min-height: 230px;
}

.reward-cards .game-card.has-card-art {
  --card-position: center 18%;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-7px);
  }
  45% {
    transform: translateX(5px);
  }
  70% {
    transform: translateX(-3px);
  }
}

@keyframes lunge {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  42% {
    transform: translateY(-10px) scale(1.025);
  }
}

@keyframes attackLift {
  0%,
  100% {
    transform: translateY(0) scale(1);
    filter: drop-shadow(0 0 0 rgba(246, 200, 95, 0));
  }
  34% {
    transform: translateY(-30px) scale(1.13);
    filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.42));
  }
  70% {
    transform: translateY(-38px) scale(1.19);
    filter: drop-shadow(0 24px 28px rgba(0, 0, 0, 0.5));
  }
  78% {
    transform: translateY(0) scale(1.05);
    filter: drop-shadow(0 0 20px rgba(246, 200, 95, 0.42));
  }
  90% {
    transform: translateY(-4px) scale(1.02);
  }
}

@keyframes summonOut {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
    filter: drop-shadow(0 0 0 rgba(246, 200, 95, 0));
  }
  62% {
    transform: translateY(-34px) scale(1.1);
    opacity: 0.72;
    filter: drop-shadow(0 20px 22px rgba(0, 0, 0, 0.48)) drop-shadow(0 0 18px rgba(246, 200, 95, 0.34));
  }
  100% {
    transform: translateY(-54px) scale(0.94);
    opacity: 0;
    filter: drop-shadow(0 24px 28px rgba(0, 0, 0, 0.38)) drop-shadow(0 0 26px rgba(246, 200, 95, 0.42));
  }
}

@keyframes summonDrop {
  0% {
    transform: translateY(-60px) scale(1.1);
    opacity: 0;
    filter: drop-shadow(0 0 24px rgba(246, 200, 95, 0.5));
  }
  46% {
    transform: translateY(-12px) scale(1.06);
    opacity: 1;
    filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 20px rgba(246, 200, 95, 0.38));
  }
  72% {
    transform: translateY(4px) scale(0.985);
  }
  86% {
    transform: translateY(-3px) scale(1.015);
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
    filter: drop-shadow(0 0 0 rgba(246, 200, 95, 0));
  }
}

@keyframes floatPop {
  from {
    transform: translateY(12px) scale(0.72);
    opacity: 0;
  }
  14% {
    opacity: 1;
    transform: translateY(0) scale(1.08);
  }
  to {
    transform: translateY(-36px) scale(1.1);
    opacity: 0;
  }
}

@keyframes impactBurst {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.24) rotate(0deg);
  }
  18% {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.18) rotate(24deg);
  }
}

@keyframes impactRing {
  from {
    opacity: 0.85;
    transform: translate(-50%, -50%) scale(0.32);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.4);
  }
}

@keyframes pulseWin {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(246, 200, 95, 0);
  }
  50% {
    box-shadow: 0 0 38px rgba(246, 200, 95, 0.42);
  }
}

@keyframes supportPanelIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes supportPanelOut {
  to {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
    filter: blur(4px);
  }
}

@keyframes supportCardReveal {
  0% {
    opacity: 0;
    transform: translateX(-30px) rotateY(-30deg) scale(0.86);
    filter: brightness(1.12) blur(4px);
  }
  38% {
    opacity: 1;
    transform: translateX(0) rotateY(6deg) scale(1.05);
    filter: brightness(1.24) blur(0);
  }
  68% {
    transform: translateX(0) rotateY(0) scale(0.98);
    filter: brightness(1.04);
  }
  100% {
    opacity: 1;
    transform: translateX(0) rotateY(0) scale(1);
    filter: brightness(1);
  }
}

@keyframes introLineIn {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.98);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes introFadeOut {
  to {
    opacity: 0;
    transform: scale(1.025);
  }
}

@keyframes coinToss {
  0% {
    transform: translateY(48px) rotateX(0deg) rotateY(0deg) scale(0.76);
  }
  36% {
    transform: translateY(-112px) rotateX(780deg) rotateY(540deg) scale(1.06);
  }
  72% {
    transform: translateY(8px) rotateX(1680deg) rotateY(1180deg) scale(0.98);
  }
  100% {
    transform: translateY(0) rotateX(2160deg) rotateY(1440deg) scale(1);
  }
}

@keyframes resultFlash {
  from {
    opacity: 0;
    transform: translateY(8px);
    text-shadow: 0 0 0 rgba(246, 200, 95, 0);
  }
  42% {
    opacity: 1;
    transform: translateY(0);
    text-shadow: 0 0 28px rgba(246, 200, 95, 0.5);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    text-shadow: 0 0 12px rgba(246, 200, 95, 0.22);
  }
}

@keyframes titleCardDrift {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -14px;
  }
}

@media (max-width: 1080px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .duel-layout {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .side-panel {
    grid-template-columns: minmax(260px, 0.8fr) minmax(260px, 1fr);
    grid-template-rows: auto minmax(220px, 1fr);
  }

  .log-panel {
    grid-column: 1 / -1;
  }
}

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

  .side-panel {
    grid-template-columns: 1fr;
  }

  .log-panel {
    grid-column: auto;
  }

  .field-wrap {
    padding: 8px;
    grid-template-rows: repeat(2, minmax(105px, auto)) auto repeat(2, minmax(105px, auto));
  }

  .slot-row,
  .back-row {
    grid-template-columns: repeat(3, minmax(86px, 1fr));
    padding-inline: 0;
  }

  .back-row {
    grid-template-columns: repeat(2, minmax(86px, 1fr));
  }

  .arena-line {
    grid-template-columns: 88px 1fr 88px;
  }

  .support-play-overlay {
    inset: 6px;
    padding: 8px;
  }

  .support-play-panel {
    width: min(340px, calc(100% - 12px));
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 10px;
    padding: 12px;
  }

  .support-play-card {
    width: min(156px, 52vw);
  }

  .support-play-copy {
    text-align: center;
  }

  .support-play-copy h3 {
    font-size: 1.18rem;
  }

  .support-play-text {
    -webkit-line-clamp: 2;
  }

  .title-screen {
    place-items: start center;
    overflow: hidden;
    padding: 14px 18px 18px;
  }

  .title-visuals {
    z-index: 1;
    overflow: hidden;
  }

  .title-card {
    top: var(--title-mobile-top, var(--title-top, auto));
    right: var(--title-mobile-right, var(--title-right, auto));
    bottom: var(--title-mobile-bottom, var(--title-bottom, auto));
    left: var(--title-mobile-left, var(--title-left, auto));
    width: var(--title-mobile-width, clamp(86px, 28vw, 148px));
    opacity: 0.38;
  }

  .title-content {
    width: min(420px, calc(100vw - 36px));
    padding-top: clamp(190px, 33vh, 278px);
  }

  .title-logo-backdrop {
    top: clamp(12px, 3.5vh, 26px);
    z-index: 2;
    width: min(420px, calc(100vw - 30px));
    max-height: min(30vh, 250px);
    opacity: 0.9;
    transform: translate(-50%, 0);
  }

  .title-kicker {
    margin-bottom: 8px;
  }

  .title-subtitle {
    margin: 8px 0 18px;
    font-size: clamp(0.94rem, 4.1vw, 1.08rem);
  }

  .title-actions {
    gap: 8px;
  }

  .title-start {
    width: 100%;
    min-height: 44px;
  }

  .title-menu-button {
    width: 100%;
    min-height: 44px;
  }

  @media (max-height: 700px) {
    .title-screen {
      padding: 10px 18px 12px;
    }

    .title-logo-backdrop {
      top: 10px;
      width: min(360px, calc(100vw - 28px));
      max-height: min(27vh, 190px);
    }

    .title-content {
      padding-top: clamp(168px, 30vh, 210px);
    }

    .title-kicker {
      margin-bottom: 6px;
      font-size: 0.74rem;
    }

    .title-subtitle {
      margin: 6px 0 14px;
      font-size: 0.9rem;
    }

    .title-actions {
      gap: 7px;
    }

    .title-start,
    .title-menu-button {
      min-height: 40px;
    }
  }

  .how-to-play-card {
    padding: 18px;
  }

  .how-to-play-body {
    grid-template-columns: 1fr;
  }

  .data-transfer-actions {
    grid-template-columns: 1fr;
  }

  .system-voice-actions {
    grid-template-columns: 1fr;
  }

  .system-voice-card {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
  }

  .system-voice-list {
    min-height: 180px;
  }

  .system-voice-option-copy strong,
  .system-voice-option-copy small {
    overflow-wrap: anywhere;
    text-overflow: clip;
    white-space: normal;
  }

  .modal {
    place-items: start center;
    padding: 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .modal-card {
    min-height: 0;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .deck-editor,
  .gallery-view {
    padding: 8px;
    overflow: hidden;
  }

  .deck-editor-shell,
  .gallery-shell {
    gap: 8px;
    padding: 8px;
  }

  .deck-editor-shell {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .deck-editor-header,
  .gallery-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .deck-editor-actions {
    width: 100%;
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 6px;
  }

  .gallery-header-actions {
    width: 100%;
    justify-content: stretch;
  }

  #resetDeckBtn {
    display: none;
  }

  #saveDeckBtn {
    grid-column: 4;
  }

  #closeDeckEditorBtn {
    grid-column: 5;
  }

  .deck-slot-bar {
    width: 100%;
    align-items: stretch;
  }

  .deck-slot-buttons {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .deck-slot-button {
    width: auto;
  }

  .deck-editor-actions button {
    flex: none;
    min-width: 58px;
    min-height: 34px;
    padding: 0 9px;
    font-size: 0.74rem;
  }

  .gallery-header-actions button {
    flex: 1 1 92px;
  }

  .deck-count {
    min-width: 0;
    padding: 6px 8px;
    font-size: 0.74rem;
    line-height: 1;
    white-space: nowrap;
  }

  .deck-editor-grid,
  .gallery-grid {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-auto-rows: auto;
    align-content: start;
  }

  .card-library,
  .gallery-card-grid {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  }

  .deck-editor-panel {
    gap: 8px;
    padding: 8px;
  }

  .deck-editor-panel h3 {
    font-size: 1.08rem;
    line-height: 1.1;
    white-space: nowrap;
  }

  .deck-editor-panel-head {
    min-height: 32px;
    gap: 6px;
  }

  .deck-editor-panel-actions {
    gap: 4px;
    flex-wrap: nowrap;
  }

  #librarySortBtn {
    width: 72px;
    min-width: 72px;
    min-height: 32px;
    padding-inline: 6px;
    font-size: 0.64rem;
  }

  #toggleLibraryBtn {
    width: 30px;
    min-width: 30px;
    padding: 0;
    overflow: hidden;
    font-size: 0;
  }

  #toggleLibraryBtn::before {
    content: "-";
    font-size: 1rem;
    font-weight: 1000;
    line-height: 1;
  }

  #toggleLibraryBtn.is-on::before {
    content: "+";
  }

  #ownedOnlyLibraryBtn {
    width: 68px;
    min-width: 68px;
    min-height: 32px;
    padding-inline: 6px;
    overflow: hidden;
    font-size: 0;
  }

  #ownedOnlyLibraryBtn::before {
    content: "入手済み";
    font-size: 0.62rem;
  }

  #ownedOnlyLibraryBtn.is-on::before {
    content: "全カード";
  }

  .deck-sort-modal {
    place-items: stretch;
    padding: 0;
    overflow: hidden;
  }

  .deck-sort-card {
    gap: 10px;
    padding: 12px;
    max-height: none;
    overflow: hidden;
  }

  .deck-sort-header {
    align-items: stretch;
  }

  .deck-sort-target {
    min-width: 96px;
    padding: 7px 9px;
  }

  .deck-sort-options {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-right: 0;
  }

  .deck-sort-section {
    max-height: min(42vh, 320px);
    align-self: stretch;
    grid-template-rows: auto minmax(0, 1fr);
    padding: 8px;
  }

  .deck-sort-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: auto;
  }

  .deck-sort-section-series .deck-sort-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .deck-sort-choice {
    min-height: 38px;
    gap: 6px;
    padding: 6px 7px;
  }

  .deck-sort-choice span {
    font-size: 0.72rem;
  }

  .deck-sort-section-series .deck-sort-choice span {
    white-space: nowrap;
  }

  .deck-sort-choice small {
    min-width: 36px;
    padding-inline: 5px;
    font-size: 0.62rem;
  }

  .deck-sort-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .card-library {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: clamp(200px, calc((100vw - 50px) * 0.75), 460px);
    gap: 8px;
    align-items: stretch;
    min-height: clamp(200px, calc((100vw - 50px) * 0.75), 460px);
    max-height: min(70vh, 680px);
    padding-right: 0;
  }

  .card-library .deck-edit-card {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    min-height: 0;
    align-self: stretch;
    position: relative;
    background: #05070b;
    filter: none;
  }

  .card-library .deck-edit-card-inner {
    position: absolute;
    inset: 0;
    min-height: 100%;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 4px;
    padding: 6px;
    background: none;
    pointer-events: none;
  }

  .card-library .deck-card-mobile-face {
    position: absolute;
    inset: 0;
    display: block;
    overflow: hidden;
    border-radius: inherit;
    color: #07080b;
    font-family: "Hiragino Mincho ProN", "Yu Mincho", "Times New Roman", serif;
    font-feature-settings: "palt";
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.72), 0 0 5px rgba(255, 255, 255, 0.42);
    pointer-events: none;
  }

  .card-library .deck-card-mobile-face::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background: var(--card-image) center / cover no-repeat;
  }

  .card-library .deck-card-mobile-face::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 28%, rgba(255, 255, 255, 0.1) 83%, rgba(255, 255, 255, 0.22)),
      linear-gradient(180deg, rgba(0, 0, 0, 0.04), transparent 35%, rgba(0, 0, 0, 0.1));
  }

  .card-library .deck-card-mobile-frame {
    position: absolute;
    inset: 0;
    z-index: 3;
    background: url("assets/ui/deck-card-frame-mobile.png") center / 100% 100% no-repeat;
  }

  .card-library .deck-card-mobile-cost,
  .card-library .deck-card-mobile-name,
  .card-library .deck-card-mobile-type,
  .card-library .deck-card-mobile-element,
  .card-library .deck-card-mobile-effect,
  .card-library .deck-card-mobile-stats {
    position: absolute;
    z-index: 4;
  }

  .card-library .deck-card-mobile-cost {
    top: 7.8%;
    left: 6.4%;
    width: 9%;
    color: #07080b;
    font-size: 1.24rem;
    font-weight: 900;
    line-height: 1;
    text-align: center;
  }

  .card-library .deck-card-mobile-name {
    top: 4.4%;
    left: 21.8%;
    right: 18.6%;
    min-height: 8.2%;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: 1px 5px 2px;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 5px;
    color: #07080b;
    background: rgba(238, 244, 248, 0.32);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38), 0 1px 4px rgba(0, 0, 0, 0.1);
    -webkit-backdrop-filter: blur(0.55px);
    backdrop-filter: blur(0.55px);
    font-size: 0.82rem;
    font-weight: 900;
    line-height: 1.05;
    text-align: center;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.78), 0 0 6px rgba(255, 255, 255, 0.55);
  }

  .card-library .deck-card-mobile-name span {
    display: -webkit-box;
    overflow: hidden;
    text-align: center;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .card-library .deck-card-mobile-name.is-compact {
    font-size: 0.62rem;
    line-height: 1.08;
  }

  .card-library .deck-card-mobile-type {
    top: 13.2%;
    left: 32.8%;
    right: 32.2%;
    min-height: 4.5%;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: 1px 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    color: #07080b;
    background: rgba(238, 244, 248, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 1px 3px rgba(0, 0, 0, 0.08);
    -webkit-backdrop-filter: blur(0.3px);
    backdrop-filter: blur(0.3px);
    font-size: 0.56rem;
    font-weight: 900;
    line-height: 1.05;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.78), 0 0 5px rgba(255, 255, 255, 0.55);
  }

  .card-library .deck-card-mobile-element {
    top: 5%;
    right: 7%;
    width: 8.8%;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background:
      radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.78), transparent 25%),
      radial-gradient(circle at 50% 55%, color-mix(in srgb, var(--element) 72%, #ffffff), color-mix(in srgb, var(--element) 76%, #05070b) 68%);
    font-family: serif;
    font-size: 0.7rem;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.82);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.54), 0 1px 5px rgba(0, 0, 0, 0.38);
  }

  .card-library .deck-card-mobile-effect {
    top: 63.5%;
    left: 8.9%;
    right: 8.8%;
    height: 20.1%;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    align-content: start;
    gap: 2px;
    overflow: hidden;
    padding: 4px 6px 3px;
    border: 1px solid rgba(255, 255, 255, 0.46);
    border-radius: 4px;
    color: #07080b;
    background: rgba(238, 244, 248, 0.7);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.62), 0 1px 6px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(1.5px);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.58);
  }

  .card-library .deck-card-mobile-effect strong {
    overflow: hidden;
    font-size: 0.62rem;
    font-weight: 900;
    line-height: 1.06;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .card-library .deck-card-mobile-effect span {
    display: -webkit-box;
    overflow: hidden;
    font-family: ui-sans-serif, system-ui, sans-serif;
    font-size: 0.5rem;
    font-weight: 900;
    line-height: 1.14;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
  }

  .card-library .deck-card-mobile-stats {
    left: 0;
    right: 0;
    bottom: 4.05%;
    height: 5.2%;
    font-family: "Hiragino Mincho ProN", "Yu Mincho", "Times New Roman", serif;
    font-variant-numeric: tabular-nums;
  }

  .card-library .deck-card-mobile-stat {
    position: absolute;
    top: 50%;
    width: 8%;
    transform: translate(-50%, -50%);
    color: #07080b;
    font-size: 0.74rem;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.82), 0 0 4px rgba(255, 255, 255, 0.48);
  }

  .card-library .deck-card-mobile-stat:nth-child(1) {
    left: 28.5%;
  }

  .card-library .deck-card-mobile-stat:nth-child(2) {
    left: 56.3%;
  }

  .card-library .deck-card-mobile-stat:nth-child(3) {
    left: 86.4%;
  }

  .deck-list .deck-edit-card {
    min-height: 122px;
  }

  .deck-list .deck-edit-card-inner {
    min-height: 122px;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    align-items: stretch;
  }

  .deck-card-top {
    gap: 4px;
    font-size: 0.62rem;
    line-height: 1.15;
  }

  .card-library .deck-card-top,
  .card-library .deck-card-id,
  .card-library .deck-card-kind,
  .card-library .deck-card-mode-btn,
  .card-library .deck-card-name,
  .card-library .deck-card-skill,
  .card-library .deck-card-stats,
  .card-library .deck-card-meta,
  .card-library .deck-card-count {
    display: none;
  }

  .card-library .deck-card-library-status,
  .card-library .deck-card-library-skill {
    min-width: 0;
    display: grid;
    gap: 1px;
    padding: 4px 5px;
    border: 1px solid rgba(246, 200, 95, 0.28);
    border-radius: 7px;
    background: rgba(5, 7, 11, 0.72);
    color: rgba(246, 242, 233, 0.92);
    overflow: hidden;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
  }

  .card-library .deck-card-library-status {
    align-self: start;
  }

  .card-library .deck-card-library-status strong {
    display: -webkit-box;
    overflow: hidden;
    color: #fff;
    font-size: clamp(0.58rem, 2.3vw, 0.7rem);
    line-height: 1.08;
    text-overflow: ellipsis;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .card-library .deck-card-library-status span {
    overflow: hidden;
    font-size: clamp(0.48rem, 1.85vw, 0.56rem);
    font-weight: 900;
    line-height: 1.08;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .card-library .deck-card-library-no {
    color: var(--gold);
  }

  .card-library .deck-card-library-stats {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
  }

  .deck-card-mode-btn {
    min-width: 48px;
    min-height: 22px;
    padding-inline: 6px;
    font-size: 0.58rem;
  }

  .deck-card-name {
    font-size: 0.78rem;
  }

  .card-library .deck-card-library-skill {
    align-self: end;
  }

  .card-library .deck-card-library-skill strong {
    overflow: hidden;
    color: var(--gold);
    font-size: clamp(0.48rem, 1.85vw, 0.58rem);
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .card-library .deck-card-library-skill span {
    display: -webkit-box;
    overflow: hidden;
    color: rgba(246, 242, 233, 0.92);
    font-size: clamp(0.42rem, 1.6vw, 0.52rem);
    font-weight: 800;
    line-height: 1.08;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
  }

  .deck-card-skill strong {
    font-size: 0.68rem;
  }

  .deck-card-skill span {
    font-size: 0.58rem;
    -webkit-line-clamp: 3;
  }

  .deck-list .deck-card-skill span {
    -webkit-line-clamp: 2;
  }

  .deck-card-bottom {
    gap: 5px;
    font-size: 0.6rem;
    line-height: 1.15;
    flex-wrap: nowrap;
  }

  .deck-card-stats {
    align-items: center;
  }

  .deck-card-stat-line {
    gap: 4px;
    overflow: visible;
    font-size: clamp(0.5rem, 2.1vw, 0.62rem);
  }

  .deck-card-count {
    min-width: 30px;
    padding: 2px 5px;
    font-size: 0.6rem;
  }

  .deck-card-meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .lp-target {
    font-size: 0.78rem;
  }

  .hand-row .game-card {
    flex-basis: 134px;
    min-height: 210px;
  }

  .hand-dock {
    width: 190px;
  }

  .hand-dock:hover,
  .hand-dock:focus-within,
  .hand-dock.is-open {
    height: 258px;
    width: calc(100vw - 16px);
  }

  .reward-cards,
  .choice-cards {
    grid-template-columns: 1fr;
  }

  .reward-actions {
    grid-template-columns: 1fr;
  }
}

/* ===================== STORY MODE (ADV) ===================== */
.story-view {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  flex-direction: column;
  background: #04050b;
  color: var(--text);
  overflow: hidden;
}

.story-view.hidden {
  display: none;
}

.story-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.story-bg {
  position: absolute;
  inset: 0;
  transition: background 0.45s ease;
}

.story-sprites {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.story-sprite {
  position: absolute;
  bottom: 0;
  width: clamp(180px, 28vw, 360px);
  height: clamp(260px, 78%, 620px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: filter 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.55));
}

.story-sprite.pos-left {
  left: 4%;
}

.story-sprite.pos-center {
  left: 50%;
  transform: translateX(-50%);
}

.story-sprite.pos-right {
  right: 4%;
}

.story-sprite.is-dim {
  filter: brightness(0.55) saturate(0.7);
  opacity: 0.82;
}

.story-sprite-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 14px;
}

.story-sprite-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 18px 18px 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 18px 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom: none;
}

.story-cg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.story-cg.hidden {
  display: none;
}

.story-cg-label {
  font-size: clamp(1.4rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.7);
}

.story-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(8, 10, 18, 0.62);
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.story-close:hover {
  background: rgba(30, 36, 56, 0.85);
}

.story-choices {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  background: rgba(4, 5, 11, 0.45);
}

.story-choices.hidden {
  display: none;
}

.story-choice-button {
  min-width: min(440px, 84vw);
  padding: 16px 24px;
  border-radius: 12px;
  border: 1px solid rgba(126, 162, 255, 0.55);
  background: rgba(16, 22, 42, 0.92);
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.story-choice-button:hover {
  transform: translateY(-2px);
  background: rgba(36, 48, 86, 0.96);
  border-color: rgba(170, 196, 255, 0.9);
}

.story-dialogue {
  position: relative;
  flex: 0 0 auto;
  min-height: 132px;
  margin: 0 auto 18px;
  width: min(960px, 94%);
  padding: 18px 26px 22px;
  border-radius: 16px;
  border: 1px solid rgba(126, 162, 255, 0.3);
  background: rgba(6, 9, 18, 0.86);
  box-shadow: 0 -6px 30px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  outline: none;
}

.story-dialogue:focus-visible {
  border-color: rgba(170, 196, 255, 0.8);
}

.story-name-plate {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 16px;
  border-radius: 8px;
  background: linear-gradient(120deg, #2a5cff, #7e3dff);
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 0.98rem;
}

.story-name-plate.is-empty {
  display: none;
}

.story-text {
  margin: 0;
  font-size: clamp(1rem, 2.4vw, 1.18rem);
  line-height: 1.7;
  min-height: 1.7em;
}

.story-advance {
  position: absolute;
  right: 18px;
  bottom: 10px;
  font-size: 0.9rem;
  color: rgba(170, 196, 255, 0.9);
  opacity: 0;
}

.story-advance.is-ready {
  opacity: 1;
  animation: story-advance-bounce 1s ease-in-out infinite;
}

@keyframes story-advance-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

/* ----- novel mode (full-screen long text) ----- */
.story-dialogue.hidden {
  display: none;
}

.story-novel {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(28px, 7vh, 84px) clamp(20px, 8vw, 120px);
  background: linear-gradient(180deg, rgba(3, 4, 9, 0.9) 0%, rgba(3, 4, 9, 0.8) 100%);
  cursor: pointer;
}

.story-novel.hidden {
  display: none;
}

.story-novel-inner {
  width: min(820px, 100%);
  max-height: 100%;
  overflow-y: auto;
}

.story-novel-name {
  display: inline-block;
  margin-bottom: 18px;
  padding: 5px 18px;
  border-radius: 8px;
  background: linear-gradient(120deg, #2a5cff, #7e3dff);
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 1rem;
}

.story-novel-name.is-empty {
  display: none;
}

.story-novel-text {
  margin: 0;
  font-size: clamp(1.05rem, 2.6vw, 1.5rem);
  line-height: 2;
  white-space: pre-wrap;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.65);
}

.story-novel-advance {
  right: 24px;
  bottom: 18px;
}

.story-controls {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 5;
  display: flex;
  gap: 8px;
}

.story-ctrl-btn {
  min-width: 52px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(8, 10, 18, 0.62);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.story-ctrl-btn:hover {
  background: rgba(30, 36, 56, 0.85);
}

.story-ctrl-btn.is-on {
  background: linear-gradient(120deg, #2a5cff, #7e3dff);
  border-color: transparent;
  color: #fff;
}

.story-resume {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 5, 11, 0.72);
  backdrop-filter: blur(6px);
}

.story-resume-card {
  width: min(420px, 88vw);
  padding: 28px 26px;
  border-radius: 16px;
  border: 1px solid rgba(126, 162, 255, 0.4);
  background: rgba(10, 14, 26, 0.96);
  text-align: center;
}

.story-resume-eyebrow {
  margin: 0 0 6px;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: rgba(170, 196, 255, 0.85);
}

.story-resume-title {
  margin: 0 0 20px;
  font-size: 1.1rem;
  font-weight: 700;
}

.story-resume-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.story-resume-actions button {
  flex: 1;
  max-width: 170px;
  padding: 13px 16px;
  border-radius: 11px;
  border: 1px solid rgba(126, 162, 255, 0.45);
  background: rgba(20, 26, 46, 0.92);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.story-resume-actions button:hover {
  background: rgba(40, 52, 92, 0.95);
}

.story-resume-actions .story-resume-primary {
  background: linear-gradient(120deg, #2a5cff, #7e3dff);
  border-color: transparent;
}

.story-backlog {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  background: rgba(4, 5, 11, 0.92);
  backdrop-filter: blur(8px);
}

.story-backlog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid rgba(126, 162, 255, 0.25);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.story-backlog-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px 30px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(960px, 100%);
  margin: 0 auto;
}

.story-backlog-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
}

.story-backlog-name {
  display: inline-block;
  margin-bottom: 5px;
  padding: 2px 12px;
  border-radius: 7px;
  background: linear-gradient(120deg, #2a5cff, #7e3dff);
  font-size: 0.85rem;
  font-weight: 700;
}

.story-backlog-text {
  margin: 0;
  font-size: 1rem;
  line-height: 1.65;
  color: rgba(232, 236, 251, 0.92);
}

.story-backlog.hidden,
.story-resume.hidden {
  display: none;
}

.story-battle-note {
  margin: 0 0 4px;
  font-size: 0.78rem;
  color: rgba(170, 196, 255, 0.75);
  line-height: 1.5;
}

/* ----- in-game story select menu ----- */
.story-select {
  position: fixed;
  inset: 0;
  z-index: 94;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 20%, rgba(30, 40, 80, 0.92), rgba(4, 5, 11, 0.96));
  backdrop-filter: blur(6px);
}

.story-select.hidden {
  display: none;
}

.story-select-panel {
  width: min(720px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: rgba(10, 14, 28, 0.92);
  border: 1px solid rgba(126, 162, 255, 0.28);
  border-radius: 18px;
  padding: 24px 26px 28px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
}

.story-select-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.story-select-head h2 {
  margin: 4px 0 0;
  font-size: 1.4rem;
}

.story-select-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.story-select-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 18px 22px;
  border-radius: 14px;
  border: 1px solid rgba(126, 162, 255, 0.3);
  background: rgba(18, 24, 44, 0.9);
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.story-select-item:hover {
  transform: translateY(-2px);
  background: rgba(36, 48, 86, 0.96);
  border-color: rgba(170, 196, 255, 0.9);
}

.story-select-item-badge {
  flex: 0 0 auto;
  padding: 3px 12px;
  border-radius: 999px;
  background: linear-gradient(120deg, #2a5cff, #7e3dff);
  font-size: 0.74rem;
  font-weight: 700;
}

.story-select-empty {
  color: var(--muted, #9aa6c7);
  text-align: center;
  padding: 30px 0;
}

/* =========================================================
 * Battle FX（fx.js が生成するレイヤーと演出）
 * ========================================================= */

#fxVignette,
#fxLayer,
#fxBannerLayer,
#fxResultLayer,
#fxCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#fxVignette {
  z-index: 58;
  opacity: 0;
}

#fxVignette.is-damage {
  background: radial-gradient(ellipse at center, transparent 46%, rgba(255, 48, 48, 0.38) 100%);
  animation: fxVignetteFlash 520ms ease-out forwards;
}

#fxVignette.is-heal {
  background: radial-gradient(ellipse at center, transparent 52%, rgba(115, 216, 138, 0.3) 100%);
  animation: fxVignetteFlash 560ms ease-out forwards;
}

#fxVignette.is-gold {
  background: radial-gradient(ellipse at center, transparent 52%, rgba(246, 200, 95, 0.3) 100%);
  animation: fxVignetteFlash 560ms ease-out forwards;
}

#fxLayer {
  z-index: 60;
}

#fxBannerLayer {
  z-index: 96;
}

#fxResultLayer {
  z-index: 105;
}

#fxCanvas {
  z-index: 106;
  width: 100vw;
  height: 100vh;
}

@keyframes fxVignetteFlash {
  0% {
    opacity: 0;
  }
  16% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* ---- 衝撃波 / 斬撃 / 閃光 ---- */

.fx-shockwave {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 3px solid var(--fx-color, var(--gold));
  border-radius: 999px;
  transform: translate(-50%, -50%);
  box-shadow:
    0 0 18px var(--fx-color, var(--gold)),
    inset 0 0 12px var(--fx-color, var(--gold));
  animation: fxShockwave var(--fx-duration, 460ms) cubic-bezier(0.16, 0.84, 0.3, 1) forwards;
}

@keyframes fxShockwave {
  0% {
    width: 14px;
    height: 14px;
    opacity: 0.95;
    border-width: 4px;
  }
  100% {
    width: var(--fx-size, 150px);
    height: var(--fx-size, 150px);
    opacity: 0;
    border-width: 1px;
  }
}

.fx-slash {
  position: absolute;
  width: var(--fx-length, 170px);
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    transparent,
    #fff 32%,
    var(--fx-color, var(--gold)) 50%,
    #fff 68%,
    transparent
  );
  transform: translate(-50%, -50%) rotate(var(--fx-angle, -32deg)) scaleX(0);
  filter: drop-shadow(0 0 9px var(--fx-color, var(--gold)));
  animation: fxSlash 300ms cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

@keyframes fxSlash {
  0% {
    transform: translate(-50%, -50%) rotate(var(--fx-angle, -32deg)) scaleX(0);
    opacity: 0;
  }
  16% {
    transform: translate(-50%, -50%) rotate(var(--fx-angle, -32deg)) scaleX(1.06);
    opacity: 1;
  }
  70% {
    transform: translate(-50%, -50%) rotate(var(--fx-angle, -32deg)) scaleX(1);
    opacity: 0.85;
  }
  100% {
    transform: translate(-50%, -50%) rotate(var(--fx-angle, -32deg)) scaleX(0.92);
    opacity: 0;
  }
}

.fx-impact-flash {
  position: absolute;
  width: var(--fx-size, 90px);
  height: var(--fx-size, 90px);
  border-radius: 999px;
  background: radial-gradient(circle, #fff 0 18%, var(--fx-color, #fff) 36%, transparent 70%);
  transform: translate(-50%, -50%) scale(0.3);
  mix-blend-mode: screen;
  animation: fxImpactFlash 340ms ease-out forwards;
}

@keyframes fxImpactFlash {
  0% {
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 0;
  }
  14% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.24);
    opacity: 0;
  }
}

/* ---- 攻撃中カード / 被弾リアクション ---- */

.fx-attacking {
  position: relative;
  z-index: 40;
  will-change: transform;
}

.hit-up {
  animation: fxHitUp 460ms cubic-bezier(0.2, 0.8, 0.3, 1);
}

.hit-down {
  animation: fxHitDown 460ms cubic-bezier(0.2, 0.8, 0.3, 1);
}

@keyframes fxHitUp {
  0% {
    transform: translate(0, 0);
    filter: brightness(1);
  }
  12% {
    transform: translate(-4px, -13px) rotate(-2.2deg);
    filter: brightness(2.3) saturate(0.5);
  }
  32% {
    transform: translate(4px, -7px) rotate(1.6deg);
    filter: brightness(1.5);
  }
  58% {
    transform: translate(-2px, -2px);
    filter: brightness(1.12);
  }
  100% {
    transform: translate(0, 0);
    filter: brightness(1);
  }
}

@keyframes fxHitDown {
  0% {
    transform: translate(0, 0);
    filter: brightness(1);
  }
  12% {
    transform: translate(4px, 13px) rotate(2.2deg);
    filter: brightness(2.3) saturate(0.5);
  }
  32% {
    transform: translate(-4px, 7px) rotate(-1.6deg);
    filter: brightness(1.5);
  }
  58% {
    transform: translate(2px, 2px);
    filter: brightness(1.12);
  }
  100% {
    transform: translate(0, 0);
    filter: brightness(1);
  }
}

/* ---- カード破壊 ---- */

.fx-card-death {
  pointer-events: none;
  overflow: hidden;
  animation: fxCardDeath 640ms cubic-bezier(0.5, 0, 0.78, 0.4) forwards;
}

@keyframes fxCardDeath {
  0% {
    opacity: 1;
    transform: scale(1);
    filter: brightness(1);
  }
  20% {
    transform: scale(1.05);
    filter: brightness(2.2) saturate(1.5);
  }
  52% {
    opacity: 1;
    transform: scale(1.02) skewX(2deg);
    filter: brightness(1.7) contrast(1.25);
  }
  100% {
    opacity: 0;
    transform: scale(0.84) translateY(12px);
    filter: brightness(2.6) blur(7px);
  }
}

/* ---- ターン / フェーズバナー ---- */

.fx-banner {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  --fx-banner-color: var(--gold);
}

.fx-banner.is-enemy {
  --fx-banner-color: #ff5f57;
}

.fx-banner-band {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: clamp(86px, 17vh, 150px);
  transform: translateY(-50%) skewY(-1.6deg) scaleY(1);
  background:
    linear-gradient(90deg, transparent, rgba(5, 8, 13, 0.92) 16% 84%, transparent),
    linear-gradient(180deg, transparent, rgba(5, 8, 13, 0.4));
  border-top: 1px solid color-mix(in srgb, var(--fx-banner-color) 70%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--fx-banner-color) 70%, transparent);
  box-shadow: 0 0 44px rgba(0, 0, 0, 0.5);
  transform-origin: center;
  animation: fxBannerBand 220ms cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

.fx-banner-inner {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 2px;
  animation: fxBannerText 360ms cubic-bezier(0.16, 0.9, 0.24, 1) 90ms both;
}

.fx-banner-text {
  color: var(--text);
  font-size: clamp(1.9rem, 6.4vw, 4rem);
  font-weight: 950;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  text-shadow:
    0 4px 0 rgba(0, 0, 0, 0.55),
    0 0 34px color-mix(in srgb, var(--fx-banner-color) 65%, transparent);
}

.fx-banner-sub {
  color: var(--fx-banner-color);
  font-size: clamp(0.74rem, 1.8vw, 0.95rem);
  font-weight: 900;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
}

.fx-banner.is-leaving .fx-banner-band {
  animation: fxBannerBandOut 230ms ease-in forwards;
}

.fx-banner.is-leaving .fx-banner-inner {
  animation: fxBannerTextOut 230ms ease-in forwards;
}

@keyframes fxBannerBand {
  from {
    transform: translateY(-50%) skewY(-1.6deg) scaleY(0.05);
    opacity: 0;
  }
  to {
    transform: translateY(-50%) skewY(-1.6deg) scaleY(1);
    opacity: 1;
  }
}

@keyframes fxBannerBandOut {
  to {
    transform: translateY(-50%) skewY(-1.6deg) scaleY(0.05);
    opacity: 0;
  }
}

@keyframes fxBannerText {
  from {
    transform: translateX(-72px);
    opacity: 0;
    filter: blur(7px);
  }
  to {
    transform: translateX(0);
    opacity: 1;
    filter: blur(0);
  }
}

@keyframes fxBannerTextOut {
  to {
    transform: translateX(64px);
    opacity: 0;
    filter: blur(6px);
  }
}

/* ---- スキルカットイン ---- */

.fx-cutin {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
}

.fx-cutin-bg {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(100deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 56px),
    linear-gradient(100deg, transparent 6%, rgba(3, 5, 9, 0.82) 26% 74%, transparent 94%);
  animation: fxCutinBg 280ms ease both;
}

.fx-cutin-panel {
  position: relative;
  display: flex;
  width: min(740px, 94vw);
  height: clamp(170px, 30vh, 250px);
  overflow: hidden;
  border: 2px solid var(--fx-color, var(--gold));
  background: linear-gradient(115deg, #11141b 0%, #1a2029 58%, #11141b 100%);
  clip-path: polygon(4% 0, 100% 0, 96% 100%, 0 100%);
  box-shadow:
    0 26px 60px rgba(0, 0, 0, 0.6),
    0 0 38px color-mix(in srgb, var(--fx-color, var(--gold)) 36%, transparent);
  animation: fxCutinIn 430ms cubic-bezier(0.16, 0.92, 0.24, 1) both;
}

.fx-cutin-art {
  flex: 0 0 44%;
  background-size: cover;
  background-position: center 18%;
  clip-path: polygon(0 0, 100% 0, 86% 100%, 0 100%);
  filter: saturate(1.12);
  animation: fxCutinArt 1300ms ease-out both;
}

.fx-cutin-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  padding: 14px 22px;
  min-width: 0;
}

.fx-cutin-label {
  color: var(--fx-color, var(--gold));
  font-size: clamp(0.72rem, 1.8vw, 0.9rem);
  font-weight: 950;
  letter-spacing: 0.34em;
}

.fx-cutin-name {
  color: var(--text);
  font-size: clamp(1.3rem, 4.4vw, 2.3rem);
  font-weight: 950;
  line-height: 1.1;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.5);
}

.fx-cutin-skill {
  color: var(--muted);
  font-size: clamp(0.78rem, 2vw, 0.95rem);
  font-weight: 700;
}

.fx-cutin.is-leaving .fx-cutin-panel {
  animation: fxCutinOut 250ms cubic-bezier(0.6, 0, 0.8, 0.4) forwards;
}

.fx-cutin.is-leaving .fx-cutin-bg {
  animation: fxCutinBgOut 250ms ease forwards;
}

@keyframes fxCutinBg {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fxCutinBgOut {
  to {
    opacity: 0;
  }
}

@keyframes fxCutinIn {
  from {
    transform: translateX(-112vw) skewX(-4deg);
  }
  60% {
    transform: translateX(2.4vw) skewX(0);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes fxCutinOut {
  to {
    transform: translateX(112vw) skewX(4deg);
  }
}

@keyframes fxCutinArt {
  from {
    transform: scale(1.16);
  }
  to {
    transform: scale(1);
  }
}

/* ---- 勝敗演出 ---- */

.fx-result {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
}

.fx-result-dim {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 9, 0.68);
  backdrop-filter: blur(3px);
  animation: fxCutinBg 300ms ease both;
}

.fx-result-rays {
  position: absolute;
  inset: -40%;
  opacity: 0;
}

.fx-result.is-win .fx-result-rays {
  background: repeating-conic-gradient(
    from 0deg,
    rgba(246, 200, 95, 0.14) 0 6deg,
    transparent 6deg 17deg
  );
  mask-image: radial-gradient(circle, #000 0 18%, transparent 42%);
  -webkit-mask-image: radial-gradient(circle, #000 0 18%, transparent 42%);
  animation: fxResultRays 2400ms linear 280ms both;
}

.fx-result-copy {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 10px;
}

.fx-result-text {
  font-size: clamp(2.7rem, 11vw, 6.8rem);
  font-weight: 950;
  letter-spacing: 0.13em;
  text-indent: 0.13em;
  line-height: 1;
}

.fx-result.is-win .fx-result-text {
  background: linear-gradient(180deg, #fff6d8 8%, var(--gold) 46%, #b07c1c 88%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 0 rgba(60, 36, 4, 0.85)) drop-shadow(0 0 40px rgba(246, 200, 95, 0.4));
  animation: fxResultSlam 520ms cubic-bezier(0.2, 1.1, 0.3, 1) 240ms both;
}

.fx-result.is-lose .fx-result-text {
  background: linear-gradient(180deg, #d7e2f2 6%, #7c8aa4 52%, #39414f 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 0 rgba(8, 10, 16, 0.9));
  animation: fxResultSink 760ms cubic-bezier(0.2, 0.7, 0.3, 1) 240ms both;
}

.fx-result-sub {
  color: var(--text);
  font-size: clamp(0.86rem, 2.4vw, 1.2rem);
  font-weight: 900;
  letter-spacing: 0.52em;
  text-indent: 0.52em;
  opacity: 0.88;
  animation: fxBannerText 420ms ease 520ms both;
}

.fx-result.is-leaving {
  animation: fxResultLeave 330ms ease forwards;
}

@keyframes fxResultRays {
  0% {
    opacity: 0;
    transform: rotate(0deg);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0.85;
    transform: rotate(26deg);
  }
}

@keyframes fxResultSlam {
  0% {
    transform: scale(2.5);
    opacity: 0;
  }
  52% {
    transform: scale(0.94);
    opacity: 1;
  }
  74% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fxResultSink {
  0% {
    transform: translateY(-46px);
    opacity: 0;
    filter: blur(9px);
  }
  100% {
    transform: translateY(0);
    opacity: 1;
    filter: blur(0);
  }
}

@keyframes fxResultLeave {
  to {
    opacity: 0;
  }
}

/* ---- LP危機ビネット ---- */

body.fx-danger::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 56%, rgba(255, 40, 40, 0.24) 100%);
  animation: fxDangerPulse 1.7s ease-in-out infinite;
}

@keyframes fxDangerPulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}

/* ---- reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
  #fxCanvas,
  #fxLayer,
  #fxVignette {
    display: none;
  }

  .fx-banner-band,
  .fx-banner-inner,
  .fx-cutin-panel,
  .fx-cutin-bg,
  .fx-cutin-art,
  .fx-result-text,
  .fx-result-sub,
  .fx-result-rays {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
  }

  .hit-up,
  .hit-down,
  .fx-card-death {
    animation: none;
  }

  body.fx-danger::after {
    animation: none;
    opacity: 0.5;
  }
}
