﻿:root {
  color-scheme: light;
  --visual-viewport-height: 100dvh;
  --solo-browser-reserve: clamp(46px, 9dvh, 86px);
  --ink: #1c2430;
  --muted: #667085;
  --line: #d8dee8;
  --paper: #f7f8fb;
  --panel: #ffffff;
  --red: #d63f3f;
  --green: #2f8a57;
  --blue: #2876c7;
  --purple: #8060b8;
  --black: #22262e;
  --yellow: #d6a325;
  --accent: #136f63;
  --shadow: 0 18px 45px rgba(28, 36, 48, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(19, 111, 99, 0.08), rgba(247, 248, 251, 0) 320px),
    var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  min-height: 100vh;
  padding: 18px;
}

.app-locked {
  display: none;
}

.auth-screen {
  min-height: 100vh;
  padding: 18px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(19, 111, 99, 0.08), rgba(247, 248, 251, 0) 320px),
    var(--paper);
}

.auth-screen.hidden {
  display: none;
}

.auth-panel {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  gap: 16px;
}

.auth-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.auth-message {
  min-height: 1.3em;
  color: #b42318;
  font-size: 0.86rem;
  font-weight: 800;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 1480px;
  margin: 0 auto 16px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.solo-header-toggle {
  display: none;
  position: fixed;
  z-index: 60;
  top: 8px;
  left: 8px;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.3rem, 2.2vw, 2.15rem);
  line-height: 1.12;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.icon-button,
.small-button,
.tab {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  font-size: 1.25rem;
  font-weight: 800;
}

.icon-button:hover,
.small-button:hover,
.tab:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.file-button input {
  display: none;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(540px, 40vw) minmax(0, 1fr);
  gap: 16px;
  max-width: 1840px;
  margin: 0 auto;
}

.home-screen,
.manager-screen,
.solo-screen {
  max-width: 1480px;
  margin: 0 auto;
}

.home-hero {
  min-height: 62vh;
  display: grid;
  align-content: center;
  gap: 18px;
}

.home-hero h2 {
  font-size: clamp(1.8rem, 4vw, 3.3rem);
  line-height: 1.08;
}

.home-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.format-chooser {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(2, minmax(150px, 220px)) auto;
  align-items: center;
  gap: 10px;
}

.format-chooser h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.format-chooser p,
.format-choice span {
  color: var(--muted);
  font-size: 0.8rem;
}

.format-choice {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  padding: 10px 12px;
  display: grid;
  gap: 2px;
  cursor: pointer;
}

.format-choice.active {
  border-color: var(--accent);
  background: #eef8f5;
}

.home-action {
  min-height: 138px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-align: left;
  padding: 16px;
  display: grid;
  align-content: space-between;
  gap: 10px;
}

.home-action strong {
  font-size: 1.12rem;
}

.home-action span,
.empty-state {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.manager-panel,
.solo-panel {
  padding: 16px;
}

.saved-deck-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.saved-deck-card {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.saved-deck-card h3 {
  font-size: 1rem;
}

.saved-deck-card p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
}

.saved-deck-actions,
.solo-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.solo-toolbar .small-button {
  flex: 1 1 84px;
}

.solo-notice {
  border: 1px solid rgba(19, 111, 99, 0.24);
  border-radius: 8px;
  background: #eef8f6;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 800;
  min-height: 42px;
  padding: 10px 12px;
}

.saved-deck-actions button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafb;
  font-weight: 800;
}

.card-list-only {
  grid-column: 1 / -1;
  position: static;
  max-height: none;
}

.card-list-only .card-list {
  padding-bottom: 150px;
  scroll-padding-bottom: 150px;
}

.solo-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.solo-zones {
  display: grid;
  gap: 16px;
}

.solo-setup {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
  margin-top: 14px;
}

.solo-setup label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.solo-note {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.84rem;
}

.solo-game {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.battlefield {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.playmat {
  position: relative;
  border: 2px solid #e34747;
  border-radius: 8px;
  background: #f7f8fb;
  padding: 8px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 210px 76px;
  grid-template-rows: auto minmax(150px, 1fr) 100px 116px;
  grid-template-areas:
    "header header header header"
    "life character center trash"
    "don cost cost trash"
    "hand hand hand hand";
  gap: 6px;
  min-height: calc(100vh - 210px);
}

.opponent-board .playmat,
.playmat.opponent-board {
  background: #fbfbfd;
}

.opponent-board .playmat {
  grid-template-areas:
    "header header header header"
    "hand hand hand hand"
    "don cost cost trash"
    "life character center trash";
}

.playmat.active-turn {
  box-shadow: 0 0 0 4px rgba(19, 111, 99, 0.18);
}

.playmat-header {
  grid-area: header;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.playmat-header span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.life-area,
.character-area,
.center-area,
.cost-area,
.don-deck-area,
.trash-slot,
.hand-area {
  border: 1px dashed #d88;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.75);
  padding: 5px;
}

.life-area {
  grid-area: life;
  display: grid;
  align-content: start;
  gap: 8px;
  position: relative;
}

.character-area {
  grid-area: character;
  min-height: 150px;
  overflow: auto;
}

.center-area {
  grid-area: center;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  gap: 5px;
  overflow: visible;
}

.cost-area {
  grid-area: cost;
}

.don-deck-area {
  grid-area: don;
  display: grid;
  align-content: start;
  gap: 6px;
}

.trash-slot {
  grid-area: trash;
  display: grid;
  align-content: start;
  gap: 6px;
}

.hand-area {
  grid-area: hand;
  overflow: auto;
}

.life-area h3,
.character-area h3,
.center-area h3,
.cost-area h3,
.don-deck-area h3,
.trash-slot h3,
.hand-area h3 {
  color: var(--muted);
  font-size: 0.62rem;
  margin-bottom: 4px;
}

.life-stack {
  display: grid;
  justify-items: center;
  gap: 2px;
}

.life-stack span,
.deck-pile,
.don-deck-pile,
.don-row span,
.don-row button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 4px;
  font-size: 0.62rem;
  font-weight: 900;
  text-align: center;
}

.deck-pile {
  min-height: 78px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  position: relative;
}

.don-deck-pile {
  min-height: 70px;
  display: grid;
  place-items: center;
  position: relative;
  background: transparent;
  color: #fff;
}

.battle-card-grid,
.hand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 5px;
}

.battle-card,
.hand-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 4px;
  display: grid;
  gap: 3px;
  cursor: grab;
  position: relative;
}

.attached-don-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.88);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1;
}

.battle-card.rested {
  transform: rotate(90deg) scale(0.82);
  opacity: 0.82;
}

.leader-slot.leader-rested {
  transform: rotate(90deg) scale(0.82);
  transform-origin: center;
}

.leader-rested .battle-card-img {
  transform: none;
  opacity: 0.82;
}

.stage-rested .battle-card-img {
  transform: rotate(90deg) scale(0.82);
  opacity: 0.82;
}

.battle-card-img {
  width: 100%;
  aspect-ratio: 5 / 7;
  object-fit: contain;
  object-position: center;
  border-radius: 4px;
  background: #edf0f4;
}

.battle-card strong,
.hand-card strong,
.hand-card span {
  font-size: 0.56rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.battle-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.battle-actions button,
.life-area button,
.cost-area button,
.don-deck-pile,
.deck-pile {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 0.58rem;
  font-weight: 800;
}

.battle-actions button:disabled,
.life-area button:disabled,
.cost-area button:disabled,
.don-deck-pile:disabled,
.deck-pile:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.don-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, 34px);
  gap: 3px;
  justify-content: start;
}

.don-count-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 900;
}

.don-count-control input {
  width: 42px;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 4px;
  font: inherit;
  font-weight: 900;
}

.life-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
  justify-items: center;
  align-items: center;
  order: 2;
}

.life-stack .card-back-object + .card-back-object {
  margin-top: -24px;
}

.life-area h3 {
  order: 1;
}

.life-area > button {
  order: 3;
}

.life-area > .life-stack .card-back-object {
  width: 38px;
  flex: 0 0 auto;
}

.life-card-object.face-up {
  aspect-ratio: 5 / 7;
  overflow: hidden;
}

.life-card-object.face-up .life-face-img {
  position: static;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: none;
}

.card-back-object {
  width: min(100%, 48px);
  aspect-ratio: 5 / 7;
  border-radius: 5px;
  box-shadow: 0 4px 8px rgba(15, 23, 42, 0.18);
  color: #fff;
  cursor: grab;
  display: grid;
  place-items: end center;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.card-back-object img,
.don-deck-pile img,
.don-row img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
}

.don-row img {
  object-fit: contain;
}

.don-deck-pile img {
  width: 100%;
  max-width: none;
  height: 100%;
  aspect-ratio: 5 / 7;
  object-fit: contain;
}

.card-back-object span,
.don-deck-pile span,
.deck-pile > .pile-count {
  position: absolute;
  right: 2px;
  bottom: 2px;
  background: rgba(15, 23, 42, 0.78);
  border-radius: 999px;
  font-size: 0.55rem;
  line-height: 1;
  max-width: 100%;
  overflow: hidden;
  padding: 2px 4px;
  text-overflow: ellipsis;
  white-space: nowrap;
  z-index: 3;
}

.life-count-badge {
  display: none;
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 18px;
  min-height: 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #25306a;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
  z-index: 4;
}

.drop-zone.drag-over {
  background: rgba(19, 111, 99, 0.14);
  outline: 3px solid rgba(19, 111, 99, 0.32);
  outline-offset: -3px;
}
.center-area .leader-slot,
.center-area .stage-slot,
.center-area .deck-slot {
  min-height: 0;
  margin: 0;
  display: grid;
  align-content: start;
  place-items: center;
  justify-self: center;
  position: relative;
  overflow: visible;
}

.center-area .battle-card-img {
  max-width: 54px;
  margin: 0 auto;
}

.center-area .battle-actions button {
  min-height: 22px;
}


.don-row span,
.don-row button {
  width: 34px;
  height: 48px;
  aspect-ratio: 5 / 7;
  display: grid;
  overflow: hidden;
  padding: 0;
  place-items: center;
}

.don-row span.rested,
.don-row button.rested {
  background: #d7dee8;
  box-shadow: inset 0 0 0 2px rgba(15, 23, 42, 0.2);
  transform: rotate(90deg) scale(0.82);
  transform-origin: center;
  overflow: visible;
  z-index: 1;
}

.don-row button.rested img {
  transform: none;
}

.solo-card-zone {
  margin-top: 8px;
  max-width: 180px;
}

.solo-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.solo-card-grid.compact {
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
}

.solo-card-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 6px;
  display: grid;
  gap: 6px;
  text-align: left;
}

.solo-card-button.readonly {
  cursor: default;
}

.solo-card-img {
  width: 100%;
  aspect-ratio: 5 / 7;
  object-fit: cover;
  object-position: top center;
  border-radius: 6px;
  background: #edf0f4;
}

.solo-card-button span {
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.panel,
.deck-surface {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.panel {
  border-radius: 8px;
}

.library-panel,
.curve-panel {
  padding: 14px;
}

.library-panel {
  position: sticky;
  top: 18px;
  align-self: start;
  height: calc(100vh - 36px);
  max-height: calc(100vh - 36px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-toggle {
  width: 100%;
}

.library-panel.filters-collapsed .filter-grid,
.library-panel.filters-collapsed .quick-colors {
  display: none;
}

.panel-heading,
.zone-heading,
.deck-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.heading-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.deck-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.format-select {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.format-select select {
  min-width: 150px;
}

.panel-heading h2,
.zone-heading h2 {
  font-size: 1rem;
}

.count-pill {
  min-width: 34px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: #eef4f2;
  color: var(--accent);
  font-weight: 800;
}

.search-box,
.filter-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.flow-hint {
  border: 1px solid #c8e0d9;
  border-radius: 8px;
  background: #eef8f5;
  color: #105c52;
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.4;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

input,
select {
  min-height: 36px;
  padding: 0 11px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.quick-colors {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.swatch-button {
  min-height: 32px;
  border: 2px solid transparent;
  border-radius: 8px;
  color: #fff;
  font-size: 0;
}

.swatch-button.active {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 2px #fff;
}

.card-list {
  flex: 1 1 auto;
  min-height: 520px;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 3px;
  padding-top: 10px;
  padding-bottom: 120px;
  scroll-padding-bottom: 120px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  align-content: start;
}

.builder-screen .library-panel .card-list,
.workspace:not(.hidden) .library-panel:not(.card-list-only) .card-list {
  min-height: 0;
  height: 100%;
}

.workspace:not(.hidden) .library-panel:not(.card-list-only) {
  min-height: 0;
}

.library-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 8px;
}

.deck-row {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 8px;
}

.deck-zone-heading {
  gap: 10px;
  align-items: center;
}

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

[data-deck-drag-handle] {
  cursor: grab;
}

[data-deck-drag-handle]:active {
  cursor: grabbing;
}

.library-card .mini-card {
  width: 100%;
  aspect-ratio: 5 / 7;
}

.library-card img,
.deck-row img,
.game-card img {
  -webkit-touch-callout: none;
  user-select: none;
}

.card-image-actions {
  display: flex;
  justify-content: center;
  margin-top: -2px;
}

.art-picker-button {
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--accent);
  font-weight: 900;
  font-size: 0.76rem;
  line-height: 1.1;
  -webkit-tap-highlight-color: transparent;
}

.art-picker-button:active,
.art-picker-button:focus,
.art-picker-button:focus-visible {
  outline: none;
  box-shadow: none;
  transform: none;
  filter: none;
}

.game-card .card-image-actions,
.deck-row-image .card-image-actions {
  padding: 4px 8px 0;
  margin-top: 0;
}

.game-card .art-picker-button,
.deck-row-image .art-picker-button {
  min-height: 28px;
  font-size: 0.72rem;
}

.mini-card {
  width: 74px;
  aspect-ratio: 5 / 7;
  border-radius: 7px;
  object-fit: cover;
  object-position: top center;
  background: #edf0f4;
  border: 0;
  display: block;
  overflow: hidden;
}

.fallback-card {
  padding: 5px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.fallback-card::after,
.game-card .card-art::after {
  content: "";
  position: absolute;
  inset: 22% 10%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45);
  transform: rotate(-18deg);
}

.fallback-card strong {
  font-size: 0.78rem;
}

.fallback-card span {
  align-self: flex-end;
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #111827;
  font-weight: 900;
}

.library-info {
  min-width: 0;
}

.library-info h3,
.deck-row h3 {
  font-size: 0.92rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.library-info p,
.deck-row p,
.zone-heading span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
}

.add-controls {
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  max-width: 100%;
}

.add-controls button,
.qty-control button {
  box-sizing: border-box;
  width: 38px;
  max-width: 100%;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f9fafb;
  font-weight: 900;
  line-height: 1.1;
  overflow: hidden;
  white-space: nowrap;
}

.add-controls button:only-child {
  width: min(100%, 58px);
  min-width: 0;
  padding: 0 6px;
}

.add-controls button:active,
.add-controls button:focus,
.add-controls button:focus-visible,
.qty-control button:active,
.qty-control button:focus,
.qty-control button:focus-visible {
  outline: none;
  box-shadow: none;
  transform: none;
  filter: none;
  background: #f9fafb;
}

#builderScreen .library-card,
#builderScreen .library-card *,
#builderScreen .mini-card,
#builderScreen .add-controls button,
#builderScreen .qty-control button {
  -webkit-tap-highlight-color: transparent;
  animation: none !important;
  transition: none !important;
}

#builderScreen .library-card,
#builderScreen .library-card:hover,
#builderScreen .library-card:active,
#builderScreen .library-card:focus,
#builderScreen .library-card:focus-visible,
#builderScreen .library-card:focus-within,
#builderScreen .mini-card,
#builderScreen .mini-card:hover,
#builderScreen .mini-card:active,
#builderScreen .mini-card:focus,
#builderScreen .mini-card:focus-visible {
  outline: none !important;
  box-shadow: none !important;
  filter: none !important;
  transform: none !important;
}

#builderScreen .add-controls button:hover,
#builderScreen .add-controls button:active,
#builderScreen .add-controls button:focus,
#builderScreen .add-controls button:focus-visible,
#builderScreen .qty-control button:hover,
#builderScreen .qty-control button:active,
#builderScreen .qty-control button:focus,
#builderScreen .qty-control button:focus-visible {
  outline: none !important;
  box-shadow: none !important;
  filter: none !important;
  transform: none !important;
  border-color: var(--line);
  background: #f9fafb;
}

.deck-surface {
  border-radius: 8px;
  overflow: hidden;
}

.deck-header {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(120deg, rgba(19, 111, 99, 0.11), rgba(214, 163, 37, 0.11)),
    #fff;
}

.deck-name {
  max-width: 560px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  font-size: clamp(1.35rem, 2vw, 2rem);
  font-weight: 900;
  padding-left: 0;
}

.deck-name:focus {
  outline: none;
  border-color: var(--accent);
}

.format-tabs {
  display: flex;
  padding: 3px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
}

.tab {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 7px;
  border: 0;
  background: transparent;
  font-weight: 800;
}

.tab.active {
  background: var(--accent);
  color: #fff;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.stat {
  min-height: 74px;
  border: 1px solid rgba(216, 222, 232, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  padding: 10px;
  display: grid;
  align-content: center;
  gap: 5px;
}

.stat span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.stat strong {
  font-size: 1.35rem;
}

.warnings {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  min-height: 0;
}

.warning {
  border-radius: 999px;
  background: #fff4e5;
  color: #8a4b00;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.builder-layout {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 330px);
  gap: 16px;
  padding: 16px;
}

.deck-zone {
  min-width: 0;
}

.leader-slot {
  min-height: 210px;
  margin: 10px 0 18px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(247, 248, 251, 0.72);
}

.leader-slot.empty::before {
  content: "リーダーカードを追加";
  color: var(--muted);
  font-weight: 800;
}

.leader-slot {
  position: relative;
}

.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.game-card {
  position: relative;
  min-height: 215px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(28, 36, 48, 0.08);
}

.deck-grid .game-card {
  padding-bottom: 44px;
}

.game-card .card-art {
  position: relative;
  height: 92px;
  background: var(--card-color);
  overflow: hidden;
}

.game-card .card-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.game-card.has-image .card-art {
  height: 168px;
  background: #edf0f4;
}

.game-card.has-image .card-art::after {
  display: none;
}

.game-card .card-meta,
.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 7px 8px 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.card-bottom {
  padding-right: 8px;
  padding-bottom: 4px;
}

.game-card h3 {
  min-height: 42px;
  padding: 6px 8px 0;
  font-size: 0.9rem;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.card-traits {
  min-height: 30px;
  padding: 4px 8px 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.2;
}

.cost-badge {
  min-width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
}

.card-actions {
  position: absolute;
  right: 7px;
  bottom: 7px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
}

.deck-grid .card-actions {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

.deck-row-image {
  display: grid;
  gap: 4px;
}

.deck-row-image .mini-card {
  width: 100%;
}

.card-actions button {
  width: 26px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: #eef4f2;
  color: var(--accent);
  font-weight: 900;
}

.card-actions strong {
  min-width: 22px;
  text-align: center;
  font-size: 0.82rem;
}

.deck-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.hidden {
  display: none !important;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qty-control strong {
  min-width: 24px;
  text-align: center;
}

.art-picker-panel {
  width: min(720px, calc(100vw - 24px));
  max-height: min(760px, calc(var(--visual-viewport-height, 100vh) - 36px));
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.24);
}

.art-picker-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.art-choice {
  display: grid;
  gap: 6px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.art-choice.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(16, 115, 100, 0.22);
}

.art-choice img {
  width: 100%;
  aspect-ratio: 5 / 7;
  object-fit: contain;
  border-radius: 7px;
  background: #edf0f4;
}

.art-choice span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.deck-drag-handle {
  cursor: grab;
  touch-action: none;
}

.deck-drag-handle:active {
  cursor: grabbing;
}

.card-image-preview-panel {
  width: min(420px, calc(100vw - 24px));
  max-height: min(760px, calc(var(--visual-viewport-height, 100vh) - 36px));
  overflow: auto;
  display: grid;
  gap: 10px;
  justify-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.24);
}

.card-image-preview-img {
  width: min(100%, 360px);
  aspect-ratio: 5 / 7;
  object-fit: contain;
  border-radius: 10px;
  background: #edf0f4;
}

.curve-panel {
  align-self: start;
  display: grid;
  gap: 14px;
}

.small-button {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 800;
}

.color-chart {
  display: grid;
  gap: 8px;
}

.color-line {
  display: grid;
  grid-template-columns: 74px 1fr 30px;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 800;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #edf0f4;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  background: var(--bar-color);
}

.curve-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.curve-bars {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  align-items: end;
  gap: 5px;
  min-height: 132px;
  padding-top: 10px;
}

.curve-bar {
  display: grid;
  align-items: end;
  gap: 5px;
  height: 120px;
  text-align: center;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.curve-bar span:first-child {
  min-height: 6px;
  border-radius: 6px 6px 2px 2px;
  background: var(--accent);
}

textarea {
  min-height: 220px;
  resize: vertical;
  padding: 10px;
  line-height: 1.5;
  font-family: Consolas, "Yu Gothic UI", monospace;
  font-size: 0.82rem;
}

@media (max-width: 1100px) {
  .workspace,
  .builder-layout {
    grid-template-columns: 1fr;
  }

  .library-panel {
    position: static;
    height: auto;
    max-height: none;
  }

  .card-list {
    min-height: 460px;
  }

  .battlefield {
    grid-template-columns: 1fr;
  }

  .playmat {
    grid-template-columns: 70px 1fr 96px;
    min-height: auto;
    grid-template-areas:
      "header header header"
      "life character trash"
      "don center trash"
      "cost cost cost"
      "hand hand hand";
  }

  .solo-setup {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 8px;
  }

  .topbar,
  .deck-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-end;
  }

  .stats-grid,
  .home-actions,
  .solo-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-grid {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .home-actions,
  .saved-deck-card {
    grid-template-columns: 1fr;
  }

  .format-chooser {
    grid-template-columns: 1fr;
  }

  .photo-deck-panel {
    width: 100%;
    max-height: calc(100dvh - 18px);
  }

  .photo-deck-layout {
    grid-template-columns: 1fr;
    max-height: calc(100dvh - 74px);
    overflow: auto;
    padding: 10px;
  }

  .photo-preview {
    min-height: 220px;
  }

  .photo-row {
    grid-template-columns: 60px 64px minmax(0, 1fr);
  }

  .photo-row label:nth-of-type(3),
  .photo-row button {
    grid-column: 1 / -1;
  }

  .photo-card-thumb {
    width: 56px;
    min-height: 78px;
  }

  .photo-card-thumb .mini-card {
    width: 52px;
    height: 74px;
  }

  .builder-layout,
  .deck-header {
    padding: 12px;
  }

  .deck-grid {
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  }

  .card-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    min-height: 56vh;
    padding-bottom: 96px;
  }

  #builderScreen .library-panel {
    max-height: none;
    overflow: visible;
  }

  #builderScreen .library-panel .card-list {
    flex: none;
    height: 42vh;
    min-height: 260px;
    max-height: 420px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 8px 72px;
    background: #f8fafc;
    -webkit-overflow-scrolling: touch;
  }

  #builderScreen .library-panel .panel-heading {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(255, 255, 255, 0.96);
    padding-bottom: 4px;
  }

  #cardListScreen .card-list {
    min-height: 56vh;
  }

  .card-list-only {
    padding: 12px;
  }

  .card-list-only .panel-heading {
    align-items: center;
    flex-direction: row;
  }

  .library-card,
  .deck-row {
    grid-template-columns: 64px 1fr;
  }

  .library-card {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 6px;
  }

  .library-info h3 {
    font-size: 0.9rem;
    line-height: 1.25;
  }

  .library-info p {
    font-size: 0.72rem;
    line-height: 1.35;
  }

  .mini-card {
    width: 64px;
  }

  .library-card .mini-card {
    width: 100%;
  }

  .add-controls,
  .qty-control {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
  }

  .solo-panel {
    padding: 8px;
  }

  .solo-toolbar {
    gap: 5px;
  }

  .battlefield {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .player-board {
    min-width: 920px;
  }
}

.zone-viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.48);
  padding: 18px;
}

.zone-viewer-modal.hidden {
  display: none;
}

.drop-placement-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: end center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.36);
}

.drop-placement-panel {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 14px;
}

.drop-placement-panel h2 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.drop-placement-actions {
  display: grid;
  gap: 8px;
}

.drop-placement-actions button,
.drop-placement-cancel {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--ink);
  font-weight: 900;
}

.drop-placement-actions button {
  background: #eef8f6;
  color: var(--accent);
}

.drop-placement-cancel {
  margin-top: 10px;
}

.custom-card-panel {
  width: min(720px, 94vw);
  max-height: 90vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}

.custom-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.custom-card-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

.custom-card-grid input,
.custom-card-grid select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-weight: 700;
}

.custom-card-message {
  min-height: 22px;
  padding: 0 16px;
  color: #b42318;
  font-weight: 800;
}

.custom-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 16px 16px;
}

.photo-deck-panel {
  width: min(1180px, 96vw);
  max-height: 92vh;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(12, 20, 30, 0.2);
}

.photo-deck-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(360px, 1.35fr);
  gap: 14px;
  padding: 14px;
  max-height: calc(92vh - 58px);
  overflow: hidden;
}

.photo-import-side,
.photo-result-side {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 12px;
}

.photo-import-side label,
.photo-result-side label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.photo-import-side input,
.photo-import-side textarea,
.photo-result-side input,
.photo-result-side select,
.photo-row input,
.photo-row select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  font: inherit;
}

.photo-import-side textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.55;
}

.photo-file-drop {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f6faf9;
}

.photo-preview {
  min-height: 300px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2f4;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.photo-preview img {
  display: block;
  width: 100%;
  max-width: none;
  border-radius: 6px;
}

.photo-actions,
.photo-import-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.photo-import-settings label {
  flex: 1 1 180px;
}

.photo-summary {
  min-height: 42px;
  border: 1px solid #b9ded8;
  border-radius: 8px;
  padding: 10px 12px;
  background: #eefaf7;
  color: var(--accent);
  font-weight: 800;
}

.photo-deck-rows {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
}

.photo-row {
  display: grid;
  grid-template-columns: 72px 72px minmax(160px, 1fr) minmax(220px, 1.15fr) auto auto;
  gap: 8px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.photo-card-thumb {
  width: 64px;
  min-height: 88px;
  display: grid;
  place-items: center;
}

.photo-card-thumb .mini-card {
  width: 58px;
  height: 82px;
  object-fit: cover;
}

.photo-actions-bottom {
  justify-content: flex-end;
}

.zone-viewer-panel {
  width: min(1120px, 96vw);
  max-height: 88vh;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.zone-viewer-head,
.zone-viewer-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.viewer-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.zone-viewer-title {
  font-size: 1rem;
}

.zone-viewer-controls {
  justify-content: flex-start;
  color: var(--muted);
  font-weight: 800;
}

.viewer-count-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.viewer-count-control input {
  width: 48px;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  font: inherit;
  font-weight: 900;
}

.zone-viewer-controls button,
.viewer-card-actions button {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-weight: 800;
}

.zone-viewer-controls button.active {
  background: var(--accent);
  color: #fff;
}

.zone-viewer-body {
  overflow: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
}

.viewer-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafb;
  padding: 6px;
  display: grid;
  gap: 6px;
}

.viewer-card[draggable="true"] {
  cursor: grab;
}

.viewer-card.drag-over {
  border-color: var(--accent);
  background: rgba(19, 111, 99, 0.08);
  box-shadow: inset 0 0 0 2px rgba(19, 111, 99, 0.18);
}

.viewer-card-face {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.viewer-card-face img,
.viewer-card-img {
  width: 100%;
  aspect-ratio: 5 / 7;
  object-fit: contain;
  object-position: center;
  border-radius: 6px;
  background: #edf0f4;
}

.viewer-card-name {
  min-height: 2.2em;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.viewer-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}
/* solo pile final sizing */
.deck-pile {
  min-height: 78px;
  cursor: pointer;
}

.don-deck-pile {
  min-height: 70px;
  cursor: pointer;
  padding: 4px;
}

.don-row button {
  cursor: pointer;
}

.touch-drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  transform: translate(-50%, -50%);
  opacity: 0.92;
  filter: drop-shadow(0 16px 24px rgba(15, 23, 42, 0.32));
  box-sizing: border-box;
  overflow: hidden;
  max-width: 96px;
  max-height: 136px;
}

.touch-drag-ghost img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: contain;
}

body.touch-dragging {
  user-select: none;
  -webkit-user-select: none;
}

/* desktop solo no-scroll layout */
@media (min-width: 1101px) {
  body.solo-active {
    overflow: hidden;
  }

  body.solo-active .solo-header-toggle {
    display: inline-flex;
  }

  body.solo-active:not(.solo-header-open) .topbar,
  body.solo-active:not(.solo-header-open) .solo-panel > .panel-heading {
    display: none;
  }

  body.solo-active.solo-header-open .topbar {
    max-width: none;
    min-height: 34px;
    margin: 0 0 6px;
    padding-left: 72px;
  }

  body.solo-active.solo-header-open .brand-block .eyebrow {
    display: none;
  }

  body.solo-active.solo-header-open .brand-block h1 {
    font-size: 1rem;
  }

  body.solo-active.solo-header-open .icon-button {
    width: 34px;
    min-height: 34px;
  }

  body.solo-active.solo-header-open .solo-panel {
    height: calc(100vh - 56px);
  }

  body.solo-active .app-shell {
    height: 100vh;
    overflow: hidden;
    padding: 8px;
  }

  body.solo-active .solo-screen {
    max-width: none;
    height: 100%;
    margin: 0;
  }

  body.solo-active .solo-panel {
    height: calc(100vh - 16px);
    padding: 8px;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    overflow: hidden;
  }

  body.solo-active .panel-heading {
    min-height: 30px;
    margin-bottom: 4px;
  }

  body.solo-active .panel-heading h2 {
    font-size: 1rem;
  }

  body.solo-active .solo-game {
    min-height: 0;
    margin-top: 4px;
    gap: 5px;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    overflow: hidden;
  }

  body.solo-active .solo-toolbar {
    align-items: center;
    gap: 4px;
  }

  body.solo-active .small-button,
  body.solo-active .solo-toolbar button {
    min-height: 24px;
    padding: 3px 7px;
    font-size: 0.68rem;
  }

  body.solo-active .solo-notice {
    min-height: 28px;
    padding: 4px 8px;
    font-size: 0.72rem;
  }

  body.solo-active .battlefield {
    min-height: 0;
    height: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: hidden;
  }

  body.solo-active .player-board,
  body.solo-active .playmat {
    min-height: 0;
    height: 100%;
  }

  body.solo-active .playmat {
    padding: 5px;
    gap: 4px;
    grid-template-columns: 44px minmax(0, 1fr) 160px 58px;
    grid-template-rows: 24px minmax(0, 1fr) 74px 88px;
    border-width: 1px;
  }

  body.solo-active .playmat-header {
    align-items: center;
    gap: 4px;
    min-width: 0;
  }

  body.solo-active .playmat-header strong,
  body.solo-active .playmat-header span {
    font-size: 0.64rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.solo-active .life-area,
  body.solo-active .character-area,
  body.solo-active .center-area,
  body.solo-active .cost-area,
  body.solo-active .don-deck-area,
  body.solo-active .trash-slot,
  body.solo-active .hand-area {
    min-height: 0;
    padding: 3px;
    overflow: hidden;
  }

  body.solo-active .character-area,
  body.solo-active .hand-area {
    overflow: auto;
  }

  body.solo-active .life-area h3,
  body.solo-active .character-area h3,
  body.solo-active .center-area h3,
  body.solo-active .cost-area h3,
  body.solo-active .don-deck-area h3,
  body.solo-active .trash-slot h3,
  body.solo-active .hand-area h3 {
    font-size: 0.52rem;
    margin-bottom: 2px;
  }

  body.solo-active .center-area {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
  }

  body.solo-active .center-area .leader-slot,
  body.solo-active .center-area .stage-slot,
  body.solo-active .center-area .deck-slot {
    gap: 2px;
  }

  body.solo-active .battle-card-grid,
  body.solo-active .hand-grid {
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 3px;
  }

  body.solo-active .battle-card,
  body.solo-active .hand-card {
    padding: 2px;
    gap: 2px;
    border-radius: 5px;
  }

  body.solo-active .battle-card strong,
  body.solo-active .hand-card strong,
  body.solo-active .hand-card span {
    font-size: 0.48rem;
    line-height: 1.05;
  }

  body.solo-active .battle-actions {
    gap: 2px;
  }

  body.solo-active .battle-actions button,
  body.solo-active .life-area button,
  body.solo-active .cost-area button,
  body.solo-active .zone-viewer-controls button,
  body.solo-active .viewer-card-actions button {
    min-height: 18px;
    padding: 1px 4px;
    font-size: 0.48rem;
    border-radius: 4px;
  }

  body.solo-active .battle-card-img,
  body.solo-active .center-area .battle-card-img {
    max-width: 42px;
    border-radius: 3px;
  }

  body.solo-active .card-back-object {
    width: 34px;
    border-radius: 4px;
  }

  body.solo-active .life-stack {
    gap: 3px;
    justify-items: center;
    padding-top: 6px;
  }

  body.solo-active .life-area > .life-stack .card-back-object {
    width: 26px;
    border-radius: 3px;
  }

  body.solo-active .life-area button {
    min-height: 15px;
    padding: 0 2px;
    font-size: 0.44rem;
  }

  body.solo-active .card-back-object span,
  body.solo-active .don-deck-pile span,
  body.solo-active .deck-pile > .pile-count {
    font-size: 0.42rem;
    padding: 1px 3px;
  }

  body.solo-active .deck-pile {
    min-height: 52px;
    padding: 2px;
  }

  body.solo-active .don-deck-pile {
    width: 34px;
    min-height: 0;
    height: 48px;
    padding: 2px;
    justify-self: center;
  }

  body.solo-active .don-deck-pile img {
    width: 100%;
    max-width: none;
    height: 100%;
    object-fit: contain;
  }

  body.solo-active .don-deck-pile:disabled,
  body.solo-active .don-row button:disabled {
    opacity: 1;
  }

  body.solo-active .don-row {
    grid-template-columns: repeat(auto-fill, 28px);
    gap: 2px;
  }

  body.solo-active .don-row button {
    width: 28px;
    min-width: 28px;
    height: 40px;
    min-height: 40px;
    border-radius: 4px;
  }

  body.solo-active .zone-viewer-panel {
    width: min(980px, 94vw);
    max-height: 84vh;
  }

  body.solo-active .zone-viewer-head,
  body.solo-active .zone-viewer-controls {
    padding: 6px 8px;
  }

  body.solo-active .zone-viewer-body {
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 6px;
    padding: 8px;
  }

  body.solo-active .viewer-card {
    padding: 4px;
    gap: 4px;
  }
}

@media (max-width: 720px) {
  body.solo-active {
    overflow: hidden;
  }

  body.solo-active,
  body.solo-active .app-shell,
  body.solo-active .solo-screen,
  body.solo-active .solo-panel,
  body.solo-active .solo-game,
  body.solo-active .battlefield,
  body.solo-active .player-board,
  body.solo-active .playmat {
    max-width: 100vw;
    overflow-x: hidden;
  }

  body.solo-active .app-shell {
    height: calc(var(--visual-viewport-height, 100dvh) - var(--solo-browser-reserve));
    min-height: 0;
    overflow: hidden;
    padding: 2px;
  }

  body.solo-active .topbar,
  body.solo-active .solo-panel > .panel-heading {
    display: none;
  }

  body.solo-active .solo-screen {
    max-width: none;
    height: 100%;
    margin: 0;
  }

  body.solo-active .solo-panel {
    height: 100%;
    padding: 3px;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
  }

  body.solo-active .solo-game {
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 1px;
    overflow: hidden;
  }

  body.solo-active .solo-toolbar {
    gap: 3px;
    justify-content: flex-start;
  }

  body.solo-active .solo-toolbar .small-button,
  body.solo-active .solo-toolbar button {
    flex: 1 1 62px;
    min-height: 17px;
    padding: 1px 3px;
    font-size: 0.5rem;
    border-radius: 6px;
  }

  body.solo-active #soloTurnLabel {
    font-size: 0.6rem;
    flex-basis: 100%;
  }

  body.solo-active .solo-notice {
    min-height: 15px;
    padding: 1px 4px;
    font-size: 0.48rem;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body.solo-active .battlefield {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    border-radius: 4px;
    overflow: hidden !important;
  }

  body.solo-active .player-board {
    flex: 1 1 0;
    min-width: 0 !important;
    width: 100%;
    min-height: 0;
    overflow: hidden;
  }

  body.solo-active .player-board:has(.playmat.active-turn) {
    flex: 1 1 0;
  }

  body.solo-active .playmat {
    --solo-life-card: clamp(52px, 16vw, 74px);
    --solo-field-card: clamp(36px, 11.2vw, 54px);
    --solo-hand-card: clamp(38px, 11.2vw, 56px);
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 1px;
    gap: 1px;
    border: 0;
    border-radius: 0;
    background:
      linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 34px),
      radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.12), transparent 36%),
      linear-gradient(180deg, #858987, #686d6c);
    align-content: start;
    grid-template-columns: clamp(60px, 17.2vw, 80px) minmax(0, 1fr) minmax(0, 1fr) clamp(48px, 12.5vw, 64px);
    grid-template-rows: 9px minmax(calc(var(--solo-field-card) * 1.28), 0.66fr) minmax(calc(var(--solo-field-card) * 1.48), 0.78fr) minmax(calc(var(--solo-field-card) * 1.42), 0.7fr) minmax(calc(var(--solo-hand-card) * 1.02), 0.58fr);
    grid-template-areas:
      "header header header header"
      "life character character character"
      "life center center trash"
      "don cost cost trash"
      "hand hand hand hand";
  }

  body.solo-active .opponent-board .playmat {
    grid-template-areas:
      "header header header header"
      "hand hand hand hand"
      "don cost cost trash"
      "life center center trash"
      "life character character character";
  }

  body.solo-active .playmat-header {
    min-width: 0;
    gap: 2px;
    align-items: center;
    padding: 0 2px;
    border-radius: 999px;
    background: rgba(18, 21, 34, 0.18);
  }

  body.solo-active .playmat-header strong,
  body.solo-active .playmat-header span {
    color: #fff;
    font-size: 0.42rem;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
  }

  body.solo-active .playmat-header button {
    min-height: 14px;
    padding: 0 2px;
    font-size: 0.42rem;
  }

  body.solo-active .life-area,
  body.solo-active .character-area,
  body.solo-active .center-area,
  body.solo-active .cost-area,
  body.solo-active .don-deck-area,
  body.solo-active .trash-slot,
  body.solo-active .hand-area {
    min-height: 0;
    padding: 0;
    overflow: hidden;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
  }

  body.solo-active .character-area,
  body.solo-active .hand-area {
    overflow: hidden;
  }

  body.solo-active .hand-area {
    touch-action: pan-x;
  }

  body.solo-active .character-area {
    align-content: center;
    position: relative;
  }

  body.solo-active .cost-area {
    position: relative;
    align-content: end;
  }

  body.solo-active .life-area {
    gap: 0;
    justify-items: center;
  }

  body.solo-active .don-deck-area,
  body.solo-active .trash-slot {
    align-content: center;
    justify-items: center;
  }

  body.solo-active .life-stack {
    gap: 0;
    margin-top: 2px;
    width: 100%;
    justify-items: center;
  }

  body.solo-active .life-area h3,
  body.solo-active .character-area h3,
  body.solo-active .center-area h3,
  body.solo-active .cost-area h3,
  body.solo-active .don-deck-area h3,
  body.solo-active .trash-slot h3,
  body.solo-active .hand-area h3 {
    color: rgba(255, 255, 255, 0.86);
    font-size: 0.38rem;
    margin-bottom: 1px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }

  body.solo-active .character-area h3,
  body.solo-active .cost-area h3 {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: grid;
    place-items: center;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.92rem;
    font-weight: 900;
    letter-spacing: 0;
    pointer-events: none;
  }

  body.solo-active .cost-area h3 {
    font-size: 0.74rem;
  }

  body.solo-active .character-area .battle-card-grid,
  body.solo-active .cost-area .don-row {
    position: relative;
    z-index: 1;
  }

  body.solo-active .character-area .battle-card-grid {
    align-items: center;
    justify-content: center;
  }

  body.solo-active .cost-area .don-row {
    align-self: end;
  }

  body.solo-active .playmat.active-turn {
    --solo-field-card: clamp(38px, 11.8vw, 58px);
    --solo-hand-card: clamp(40px, 11.6vw, 58px);
    box-shadow: none;
    background:
      linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 32px),
      radial-gradient(circle at 44% 42%, rgba(255, 255, 255, 0.15), transparent 38%),
      linear-gradient(180deg, #b94443 0%, #c9563c 54%, #e17c3b 100%);
  }

  body.solo-active .playmat.active-turn .life-area,
  body.solo-active .playmat.active-turn .character-area,
  body.solo-active .playmat.active-turn .center-area,
  body.solo-active .playmat.active-turn .cost-area,
  body.solo-active .playmat.active-turn .don-deck-area,
  body.solo-active .playmat.active-turn .trash-slot,
  body.solo-active .playmat.active-turn .hand-area {
    border-color: rgba(246, 214, 95, 0.62);
    background: rgba(109, 20, 24, 0.1);
  }

  body.solo-active .battle-actions,
  body.solo-active .life-area > button,
  body.solo-active .cost-area > button,
  body.solo-active .cost-area label,
  body.solo-active .stage-slot button {
    display: none;
  }

  body.solo-active [data-drag-card] {
    touch-action: none;
  }

  body.solo-active .center-area {
    --solo-center-card: calc(var(--solo-field-card) * 1.32);
    grid-template-columns: repeat(3, var(--solo-center-card));
    justify-content: center;
    align-items: center;
    gap: 5px;
  }

  body.solo-active .center-area .leader-slot,
  body.solo-active .center-area .stage-slot,
  body.solo-active .center-area .deck-slot {
    width: var(--solo-center-card);
    min-height: calc(var(--solo-center-card) * 1.42);
    align-content: center;
  }

  body.solo-active .center-area .battle-card {
    flex: 0 0 var(--solo-center-card);
    width: var(--solo-center-card);
    height: calc(var(--solo-center-card) * 1.42);
    min-height: 0;
  }

  body.solo-active .battle-card-grid,
  body.solo-active .hand-grid {
    display: flex;
    align-items: flex-start;
    gap: 1px;
    height: 100%;
    overflow: hidden;
  }

  body.solo-active .battle-card {
    flex: 0 0 var(--solo-field-card);
    width: var(--solo-field-card);
    height: calc(var(--solo-field-card) * 1.42);
    padding: 1px;
    gap: 1px;
    border-radius: 3px;
    min-height: 0;
    overflow: hidden;
  }

  body.solo-active .hand-card {
    flex: 0 0 var(--solo-hand-card);
    width: var(--solo-hand-card);
    height: calc(var(--solo-hand-card) * 1.42);
    padding: 1px;
    gap: 1px;
    border-radius: 3px;
    min-height: 0;
    overflow: hidden;
  }

  body.solo-active .battle-card strong,
  body.solo-active .hand-card strong,
  body.solo-active .hand-card span {
    display: none;
  }

  body.solo-active .battle-card-img,
  body.solo-active .center-area .battle-card-img {
    width: 100%;
    max-width: none;
    height: auto;
    aspect-ratio: 5 / 7;
    max-height: none;
    object-fit: contain;
    object-position: center;
    border-radius: 3px;
  }

  body.solo-active .card-back-object {
    width: var(--solo-field-card);
    min-width: var(--solo-field-card);
    height: calc(var(--solo-field-card) * 1.42);
    max-height: none;
    border-radius: 3px;
  }

  body.solo-active .life-area > .life-stack .card-back-object {
    width: calc(100% - 4px);
    min-width: 0;
    max-width: calc(var(--solo-life-card) * 1.24);
    height: auto;
    aspect-ratio: 7 / 5;
    margin: calc(var(--solo-life-card) * -0.22) 0;
    transform: none;
  }

  body.solo-active .life-area > .life-stack .card-back-object:first-child {
    margin-top: 4px;
  }

  body.solo-active .life-area > .life-stack .card-back-object img {
    position: absolute;
    inset: 50% auto auto 50%;
    width: 71.5%;
    height: 140%;
    object-fit: contain;
    transform: translate(-50%, -50%) rotate(90deg);
  }

  body.solo-active .card-back-object span,
  body.solo-active .don-deck-pile span,
  body.solo-active .deck-pile > .pile-count {
    font-size: 0.36rem;
    padding: 0 2px;
  }

  body.solo-active .deck-pile {
    width: var(--solo-center-card, var(--solo-field-card));
    min-height: calc(var(--solo-center-card, var(--solo-field-card)) * 1.42);
    height: calc(var(--solo-center-card, var(--solo-field-card)) * 1.42);
    padding: 1px;
    justify-self: center;
  }

  body.solo-active .don-deck-pile {
    width: min(calc(100% - 1px), calc(var(--solo-field-card) * 1.26));
    height: auto;
    aspect-ratio: 5 / 7;
    min-height: 0;
    padding: 0;
    justify-self: center;
  }

  body.solo-active .trash-slot .deck-pile {
    width: min(calc(100% - 1px), calc(var(--solo-field-card) * 1.18));
    min-width: 0;
    min-height: 0;
    height: auto;
    aspect-ratio: 5 / 7;
  }

  body.solo-active .deck-slot .deck-pile .card-back-object,
  body.solo-active .trash-slot .deck-pile .card-back-object {
    width: 100%;
    min-width: 100%;
    height: 100%;
    border-radius: 4px;
  }

  body.solo-active .don-deck-pile img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
  }

  body.solo-active .don-row {
    grid-template-columns: repeat(auto-fill, var(--solo-field-card));
    gap: 1px;
  }

  body.solo-active .don-row button {
    width: var(--solo-field-card);
    min-width: var(--solo-field-card);
    height: calc(var(--solo-field-card) * 1.42);
    min-height: calc(var(--solo-field-card) * 1.42);
    border-radius: 3px;
    padding: 1px;
  }

  body.solo-active .zone-viewer-modal {
    align-items: start;
    padding: 8px;
  }

  body.solo-active .zone-viewer-panel {
    width: 100%;
    max-height: calc(100dvh - 24px);
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  body.solo-active .zone-viewer-head {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
  }

  body.solo-active .zone-viewer-head [data-close-viewer],
  body.solo-active .zone-viewer-head [data-solo-home] {
    min-height: 34px;
    padding: 4px 12px;
    font-size: 0.82rem;
  }

  body.solo-active .don-row button:disabled,
  body.solo-active .don-deck-pile:disabled {
    opacity: 1;
  }

  body.solo-active .drag-over {
    outline: 2px solid rgba(19, 111, 99, 0.8);
    outline-offset: -2px;
    background: rgba(19, 111, 99, 0.08);
  }
}

@media (max-width: 720px) {
  html.ios-safari-viewport {
    --solo-browser-reserve: clamp(104px, 14dvh, 136px);
  }

  html.ios-safari-viewport body.solo-active .playmat {
    --solo-life-card: clamp(46px, 14.4vw, 68px);
    --solo-field-card: clamp(33px, 10.2vw, 49px);
    --solo-hand-card: clamp(34px, 10vw, 48px);
    grid-template-columns: clamp(54px, 15.8vw, 74px) minmax(0, 1fr) minmax(0, 1fr) clamp(43px, 11.2vw, 58px);
    grid-template-rows: 8px minmax(calc(var(--solo-field-card) * 1.18), 0.58fr) minmax(calc(var(--solo-field-card) * 1.4), 0.72fr) minmax(calc(var(--solo-field-card) * 1.3), 0.62fr) minmax(calc(var(--solo-hand-card) * 1.0), 0.52fr);
  }

  html.ios-safari-viewport body.solo-active .opponent-board .playmat {
    grid-template-rows: 8px minmax(calc(var(--solo-hand-card) * 1.0), 0.52fr) minmax(calc(var(--solo-field-card) * 1.3), 0.62fr) minmax(calc(var(--solo-field-card) * 1.4), 0.72fr) minmax(calc(var(--solo-field-card) * 1.18), 0.58fr);
  }

  html.ios-safari-viewport body.solo-active .playmat.active-turn {
    --solo-field-card: clamp(34px, 10.6vw, 51px);
    --solo-hand-card: clamp(35px, 10.4vw, 50px);
  }

  html.ios-safari-viewport body.solo-active .solo-toolbar .small-button,
  html.ios-safari-viewport body.solo-active .solo-toolbar button {
    flex: 1 1 62px;
    min-height: 16px;
    padding: 0 3px;
    font-size: 0.48rem;
  }

  html.ios-safari-viewport body.solo-active #soloTurnLabel {
    font-size: 0.56rem;
  }

  html.ios-safari-viewport body.solo-active .solo-notice {
    min-height: 14px;
    font-size: 0.46rem;
  }
}

@media (max-width: 720px) and (max-height: 740px) {
  body.solo-active .solo-toolbar .small-button,
  body.solo-active .solo-toolbar button {
    min-height: 17px;
    padding: 0 3px;
    font-size: 0.5rem;
  }

  body.solo-active #soloTurnLabel {
    font-size: 0.58rem;
  }

  body.solo-active .solo-notice {
    min-height: 15px;
    padding: 1px 3px;
    font-size: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body.solo-active .playmat {
    --solo-life-card: clamp(44px, 14vw, 64px);
    --solo-field-card: clamp(32px, 10.2vw, 49px);
    --solo-hand-card: clamp(36px, 10.8vw, 52px);
    grid-template-columns: clamp(52px, 15.4vw, 72px) minmax(0, 1fr) minmax(0, 1fr) clamp(40px, 10.4vw, 54px);
    grid-template-rows: 8px minmax(calc(var(--solo-field-card) * 1.1), 0.54fr) minmax(calc(var(--solo-field-card) * 1.34), 0.68fr) minmax(calc(var(--solo-field-card) * 1.22), 0.56fr) minmax(calc(var(--solo-hand-card) * 1.0), 0.52fr);
  }

  body.solo-active .opponent-board .playmat {
    grid-template-rows: 8px minmax(calc(var(--solo-hand-card) * 1.0), 0.52fr) minmax(calc(var(--solo-field-card) * 1.22), 0.56fr) minmax(calc(var(--solo-field-card) * 1.34), 0.68fr) minmax(calc(var(--solo-field-card) * 1.1), 0.54fr);
  }

  body.solo-active .playmat.active-turn {
    --solo-field-card: clamp(34px, 10.5vw, 50px);
    --solo-hand-card: clamp(38px, 11vw, 54px);
  }

  body.solo-active .life-area h3,
  body.solo-active .character-area h3,
  body.solo-active .center-area h3,
  body.solo-active .cost-area h3,
  body.solo-active .don-deck-area h3,
  body.solo-active .trash-slot h3,
  body.solo-active .hand-area h3 {
    font-size: 0.34rem;
  }

  body.solo-active .battle-card-grid,
  body.solo-active .hand-grid {
    display: flex;
  }

  body.solo-active .battle-card-img,
  body.solo-active .center-area .battle-card-img {
    max-width: none;
  }

  body.solo-active .life-area > .life-stack .card-back-object {
    margin: calc(var(--solo-life-card) * -0.22) 0;
  }

  body.solo-active .life-area > .life-stack .card-back-object:first-child {
    margin-top: 4px;
  }

  body.solo-active .life-area > .life-stack .card-back-object img {
    width: 71.5%;
    height: 140%;
    transform: translate(-50%, -50%) rotate(90deg);
  }
}

@media (max-width: 720px) {
  .photo-deck-panel {
    width: 100%;
    max-height: calc(100dvh - 18px);
  }

  .photo-deck-layout {
    grid-template-columns: 1fr;
    max-height: calc(100dvh - 74px);
    overflow: auto;
    padding: 10px;
  }

  .photo-preview {
    min-height: 220px;
  }

  .photo-row {
    grid-template-columns: 60px 64px minmax(0, 1fr);
  }

  .photo-row label:nth-of-type(3),
  .photo-row button {
    grid-column: 1 / -1;
  }

  .photo-card-thumb {
    width: 56px;
    min-height: 78px;
  }

  .photo-card-thumb .mini-card {
    width: 52px;
    height: 74px;
  }
}

@media (max-width: 720px) {
  body.solo-active .center-area {
    --solo-center-card: calc(var(--solo-field-card) * 1.34);
    grid-template-columns: repeat(3, var(--solo-center-card));
    gap: 5px;
  }

  body.solo-active .center-area .leader-slot,
  body.solo-active .center-area .stage-slot,
  body.solo-active .center-area .deck-slot {
    width: var(--solo-center-card);
    min-height: calc(var(--solo-center-card) * 1.42);
  }

  body.solo-active .center-area .battle-card,
  body.solo-active .center-area .deck-pile,
  body.solo-active .center-area .don-deck-pile {
    width: var(--solo-center-card);
    min-width: var(--solo-center-card);
    min-height: calc(var(--solo-center-card) * 1.42);
  }

  body.solo-active .center-area .battle-card-img,
  body.solo-active .center-area .card-back-object {
    width: var(--solo-center-card);
    min-width: var(--solo-center-card);
    height: calc(var(--solo-center-card) * 1.42);
  }

  body.solo-active .don-deck-pile,
  body.solo-active .deck-pile {
    position: relative;
    overflow: hidden;
  }

  body.solo-active .don-deck-pile span,
  body.solo-active .deck-pile > .pile-count {
    right: 4px;
    bottom: auto;
    top: 4px;
    min-width: 16px;
    min-height: 16px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #25306a;
    color: #fff;
    font-size: 0.52rem;
    line-height: 1;
  }

  body.solo-active .life-count-badge {
  display: none;
    top: 3px;
    right: 3px;
    min-width: 16px;
    min-height: 16px;
    font-size: 0.54rem;
  }
}

body.solo-active .hand-grid,
body.solo-active .cost-area .don-row {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

body.solo-active .hand-grid {
  gap: 2px;
  padding: 1px 12px 2px 1px;
}

body.solo-active .cost-area .don-row {
  gap: 1px;
  align-items: center;
  align-self: end;
  padding: 1px 12px 2px 1px;
}

body.solo-active .hand-grid.is-stacked .hand-card + .hand-card {
  margin-left: calc(var(--solo-hand-card, 54px) * -0.38);
}

body.solo-active .cost-area .don-row.is-stacked button + button {
  margin-left: calc(var(--solo-field-card, 54px) * -0.42);
}

body.solo-active .hand-grid .hand-card,
body.solo-active .cost-area .don-row button {
  flex-shrink: 0;
}

body.solo-active .hand-grid [data-drag-card],
body.solo-active .cost-area .don-row [data-drag-card] {
  touch-action: pan-x;
}

body.solo-active .hand-grid::-webkit-scrollbar,
body.solo-active .cost-area .don-row::-webkit-scrollbar {
  height: 4px;
}

body.solo-active .hand-grid::-webkit-scrollbar-thumb,
body.solo-active .cost-area .don-row::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
}

.battle-card,
.leader-slot {
  position: relative;
  contain: layout paint style;
  container-type: inline-size;
}

.modifier-badges {
  position: absolute;
  top: 1px;
  left: 1px;
  right: 1px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  align-items: flex-start;
  justify-content: flex-end;
  align-content: flex-start;
  pointer-events: none;
}

.modifier-badge {
  min-width: 0;
  max-width: 100%;
  padding: 1px 3px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  color: #fff;
  background: rgba(15, 23, 42, 0.9);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.28);
  font-size: clamp(0.34rem, 8cqw, 0.58rem);
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

.modifier-badge.cost {
  font-size: clamp(0.32rem, 7cqw, 0.54rem);
}

.modifier-badge.power {
  background: linear-gradient(135deg, rgba(29, 185, 84, 0.95), rgba(13, 115, 119, 0.94));
}

.modifier-badge.cost {
  background: linear-gradient(135deg, rgba(255, 122, 24, 0.96), rgba(190, 24, 93, 0.94));
}

.modifier-badge.don {
  background: linear-gradient(135deg, rgba(11, 132, 255, 0.96), rgba(109, 40, 217, 0.94));
}

.library-card,
.game-card,
.hand-card,
.viewer-card {
  contain: layout paint style;
}
