:root {
  color-scheme: light;
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  color: #292044;
  background: #ede8fa;
  --ink: #292044;
  --muted: #625974;
  --paper: #fff;
  --surface: #f8f5ff;
  --line: #d9d0eb;
  --violet: #6546d9;
  --violet-dark: #493099;
  --mint: #c9f7e8;
  --peach: #ffe0ce;
  --yellow: #ffe895;
  --paper-stock: #faf4e4;
  --paper-edge: #ede5d1;
  --print-ink: #222d35;
  --mustard: #edb950;
  --card-back-print: radial-gradient(circle, #f0be58 0 15%, #6f8057 17% 35%, #3a4b3c 37%);
  --card-ratio: 5 / 7;
  --soft-shadow: 0 5px 0 #4a32631a, 0 14px 30px #38265e12;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 0; min-height: 100dvh; }
:where(h1, h2, h3, p, ol, ul) { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .48; }
button:not(:disabled), [role="button"] { transition: transform 120ms ease, background-color 140ms ease, box-shadow 140ms ease; }
button:not(:disabled):active, [role="button"]:active { transform: translateY(2px); }
:focus-visible { outline: 3px solid #4423ab; outline-offset: 2px; }
[hidden], .hidden { display: none !important; }
img { max-width: 100%; }
input, select {
  background: white;
  min-width: 0;
  width: 100%;
  min-height: 44px;
  border: 1px solid #bfb1db;
  border-radius: 12px;
  padding: 7px 11px;
}
:is(.small-button, .title-button, .record-tab, .options-button, .end-button, .close-detail, .title-menu-button) {
  background: white;
  border: 1px solid var(--line);
  border-radius: 13px;
  min-height: 44px;
  padding: 8px 13px;
  font-size: .9rem;
  font-weight: 800;
}
:is(.primary, .end-button, .detail-confirm-button) {
  background: var(--violet);
  border-color: var(--violet);
  color: white;
  box-shadow: 0 3px 0 var(--violet-dark);
}
:is(.danger-button) { color: #8d2947; background: #ffe8ed; border-color: #eec6d1; }
.challenge-button { background: var(--mint); border-color: #b2e5d5; }
:where(.eyebrow, .empty-note) { color: var(--muted); font-weight: 700; font-size: .84rem; }

.title-screen {
  --title-paper: var(--paper-stock);
  --title-ink: var(--print-ink);
  --title-line: #b8b09d;
  --line: var(--title-line);
  --surface: var(--title-paper);
  --violet: #253e45;
  --violet-dark: #192b30;
  display: none;
  width: min(100%, 540px);
  min-height: 100dvh;
  margin: auto;
  color: var(--title-ink);
  background: var(--title-paper);
}
body.title-active:not(.battle-cards-active) { background: var(--paper-edge); }
:is(.title-active, .battle-cards-active) .title-screen { display: flex; flex-direction: column; }
:is(.title-active, .battle-cards-active) .battle-shell { display: none; }
.title-toolbar {
  position: relative;
  z-index: 5;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(7px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 4px max(14px, env(safe-area-inset-left));
}
body:not(.title-home-open) .title-toolbar { display: none; }
.profile-summary {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  border: 0;
  padding: 0;
  text-align: left;
  background: none;
  font-size: .79rem;
}
.profile-summary strong { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.profile-summary img, .avatar-choice img, .shared-rank-avatar img, .player-avatar, .battle-start-player img {
  width: 35px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  object-fit: contain;
}
.profile-summary img { flex: 0 0 auto; background: #efe4cd; image-rendering: pixelated; }
.hapi-coin-display { display: flex; align-items: center; gap: 5px; flex: none; white-space: nowrap; font-weight: 700; font-size: .74rem; }
.hapi-coin-display::before { content: ""; width: 10px; height: 10px; border: 2px solid #8b601d; border-radius: 50%; background: #edb755; }
.login-bonus-note { position: absolute; z-index: 1; inset: calc(100% - 2px) 56px auto auto; padding: 4px 8px; background: var(--title-ink); color: #fff; font-size: .72rem; pointer-events: none; }
.title-menu-button { flex: 0 0 44px; padding: 0; border-color: transparent; border-radius: 5px; background: transparent; }
.title-menu-panel, .options-panel {
  position: absolute;
  z-index: 16;
  inset: 100% 12px auto auto;
  width: min(260px, calc(100% - 24px));
  display: grid;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 4px 12px #23303b24;
}
.title-menu-panel button, .options-panel button { border: 0; border-radius: 0; padding-inline: 3px; text-align: left; background: none; }
.title-menu-panel button + button, .options-panel button + button { border-top: 1px solid var(--line); }
.title-content {
  flex: 1;
  min-width: 0;
  padding: max(12px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}
.title-home-open .title-content { padding-top: 0; }
.home-dashboard { display: grid; margin: auto; }
.home-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 3px 0 6px;
  min-height: clamp(218px, 42dvh, 350px);
}
.home-hero h1 {
  position: relative;
  z-index: 2;
  justify-self: start;
  margin: 5px 0 0 3px;
  transform: rotate(-5deg);
  font-size: clamp(2.35rem, 10.6vw, 4.2rem);
  line-height: .98;
  letter-spacing: -.075em;
  font-weight: 1000;
  -webkit-text-stroke: .55px currentColor;
}
.home-hero h1 span { display: block; }
.home-hero h1 span + span { margin-inline-start: .2em; }
.home-cast { position: relative; align-self: stretch; min-height: 123px; max-width: 440px; width: 100%; justify-self: center; }
.home-cast::before {
  content: "";
  position: absolute;
  inset: 39% 0 9%;
  background: #dce6be;
  clip-path: polygon(0 27%, 42% 18%, 49% 0, 100% 14%, 97% 70%, 58% 100%, 5% 84%);
}
.home-cast img { position: absolute; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(2px 3px 0 #2c342532); }
.cast-warado { width: 32%; height: 66%; bottom: 10%; left: 1%; transform: rotate(-7deg); }
.cast-dragon { width: 51%; height: 100%; bottom: 10%; left: 25%; }
.cast-slime { width: 31%; height: 61%; bottom: 4%; right: 0; transform: rotate(8deg); }
.home-play {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 0 17px;
  min-height: 52px;
  border: 2px solid var(--title-ink);
  border-radius: 7px 7px 5px 5px;
  background: var(--mustard);
  box-shadow: 0 4px 0 var(--title-ink);
  text-align: left;
  font-size: 1.13rem;
  font-weight: 900;
}
.home-play::after { content: ""; width: 0; height: 0; border-block: 6px solid transparent; border-inline-start: 9px solid currentColor; }
.title-rows { display: grid; border-top: 1px solid var(--title-line); }
.home-links { margin-top: 18px; }
.title-row {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-bottom: 1px solid var(--title-line);
  padding: 4px 7px 4px 1px;
  text-align: left;
  font-weight: 800;
  background: transparent;
}
.title-row::after { content: ""; flex: 0 0 7px; height: 7px; margin: 0 0 0 auto; border-top: 1px solid; border-right: 1px solid; transform: rotate(45deg); }
.title-row:hover, .title-menu-panel button:hover, .options-panel button:hover { background: #8a856a14; }
.title-back {
  display: inline-flex;
  width: fit-content;
  min-height: 44px;
  align-items: center;
  gap: 7px;
  border: 0;
  padding: 0 10px 0 3px;
  background: transparent;
  text-align: left;
  font-weight: 700;
  font-size: .85rem;
}
.title-back::before { content: ""; width: 8px; height: 8px; border-left: 2px solid; border-bottom: 2px solid; transform: rotate(45deg); }
.title-content > :not(.home-dashboard) { display: grid; gap: 14px; }
.title-content h2 { font-size: 1.55rem; letter-spacing: -.035em; line-height: 1.2; }
.title-content h3 { font-size: 1rem; }
.match-cpu { display: grid; gap: 5px; }
.match-cpu h3 { color: #454e49; font-size: .82rem; }
.match-option { min-height: 57px; }
.match-option img { width: 42px; height: 42px; object-fit: contain; image-rendering: pixelated; }
.match-option small { display: block; color: #4a5736; font-weight: 700; font-size: .7rem; }
.rules-nav, .title-copy-row, .record-ranking-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.rules-head, .challenge-card-head { display: flex; align-items: center; justify-content: space-between; gap: 7px; flex-wrap: wrap; font-weight: 850; }
.rules-head > span { font-size: .8rem; color: #585b50; }
.profile-setup label, .rules-body, .challenge-card, .title-lobby-row, .rules-list, .update-list-body, .record-list-body, .challenge-list { display: grid; gap: 9px; }
.rules-body, .challenge-card, .update-entry { line-height: 1.6; }
.rules-list, .update-entry ul { padding-inline-start: 1.4em; }
.challenge-card, .update-entry, .record-ranking { min-width: 0; padding: 12px 0; border-block-start: 1px solid var(--title-line); }
.challenge-card .title-button { justify-self: start; }
.challenge-clear { color: #39503d; font-weight: 900; }
.title-screen :is(.title-button, .small-button, input, .record-tab) { border-radius: 5px; }
.title-screen .record-tab { background: transparent; border-color: var(--title-line); }
.title-screen .record-tab.active { background: var(--title-ink); border-color: var(--title-ink); color: #fff7e3; }
.avatar-picker, .card-list-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(54px, 1fr)); gap: 8px; }
.avatar-choice { min-height: 52px; padding: 4px; border: 1px solid var(--title-line); border-radius: 5px; background: transparent; }
.avatar-choice.selected { background: #e4e8ce; border-color: var(--title-ink); outline: 1px solid var(--title-ink); }
.card-list-body, .card-list-section { display: grid; gap: 11px; min-width: 0; }
.card-list-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card-list-entry { min-width: 0; padding: 0; border: 0; background: transparent; }
.card-list-tabs { display: flex; gap: 5px; flex-wrap: wrap; }
.card-list-tabs .record-tab { flex: 1; padding-inline: 4px; font-size: .77rem; white-space: nowrap; }
.catalog-reader { width: min(340px, calc(100% - 24px)); max-height: 88dvh; padding: 12px 16px 16px; border: 1px solid var(--title-line); border-radius: 8px; background: var(--title-paper); color: var(--title-ink); }
.catalog-reader::backdrop { background: #1b252c90; }
.catalog-reader form { text-align: right; }
.catalog-reader h3 { margin-bottom: 10px; }
.catalog-reader #catalogReaderCard { width: min(172px, 52dvh * .68, 80%); margin: 0 auto 12px; }
.catalog-reader p { font-size: .95rem; line-height: 1.5; }
.share-link { overflow-wrap: anywhere; white-space: pre-wrap; font-size: .85rem; }
.share-link:empty, #titleLobbyNote:empty, .title-copy-row:has(> .hidden + .hidden) { display: none; }
.today-record, .record-summary { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); margin: 0; border-block: 1px solid var(--title-line); }
.today-record div, .record-summary div { display: grid; gap: 3px; padding: 7px 3px; text-align: center; }
.today-record dt, .record-summary span { font-size: .72rem; }
.today-record dd, .record-summary strong { margin: 0; font-weight: 850; }
.record-summary { grid-template-columns: repeat(2, minmax(0,1fr)); }
.shared-ranking-list { list-style: none; padding: 0; }
.shared-rank-row { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 7px; padding: 7px 0; border-bottom: 1px solid var(--line); }
@media (max-height: 620px) {
  .home-hero { min-height: clamp(192px, 42dvh, 250px); }
  .home-hero h1 { font-size: clamp(2.2rem, 9.2vw, 3.1rem); }
  .home-cast { min-height: 104px; }
  .home-links { margin-top: 14px; }
}

body:not(.title-active):not(.battle-cards-active) { overflow: hidden; background: var(--paper-edge); }
.battle-shell {
  --line: #b8b09d;
  --surface: #fffaf0;
  --ink: var(--print-ink);
  --muted: #575748;
  --violet: #394c3a;
  --violet-dark: #28352a;
  --battle-inset: max(9px, env(safe-area-inset-left), env(safe-area-inset-right));
  --hand-height: clamp(94px, 17dvh, 140px);
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 6px;
  width: min(100%, 540px);
  height: 100dvh;
  margin: auto;
  padding: max(5px, env(safe-area-inset-top)) var(--battle-inset) max(7px, env(safe-area-inset-bottom));
  color: var(--ink);
  background: var(--paper-stock);
}
.battle-shell, .game-card, .battle-start-overlay, .card-cast, .winner-overlay {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.battle-shell :is(input, textarea, select) { -webkit-user-select: text; user-select: text; }
.battle-shell img, .battle-start-overlay img, .winner-overlay img { pointer-events: none; }
.battle-top, .life-box, .player-controls, .left-rail, .deck-stack { min-width: 0; display: grid; gap: 5px; }
.battle-top { grid-template-columns:minmax(0,1fr) auto 44px; align-items:center; gap:7px; }
.turn-status { display:flex; gap:7px; justify-content:center; min-width:0; color:#495041; line-height:1.1; font-size:.64rem; font-weight:800; }
.turn-status > * { min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.battle-top-actions { display:grid; gap:4px; }
.battle-top-actions button { min-height:34px; padding:0; border-radius:5px; font-size:.72rem; color:var(--ink); background:transparent; }
.battle-menu-icon { display:inline-block; width:15px; height:2px; border-radius:1px; background:currentColor; box-shadow:0 -5px,0 5px; vertical-align:middle; }
.options-panel { inset:calc(max(5px,env(safe-area-inset-top)) + 74px) var(--battle-inset) auto auto; }
.opponent-hand-area { display:grid; justify-items:center; gap:3px; }
.opponent-hand {
  display: flex;
  justify-content: center;
  min-width: 46px;
  padding: 2px 4px 4px 12px;
}
.log-panel, .draw-prompt { display: none; }
.life-box {
  --life-ink:#2e4234;
  --life-fill:#6d885b;
  --life-empty:#a7ad8c;
  grid-template-columns:43px minmax(0,1fr) auto;
  grid-template-areas:"avatar name name" "avatar life status" "avatar gauge gauge" "avatar lamps lamps";
  align-items:center;
  justify-items:start;
  column-gap:8px;
  row-gap:2px;
}
.life-box .player-avatar {
  grid-area:avatar; align-self:start; width:43px; margin-top:4px; border-radius:50%;
  border:1px solid color-mix(in srgb,var(--life-fill),white 18%); background:color-mix(in srgb,var(--life-fill),white 81%);
  box-shadow:inset 0 0 0 2px #fff8;
}
.life-box > span { grid-area:name; max-width:100%; color:var(--ink); white-space:nowrap; text-overflow:ellipsis; overflow:hidden; font-weight:850; font-size:.8rem; }
.life-readout {
  grid-area:life; display:inline-flex; gap:5px; align-items:baseline; min-height:32px;
  border:0; background:none; padding:0; color:var(--life-ink); white-space:nowrap; text-align:left;
}
.life-readout small { font-size:.64rem; font-weight:800; }
.life-readout b {
  font-family:"DIN Alternate", Bahnschrift, "Avenir Next Condensed", "Arial Narrow", sans-serif;
  font-weight:700; font-size:2.22rem; font-stretch:condensed; font-variant-numeric:tabular-nums;
  line-height:.9; letter-spacing:-.045em; text-shadow:0 1px 0 #fff;
}
.life-gauge { grid-area:gauge; display:grid; grid-template-columns:repeat(12,minmax(0,1fr)); width:min(100%,114px); gap:2px; }
.life-segment { height:7px; border-radius:2px; background:#fffbf1; box-shadow:inset 0 0 0 1px var(--life-empty); }
.life-segment.filled { background:var(--life-fill); box-shadow:inset 0 1px 0 #fff7,inset 0 -1px 0 #0002; }
.life-segment.layered { background:linear-gradient(0deg,var(--life-fill) 0 25%,var(--life-under) 25% 55%,var(--life-over) 55%); }
.opponent-hand-area small, .player-commands small { white-space:nowrap; color:var(--muted); font-size:.69rem; font-weight:750; }
.life-box .streak-note { display: none; }
.action-lamps { grid-area:lamps; display:flex; align-items:center; flex-wrap:wrap; gap:4px; min-height:11px; }
.lamp { width:9px; height:9px; border-radius:50%; border:1px solid var(--life-ink); background:#fff8; }
.lamp.on { background:var(--life-ink); box-shadow:inset 0 1px 0 #fff7; }
.defense-status-list { grid-area: status; display: flex; gap: 4px; }
.defense-status-list:empty { display: none; }
.defense-status-badge {
  position: relative;
  display: grid;
  place-items: center;
  inline-size: 24px;
  block-size: 24px;
  padding: 0;
  border: 1px solid currentColor;
  border-radius: 8px;
  background: #fcf2cd;
  color: #815023;
  font-size: .9rem;
}
.defense-status-badge::before { content: ""; position: absolute; inset: -9px -2px; }
.defense-status-badge.auroraVeil { background: #e0f6fb; color: #236079; }
.defense-status-badge.wish { background: #f7e4da; color: #914838; }
.battle-effect-dialog {
  width: min(340px, calc(100% - 32px));
  padding: 18px;
  border: 1px solid #776e5e;
  border-radius: 12px;
  background: #fbf5e7;
  color: #382e23;
  box-shadow: 0 8px 26px #2e251f55;
}
.battle-effect-dialog::backdrop { background: #30271f66; }
.battle-effect-dialog h2 { margin: 0; font-size: 1.14rem; }
.battle-effect-dialog .effect-summary { margin: 10px 0; line-height: 1.65; font-size: .92rem; }
.battle-effect-dialog .effect-duration { margin: 0 0 14px; padding-block: 8px; border-top: 1px solid #c6b99f; font-size: .8rem; }
.battle-effect-dialog form { text-align: right; }
.battle-effect-dialog button { min-height: 40px; padding: 0 16px; border-radius: 7px; border: 1px solid #9d8c70; background: #fffaf0; color: inherit; }

.arena {
  --mat-ink: #6b6655;
  position: relative;
  isolation: isolate;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 33px minmax(0, 1fr);
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--mat-ink);
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(#e9dfc7 0 50%, #dce5c5 50%);
  box-shadow: 0 2px 0 #b7a98d;
}
.arena::before {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: -1;
  inset: 5px;
  opacity: .52;
  background:
    linear-gradient(var(--mat-ink), var(--mat-ink)) top left / 11px 1px no-repeat,
    linear-gradient(var(--mat-ink), var(--mat-ink)) top left / 1px 11px no-repeat,
    linear-gradient(var(--mat-ink), var(--mat-ink)) top right / 11px 1px no-repeat,
    linear-gradient(var(--mat-ink), var(--mat-ink)) top right / 1px 11px no-repeat,
    linear-gradient(var(--mat-ink), var(--mat-ink)) bottom left / 11px 1px no-repeat,
    linear-gradient(var(--mat-ink), var(--mat-ink)) bottom left / 1px 11px no-repeat,
    linear-gradient(var(--mat-ink), var(--mat-ink)) bottom right / 11px 1px no-repeat,
    linear-gradient(var(--mat-ink), var(--mat-ink)) bottom right / 1px 11px no-repeat;
}
.field-line {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
  gap: clamp(6px, 2.6vw, 14px);
  padding: 1px 3px;
  border-radius: 12px;
}
.field-slot {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  container-type: size;
}
.field-slot.empty {
  align-self: center;
  justify-self: center;
  width: min(100%, 76px);
  height: min(100%, 82px);
  border: 1px dashed #6863519e;
  background: #fffaf02e;
  border-radius: 5px;
}
.slot-mark { color: #575749; opacity: .78; font-size: .92rem; font-weight: 750; }
.field-slot.filled {
  --face-width: min(91cqw, calc((100cqh - 5px) * var(--card-ratio)));
  grid-template-rows: minmax(0, 1fr);
  padding-bottom: 8px;
  cursor: pointer;
}
.field-slot.filled > .game-card {
  width: var(--face-width);
}
@property --orbit-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
.field-slot.action-ready > .game-card::before,
.field-slot.action-ready > .game-card::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: -5px;
  border-radius: 8% / 6%;
  pointer-events: none;
}
.field-slot.action-ready > .game-card::before {
  border: 4px solid #fff2a3;
  box-shadow: 0 0 0 1px #9b733b, 0 0 9px 2px #ffd36899;
}
.field-slot.action-ready > .game-card::after {
  padding: 4px;
  background: conic-gradient(from var(--orbit-angle), transparent 0 60%, #ffe595 72%, #fff8d0 85%, #fffef6 94%, transparent 100%);
  animation: border-light-orbit 1.35s linear infinite;
}
.field-slot.action-ready > .game-card::after,
.deck-stack.can-draw .deck-card:not(:disabled)::after {
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}
@keyframes border-light-orbit {
  to { --orbit-angle: 360deg; }
}
.field-slot:has(.stat-pulsing) { position: relative; z-index: 4; }
.field-draggable { touch-action: none; user-select: none; -webkit-touch-callout: none; }
.field-slot.selected > .game-card, .card-shell.selected > .game-card { outline: 2px solid var(--violet); outline-offset: 2px; }
.field-wall {
  --wall-travel: 6px;
  position: absolute;
  inset-inline: 3px;
  z-index: -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  height: clamp(17px, 3.25dvh, 25px);
  filter: drop-shadow(0 2px 1px #57402b66);
  pointer-events: none;
}
.opponent-field > .field-wall { --wall-travel: -6px; top: -4px; transform-origin: top; }
.player-field > .field-wall { bottom: -4px; transform-origin: bottom; }
.field-wall > i {
  position: relative;
  opacity: 0;
  transform-origin: inherit;
  transform: translateY(var(--wall-travel)) scaleY(.68);
  background: linear-gradient(180deg, #dec49b 0 22%, #c3a071 22% 31%, #ad855d 32% 81%, #785944 82%);
  clip-path: polygon(0 28%, 6% 28%, 6% 0, 28% 0, 28% 22%, 40% 22%, 40% 0, 60% 0, 60% 22%, 72% 22%, 72% 0, 94% 0, 94% 28%, 100% 28%, 100% 86%, 96% 100%, 4% 100%, 0 86%);
  transition: transform 260ms cubic-bezier(.2,.8,.3,1), opacity 190ms ease;
}
.field-wall > i::after {
  content: "";
  position: absolute;
  inset: 38% 0 15%;
  background:
    linear-gradient(transparent 40%, #684b3890 42% 54%, transparent 56%),
    repeating-linear-gradient(90deg, transparent 0 22%, #684b3870 22% 24%, transparent 24% 48%);
}
.wall-active > .field-wall > i { opacity: 1; transform: none; }
.wall-active > .field-wall > i:nth-child(2) { transition-delay: 45ms; }
.wall-active > .field-wall > i:nth-child(3) { transition-delay: 90ms; }
.field-effect-layer {
  position: absolute;
  z-index: -1;
  inset: 3px;
  border-radius: 10px;
  pointer-events: none;
}
.field-effect-layer.mysticGuard {
  border: 1px solid #bc8460;
  box-shadow: inset 0 0 16px #f3ce7d9e, inset 0 0 0 2px #fff1b4;
  background:
    radial-gradient(circle at 3% 11%, #fff7df 0 2px, #dd913f 2.5px 4px, transparent 4.5px),
    radial-gradient(circle at 97% 89%, #fff7df 0 2px, #dd913f 2.5px 4px, transparent 4.5px),
    repeating-linear-gradient(120deg, transparent 0 22px, #ffedb93b 23px 24px, transparent 25px 36px);
}
.field-effect-layer.auroraVeil {
  inset: 8px 7px;
  border-block: 2px solid #69b7d3;
  box-shadow: inset 0 2px #d7f7ff, inset 0 -2px #d7f7ff;
  background:
    repeating-linear-gradient(112deg, #e9faff80 0 4px, #a4ddeb3b 5px 16px, #7ec0d440 17px 32px),
    linear-gradient(#9dd8ea49, #9dd8ea29);
}
.field-effect-layer.wish {
  inset: 14px 12px;
  border-inline: 3px dashed #c7795c;
  background: linear-gradient(90deg, #f1b39075, transparent 13% 87%, #f1b39075);
}
.center-line {
  position: relative;
  display: grid;
  align-content:center;
  gap:2px;
  place-items: center;
  overflow: hidden;
}
.center-line::before { content:""; position:absolute; z-index:-1; inset:50% 2px auto; border-top:1px solid #6b66556b; }
.message {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: 3px;
  color: #34372c;
  background: #faf4e4;
  text-align: center;
  font-size: .73rem;
  font-weight: 750;
  line-height: 1.2;
}
.message:empty { visibility: hidden; min-height: calc(.73rem * 1.2 + 4px); }
.left-rail { grid-template-columns: minmax(0, 1fr) auto; }
.deck-stack { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.deck-card, .discard-pile {
  min-width: 0;
  min-height: 47px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 4px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  text-align: left;
}
.deck-card {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 4px;
}
.pile-cards {
  width: clamp(25px, 8.5vw, 43px);
  aspect-ratio: var(--card-ratio);
  position: relative;
}
.pile-cards > .game-card { position: relative; z-index: 1; }
.pile-cards::after {
  content: "";
  position: absolute;
  inset: 3px -1px -3px 2px;
  border: 1px solid #ab9a81;
  border-radius: 4px;
  background: repeating-linear-gradient(#fff9e9 0 2px, #dccfb5 2px 3px);
}
.pile-cards.empty::after { inset: 0; border-style: dashed; background: #ece3ce; }
.deck-stack.can-draw .deck-card:not(:disabled) {
  position: relative;
  background: #fff8df;
  border-color: #996a20;
  box-shadow: 0 0 0 1px #e9b64b, inset 0 0 9px #ffd05c38;
}
.deck-stack.can-draw .deck-card:not(:disabled)::after {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: 2;
  padding: 3px;
  border-radius: 7px;
  pointer-events: none;
  background: conic-gradient(from var(--orbit-angle), transparent 0 60%, #e9a43f 70%, #fff09e 86%, #fffef0 95%, transparent 100%);
  animation: border-light-orbit 1.85s linear infinite;
}
.deck-card.drawing {
  background: #ffdf7f;
  border-color: #8a5717;
  box-shadow: 0 0 0 2px #ffcd47, 0 0 12px #ffbd4c;
}
.deck-meta { min-width: 0; display: grid; gap: 1px; color: #514c40; font-size: .65rem; }
.deck-name { font-weight: 850; }
.deck-meta small { font-size: inherit; }
.pile-top-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: .73rem;
  font-weight: 850;
  line-height: 1.12;
  block-size: 2.24em;
}
.discard-pile { justify-items: center; min-width: 48px; color: #514c40; background: #eee4ce; font-size: .7rem; }
.discard-pile strong { font-size: .8rem; }
.player-row { display: grid; min-width: 0; gap: 4px; }
.player-controls { grid-template-columns:minmax(0,1fr) auto; align-items:center; }
.player-commands { display:grid; justify-items:end; align-content:center; gap:5px; }
.player-commands .end-button {
  min-width:91px; min-height:44px; padding:0 10px;
  background:#3b4b39;
  border:1px solid #263227; border-radius:7px;
  color:#fff8e7; font-size:.76rem; font-weight:850; white-space:nowrap;
  box-shadow:0 3px 0 #263227,inset 0 1px 0 #647052;
}
.hand-wrap {
  min-width: 0;
  border-radius: 5px;
  background: #f0e8d5;
}
.hand-heading { display:flex; height:16px; justify-content:flex-end; align-items:center; padding:0 8px; }
.hand-wrap h2 { position:absolute; width:1px; height:1px; margin:0; overflow:hidden; clip-path:inset(50%); }
.hand-hint { color: #525445; font-size: .69rem; font-weight: 750; }
.hand-grid {
  --hand-card-size: calc(var(--hand-height) * (var(--card-ratio)));
  min-width: 0;
  display: grid;
  height: calc(var(--hand-height) + 12px);
  padding: 7px 8px 5px;
  touch-action: none;
}
.hand-row {
  min-width: 0;
  display: grid;
  justify-self: center;
  width: min(100%, var(--hand-card-size));
  grid-template-columns: minmax(0, 1fr);
}
.hand-row.overlapping {
  width: min(100%, calc(var(--hand-card-size) * (1 + var(--overlap-count) * .76)));
  grid-template-columns: repeat(var(--overlap-count), minmax(0, 1fr)) var(--hand-card-size);
}
.hand-grid > .empty-note { display: none; }
.card-shell {
  display: grid;
  align-content: start;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  cursor: pointer;
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
}
.card-shell > .game-card {
  width: var(--hand-card-size);
  pointer-events: none;
  transform: rotate(var(--hand-tilt, 0deg));
  transform-origin: center 95%;
  transition: transform 130ms ease, box-shadow 140ms ease, opacity 130ms ease;
}
.card-shell:is(:focus-visible, .selected) { z-index: 1; }
.card-shell:active { transform: none; }
.field-slot:has(.card-pressed) { z-index: 3; }
.game-card.card-pressed { transform: translateY(-3px) scale(1.055); }
.card-shell .game-card.card-pressed { transform: rotate(var(--hand-tilt, 0deg)); }
.card-shell.disabled-card .game-card { filter: saturate(.68); }
.card-shell.playable .game-card { box-shadow: 0 2px 0 #33203f45, 0 0 0 1px #fff4; }
.card-shell.lifted .game-card, .field-slot.lifted .game-card { opacity: .2; }

.game-card {
  --card-rim: #e9c18f;
  --card-edge: #63394d;
  --card-paper: #fff4de;
  --card-banner: #64466f;
  --card-banner-line: #bb899c;
  --card-sky: #f5bd9d;
  --card-light: #fbd3aa;
  --card-horizon: #af85be;
  --card-hill: #a87ca7;
  --card-hill-near: #bd8ca9;
  --card-sun: #ffe7b8;
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  min-width: 0;
  min-height: 0;
  width: 100%;
  aspect-ratio: var(--card-ratio);
  border: 1px solid var(--card-edge);
  border-radius: 6% / 4.3%;
  background: var(--card-rim);
  box-shadow: 0 2px 0 var(--card-edge), 0 3px 6px #33203f30;
  color: #3e2d43;
}
.game-card.item {
  --card-rim: #a9d2ca;
  --card-edge: #3c5865;
  --card-paper: #eef9ef;
  --card-banner: #3e6575;
  --card-banner-line: #81aeb1;
  --card-sky: #a3d8d5;
  --card-light: #cbe7d0;
  --card-horizon: #87a6c2;
  --card-hill: #7696ad;
  --card-hill-near: #94b9b8;
  --card-sun: #e7f2d2;
}
.game-card.action {
  --card-rim: #c9b4df;
  --card-edge: #5b4077;
  --card-paper: #f8effb;
  --card-banner: #5e4389;
  --card-banner-line: #aa90c7;
  --card-sky: #bb9fdf;
  --card-light: #e0bce9;
  --card-horizon: #8f82c0;
  --card-hill: #8c78b4;
  --card-hill-near: #ab91c4;
  --card-sun: #fdecf7;
}
.game-card.special-card {
  --card-rim: #d9ab58;
  --card-edge: #58381b;
  --card-paper: #fff2cd;
  --card-banner: #3b2c38;
  --card-banner-line: #deb466;
  background: repeating-linear-gradient(128deg, #734920 0%, #b38036 6%, #f9e3a6 12%, #ce9942 19%, #81532d 30%, #e3b764 41%);
  box-shadow: 0 2px 0 #583d28, 0 4px 8px #573d3a54;
}
.game-card.special-card .card-face::before {
  inset: 1.3% 1.9%;
  border-color: #fff0b1;
  box-shadow: inset 0 0 0 .6cqw #704820b0, 0 0 0 .35cqw #79502b;
}
.game-card.special-card .card-type-label {
  background: #392e36;
  color: #ffe9a9;
  border-color: #f2cc82;
  letter-spacing: .05em;
}
.game-card.special-card .card-effect-box {
  background: repeating-linear-gradient(135deg, #f9e6b4 0%, #fff3d0 36%, #fff7dd 50%, #f5deaa 100%);
}
.card-face {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.card-face::before {
  content: "";
  position: absolute;
  inset: 1.9% 2.5%;
  border: max(.5px, .3cqw) solid color-mix(in srgb, var(--card-edge), #e0aeb6 40%);
  border-radius: 5% / 3.5%;
  pointer-events: none;
}
.card-type-label {
  position: absolute;
  z-index: 3;
  inset: 4.7% auto auto 50%;
  translate: -50% -50%;
  min-width: 45%;
  padding: 1.25cqw 3cqw 1.5cqw;
  border: max(.5px, .3cqw) solid var(--card-edge);
  border-radius: 1cqw 1cqw 2.8cqw 2.8cqw;
  background: var(--card-paper);
  box-shadow: 0 .7cqw 0 #6f436435;
  font-size: 4cqw;
  font-weight: 850;
  letter-spacing: .1em;
  line-height: 1.18;
  text-align: center;
  white-space: nowrap;
}
.card-art {
  position: absolute;
  inset: 8% 6% auto;
  height: 46%;
  overflow: hidden;
  border: max(.5px, .55cqw) solid var(--card-edge);
  border-radius: 46% 46% 29% 29% / 22% 22% 15% 15%;
  background: radial-gradient(ellipse at 50% 48%, var(--card-sun) 0 31%, #ffebc55e 32% 40%, transparent 41%),
    linear-gradient(158deg, var(--card-sky), var(--card-light) 48%, var(--card-horizon));
  box-shadow: inset 0 0 0 .65cqw #ffeece9c, inset 0 -1.8cqw 4cqw #724e7e40;
}
.card-terrain {
  position: absolute;
  inset: 67% -5% -43%;
  border-radius: 47% 53% 0 0;
  background: var(--card-hill);
  transform: rotate(-8deg);
  box-shadow: 0 -1cqw 0 #f8d2ba59, 0 -3cqw 0 #dc9cb5;
}
.card-terrain::after {
  content: "";
  position: absolute;
  inset: 5% -4% 0 57%;
  border-radius: 50%;
  background: var(--card-hill-near);
}
.card-spark {
  position: absolute;
  color: #fff2cc;
  line-height: 1;
  font-size: 6cqw;
  text-shadow: 0 0 3cqw #fff3da;
}
.card-spark.left { left: 13%; top: 30%; }
.card-spark.right { right: 11%; top: 46%; font-size: 4cqw; }
.card-art.has-art::after {
  content: "";
  position: absolute;
  inset: 7% 11% 5%;
  background: var(--card-art) center / contain no-repeat;
  image-rendering: pixelated;
  filter: drop-shadow(0 1.3cqw .9cqw #56304863);
}
.game-card:is(.action, .item) .card-art.has-art {
  border-radius: 5cqw 5cqw 1cqw 1cqw;
  background: var(--card-art) center / cover no-repeat;
  image-rendering: pixelated;
  box-shadow: none;
}
.game-card:is(.action, .item) .card-art.has-art :is(.card-terrain, .card-spark),
.game-card:is(.action, .item) .card-art.has-art::after { display: none; }
.game-card.special-card.action .card-art.has-art {
  border-color: #e9c77e;
  box-shadow: 0 0 0 .7cqw #79502d, inset 0 0 4cqw #3521367a;
}
.game-card.special-card.action .card-art.has-art::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(130deg, #ffe9b386, transparent 28%, transparent 68%, #fff0ab6b),
    repeating-linear-gradient(135deg, transparent 0 19%, #fff0b94d 19.5% 20%, transparent 20.5% 28%);
}
.card-art:not(.has-art)::after {
  content: "✦";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: color-mix(in srgb, var(--card-banner), var(--card-paper) 16%);
  font-size: 27cqw;
  text-shadow: 0 .8cqw 0 #fff9;
}
.game-card.item .card-art:not(.has-art)::after { content: "◆"; }
.card-title-band {
  position: absolute;
  z-index: 3;
  inset: 52% 4% auto;
  height: 10%;
  display: grid;
  place-items: center;
  border: max(.5px, .48cqw) solid var(--card-edge);
  border-radius: 1.6cqw;
  background: var(--card-banner);
  color: #fff3dc;
  box-shadow: inset 0 0 0 .55cqw var(--card-banner-line), 0 1cqw 0 #6d456239;
  font-size: var(--title-size);
  font-weight: 900;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}
.card-title-band::before, .card-title-band::after {
  content: "";
  position: absolute;
  top: 19%;
  width: 5.6cqw;
  height: 82%;
  background: color-mix(in srgb, var(--card-banner), var(--card-banner-line) 30%);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 23% 50%);
}
.card-title-band::before { right: 100%; }
.card-title-band::after { left: 100%; transform: scaleX(-1); }
.card-effect-box {
  position: absolute;
  inset: 60% 6.2% 8%;
  display: grid;
  place-items: center;
  padding: 3cqw 5cqw 5cqw;
  border: max(.5px, .5cqw) solid color-mix(in srgb, var(--card-edge), var(--card-paper) 40%);
  border-radius: 3cqw;
  background: var(--card-paper);
  font-size: var(--effect-size);
  font-weight: 750;
  line-height: 1.4;
  text-align: center;
  overflow-wrap: anywhere;
}
.unit .card-effect-box { padding-bottom: 10cqw; }
.unit .card-effect-box.long-effect { padding: 4cqw 3cqw 14cqw; line-height: 1.22; }
.card-effect-box strong { color: var(--card-banner); font-weight: 900; }
.stat-badge {
  --stat-edge: #665281;
  --stat-fill: #d5c5f3;
  position: absolute;
  z-index: 4;
  bottom: 3.4%;
  display: flex;
  width: 24%;
  aspect-ratio: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: max(.6px, .65cqw) solid var(--stat-edge);
  border-radius: 50%;
  background: radial-gradient(circle at 36% 20%, #fff8, transparent 65%), var(--stat-fill);
  box-shadow: inset 0 0 0 .65cqw #fff7, 0 1cqw 0 var(--stat-edge), 0 1.9cqw 2cqw #47283d37;
  color: #342746;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}
.stat-badge.power { left: 2.9%; }
.stat-badge.hp { right: 2.9%; --stat-edge: #3e7065; --stat-fill: #bfe4cc; color: #235145; }
.stat-badge small { font-size: 3.55cqw; font-weight: 900; letter-spacing: .12em; }
.stat-value { position: relative; display: inline-block; font-size: 11.6cqw; font-weight: 900; line-height: .97; }
.stat-badge.hp .stat-value { translate: -1.85cqw; }
.stat-max { position: absolute; bottom: .35cqw; left: calc(100% + .25cqw); font-size: 3.7cqw; white-space: nowrap; }
:is(.field-slot.filled, .battle-moving-card.field-flight) .stat-badge {
  width: 36%;
  bottom: -14%;
  transform-origin: center bottom;
}
:is(.field-slot.filled, .battle-moving-card.field-flight) .stat-badge.power { left: -7%; }
:is(.field-slot.filled, .battle-moving-card.field-flight) .stat-badge.hp { right: -7%; }
:is(.field-slot.filled, .battle-moving-card.field-flight) .stat-badge small { font-size: clamp(6px, 9.6cqw, 11px); letter-spacing: .04em; }
:is(.field-slot.filled, .battle-moving-card.field-flight) .stat-value { font-size: 18cqw; }
:is(.field-slot.filled, .battle-moving-card.field-flight) .stat-badge.hp .stat-value { translate: none; }
:is(.field-slot.filled, .battle-moving-card.field-flight) .stat-max { position: static; margin-inline-start: .6cqw; font-size: 6cqw; }
:is(.field-slot.filled, .battle-moving-card.field-flight) .card-effect-box {
  inset: 62% 4% 13%;
  padding: 1cqw 1.5cqw 4.5cqw;
  font-size: calc(var(--effect-size) * 1.4);
  line-height: 1.16;
}
:is(.field-slot.filled, .battle-moving-card.field-flight) .card-effect-box.long-effect {
  align-items: start;
  font-size: calc(var(--effect-size) * 1.28);
  line-height: 1.13;
}
.stat-badge.stat-pulsing { z-index: 6; animation: pulse-card-stat var(--stat-duration, 1080ms) cubic-bezier(.2,.76,.28,1); }
.stat-badge.stat-pulsing.loss { --stat-edge: #9a425d; --stat-fill: #f7c1c7; color: #67213b; }
.stat-badge.stat-pulsing.gain { --stat-edge: #3c7263; --stat-fill: #bcebd1; color: #235145; }
.stat-badge.power.stat-pulsing.gain { --stat-edge: #78579f; --stat-fill: #e2cbff; color: #492966; }
.stat-up { color: #166448; }
.stat-down { color: #a32d48; }
@keyframes pulse-card-stat {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.78); }
  66% { transform: scale(1.66); }
}
.state-badge, .held-item-icon {
  position: absolute;
  z-index: 1;
  top: 16%;
  border: 1px solid #8d6eb645;
  border-radius: 20px;
  line-height: 1;
  background: #fff;
  color: #2d6252;
}
.state-badge { font-weight: 850; }
.state-badge.status-mark {
  top: 15%;
  right: 5%;
  left: auto;
  z-index: 2;
  display: grid;
  place-items: center;
  width: max(15px, 20cqw);
  aspect-ratio: 1;
  padding: 0;
  border-color: #fff9;
  background: #3c3050;
  color: #fff;
  font-size: clamp(9px, 12cqw, 18px);
}
.state-badge.sick { color: #4d351c; background: #fae8b9; border-color: #ae8047; }
.held-item-icon {
  top: 10%;
  left: 3%;
  display: block;
  width: clamp(16px, 25cqw, 38px);
  aspect-ratio: 1;
  border-radius: 18%;
  border-color: #f9e6b7;
  background: #f4e4ba url("assets/cards/item-hidden.png") center / 88% no-repeat;
  box-shadow: 0 0 0 1px #514049;
}
.held-item-icon:not([data-visible-card-id]) { pointer-events: none; }
.game-card .held-item-icon.has-art {
  background: var(--held-art) center / cover no-repeat;
  border-color: #ffefcc;
  box-shadow: 0 0 0 .75cqw #514049;
}
.card-back {
  width: 18px;
  aspect-ratio: var(--card-ratio);
  margin-inline-start: -10px;
  border: 1px solid #fff;
  border-radius: 3px;
  box-shadow: 0 1px 2px #34235755;
  background: var(--card-back-print);
  transform: rotate(var(--fan-rotation));
  transform-origin: 50% 90%;
}

.right-rail { display: contents; }
.detail-backdrop { position: absolute; z-index: 20; inset: 0; background: #292d2459; animation: fade-in 130ms ease both; }
.detail-panel {
  position: absolute;
  z-index: 21;
  inset: auto var(--battle-inset) max(5px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  max-height: min(84dvh, 680px);
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 8px 24px #292d2445;
  animation: fade-in 180ms ease-out both;
}
.detail-command-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  min-height: 53px;
  padding: 7px 13px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
#detailTitle { min-width: 0; overflow-wrap: anywhere; line-height: 1.3; }
.detail-command-bar .close-detail { flex: none; }
#detailContent {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 10px 13px 13px;
}
.detail-footer {
  flex: none;
  display: grid;
  padding: 8px 13px 10px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.detail-footer .detail-confirm-button { width: 100%; }
.detail-card, .detail-actions, .action-form, .click-picker-wrap { display: grid; min-width: 0; gap: 8px; }
.detail-card > .game-card, .card-hover-preview > .game-card { justify-self: center; width: min(100%, 220px); }
.compact-command {
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 9px 12px;
}
.compact-command > .game-card { width: 100%; }
.command-summary { min-width: 0; display: grid; gap: 4px; }
.command-effect { font-size: .82rem; line-height: 1.45; overflow-wrap: anywhere; }
.compact-command .detail-actions { grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(116px, 1fr)); gap: 6px; }
.compact-command .detail-actions > :not(.battle-command) { grid-column: 1 / -1; }
.choice-sheet .compact-command { grid-template-columns: minmax(0, 1fr); }
.choice-sheet .modern-detail-card > :is(.game-card, .command-summary) { display: none; }
.battle-command {
  --command-color: #344436;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
  min-height: 46px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--command-color);
  background: var(--paper-stock);
  font-weight: 900;
  font-size: .88rem;
  line-height: 1.18;
}
.command-icon {
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  height: 24px;
  font-size: .96rem;
}
.command-attack { --command-color: #823748; }
.command-item { --command-color: #276b62; }
.command-skill { --command-color: #484a83; }
.detail-actions .small-button:not(:disabled) { background: var(--violet); border-color: var(--violet); color: white; font-size: 1rem; }
.detail-actions .small-button:disabled { font-size: .84rem; }
.detail-card h2 { font-size: 1.18rem; }
.click-picker, .detail-panel .discard-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: max-content;
  align-content: start;
  gap: 7px;
}
.click-picker button, .detail-panel .discard-list button {
  position: relative;
  min-width: 0;
  min-height: 52px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper-stock);
  overflow-wrap: anywhere;
  text-align: left;
}
.click-picker button[aria-pressed] { padding-right: 37px; }
.click-picker .selected { outline: 2px solid var(--violet); outline-offset: -2px; background: #e6ead6; }
.click-picker button[aria-pressed]::after {
  position: absolute;
  content: "";
  top: 50%;
  right: 9px;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  border: 1px solid #c2b2dd;
  border-radius: 50%;
  background: white;
  color: white;
  font-size: .78rem;
  pointer-events: none;
}
.click-picker button[aria-pressed="true"]::after { content: "✓"; background: var(--violet); border-color: var(--violet); }
.click-picker .pile-choice-card .pile-cards { width: 44px; }
.click-picker .pile-choice-card .deck-meta { font-size: .8rem; }
.click-picker .pile-choice-card .pile-top-name { font-size: .93rem; }
:is(.choice-card, .target-choice-card, .discard-list .mini-card):has(.choice-thumbnail, .target-life-value) {
  display: grid;
  grid-template-columns: 45px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
}
.choice-thumbnail { display: block; width: 100%; aspect-ratio: var(--card-ratio); }
.choice-copy { display: grid; min-width: 0; gap: 3px; text-align: left; }
.choice-copy strong { line-height: 1.25; font-size: .92rem; }
.choice-effect, .choice-copy small { font-size: .77rem; color: #57496a; line-height: 1.45; }
.choice-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 800; }
.choice-count, .choice-source { font-size: .77rem; color: #604887; font-weight: 800; }
.choice-count { white-space: nowrap; }
.target-life-value { font-weight: 850; text-align: center; }
.battle-log-list { display: grid; gap: 4px; padding-inline-start: 21px; font-size: .86rem; line-height: 1.4; }
.log-turn-separator { font-weight: 850; color: var(--violet-dark); }

.animation-lock .battle-shell { pointer-events: none; }
.animation-lock .battle-shell :is(.detail-panel, .detail-backdrop) { visibility: hidden; }
:is(.awaiting-summon, .attacking-in-flight) > .game-card { visibility: hidden; }
.card-hover-preview {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  place-items: center;
  background: #21123746;
  pointer-events: none;
}
.card-hover-preview.show { display: grid; }
.card-dragging .card-hover-preview { display: none; }
.touch-card-preview {
  position: fixed;
  inset: 0;
  z-index: 47;
  display: grid;
  place-items: center;
  padding-bottom: 5dvh;
  background: #24173750;
  pointer-events: none;
}
.touch-card-frame {
  display: grid;
  justify-items: center;
  gap: 8px;
}
.touch-card-hint {
  padding: 6px 12px;
  border-radius: 20px;
  background: #35264e;
  color: #fff;
  font-size: .8rem;
  font-weight: 750;
}
.touch-card-preview .game-card {
  width: min(88vw, 292px, calc(80dvh * (var(--card-ratio))));
  box-shadow: 0 8px 22px #3423516b;
}
.game-card.drag-ghost { position: fixed; z-index: 45; inset: 0 auto auto 0; pointer-events: none; transform-origin: left top; box-shadow: 0 9px 19px #2e1e5566; will-change: transform; }
.drag-ghost.over-target { filter: brightness(1.045); box-shadow: 0 8px 17px #2e1e5544, 0 0 0 2px #fff; }
.game-card.drag-ghost.returning { z-index: 18; }
.drop-ready { outline: 1.5px dashed #6c52b7; outline-offset: -2px; border-radius: 12px; }
.drop-ready.drag-target { outline: 2px solid #5632c4; box-shadow: inset 0 0 0 6px #ffffff92; }
.left-rail.drop-ready { position: relative; }
.left-rail.drop-ready::after {
  content: "ここで離す";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 1px dashed #785bc3;
  border-radius: 11px;
  background: #eee5ff;
  color: #533495;
  font-weight: 850;
  font-size: .88rem;
  pointer-events: none;
}
.left-rail.drop-ready.drag-target::after { background: #ded0ff; border-style: solid; }
.target-toolbar {
  position: absolute;
  z-index: 18;
  inset: auto var(--battle-inset) max(7px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 9px 7px 13px;
  border: 1px solid #a88cdd;
  border-radius: 14px;
  background: #f7f1ff;
  color: #44277f;
  font-size: .88rem;
  font-weight: 850;
}
.choosing-target :is(.left-rail, .opponent-hand-area, .battle-top-actions, .player-commands, .hand-wrap, .center-line),
.choosing-target :is(.field-slot, .life-box):not(.board-target) {
  filter: brightness(.58) saturate(.56);
}
.choosing-target .arena { box-shadow:inset 0 0 0 999px #29233429; }
.choosing-target :is(.field-slot, .card-shell).selected:not(.board-target) > .game-card { outline: none; }
.choosing-target .board-target {
  position: relative;
  outline: 2px solid #6742c7;
  outline-offset: 2px;
  border-radius: 10px;
  box-shadow: 0 0 0 4px #fff8;
  cursor: pointer;
}
.drop-instruction {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: calc(100% - 20px);
  padding: 4px 11px;
  border-radius: 20px;
  color: white;
  background: var(--violet-dark);
  font-size: .75rem;
  font-weight: 850;
  white-space: nowrap;
  pointer-events: none;
}
.card-dragging .message { visibility: hidden; }
.fx-float, .turn-banner, .card-cast {
  position: fixed;
  z-index: 44;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.fx-float, .turn-banner {
  width: max-content;
  max-width: 84vw;
  padding: 9px 15px;
  border: 2px solid #fff;
  border-radius: 18px;
  background: #6d4ce0;
  color: white;
  box-shadow: 0 4px 0 #432b9f;
  font-size: .95rem;
  font-weight: 850;
  text-align: center;
  white-space: pre-line;
  animation: float-message var(--presentation-time, 2200ms) ease both;
}
.fx-float.damage { background: #a63b5b; box-shadow: 0 4px 0 #702b40; }
.fx-float.heal { background: #187052; box-shadow: 0 4px 0 #104733; }
.turn-banner { background: #fff0ad; color: #472b68; box-shadow: 0 4px 0 #bc9344; }
.card-cast { width: min(48vw, 200px); animation: cast var(--presentation-time, 1750ms) ease both; }
.battle-stage {
  position: fixed;
  z-index: 43;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.battle-stage-caption {
  position: absolute;
  z-index: 4;
  top: var(--caption-y, 46%);
  left: 50%;
  width: max-content;
  max-width: min(88vw, 440px);
  padding: 5px 12px;
  border: 1px solid #8b8169;
  border-radius: 5px;
  background: var(--print-ink);
  color: var(--paper-stock);
  box-shadow: 0 2px 0 #2a282435;
  translate: -50% -50%;
  font-size: .78rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.3;
}
.battle-moving-card,
.battle-target-pulse,
.battle-stat-change {
  position: absolute;
  translate: -50% -50%;
}
.battle-moving-card { z-index: 2; }
.battle-moving-card > .game-card,
.battle-flight-back { width: 100%; }
.battle-flight-back {
  display: grid;
  place-items: center;
  aspect-ratio: var(--card-ratio);
  border: 2px solid #fff;
  border-radius: 8px;
  color: #fff2c7;
  background: var(--card-back-print);
  box-shadow: 0 4px 10px #302c2445;
}
.battle-moving-card.lunge { animation: battle-lunge var(--presentation-time) both; }
.battle-moving-card:is(.fly, .effect-flight) { animation: battle-fly var(--presentation-time) both; }
.battle-stage-draw .battle-moving-card.fly { animation-name: battle-draw-flight; }
.battle-moving-card.draw-face { animation:battle-draw-flight var(--own-draw-flight) both; }
.battle-moving-card.summon-flight { animation: battle-draw-flight var(--presentation-time) both; }
.battle-moving-card.field-flight { animation: battle-field-flight var(--field-flight-time) ease-in-out both; }
.combat-defeated > .game-card { animation: combat-defeat-out 360ms 720ms both; }
.effect-departing > .game-card { animation: battle-depart 720ms 100ms both; }
.battle-target-pulse {
  z-index: 1;
  border: 2px solid #a579ef;
  border-radius: 12px;
  box-shadow: inset 0 0 0 2px #fff9, 0 0 12px #ad84ff99;
  animation: battle-pulse var(--presentation-time) both;
}
.battle-target-pulse.damage { border-color: #e57183; box-shadow: 0 0 12px #ff8696a0; }
.battle-target-pulse.draw-source { border-color: #e6ab39; box-shadow: 0 0 12px #ffcf59b0; }
.battle-stat-change {
  z-index: 3;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  min-width: 44px;
  padding: 3px 6px;
  border: 2px solid #fff;
  border-radius: 12px;
  color: #fff;
  background: #65449f;
  box-shadow: 0 3px 0 #38274a50;
  font-weight: 850;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  animation: battle-count var(--presentation-time) both;
}
.battle-stat-change.loss { background: #a83d58; }
.battle-stat-change.gain { background: #187656; }
.battle-stat-change small { font-size: .64rem; }
.battle-stat-change strong { font-size: 1.48rem; line-height: 1.22; }
.battle-stat-change b { font-size: .74rem; }
.battle-stat-change[data-stat="power"] { translate: -75% -50%; }
.battle-stat-change[data-stat="hp"] { translate: -30% -50%; }
.battle-stage-cast {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 11px;
  padding: 12px;
  background: #24173a63;
  animation: battle-cast-visible var(--presentation-time) both;
}
.battle-stage-cast > .game-card {
  width: min(56vw, 214px, calc(51dvh * var(--card-ratio)));
  box-shadow: 0 6px 25px #26193e70;
}
.battle-stage-cast.pending-card-entrance > .game-card { visibility:hidden; }
.cast-from-hand :is(.battle-stage-caption, .battle-cast-text) {
  animation:fade-in 150ms var(--cast-entrance-time) both;
}
.battle-stage-cast .battle-stage-caption { position: relative; inset: auto; translate: none; }
.battle-cast-text {
  margin: 0;
  max-width: min(88vw, 390px);
  padding: 8px 12px;
  border: 1px solid #d7c6f4;
  border-radius: 12px;
  background: #fff7ed;
  color: #3b284d;
  font-size: .9rem;
  font-weight: 750;
  line-height: 1.5;
}
@keyframes battle-cast-visible {
  0%, 100% { opacity: 0; }
  7%, 94% { opacity: 1; }
}
@keyframes battle-lunge {
  0% { opacity: 1; transform: scale(1); }
  20% { opacity: 1; transform: scale(1.12); }
  62% { opacity: 1; transform: translate(var(--travel-x), var(--travel-y)) scale(1.09); }
  78% { opacity: 1; transform: translate(var(--travel-x), var(--travel-y)) scale(.96); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes battle-fly {
  0% { opacity: 0; transform: scale(.65); }
  25% { opacity: 1; }
  76% { opacity: 1; transform: translate(var(--travel-x), var(--travel-y)) scale(1); }
  100% { opacity: 0; transform: translate(var(--travel-x), var(--travel-y)) scale(.86); }
}
@keyframes battle-draw-flight {
  0% { opacity: 0; transform: scale(.65); }
  15% { opacity: 1; }
  93% { opacity: 1; transform: translate(var(--travel-x), var(--travel-y)) scale(.86); }
  100% { opacity: 0; transform: translate(var(--travel-x), var(--travel-y)) scale(.86); }
}
@keyframes battle-field-flight {
  from { transform: scale(1); }
  52% { transform: translate(calc(var(--travel-x) / 2 + var(--flight-bend, 0px)), calc(var(--travel-y) / 2)) scale(.91); }
  to { transform: translate(var(--travel-x), var(--travel-y)) scale(1); }
}
@keyframes battle-depart {
  0%, 45% { opacity: 1; }
  100% { opacity: 0; transform: translateY(16px) scale(.9); }
}
@keyframes combat-defeat-out {
  to { opacity: 0; transform: translateY(12px) scale(.9); }
}
@keyframes battle-pulse {
  0%, 18%, 100% { opacity: 0; }
  45%, 76% { opacity: 1; }
}
@keyframes battle-count {
  0% { opacity: 0; transform: scale(.76); }
  19%, 88% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; }
}
.fx-summon > .game-card { animation: spring-card 580ms cubic-bezier(.21,.75,.25,1.15) both; }
.fx-hit > .game-card, .life-damage { animation: card-hit 930ms ease both; }
.fx-attack > .game-card, .fx-attack-charge > .game-card { animation: spring-card 440ms ease both; }
.fx-draw { animation: spring-card 460ms ease both; }
.fx-item > .game-card, .life-heal { animation: card-heal 870ms ease both; }
.fx-stat-up > .game-card, .fx-stat-down > .game-card { animation: spring-card 720ms ease both; }
.winner-overlay, .confirm-overlay, .battle-start-overlay {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 14px;
  background: #292d247c;
  animation: fade-in 180ms ease both;
}
.winner-card, .confirm-card, .battle-start-card {
  width: min(100%, 380px);
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 18px;
  border: 1px solid #b8b09d;
  border-radius: 9px;
  background: var(--paper-stock);
  box-shadow: var(--soft-shadow);
  text-align: center;
}
:is(.winner-card, .confirm-card) button {
  min-height: 44px;
  padding: 7px 12px;
  border: 1px solid #b8b09d;
  border-radius: 5px;
  background: #eee4ce;
  font-weight: 850;
}
.winner-actions, .confirm-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.battle-start-card { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; padding: 13px; }
.battle-start-player { display: grid; min-width: 0; justify-items: center; gap: 6px; overflow-wrap: anywhere; }
.battle-start-player img { width: min(70px, 100%); }
.battle-start-vs { display: grid; gap: 3px; color: var(--violet-dark); font-weight: 950; }
.battle-start-vs span { font-size: .75rem; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes spring-card { from { transform: scale(.88) translateY(4px); } 70% { transform: scale(1.05) translateY(-1px); } to { transform: none; } }
@keyframes card-hit { 28% { transform: rotate(-6deg); filter: saturate(1.8); } 52% { transform: rotate(4deg); } }
@keyframes card-heal { 40% { filter: brightness(1.17); transform: scale(1.025); } }
@keyframes float-message { from { opacity: 0; transform: translate(-50%, -36%) scale(.95); } 9%, 91% { opacity: 1; transform: translate(-50%, -50%) scale(1); } to { opacity: 0; transform: translate(-50%, -58%); } }
@keyframes cast { from { opacity: 0; transform: translate(-50%, -40%) scale(.87) rotate(-4deg); } 13%, 90% { opacity: 1; transform: translate(-50%, -50%) scale(1); } to { opacity: 0; transform: translate(-50%, -56%) scale(.98); } }
@media (max-height: 620px) {
  .battle-shell { --hand-height: clamp(78px, 16dvh, 95px); gap: 4px; }
  .arena { grid-template-rows:minmax(0,1fr) 29px minmax(0,1fr); gap:3px; padding-block:6px; }
  .life-box { grid-template-columns:35px minmax(0,1fr) auto; column-gap:6px; }
  .life-box .player-avatar { width:35px; }
  .life-readout { min-height:28px; }
  .life-readout b { font-size:1.99rem; }
  .detail-card:not(.compact-command) > .game-card { width: min(100%, 190px); }
}
@media (min-width: 560px) {
  .title-content { padding-inline: 24px; }
  .card-list-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .battle-shell, .title-screen { border-inline: 1px solid var(--line); }
}
@media (hover: hover) and (pointer: fine) {
  .card-shell:hover { z-index: 1; }
  .card-shell:hover .game-card { transform: translateY(-4px) rotate(0); box-shadow: 0 4px 0 #33203f42; }
  .modern-card-ui .card-shell.playable, .modern-card-ui .field-draggable { cursor: grab; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 0ms !important; }
  .wall-active > .field-wall > i:nth-child(n) { transition-delay: 0ms; }
  .fx-float, .turn-banner, .card-cast { animation-name: none; }
  .battle-moving-card { display: none; }
  .battle-target-pulse, .battle-stat-change, .battle-stage-cast { animation: none; }
  .stat-badge.stat-pulsing { animation: none; }
  .field-slot.action-ready > .game-card::after { animation: none; }
  .deck-stack.can-draw .deck-card:not(:disabled)::after { animation: none; }
}
