/* 中央操作欄、選択表示、モーダル、操作ボタン、ログ、特殊ウェイト。 */

/* 使用制限は操作時に理由を示し、通常盤面では小さい入口だけにする。 */
.effect-restriction-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 4px;
  border: 1px solid #bc9c65;
  border-radius: 8px;
  color: #f4d49a;
  background: #30291e;
  vertical-align: middle;
}
.effect-restriction-button:focus-visible {
  outline: 2px solid #f4d49a;
  outline-offset: 2px;
}
.effect-restriction-notice {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border-left: 3px solid #c39e63;
  border-radius: 4px;
  background: #32281ee8;
  color: #f1e9db;
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
  box-sizing: border-box;
  overflow-wrap: anywhere;
}
.effect-restriction-entry { display: grid; gap: 2px; }
.effect-restriction-entry + .effect-restriction-entry { margin-top: 8px; }
.effect-restriction-entry > strong { color: #ffe0a4; font-size: inherit; }
.effect-restriction-entry > small { color: #c6c5bb; font-size: 0.9em; }
.selection-detail--formal > .effect-restriction-notice { flex: 0 0 auto; margin-bottom: 6px; }
.effect-restrictions-dialog {
  inset: max(12px, var(--app-safe-top, env(safe-area-inset-top))) max(12px, var(--app-safe-right, env(safe-area-inset-right))) max(12px, var(--app-safe-bottom, env(safe-area-inset-bottom))) max(12px, var(--app-safe-left, env(safe-area-inset-left)));
  width: min(480px, calc(100vw - max(12px, var(--app-safe-left, env(safe-area-inset-left))) - max(12px, var(--app-safe-right, env(safe-area-inset-right)))));
  max-height: calc(100dvh - max(12px, var(--app-safe-top, env(safe-area-inset-top))) - max(12px, var(--app-safe-bottom, env(safe-area-inset-bottom))));
  padding: 16px;
  border: 1px solid #a89065;
  border-radius: 12px;
  background: #14221f;
  color: #eee9da;
  box-sizing: border-box;
  overflow: auto;
  overscroll-behavior: contain;
  font-size: 15px;
  line-height: 1.6;
}
.effect-restrictions-dialog::backdrop { background: #020807bb; }
.effect-restrictions-dialog > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.effect-restrictions-dialog h2 { margin: 0; font: inherit; font-weight: 700; }
.effect-restrictions-dialog button { font: inherit; padding: 6px 10px; min-height: 36px; }
.effect-restrictions-list { display: grid; gap: 14px; }
.effect-restrictions-list > section + section { border-top: 1px solid #65706566; padding-top: 12px; }
.effect-restrictions-list [data-restriction-card] { margin-top: 8px; }
.selection-status-badges { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
.selection-status-badges > .effect-restriction-button { width: 24px; height: 24px; min-width: 24px; min-height: 24px; padding: 2px; }
body.mobile-layout .selection-detail--compact:has(.effect-restriction-notice) .selection-text {
  max-height: calc(var(--mobile-selection-height) - 8px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
body.mobile-layout .selection-text > .effect-restriction-notice { padding: 5px 7px; font-size: 12px; line-height: 1.4; }

body.first-battle-options-highlight .mobile-options-tool {
  outline: 2px solid #efd59b;
  outline-offset: 2px;
  box-shadow: 0 0 12px #efd59b80;
}

/* 各配置の寸法を保ち、背景が文字に重なる情報面だけを濃くする。 */
#app .selection:not(.card-text-hold-preview),
#app #status {
  background:
    linear-gradient(110deg, var(--phase-tint), transparent 65%),
    linear-gradient(180deg, #18362ff5, #0c221eee);
  border-color: color-mix(in srgb, var(--phase-accent) 30%, #8d8466);
}
#app .selection-empty-guide strong {
  color: #efdfb5;
}
#app .selection-empty-guide span {
  color: #c8cebf;
}

.control-panel {
  position: sticky;
  --phase-status-height: max(var(--status-panel-min-height), calc(4.6em + 22px));
  top: 12px;
  z-index: 20;
  display: grid;
  gap: var(--ui-gap-md);
  padding: 12px;
  overflow: visible;
  --phase-accent: #d4af4c;
  --phase-accent-soft: rgba(212, 175, 76, 0.34);
  --phase-panel: rgba(33, 37, 31, 0.68);
  --phase-tint: rgba(224, 184, 78, 0.08);
  --phase-button: #30352e;
  --phase-mobile-button-bg: rgba(48, 53, 46, 0.96);
  --phase-mobile-start-bg: rgba(54, 60, 48, 0.98);
  --phase-mobile-end-bg: rgba(60, 50, 38, 0.98);
  --phase-mobile-button-border: rgba(212, 175, 76, 0.5);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 30%),
    linear-gradient(180deg, var(--phase-tint), transparent 24%),
    var(--phase-panel);
  border-color: var(--phase-accent-soft);
  box-shadow:
    inset 0 3px 0 var(--phase-accent),
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    var(--shadow-panel),
    0 0 0 1px rgba(0, 0, 0, 0.08);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

@media (min-width: 1081px) {
  /* 戦闘中は中央欄が伸びても、stickyの余白で表示位置を変えない。 */
  body:not(.mobile-layout):not(.mobile-landscape-layout) .control-panel.has-pending-battle {
    top: 0;
  }
}

.app.phase-main,
.control-panel.phase-main {
  --phase-accent: #79c48a;
  --phase-accent-soft: rgba(121, 196, 138, 0.34);
  --phase-panel: rgba(31, 39, 32, 0.7);
  --phase-tint: rgba(121, 196, 138, 0.1);
  --phase-button: #2c3d31;
  --phase-mobile-button-bg: rgba(37, 70, 45, 0.98);
  --phase-mobile-start-bg: rgba(35, 82, 47, 0.98);
  --phase-mobile-end-bg: rgba(46, 75, 42, 0.98);
  --phase-mobile-button-border: rgba(121, 196, 138, 0.62);
}

.app.phase-main2,
.control-panel.phase-main2 {
  --phase-accent: #85d3cc;
  --phase-accent-soft: rgba(133, 211, 204, 0.34);
  --phase-panel: rgba(29, 38, 38, 0.7);
  --phase-tint: rgba(133, 211, 204, 0.1);
  --phase-button: #2a3d3d;
  --phase-mobile-button-bg: rgba(34, 67, 68, 0.98);
  --phase-mobile-start-bg: rgba(34, 77, 77, 0.98);
  --phase-mobile-end-bg: rgba(43, 66, 61, 0.98);
  --phase-mobile-button-border: rgba(133, 211, 204, 0.62);
}

.app.phase-battle,
.control-panel.phase-battle {
  --phase-accent: #d98c5b;
  --phase-accent-soft: rgba(217, 140, 91, 0.38);
  --phase-panel: rgba(42, 34, 29, 0.72);
  --phase-tint: rgba(217, 140, 91, 0.11);
  --phase-button: #44352c;
  --phase-mobile-button-bg: rgba(76, 48, 32, 0.98);
  --phase-mobile-start-bg: rgba(92, 52, 30, 0.98);
  --phase-mobile-end-bg: rgba(76, 44, 28, 0.98);
  --phase-mobile-button-border: rgba(217, 140, 91, 0.66);
}

.app.phase-target,
.control-panel.phase-target {
  --phase-accent: #e3cf78;
  --phase-accent-soft: rgba(227, 207, 120, 0.38);
  --phase-panel: rgba(42, 39, 29, 0.72);
  --phase-tint: rgba(227, 207, 120, 0.11);
  --phase-button: #413b2a;
  --phase-mobile-button-bg: rgba(72, 63, 32, 0.98);
  --phase-mobile-start-bg: rgba(85, 72, 34, 0.98);
  --phase-mobile-end-bg: rgba(72, 58, 30, 0.98);
  --phase-mobile-button-border: rgba(227, 207, 120, 0.66);
}

.app.phase-commander,
.control-panel.phase-commander {
  --phase-accent: #e8897b;
  --phase-accent-soft: rgba(232, 137, 123, 0.4);
  --phase-panel: rgba(43, 31, 31, 0.74);
  --phase-tint: rgba(232, 137, 123, 0.12);
  --phase-button: #472f31;
  --phase-mobile-button-bg: rgba(78, 42, 42, 0.98);
  --phase-mobile-start-bg: rgba(91, 45, 43, 0.98);
  --phase-mobile-end-bg: rgba(70, 38, 38, 0.98);
  --phase-mobile-button-border: rgba(232, 137, 123, 0.66);
}

.app.phase-opening,
.app.phase-finish,
.control-panel.phase-opening,
.control-panel.phase-finish,
.rematch-deck-dialog {
  --phase-accent: #ffe19a;
  --phase-accent-soft: rgba(255, 225, 154, 0.36);
  --phase-panel: rgba(36, 34, 28, 0.74);
  --phase-tint: rgba(255, 225, 154, 0.1);
  --phase-button: #3e3727;
  --phase-mobile-button-bg: rgba(66, 58, 35, 0.98);
  --phase-mobile-start-bg: rgba(76, 66, 38, 0.98);
  --phase-mobile-end-bg: rgba(66, 54, 33, 0.98);
  --phase-mobile-button-border: rgba(255, 225, 154, 0.62);
}

.status {
  height: var(--phase-status-height);
  min-height: var(--phase-status-height);
  max-height: var(--phase-status-height);
  padding: 10px;
  border: 1px solid var(--phase-accent-soft);
  border-radius: var(--ui-radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 52%),
    linear-gradient(90deg, var(--phase-tint), transparent 54%),
    rgba(26, 29, 25, 0.66);
  line-height: 1.38;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 6px 16px rgba(0, 0, 0, 0.14);
}

.status strong {
  color: #ffe19a;
}

.phase-status-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: max-content minmax(0, 1fr);
  column-gap: 4px;
  height: 100%;
  min-height: 0;
}

.phase-status-heading {
  display: flex;
  align-items: center;
  gap: 0.3em;
  min-width: 0;
  white-space: nowrap;
}

.phase-status-heading strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.phase-status-phase {
  flex: 0 0 auto;
}

.phase-status-layout > .status-progress-badge {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  justify-self: end;
  white-space: nowrap;
}

.phase-status-details {
  grid-column: 1 / -1;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overflow-wrap: anywhere;
  scrollbar-width: thin;
}

.phase-status-layout:has(> .effect-restriction-button) { grid-template-columns: minmax(0, 1fr) 24px auto; }
.phase-status-layout > .effect-restriction-button { grid-column: 2; grid-row: 1; width: 24px; min-width: 24px; height: 24px; min-height: 24px; padding: 2px; }
.phase-status-layout:has(> .effect-restriction-button) > .status-progress-badge { grid-column: 3; }
.phase-status-layout:has(> .effect-restriction-button) .phase-status-phase { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

@media (orientation: landscape) {
  body:not(.mobile-layout):not(.mobile-landscape-layout) .status {
    height: auto;
    max-height: none;
  }

  body:not(.mobile-layout):not(.mobile-landscape-layout) .phase-status-layout {
    height: auto;
    min-height: calc(var(--phase-status-height) - 22px);
  }

  body:not(.mobile-layout):not(.mobile-landscape-layout) .phase-status-details {
    overflow: visible;
    white-space: normal;
  }
}

.status-progress-badge {
  display: inline-block;
  margin-left: 2px;
  border-color: rgba(174, 231, 255, 0.58);
  background:
    linear-gradient(180deg, rgba(42, 73, 83, 0.97), rgba(25, 45, 51, 0.96));
  color: #e8f8ff;
  vertical-align: middle;
  box-shadow:
    0 0 0 1px rgba(174, 231, 255, 0.14),
    0 5px 16px rgba(0, 0, 0, 0.28);
}

.status .player-state-badge.status-progress-badge,
.selection .player-state-badge.status-progress-badge {
  width: max-content;
  max-width: none;
  white-space: nowrap;
}

.status-progress-badge.is-max {
  color: #fff1a8;
  text-shadow: 0 0 10px rgba(255, 225, 128, 0.46);
  box-shadow:
    0 0 0 1px rgba(174, 231, 255, 0.14),
    0 0 14px rgba(255, 225, 128, 0.18),
    0 5px 16px rgba(0, 0, 0, 0.28);
}

.status-progress-badge.progress-visual-progress-blocked {
  animation: progress-badge-blocked 720ms ease-out both;
}

.mobile-progress-tips {
  position: absolute;
  z-index: 147;
  top: calc(12px + var(--phase-status-height) - 18px);
  right: 22px;
  left: 22px;
  display: none;
  gap: 3px;
  box-sizing: border-box;
  padding: 6px 9px;
  overflow: visible;
  border: 1px solid rgba(244, 199, 95, 0.62);
  border-radius: 7px;
  background:
    linear-gradient(90deg, rgba(122, 78, 23, 0.46), rgba(24, 22, 18, 0.93) 58%),
    rgba(18, 19, 16, 0.96);
  color: #fff0bd;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  white-space: normal;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.3),
    0 0 16px rgba(244, 199, 95, 0.16),
    0 8px 22px rgba(0, 0, 0, 0.34);
  pointer-events: none;
}

.mobile-progress-tips.show {
  display: grid;
}

.mobile-progress-tips.has-rule-link {
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: center;
  column-gap: 2px;
  padding-right: 1px;
  pointer-events: auto;
}

.mobile-progress-warning-line {
  display: block;
  min-width: 0;
  overflow: visible;
  text-wrap: pretty;
}

.mobile-progress-warning-line .progress-warning-phrase,
.status-warning-message .progress-warning-phrase {
  display: inline;
  white-space: nowrap;
}

.mobile-progress-warning-line .progress-warning-clause,
.status-warning-message .progress-warning-clause {
  display: inline-block;
  max-width: 100%;
  vertical-align: top;
}

body.mobile-landscape-layout .mobile-progress-warning-line .progress-warning-clause,
body.mobile-landscape-layout .status-warning-message .progress-warning-clause {
  display: inline;
}

.rule-context-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  min-width: 30px;
  min-height: 28px;
  padding: 2px;
  border: 1px solid rgba(230, 201, 128, 0.34);
  border-radius: 5px;
  background: rgba(47, 43, 30, 0.72);
  color: rgba(255, 239, 197, 0.84);
  font: inherit;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none;
}

.rule-context-link:hover,
.rule-context-link:focus-visible {
  border-color: rgba(244, 214, 137, 0.58);
  background: rgba(65, 57, 35, 0.86);
  color: #fff0c2;
  outline: 2px solid rgba(230, 201, 128, 0.18);
  outline-offset: 1px;
}

.tutorial-guide {
  --tutorial-guide-accent: #8bd7e5;
  position: fixed;
  z-index: 180;
  top: auto;
  bottom: clamp(18px, 3dvh, 30px);
  left: 50%;
  width: min(620px, calc(100vw - 48px));
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
  height: 176px;
  min-height: 176px;
  max-height: 176px;
  overflow: visible;
  padding: 0 12px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: translateX(-50%);
  pointer-events: auto;
}

.tutorial-guide-complete {
  grid-template-rows: 176px 38px;
  row-gap: 8px;
  height: 222px;
  min-height: 222px;
  max-height: 222px;
}

.tutorial-guide[hidden],
.tutorial-guide.is-hidden {
  display: none !important;
}

.tutorial-guide-thinking {
  --tutorial-guide-accent: #8acdf4;
}

.tutorial-guide-happy {
  --tutorial-guide-accent: #f2d06b;
}

.tutorial-guide-portrait {
  align-self: start;
  width: 126px;
  height: 176px;
  max-height: 176px;
  margin: 6px -8px 0 0;
  object-fit: contain;
  object-position: top center;
  cursor: pointer;
  filter:
    drop-shadow(0 10px 14px rgba(0, 0, 0, 0.34))
    drop-shadow(0 0 10px color-mix(in srgb, var(--tutorial-guide-accent) 34%, transparent));
}

.tutorial-guide.tutorial-guide-dimmed {
  pointer-events: none !important;
}

/* 透明な案内の余白・完了操作は、背後のカード入力を受け止めない。 */
.tutorial-guide.tutorial-guide-dimmed * {
  pointer-events: none !important;
}

.tutorial-guide.tutorial-guide-dimmed > .tutorial-guide-portrait {
  pointer-events: auto !important;
}

.tutorial-guide-dimmed .tutorial-guide-portrait {
  opacity: 0.38;
  pointer-events: auto;
  filter:
    drop-shadow(0 6px 10px rgba(0, 0, 0, 0.22))
    saturate(0.82);
}

.tutorial-guide-dimmed .tutorial-guide-bubble {
  display: none;
}

.tutorial-guide-dimmed .tutorial-guide-actions,
.tutorial-guide-dimmed .tutorial-guide-complete-actions,
.tutorial-guide-dimmed .tutorial-guide-shortcuts {
  display: none;
}

.tutorial-inspection-highlight {
  outline: 2px solid rgba(139, 215, 229, 0.9);
  outline-offset: -2px;
}

.tutorial-guide-bubble {
  align-self: center;
  position: relative;
  overflow-y: auto;
  min-width: 0;
  max-height: 154px;
  padding: 12px 38px 12px 14px;
  border: 1px solid rgba(255, 244, 202, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 52%),
    rgba(10, 13, 13, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 10px 24px rgba(0, 0, 0, 0.26);
}

.tutorial-guide-complete .tutorial-guide-bubble {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  overflow-y: auto;
  max-height: 154px;
  padding-bottom: 12px;
}

.tutorial-guide-complete .tutorial-guide-portrait {
  grid-column: 1;
  grid-row: 1;
}

.tutorial-guide-has-action .tutorial-guide-bubble {
  cursor: pointer;
}

.tutorial-guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  color: #b9f5ff;
  font-size: 12px;
  font-weight: 900;
}

.tutorial-guide-speaker {
  color: var(--tutorial-guide-accent);
}

.tutorial-guide-can-back:not(.tutorial-guide-dimmed) .tutorial-guide-bubble {
  pointer-events: auto;
}

.tutorial-guide-progress {
  color: rgba(255, 242, 190, 0.82);
}

.tutorial-guide-bubble strong {
  display: block;
  overflow: hidden;
  color: #fff4c7;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tutorial-guide-bubble p {
  margin: 4px 0 0;
  color: #f4f2df;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.42;
}

.tutorial-guide-quoted-title {
  white-space: nowrap;
}

.tutorial-guide-attribute {
  display: inline-flex;
  align-items: center;
  gap: 0.15em;
  white-space: nowrap;
}

.tutorial-guide-attribute .weapon-attribute-icon {
  margin: 0;
}

.tutorial-guide-attribute .weapon-attribute-icon::before {
  width: 1em;
  height: 1em;
}

.tutorial-guide-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.tutorial-guide-complete-actions {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  margin-top: 0;
}

.tutorial-guide-next-icon {
  position: absolute;
  right: 10px;
  bottom: 8px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--tutorial-guide-accent) 62%, #f2d06b);
  border-radius: 999px;
  background: rgba(12, 18, 18, 0.62);
  color: #fff3c5;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 3px 10px rgba(0, 0, 0, 0.22);
}

.tutorial-guide-next {
  min-width: 112px;
  min-height: 34px;
  padding: 6px 14px;
  border: 1px solid color-mix(in srgb, var(--tutorial-guide-accent) 64%, #f2d06b);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255, 246, 190, 0.22), rgba(122, 87, 25, 0.62)),
    rgba(30, 25, 16, 0.88);
  color: #fff3c5;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 4px 14px rgba(0, 0, 0, 0.24);
}

.tutorial-guide-secondary {
  border-color: rgba(197, 220, 218, 0.42);
  background:
    linear-gradient(180deg, rgba(219, 247, 255, 0.12), rgba(25, 40, 42, 0.66)),
    rgba(18, 27, 28, 0.88);
  color: #e9fbff;
}

.tutorial-guide-complete-actions.tutorial-guide-actions-with-match .tutorial-guide-next {
  min-width: 0;
  padding-inline: 8px;
  white-space: nowrap;
}

.tutorial-guide-next:focus-visible,
.tutorial-guide-next-icon:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--tutorial-guide-accent) 78%, #ffffff);
  outline-offset: 2px;
}

.tutorial-guide-shortcuts {
  display: none;
}

@media (min-width: 1081px) {
  .tutorial-guide,
  .tutorial-guide-complete {
    --desktop-tutorial-field-width:
      clamp(320px, calc((min(100vw, 1500px) - 424px) * 0.5), 538px);
    --desktop-tutorial-content-inset: 18px;
    --desktop-tutorial-bubble-height: 154px;
    --desktop-tutorial-portrait-width: clamp(164px, 18dvh, 190px);
    --desktop-tutorial-portrait-height: clamp(228px, 25dvh, 264px);
    right: max(10px, calc((100vw - 1500px) * 0.5 + 10px));
    left: auto;
    width: var(--desktop-tutorial-field-width);
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding-right: 0;
    transform: none;
  }

  .tutorial-guide-portrait {
    position: absolute;
    right: var(--desktop-tutorial-content-inset);
    bottom: calc(var(--desktop-tutorial-bubble-height) + 8px);
    left: auto;
    width: var(--desktop-tutorial-portrait-width);
    height: var(--desktop-tutorial-portrait-height);
    max-height: var(--desktop-tutorial-portrait-height);
    margin: 0;
  }

  .tutorial-guide-bubble,
  .tutorial-guide-complete .tutorial-guide-bubble {
    grid-column: 1;
    grid-row: 1;
    align-self: end;
    width: 100%;
    height: var(--desktop-tutorial-bubble-height);
    min-height: var(--desktop-tutorial-bubble-height);
    max-height: var(--desktop-tutorial-bubble-height);
  }

  .tutorial-guide-complete {
    grid-template-rows: minmax(0, 1fr);
    height: 176px;
    min-height: 176px;
    max-height: 176px;
  }

  .tutorial-guide-complete-actions {
    position: absolute;
    grid-column: 1;
    grid-row: 1;
    right: calc(var(--desktop-tutorial-content-inset) + var(--desktop-tutorial-portrait-width) + 8px);
    bottom: calc(var(--desktop-tutorial-bubble-height) + 8px);
    left: 8px;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-top: 0;
  }

  .tutorial-guide-shortcuts {
    position: absolute;
    grid-column: 1;
    grid-row: 1;
    right: calc(var(--desktop-tutorial-content-inset) + var(--desktop-tutorial-portrait-width) + 8px);
    bottom: calc(var(--desktop-tutorial-bubble-height) + 8px);
    left: 8px;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
  }

  .tutorial-guide-shortcuts span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 28px;
    padding: 3px 8px;
    border: 1px solid color-mix(in srgb, var(--tutorial-guide-accent) 36%, rgba(151, 172, 190, 0.3));
    border-radius: 999px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent),
      rgba(21, 27, 34, 0.8);
    color: #edf5ff;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  }

  .tutorial-guide-shortcuts kbd {
    padding: 2px 5px;
    border: 1px solid rgba(225, 239, 247, 0.3);
    border-radius: 4px;
    background: rgba(5, 9, 12, 0.58);
    color: #fff3c5;
    font: inherit;
    font-size: 10px;
  }
}

.selection {
  height: var(--selection-panel-height);
  min-height: var(--selection-panel-height);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--phase-accent-soft) 72%, #535b4a);
  border-radius: var(--ui-radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 48%),
    linear-gradient(180deg, var(--phase-tint), transparent 34%),
    rgba(32, 36, 31, 0.66);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 8px 18px rgba(0, 0, 0, 0.16);
}

body:not(.mobile-layout):not(.mobile-landscape-layout)
  .control-panel.has-pending-battle > .selection {
  --selection-panel-height: 128px;
  overscroll-behavior: contain;
}

/* 元の予約高を保ち、進行タブの下端まで説明欄だけを伸ばす。 */
body:not(.mobile-layout):not(.mobile-landscape-layout)
  .control-panel.has-pending-battle > .selection.selection--flexible-detail {
  position: relative;
  height: var(--compact-detail-height);
  max-height: var(--compact-detail-height);
  margin-bottom: calc(var(--compact-detail-base-height) - var(--compact-detail-height));
}

.selection.is-compact-detail-expanded {
  z-index: 81;
  background-color: #19221d;
}

.selection-empty-guide {
  display: grid;
  align-content: start;
  min-height: 100%;
  gap: 6px;
  padding: 10px 12px;
  color: var(--muted);
}

.selection-empty-guide strong {
  color: #e7dfc6;
  font-size: 14px;
  font-weight: 850;
}

.selection-empty-guide span {
  font-size: 12px;
  line-height: 1.5;
}

.selection-status-summary {
  display: none;
}

.selection-attack-pair {
  display: inline-flex;
  max-width: 100%;
  margin: 0 0 8px;
  padding: 4px 9px;
  border: 1px solid rgba(255, 233, 166, 0.36);
  border-radius: 999px;
  background: rgba(38, 49, 59, 0.82);
  color: #fff0bc;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.selection-detail {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.selection-text {
  min-width: 0;
}

.selection-card-detail-body {
  display: block;
  margin-top: 2px;
  color: #ded8c7;
  line-height: 1.4;
}

.card-detail-warrior-mobile-separator {
  display: none;
}

.selection-card-detail-body .card-detail-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 5px;
}

.selection-card-detail-body .card-detail-trait {
  min-height: 0;
  align-items: baseline;
  gap: 1px;
  padding: 1px 4px;
  white-space: normal;
}

.selection-card-detail-body .card-detail-trait-name {
  flex: 0 0 auto;
}

.selection-card-detail-body .card-detail-trait-description {
  color: inherit;
  font-size: 0.88em;
  font-weight: 700;
  opacity: 0.82;
}

.selection-card-detail-body .card-detail-trait-tooltip-trigger {
  position: relative;
  cursor: help;
}

.selection-card-detail-body .card-detail-trait-tooltip-trigger:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.selection-card-detail-body .card-detail-effect-segment {
  display: block;
  margin-top: 4px;
}

.selection-card-detail-body > .card-detail-effect-segment:first-child {
  margin-top: 0;
}

.selection-card-detail-body .card-detail-timing {
  display: inline-flex;
  width: auto;
  margin: 0 3px 0 0;
  padding: 1px 4px;
  border: 1px solid rgba(226, 190, 92, 0.48);
  border-radius: 4px;
  background: rgba(190, 145, 48, 0.13);
  color: #f0d58a;
  vertical-align: baseline;
}

.selection-card-detail-body .card-detail-effect {
  display: inline;
  color: #dcd6c4;
  white-space: normal;
}

.selection-card-title {
  font-weight: 900;
}

.selection-art-card {
  position: relative;
  width: 88px;
  aspect-ratio: 2 / 3;
  min-height: 0;
  padding: 0;
  border: 1px solid rgba(242, 219, 157, 0.42);
  border-radius: var(--compact-card-corner-radius);
  overflow: hidden;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.08), transparent 32%),
    #252b24;
  box-shadow:
    0 6px 14px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.selection-art-card:hover {
  border-color: var(--accent);
}

.selection-art-card.has-card-art:where(:not(.type-warrior)) {
  background-image:
    linear-gradient(180deg, rgba(13, 15, 12, 0.02), rgba(13, 15, 12, 0.12)),
    var(--card-art);
  background-position: center;
  background-size: cover;
}

.selection-art-card > .warrior-portrait::after {
  background: linear-gradient(180deg, rgba(13, 15, 12, 0.02), rgba(13, 15, 12, 0.12));
  box-shadow: none;
}

/* 簡易欄はイラストの実幅だけを予約し、本文を装飾で狭めない。 */
.selection-detail.selection-detail--compact {
  --compact-accent: #d3b878;
  display: grid;
  grid-template-columns: var(--compact-selection-art-width, 64px) minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  min-width: 0;
}

.selection-detail.selection-detail--compact-weapon {
  --compact-accent: #91c8dd;
}

.selection-detail.selection-detail--compact-special {
  --compact-accent: #96d5b1;
}

.selection-detail--compact .selection-art-card {
  width: 100%;
  min-width: 0;
  height: 96px;
  border-color: color-mix(in srgb, var(--compact-accent) 64%, #303d39);
  border-radius: var(--compact-card-corner-radius);
  box-shadow: inset 0 0 0 2px #101915, 0 3px 9px #0005;
}

.selection-detail--compact .selection-text {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
  color: #efe8d4;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.selection-compact-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 6px;
}

.selection-compact-heading > strong {
  min-width: 0;
  color: #fff2cc;
  font-size: 1.15em;
  line-height: 1.2;
}

.selection-compact-owner {
  color: #bac5ba;
  font-size: 0.72em;
  font-weight: 600;
}

.selection-compact-meta {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  color: var(--compact-accent);
  font-size: 0.82em;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.selection-compact-meta > span + span {
  padding-left: 4px;
  border-left: 1px solid color-mix(in srgb, var(--compact-accent) 36%, transparent);
}

.selection-compact-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  min-width: 0;
  font-size: 0.92em;
  line-height: 1.2;
}

.selection-compact-stats :is(.selection-compact-stat, .card-face__stat, .card-face__attribute, .card-detail-attribute) {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: baseline;
  gap: 3px;
  width: auto;
  min-width: 0;
  min-height: 0;
  padding: 1px 4px;
  border: 1px solid #c2b89042;
  border-radius: 4px;
  background: #c2b89012;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
  white-space: nowrap;
  box-shadow: none;
}

.selection-compact-stats :is(.selection-compact-stat > span, .card-face__stat-label) {
  font-size: 0.82em;
  font-weight: 700;
  opacity: 0.85;
}

.selection-compact-stats :is(strong, .card-face__stat-value) {
  font-size: 1.1em;
  line-height: 1;
}

.selection-compact-stats .stat-delta {
  font-size: 0.85em;
}

.selection-compact-stats :is(.selection-compact-stat--hp, .selection-compact-stat--attack) {
  border-color: #cb8e7366;
  background: #a94c3124;
}

.selection-compact-stats .selection-compact-stat--defense {
  border-color: #83bfd666;
  background: #397ba524;
}

.selection-compact-stats .card-face__stat--basic {
  border-color: #d5b65f66;
  background: #a5863224;
}

.selection-compact-stats .card-face__attribute {
  border-color: color-mix(in srgb, var(--card-attribute-color, #cabf9d) 50%, transparent);
  background: color-mix(in srgb, var(--card-attribute-color, #cabf9d) 18%, #101915);
  color: color-mix(in srgb, var(--card-attribute-color, #fff0bd) 72%, white);
  transform: none;
}

.selection-compact-stats .card-face__attribute > * {
  transform: none;
}

.selection-detail--compact .boosted-stat {
  color: #73e0a5;
}

.selection-detail--compact .debuffed-stat {
  color: #ff9a83;
}

.selection-compact-activity,
.selection-compact-range {
  color: #becabd;
  font-size: 0.9em;
}

.selection-detail--compact .selection-card-detail-body {
  margin-top: 0;
  padding-top: 4px;
  border-top: 1px solid color-mix(in srgb, var(--compact-accent) 28%, transparent);
  line-height: 1.4;
}

.selection-detail--compact .selection-card-detail-body:empty {
  display: none;
}

.selection-detail--compact .card-detail-timing {
  border-color: color-mix(in srgb, var(--compact-accent) 50%, transparent);
  background: color-mix(in srgb, var(--compact-accent) 12%, transparent);
  color: var(--compact-accent);
  font-size: 0.92em;
  font-weight: 800;
}

.selection-detail--compact .card-detail-effect {
  color: #efe8d4;
}

@media (orientation: landscape) {
  .selection-detail--compact .selection-card-detail-body .card-detail-traits {
    margin-bottom: 2px;
  }

  .selection-detail--compact .selection-card-detail-body .card-detail-traits + .card-detail-effect-segment {
    margin-top: 2px;
  }
}

.selection-compact-stack {
  padding-top: 3px;
  border-top: 1px dotted #c2b89040;
  color: #bac5ba;
  font-size: 0.9em;
}

.selection-art-card.rarity-showcase::after,
.art-modal-card.rarity-showcase::after {
  content: "";
  position: absolute;
  inset: -18%;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 18%, var(--rarity-foil-color, rgba(255, 255, 255, 0.48)) 44%, transparent 68%);
  mix-blend-mode: screen;
  opacity: 0;
  transform: translateX(-72%) rotate(7deg);
  animation: rarity-card-foil var(--rarity-foil-duration, 1180ms) ease-out 140ms both;
}

.selection-art-card.rarity-foil-soft::after,
.art-modal-card.rarity-foil-soft::after {
  --rarity-foil-color: rgba(255, 218, 166, 0.22);
  --rarity-foil-duration: 840ms;
}

.selection-art-card.rarity-foil-strong::after,
.art-modal-card.rarity-foil-strong::after {
  --rarity-foil-color: rgba(240, 249, 255, 0.52);
}

.selection-art-card.rarity-tier-ur::before,
.art-modal-card.rarity-tier-ur::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 23%, rgba(255, 255, 255, 1) 0 2px, rgba(255, 236, 120, 0.85) 2.2px 5.2px, rgba(255, 200, 46, 0.32) 5.4px 11px, transparent 18px),
    radial-gradient(circle at 79% 32%, rgba(255, 255, 255, 0.96) 0 1.8px, rgba(255, 236, 132, 0.76) 2px 4.6px, rgba(255, 198, 44, 0.3) 4.8px 10px, transparent 16px),
    radial-gradient(circle at 42% 66%, rgba(255, 255, 252, 0.94) 0 1.9px, rgba(255, 229, 111, 0.72) 2.1px 4.8px, rgba(255, 190, 38, 0.28) 5px 10px, transparent 17px),
    radial-gradient(circle at 63% 15%, rgba(255, 255, 255, 0.9) 0 1.4px, rgba(255, 235, 140, 0.66) 1.6px 3.8px, rgba(255, 203, 62, 0.24) 4px 8px, transparent 14px),
    radial-gradient(circle at 29% 48%, rgba(255, 255, 255, 0.86) 0 1.3px, rgba(255, 231, 129, 0.58) 1.5px 3.5px, rgba(255, 201, 58, 0.22) 3.7px 7px, transparent 12px);
  mix-blend-mode: screen;
  opacity: 0;
  filter: drop-shadow(0 0 8px rgba(255, 222, 78, 0.75));
  animation: rarity-ur-sparkle 1420ms ease-out 180ms both;
}

.selection-art-card.rarity-tier-ur::after,
.art-modal-card.rarity-tier-ur::after {
  --rarity-foil-color: rgba(255, 238, 134, 0.58);
  --rarity-foil-duration: 1320ms;
  background:
    linear-gradient(115deg, transparent 18%, var(--rarity-foil-color) 44%, transparent 68%);
  animation: rarity-card-foil var(--rarity-foil-duration) ease-out 140ms both;
}

/* PC非戦闘時は選択の有無で外枠を動かさず、ダメージ計算時に近い高さを確保する。 */
@media (min-width: 1081px) {
  body:not(.mobile-layout):not(.mobile-landscape-layout)
    .control-panel:not(.has-pending-battle) {
    height: min(calc(100dvh - 16px), 700px);
    min-height: min(calc(100dvh - 16px), 700px);
    max-height: min(calc(100dvh - 16px), 700px);
    grid-template-rows: auto minmax(0, 1fr) auto;
    align-content: stretch;
  }

  body.match-screen-admin:not(.mobile-layout):not(.mobile-landscape-layout)
    .control-panel:not(.has-pending-battle) {
    height: min(calc(100dvh - 76px), 680px);
    min-height: min(calc(100dvh - 76px), 680px);
    max-height: min(calc(100dvh - 76px), 680px);
  }

  body:not(.mobile-layout):not(.mobile-landscape-layout)
    .control-panel:not(.has-pending-battle) > .selection {
    position: relative;
    height: 100%;
    min-height: 0;
    max-height: none;
    padding: 10px;
    overflow: hidden;
  }

  body:not(.mobile-layout):not(.mobile-landscape-layout)
    .control-panel:not(.has-pending-battle) .selection.is-empty {
    isolation: isolate;
  }

  body:not(.mobile-layout):not(.mobile-landscape-layout)
    .control-panel:not(.has-pending-battle) .selection.is-empty::before {
    content: "";
    position: absolute;
    z-index: 0;
    top: auto;
    right: 50%;
    bottom: 12px;
    left: auto;
    width: min(280px, calc(100% - 24px));
    height: 420px;
    transform: translateX(50%);
    pointer-events: none;
    opacity: 0.14;
    background: url("../assets/backgrounds/emblem.webp?v=app-cache-20261118-3") center bottom / contain no-repeat;
    mix-blend-mode: screen;
  }

  body:not(.mobile-layout):not(.mobile-landscape-layout)
    .control-panel:not(.has-pending-battle) .selection.is-empty > * {
    position: relative;
    z-index: 1;
  }

  body:not(.mobile-layout):not(.mobile-landscape-layout)
    .control-panel:not(.has-pending-battle):not(.has-empty-selection) .selection-detail {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border-radius: 6px;
    isolation: isolate;
  }

  body:not(.mobile-layout):not(.mobile-landscape-layout)
    .control-panel:not(.has-pending-battle):not(.has-empty-selection) .selection-detail::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
      linear-gradient(180deg, rgba(9, 12, 10, 0.02) 0 44%, rgba(9, 12, 10, 0.3) 70%, rgba(9, 12, 10, 0.7) 100%),
      linear-gradient(90deg, rgba(9, 12, 10, 0.16), transparent 16% 84%, rgba(9, 12, 10, 0.16));
    pointer-events: none;
  }

  body:not(.mobile-layout):not(.mobile-landscape-layout)
    .control-panel:not(.has-pending-battle):not(.has-empty-selection) .selection-art-card {
    --warrior-portrait-position: center 24%;
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    border: 0;
    border-radius: inherit;
    background-position: center 24%;
    background-size: cover;
    box-shadow: none;
    opacity: 0.94;
    cursor: zoom-in;
  }

  body:not(.mobile-layout):not(.mobile-landscape-layout)
    .control-panel:not(.has-pending-battle):not(.has-empty-selection) .selection-text {
    position: absolute;
    z-index: 2;
    right: 8px;
    bottom: 8px;
    left: 8px;
    width: auto;
    min-height: 0;
    max-height: 48%;
    margin: 0;
    padding: 10px 11px 11px;
    overflow-x: hidden;
    overflow-y: auto;
    border: 1px solid rgba(239, 220, 163, 0.3);
    border-radius: 7px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 48%),
      rgba(12, 15, 13, 0.86);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.04),
      0 8px 22px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(6px);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.88);
    scrollbar-gutter: stable;
  }

}

.card.inspection-revealed-card {
  box-shadow:
    0 0 0 1px rgba(133, 211, 255, 0.72),
    0 0 18px rgba(93, 177, 255, 0.34);
}

.card.inspection-revealed-card::after {
  content: var(--i18n-inspecting, "確認中");
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 4;
  padding: 2px 5px;
  border-radius: 6px;
  background: rgba(24, 67, 91, 0.76);
  color: #dff5ff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 0 10px rgba(68, 183, 255, 0.36);
}

.card-inspection-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  width: 100%;
  min-height: 100%;
  padding: 14px;
  border: 1px solid rgba(133, 211, 255, 0.38);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(32, 65, 82, 0.84), rgba(23, 30, 31, 0.9)),
    rgba(20, 28, 28, 0.92);
  box-shadow: inset 0 0 28px rgba(83, 187, 255, 0.12);
}

.card-inspection-head {
  display: grid;
  gap: 3px;
}

.card-inspection-head span {
  color: #9fdcff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.card-inspection-head em {
  justify-self: start;
  padding: 2px 6px;
  border: 1px solid rgba(143, 211, 255, 0.24);
  border-radius: 999px;
  color: #cdefff;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.card-inspection-head strong {
  color: #fff4bd;
  font-size: 17px;
}

.card-inspection-head small {
  color: #d4e8ee;
  font-size: 12px;
}

.card-inspection-section {
  display: grid;
  gap: 7px;
}

.card-inspection-section-title {
  color: #dff5ff;
  font-size: 12px;
  font-weight: 800;
}

.card-inspection-list {
  display: flex;
  align-items: flex-start;
  justify-content: safe center;
  gap: 8px;
  min-height: 142px;
  padding: 8px;
  overflow-x: auto;
  border: 1px solid rgba(182, 229, 255, 0.18);
  border-radius: 8px;
  background: rgba(6, 13, 14, 0.32);
}

.card-inspection-empty {
  display: grid;
  place-items: center;
  min-width: 100%;
  color: rgba(225, 238, 229, 0.72);
  font-size: 12px;
}

.inspection-mini-card {
  position: relative;
  flex: 0 0 92px;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  appearance: none;
  padding: 0;
  border: 1px solid rgba(218, 246, 255, 0.34);
  border-radius: var(--compact-card-corner-radius);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.08), transparent 34%),
    #26312f;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
  color: inherit;
  cursor: pointer;
}

/* 共通のレベルバッジは枠外へ張り出すため、overflowする確認カード内では内側へ収める。 */
.inspection-mini-card > .level-badge {
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  font-size: 11px;
}

.inspection-mini-card:hover,
.inspection-mini-card:focus-visible,
.inspection-mini-card.is-selected {
  border-color: rgba(255, 225, 154, 0.8);
  outline: none;
  box-shadow:
    0 0 0 2px rgba(255, 225, 154, 0.2),
    0 10px 22px rgba(0, 0, 0, 0.38);
}

.inspection-mini-card.is-selected {
  box-shadow:
    0 0 0 2px rgba(255, 225, 154, 0.42),
    0 0 18px rgba(255, 225, 154, 0.22),
    0 10px 22px rgba(0, 0, 0, 0.38);
}

.inspection-mini-card.has-card-art {
  background-image:
    linear-gradient(180deg, rgba(5, 10, 10, 0.02), rgba(5, 10, 10, 0.26)),
    var(--card-art);
  background-position: center;
  background-size: cover;
}

.inspection-mini-card-info {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 5px;
  display: grid;
  gap: 2px;
  padding: 5px;
  border-radius: 6px;
  background: rgba(5, 8, 8, 0.75);
}

.inspection-mini-card-info strong,
.inspection-mini-card-info span,
.inspection-mini-card-info small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspection-mini-card-info strong {
  color: #fff7cf;
  font-size: 11px;
}

.inspection-mini-card-info span {
  color: #9fdcff;
  font-size: 10px;
  font-weight: 800;
}

.inspection-mini-card-info small {
  color: #dfe8df;
  font-size: 9px;
}

.card-inspection-done {
  justify-self: end;
}

.card-inspection-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.card-inspection-actions > button {
  min-width: 0;
}

.inspection-mini-card.inspection-none {
  align-self: stretch;
  padding: 8px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  background: rgba(22, 25, 22, 0.95);
}

.art-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(5, 7, 5, 0.78);
}

.art-modal.show {
  display: grid;
}

.art-modal-card {
  --card-detail-label-font-size: 12px;
  --card-detail-awaken-font-size: 12px;
  position: relative;
  box-sizing: border-box;
  width: min(506px, calc(100vw - 48px), calc((100dvh - 48px) * 2 / 3));
  height: auto;
  max-height: calc(100dvh - 48px);
  aspect-ratio: 2 / 3;
  padding: 6px;
  border: 1px solid rgba(242, 219, 157, 0.48);
  border-radius: var(--card-corner-radius);
  overflow: hidden;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.08), transparent 32%),
    #252b24;
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.58);
}

.art-modal-card.has-card-art {
  background-image: var(--card-art);
  background-position: center 24%;
  background-size: cover;
  background-repeat: no-repeat;
}

.art-modal-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(9, 12, 10, 0.02) 0 44%, rgba(9, 12, 10, 0.3) 72%, rgba(9, 12, 10, 0.7) 100%),
    linear-gradient(90deg, rgba(9, 12, 10, 0.16), transparent 16% 84%, rgba(9, 12, 10, 0.16));
  pointer-events: none;
}

.art-modal-text {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 5;
  box-sizing: border-box;
  max-height: 48%;
  padding: 11px 12px 12px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(239, 220, 163, 0.3);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 48%),
    rgba(12, 15, 13, 0.86);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 6px 18px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(5px);
  scrollbar-gutter: stable;
}

.art-modal-card-title {
  display: block;
  color: #fff4cf;
  font-size: 1.08em;
  font-weight: 900;
  line-height: 1.3;
}

.art-modal-card-detail-body {
  margin-top: 3px;
}

.rarity-title-text {
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.rarity-title-r {
  color: #f0b47a;
  background-image: linear-gradient(180deg, #fff0d7 0%, #e58f56 42%, #7a3d1f 76%, #ffc28d 100%);
  -webkit-text-stroke: 0.18px rgba(105, 49, 20, 0.72);
  text-shadow:
    0 0 4px rgba(245, 153, 82, 0.2),
    0 0 1px rgba(44, 21, 10, 0.48);
  animation: rarity-title-copper 1100ms ease-out 120ms both;
}

.rarity-title-sr {
  color: #ecf4ff;
  background-image: linear-gradient(180deg, #ffffff 0%, #d6e7f3 36%, #7d91a6 70%, #f7fbff 100%);
  -webkit-text-stroke: 0.18px rgba(65, 82, 101, 0.7);
  text-shadow:
    0 0 5px rgba(221, 244, 255, 0.28),
    0 0 1px rgba(35, 48, 61, 0.44);
  animation: rarity-title-silver 1120ms ease-out 120ms both;
}

.rarity-title-ur {
  color: #ffe38a;
  background-image: linear-gradient(180deg, #fff7be 0%, #ffd24f 34%, #a66d08 70%, #fff0a8 100%);
  -webkit-text-stroke: 0.2px rgba(98, 62, 0, 0.76);
  text-shadow:
    0 0 6px rgba(255, 221, 93, 0.38),
    0 0 10px rgba(255, 174, 38, 0.16),
    0 0 1px rgba(58, 35, 0, 0.5);
  animation: rarity-title-gold 1160ms ease-out 120ms both;
}

.art-modal-close {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2002;
  min-width: 56px;
  min-height: 36px;
  padding: 6px 12px;
  border-color: rgba(239, 220, 163, 0.54);
  background: rgba(18, 22, 19, 0.94);
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.34);
}

.grave-modal,
.cost-modal,
.mobile-utility-modal {
  --utility-modal-gutter: 24px;
  --utility-modal-available-height: calc(
    var(--app-viewport-height, 100dvh)
    - max(var(--utility-modal-gutter), var(--app-safe-top, 0px))
    - max(var(--utility-modal-gutter), var(--app-safe-bottom, 0px))
  );
  position: fixed;
  top: var(--app-viewport-offset-top, 0px);
  right: auto;
  bottom: auto;
  left: var(--app-viewport-offset-left, 0px);
  z-index: var(--utility-modal-z);
  display: none;
  width: var(--app-viewport-width, 100dvw);
  height: var(--app-viewport-height, 100dvh);
  min-width: 0;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
  padding:
    max(var(--utility-modal-gutter), var(--app-safe-top, 0px))
    max(var(--utility-modal-gutter), var(--app-safe-right, 0px))
    max(var(--utility-modal-gutter), var(--app-safe-bottom, 0px))
    max(var(--utility-modal-gutter), var(--app-safe-left, 0px));
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgba(5, 7, 5, 0.72);
}

.grave-modal.show,
.cost-modal.show,
.mobile-utility-modal.show {
  display: grid;
}

.grave-modal {
  --utility-modal-z: 49;
  --utility-modal-panel-width: min(620px, 100%);
  --utility-modal-panel-border: rgba(242, 219, 157, 0.38);
  --utility-modal-panel-background: rgba(20, 24, 19, 0.96);
  --utility-modal-panel-gap: 12px;
  --utility-modal-panel-radius: 12px;
  --utility-modal-body-gap: 8px;
}

.cost-modal {
  /* チュートリアルの案内が確認画面の操作を遮らないようにする。 */
  --utility-modal-z: 190;
  --utility-modal-panel-width: min(640px, 100%);
  --utility-modal-panel-border: rgba(174, 231, 255, 0.4);
  --utility-modal-panel-background: rgba(18, 24, 24, 0.97);
  --utility-modal-panel-gap: 12px;
  --utility-modal-panel-radius: 12px;
  --utility-modal-body-gap: 10px;
}

.mobile-utility-modal {
  --utility-modal-z: 220;
  --utility-modal-panel-width: min(760px, 100%);
  --utility-modal-panel-border: var(--ui-panel-border-strong);
  --utility-modal-panel-background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 38%),
    rgba(20, 24, 19, 0.97);
  --utility-modal-panel-gap: var(--ui-gap-lg);
  --utility-modal-panel-radius: var(--ui-radius-lg);
  --utility-modal-body-gap: 10px;
}

.grave-modal-panel,
.cost-modal-panel,
.mobile-utility-panel {
  position: relative;
  width: var(--utility-modal-panel-width);
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: min(760px, var(--utility-modal-available-height));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: var(--utility-modal-panel-gap);
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--utility-modal-panel-border);
  border-radius: var(--utility-modal-panel-radius);
  background: var(--utility-modal-panel-background);
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.6);
}

.grave-modal-head,
.cost-modal-head,
.mobile-utility-head {
  min-width: 0;
  min-height: 36px;
  padding-right: 76px;
  overflow-wrap: anywhere;
}

.grave-modal-head h2 {
  margin: 0;
  font-size: 20px;
}

.grave-modal-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.grave-modal-close,
.cost-modal-close,
.mobile-utility-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  min-height: 36px;
  padding: 4px 10px;
}

.grave-modal-list,
.cost-modal-body,
.mobile-utility-body {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  display: grid;
  gap: var(--utility-modal-body-gap);
  padding-right: 3px;
}

.grave-modal-list {
  grid-auto-rows: max-content;
  align-content: start;
}

.grave-card-row {
  appearance: none;
  display: grid;
  grid-template-columns: 32px 52px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border: 1px solid rgba(242, 219, 157, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.grave-card-row:hover,
.grave-card-row:focus-visible {
  border-color: rgba(242, 219, 157, 0.54);
  background: rgba(242, 219, 157, 0.1);
  outline: none;
  box-shadow: 0 0 0 2px rgba(242, 219, 157, 0.16);
}

.grave-card-row.type-warrior {
  border-left: 4px solid #e66868;
}

.grave-card-row.type-weapon {
  border-left: 4px solid #5f9cf0;
}

.grave-card-row.type-special {
  border-left: 4px solid #5bc47d;
}

.grave-order {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(242, 219, 157, 0.15);
  color: #f2db9d;
  font-weight: 800;
  font-size: 13px;
}

.grave-thumb {
  width: 48px;
  aspect-ratio: 2 / 3;
  border: 1px solid rgba(242, 219, 157, 0.22);
  border-radius: var(--compact-card-corner-radius);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.08), transparent 32%),
    #252b24;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.grave-thumb.has-card-art {
  background-image: var(--card-art);
}

.grave-card-text {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.grave-card-text strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.grave-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.cost-modal-head h2 {
  margin: 0;
  color: #e8f8ff;
  font-size: 20px;
}

.cost-modal-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cost-modal-body {
  align-content: start;
}

.mobile-options-modal .mobile-utility-panel {
  width: min(640px, 100%);
}

.mobile-utility-head h2 {
  margin: 0;
  color: #fff2bc;
  font-size: 20px;
  line-height: 1.15;
}

.mobile-utility-body {
  align-content: start;
}

.mobile-options-body {
  grid-template-columns: repeat(2, minmax(190px, 1fr));
}

.mobile-options-body .speed-mode-group {
  grid-column: 1 / -1;
}

.mobile-options-body .topbar-link,
.mobile-options-body .toggle-option,
.mobile-options-body .match-autosave-option,
.mobile-options-body .volume-option,
.mobile-options-body .speed-mode-group,
.mobile-options-body .player-setup-group,
.mobile-options-body .option-section,
.mobile-options-body #logToggleBtn,
.mobile-options-body .header-hide-button,
.mobile-options-body #tutorialStartBtn,
.mobile-options-body #newGameBtn {
  width: 100%;
  box-sizing: border-box;
  justify-content: flex-start;
}

.mobile-options-body .option-section {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--ui-panel-border);
  border-radius: var(--ui-radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 54%),
    rgba(14, 18, 15, 0.72);
}

.option-section-title {
  margin: 0;
  color: #fff2bc;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.15;
  min-width: max-content;
  white-space: nowrap;
  writing-mode: horizontal-tb;
}

.mobile-options-body .option-section-head {
  align-items: center;
  min-width: 0;
}

.mobile-options-body .option-sound-section {
  grid-template-columns: minmax(0, 1fr);
}

.mobile-options-body .option-sound-section .option-section-head {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: space-between;
}

.mobile-options-body .option-sound-section .sound-master-toggle {
  width: auto;
  min-width: max-content;
  flex: 0 0 auto;
}

.mobile-options-body .option-sound-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mobile-options-body .option-play-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mobile-options-body .option-play-section .special-wait-switch-setting {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 0;
  align-items: center;
  min-width: 0;
  padding: 0;
  cursor: default;
}

.special-wait-switch-label {
  display: flex;
  align-items: center;
  align-self: stretch;
  gap: 6px;
  box-sizing: border-box;
  min-width: 0;
  min-height: 42px;
  padding: 4px 0 4px 8px;
  white-space: normal;
  cursor: pointer;
}

.special-wait-switch-setting.is-disabled .special-wait-switch-label {
  cursor: default;
}

.special-wait-switch-label > input {
  flex-shrink: 0;
}

.special-wait-switch-label > span {
  min-width: 0;
  white-space: nowrap;
  line-height: 1.35;
}

.mobile-options-body .option-play-list > .toggle-option {
  align-self: start;
  min-height: 44px;
}

.special-wait-switch-info,
.special-wait-switch-info:is(:hover, :focus-visible, [aria-describedby]) {
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  display: grid;
  place-items: center;
  width: 44px;
  min-height: 44px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  cursor: pointer;
}

.special-wait-switch-info-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(157, 219, 208, 0.5);
  border-radius: 50%;
  color: #b8e6de;
  background: transparent;
  font: 900 12px/1 system-ui, sans-serif;
}

.special-wait-switch-info:is(:hover, :focus-visible, [aria-describedby]) .special-wait-switch-info-icon {
  border-color: #c2f1e8;
  color: #f0fffb;
}

/* オートとウェイト切替を横に並べ、速度は下の一行を使う。 */
body:not(.mobile-layout):not(.mobile-landscape-layout)
  .mobile-options-body .option-play-section:not(.has-cpu-hand-option) .option-play-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body:not(.mobile-layout):not(.mobile-landscape-layout)
  .mobile-options-body .option-play-section.has-cpu-hand-option .option-play-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body:not(.mobile-layout):not(.mobile-landscape-layout)
  .mobile-options-body .option-play-list .toggle-option {
  grid-column: auto;
}

.mobile-options-body .option-play-section .option-play-list > .speed-mode-group {
  grid-column: 1 / -1;
}

.option-character-name-section[hidden] {
  display: none !important;
}

.match-autosave-option[hidden],
.topbar-link[hidden],
.admin-match-navigation a[hidden] {
  display: none !important;
}

.option-rulebook-section[hidden] {
  display: none !important;
}

.mobile-options-body .option-rulebook-section .option-section-head > div {
  min-width: 0;
  flex: 1 1 auto;
}

.mobile-options-body .option-rulebook-open {
  flex: 0 0 auto;
  min-width: max-content;
  white-space: nowrap;
  writing-mode: horizontal-tb;
}

.option-character-name-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.option-character-name-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.option-character-name-grid label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.option-character-settings {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.option-character-settings label {
  grid-template-columns: 3em minmax(0, 1fr);
}

.option-character-settings select {
  min-width: 0;
  width: 100%;
  min-height: 44px;
  font-size: 16px;
  padding: 6px 9px;
  color: var(--text);
  background: #09110f;
  border: 1px solid #657068;
  border-radius: 8px;
}

.option-character-name-grid label > span {
  color: #d8d4c7;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.option-character-name-grid input {
  min-height: 36px;
  padding: 6px 9px;
  font-size: 13px;
}

.option-character-name-status {
  min-height: 1.3em;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

.option-character-name-status.is-error {
  color: #ffafa1;
}

.option-tutorial-exit-section[hidden] {
  display: none !important;
}

.option-tutorial-exit-note {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.option-tutorial-exit-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.option-tutorial-exit-button,
.option-tutorial-restart-button {
  width: 100%;
  min-height: 38px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
}

.option-tutorial-restart-button {
  border-color: rgba(210, 180, 105, 0.62);
  color: #fff0ba;
  background:
    linear-gradient(180deg, rgba(255, 232, 166, 0.12), transparent 55%),
    rgba(73, 59, 27, 0.82);
}

.option-tutorial-restart-button:hover,
.option-tutorial-restart-button:focus-visible {
  border-color: rgba(255, 221, 134, 0.88);
  background:
    linear-gradient(180deg, rgba(255, 235, 174, 0.2), transparent 55%),
    rgba(94, 71, 28, 0.9);
}

.option-tutorial-exit-button {
  border-color: rgba(224, 151, 126, 0.58);
  color: #ffe5d7;
  background:
    linear-gradient(180deg, rgba(255, 219, 193, 0.1), transparent 55%),
    rgba(91, 42, 31, 0.78);
}

.option-tutorial-exit-button:hover,
.option-tutorial-exit-button:focus-visible {
  border-color: rgba(255, 190, 158, 0.84);
  background:
    linear-gradient(180deg, rgba(255, 228, 202, 0.16), transparent 55%),
    rgba(111, 48, 34, 0.88);
}

.option-duel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.mobile-options-body .topbar-link {
  min-height: 34px;
}

.mobile-options-body .volume-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.mobile-options-body .volume-option span {
  min-width: 0;
  white-space: nowrap;
}

.mobile-options-body .volume-option input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
}

.mobile-options-body .match-autosave-option {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.mobile-options-body .match-autosave-limit {
  min-width: 0;
}

.mobile-options-body .match-autosave-option .toggle-option {
  width: auto;
  min-width: 0;
}

.mobile-options-body .match-autosave-select {
  width: 100%;
  max-width: none;
  min-width: 0;
}

.mobile-options-body .player-setup-group {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.mobile-options-body .player-setup-title {
  grid-row: 1 / span 2;
}

.mobile-options-body .player-setup-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
}

.mobile-options-body .option-duel-grid .player-setup-group {
  min-height: auto;
  display: grid;
  grid-template-columns: 32px minmax(0, 1.35fr) minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
}

.mobile-options-body .option-duel-grid .player-setup-field {
  grid-template-columns: 34px minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  min-width: 0;
}

.mobile-options-body .option-duel-grid .player-setup-field .deck-save-select {
  grid-column: auto;
}

.mobile-options-body .option-duel-grid .player-setup-title {
  grid-row: auto;
}

.mobile-options-body .option-duel-grid .player-setup-field + .player-setup-field {
  grid-template-columns: 34px minmax(0, 1fr);
}

.mobile-options-body .player-setup-field select,
.mobile-options-body .player-setup-field .deck-save-select {
  width: 100%;
  min-width: 0;
  max-width: none;
}

.option-advice-debug-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.option-advice-debug-field select {
  width: 100%;
  min-width: 0;
}

.option-advice-debug-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.mobile-log-modal .mobile-utility-panel {
  width: min(720px, 100%);
}

.mobile-log-modal .mobile-utility-body {
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}

.mobile-log-modal .log-wrap {
  display: grid;
  min-width: 0;
  min-height: 0;
  max-height: none;
  grid-template-rows: auto minmax(0, 1fr);
}

.mobile-log-modal .log {
  min-width: 0;
  min-height: 0;
  max-height: none;
  overscroll-behavior: contain;
}

.desktop-log-pin {
  display: none;
}

.desktop-log-actions {
  display: contents;
}

.mobile-log-modal.desktop-log-drawer {
  --utility-modal-gutter: 12px;
  place-items: stretch end;
  background: transparent;
  pointer-events: none;
}

.mobile-log-modal.desktop-log-drawer .mobile-utility-panel {
  justify-self: end;
  width: min(390px, 100%);
  height: var(--utility-modal-available-height);
  max-height: none;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 9px;
  padding: 14px;
  border-color: rgba(174, 231, 255, 0.34);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 34%),
    rgba(16, 21, 19, 0.97);
  box-shadow:
    -18px 0 46px rgba(0, 0, 0, 0.46),
    inset 1px 0 0 rgba(255, 255, 255, 0.05);
  pointer-events: auto;
  animation: desktop-log-drawer-in 170ms ease-out both;
}

.mobile-log-modal.desktop-log-drawer .mobile-utility-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding-right: 0;
}

.mobile-log-modal.desktop-log-drawer .mobile-utility-head h2 {
  font-size: 18px;
}

.mobile-log-modal.desktop-log-drawer .desktop-log-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.mobile-log-modal.desktop-log-drawer .desktop-log-pin {
  display: inline-grid;
  place-items: center;
  min-height: 28px;
  margin-left: 0;
  padding: 4px 9px;
  border-color: rgba(174, 231, 255, 0.42);
  color: #dff7ff;
  font-size: 12px;
}

.mobile-log-modal.desktop-log-drawer .desktop-log-pin[aria-pressed="true"] {
  border-color: rgba(224, 184, 78, 0.68);
  background: rgba(73, 61, 29, 0.9);
  color: #fff1b8;
}

.mobile-log-modal.desktop-log-drawer .mobile-utility-close {
  position: static;
  min-height: 28px;
  padding: 4px 9px;
}

.mobile-log-modal.desktop-log-drawer .mobile-utility-body {
  min-height: 0;
  overflow: hidden;
  padding-right: 0;
}

.mobile-log-modal.desktop-log-drawer .log-wrap {
  display: grid;
  height: 100%;
  max-height: none;
  grid-template-rows: auto minmax(0, 1fr);
}

.mobile-log-modal.desktop-log-drawer .log-head {
  justify-content: flex-end;
}

.mobile-log-modal.desktop-log-drawer .log-head h2 {
  display: none;
}

.mobile-log-modal.desktop-log-drawer .log {
  height: 100%;
  max-height: none;
}

@keyframes desktop-log-drawer-in {
  from {
    opacity: 0;
    transform: translateX(28px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 正式カードの印刷情報と、対戦中だけ変化する現在値を一つの意匠としてつなぐ。 */
.selection-current-state-slot {
  display: none;
}

.selection-current-state-slot,
.selection-detail--formal {
  --selection-state-accent: #d5ad62;
  --selection-state-accent-bright: #ffe5a2;
  --selection-state-edge: rgba(234, 203, 126, 0.5);
}

.selection-detail--formal-warrior {
  --selection-state-accent: #d29a55;
  --selection-state-accent-bright: #ffe0a0;
  --selection-state-edge: rgba(229, 177, 94, 0.56);
}

.selection-detail--formal-weapon {
  --selection-state-accent: #79b7d8;
  --selection-state-accent-bright: #d6f3ff;
  --selection-state-edge: rgba(151, 207, 232, 0.54);
}

.selection-detail--formal-special {
  --selection-state-accent: #6fc8ad;
  --selection-state-accent-bright: #c9ffe8;
  --selection-state-edge: rgba(116, 211, 181, 0.54);
}

.selection-detail--formal-awakened {
  --selection-state-accent: #ef745c;
  --selection-state-accent-bright: #fff0aa;
  --selection-state-edge: rgba(255, 192, 94, 0.68);
}

.selection-current-state-slot > .selection-current-state,
.selection-detail--formal .selection-current-state {
  position: relative;
  display: grid;
  width: 100%;
  min-width: 0;
  height: auto;
  box-sizing: border-box;
  gap: 5px;
  overflow: hidden;
  border: 1px solid var(--selection-state-edge);
  border-radius: 8px;
  background:
    radial-gradient(circle at 0 0, color-mix(in srgb, var(--selection-state-accent) 20%, transparent), transparent 50%),
    linear-gradient(145deg, color-mix(in srgb, var(--selection-state-accent) 9%, rgba(12, 16, 14, 0.96)), rgba(8, 12, 11, 0.96));
  color: #f4ecda;
  box-shadow:
    0 7px 18px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.selection-current-state-slot > .selection-current-state::before,
.selection-detail--formal .selection-current-state::before {
  content: "";
  position: absolute;
  top: 0;
  right: 12%;
  left: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--selection-state-accent-bright), transparent);
  opacity: 0.72;
}

.selection-current-state__header,
.selection-current-state__summary,
.selection-current-state__stats {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
}

.selection-current-state__header {
  gap: 4px 8px;
}

.selection-current-state__label {
  flex: 0 0 auto;
  padding: 0.18em 0.58em;
  border: 1px solid color-mix(in srgb, var(--selection-state-accent) 68%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--selection-state-accent) 20%, rgba(8, 12, 10, 0.92));
  color: var(--selection-state-accent-bright);
  font-size: 0.82em;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.selection-current-state__summary {
  gap: 4px 7px;
}

.selection-current-state__level,
.selection-current-state__position,
.selection-current-state__activity {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  box-sizing: border-box;
  padding: 0.25em 0.58em;
  border: 1px solid color-mix(in srgb, var(--selection-state-accent) 34%, rgba(255, 255, 255, 0.08));
  border-radius: 999px;
  background: rgba(7, 11, 10, 0.7);
  color: #eee8d8;
}

.selection-current-state__level--boosted {
  border-color: rgba(255, 215, 105, 0.78);
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.18), transparent 34%),
    linear-gradient(135deg, rgba(126, 88, 24, 0.92), rgba(48, 35, 13, 0.9));
  color: #fff0a8;
  box-shadow:
    0 0 8px rgba(255, 202, 79, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.11);
}

.selection-current-state__hp {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  min-width: 88px;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 0.25em 0.62em;
  border: 1px solid color-mix(in srgb, var(--selection-state-accent) 48%, rgba(255, 255, 255, 0.12));
  border-radius: 999px;
  background: rgba(4, 8, 7, 0.82);
  color: #f7fff7;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.selection-current-state__hp-fill {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: -1;
  width: var(--selection-current-hp-rate, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(47, 156, 82, 0.86), rgba(95, 211, 116, 0.9));
  transition: width 180ms ease-out;
}

.selection-current-state__hp--wounded .selection-current-state__hp-fill {
  background: linear-gradient(90deg, rgba(183, 129, 34, 0.9), rgba(232, 190, 68, 0.94));
}

.selection-current-state__hp--critical .selection-current-state__hp-fill {
  background: linear-gradient(90deg, rgba(151, 46, 39, 0.92), rgba(224, 79, 62, 0.96));
}

.selection-current-state__hp-value {
  position: relative;
  z-index: 1;
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.selection-current-state__stats,
.selection-current-state__stack {
  box-sizing: border-box;
  width: 100%;
  padding: 0.3em 0.62em;
  border: 1px solid color-mix(in srgb, var(--selection-state-accent) 34%, rgba(255, 255, 255, 0.08));
  border-radius: 6px;
  background: rgba(7, 11, 10, 0.7);
  color: #eee8d8;
}

.selection-current-state__stats {
  gap: 0.35em 0.55em;
}

.selection-current-state__stat-seal.card-face__stat,
.selection-current-state__attribute-seal.card-face__attribute {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  min-height: 0;
  padding: 0.28em 0.62em;
  font-size: 1em;
  white-space: nowrap;
}

.selection-current-state__stat-seal.card-face__stat {
  gap: 0.24em;
}

.selection-current-state__attribute-seal.card-face__attribute {
  gap: 0.16em;
  padding-inline: 0.55em;
}

.selection-current-state__stat-seal .card-face__stat-label {
  font-size: 0.76em;
}

.selection-current-state__stat-seal .card-face__stat-value,
.selection-current-state__attribute-seal strong {
  font-size: 1.12em;
}

.selection-current-state__stat-seal .stat-delta,
.selection-current-state__attribute-seal .stat-delta {
  margin-inline-start: 0.08em;
  font-size: 0.78em;
}

.selection-current-state__stack {
  white-space: normal;
}

  body:not(.mobile-layout):not(.mobile-landscape-layout)
    .control-panel:not(.has-pending-battle):not(.has-empty-selection) .selection-detail--formal {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 8px;
    place-items: stretch center;
    overflow: visible;
    border-radius: 0;
  }

  body:not(.mobile-layout):not(.mobile-landscape-layout)
    .control-panel:not(.has-pending-battle):not(.has-empty-selection) .selection-detail--formal::after {
    content: none;
  }

  body:not(.mobile-layout):not(.mobile-landscape-layout)
    .selection-detail--formal .selection-card-face-host {
    display: flex;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    justify-self: stretch;
    align-items: center;
    justify-content: center;
  }

  body:not(.mobile-layout):not(.mobile-landscape-layout)
    .selection-detail--formal .selection-card-face-host > .card-face {
    flex: 0 1 auto;
    width: auto;
    min-width: 0;
    max-width: 100%;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    cursor: zoom-in;
  }

  body:not(.mobile-layout):not(.mobile-landscape-layout)
    .selection-detail--formal .card-face__information {
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  /* 中程度の説明は初回から収め、次フレームの文字調整まで一瞬スクロールさせない。 */
  body:not(.mobile-layout):not(.mobile-landscape-layout)
    .selection-detail--formal .card-face--text-medium .card-face__information {
    max-height: 59%;
  }

  body:not(.mobile-layout):not(.mobile-landscape-layout)
    .selection-detail--formal .card-face[data-card-text-fit="pending"] .card-face__information {
    overflow-y: hidden;
  }

  body:not(.mobile-layout):not(.mobile-landscape-layout)
    .selection-detail--formal .selection-current-state {
    padding: 7px 9px;
    font-size: 12px;
    line-height: 1.32;
  }

.cost-plan-section {
  display: grid;
  gap: 7px;
  padding: 11px;
  border: 1px solid rgba(174, 231, 255, 0.18);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
}

.cost-plan-section h3 {
  margin: 0;
  color: #dff5ff;
  font-size: 15px;
}

.cost-plan-section p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.cost-payment-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: cost-payment;
}

.cost-payment-list li {
  counter-increment: cost-payment;
  display: grid;
  grid-template-columns: 30px minmax(82px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid rgba(242, 219, 157, 0.14);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.14);
}

.cost-payment-list li::before {
  content: counter(cost-payment);
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(174, 231, 255, 0.15);
  color: #dff5ff;
  font-size: 12px;
  font-weight: 900;
}

.cost-payment-kind {
  padding: 3px 7px;
  border: 1px solid rgba(174, 231, 255, 0.22);
  border-radius: 999px;
  color: #e8f8ff;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

.cost-payment-text {
  min-width: 0;
  color: #f3f0df;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.cost-payment-empty {
  padding: 9px;
  border: 1px dashed rgba(242, 219, 157, 0.18);
  border-radius: 7px;
  color: var(--muted);
}

.grave-empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--field-slot-border);
  border-radius: 8px;
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--ui-gap-md);
}

.actions button {
  min-height: 40px;
  font-weight: 850;
  line-height: 1.22;
}

.control-panel.phase-finish .actions {
  position: relative;
  z-index: 95;
}

.control-panel.phase-finish .actions .rematch-action,
.control-panel.phase-finish .actions .return-title-action,
.rematch-deck-dialog [data-rematch-deck="confirm"] {
  border-color: rgba(255, 226, 154, 0.58);
  background:
    linear-gradient(180deg, rgba(255, 246, 190, 0.18), rgba(76, 57, 27, 0.62)),
    rgba(26, 24, 19, 0.9);
  color: #fff2c9;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.11),
    0 6px 18px rgba(0, 0, 0, 0.26);
}

.operation-hints {
  display: flex;
  align-items: center;
  gap: var(--ui-gap-sm);
  box-sizing: border-box;
  height: 34px;
  padding: 4px 7px;
  border: 1px solid rgba(151, 172, 190, 0.22);
  border-radius: var(--ui-radius-md);
  background:
    linear-gradient(90deg, var(--phase-tint), transparent 62%),
    rgba(17, 22, 27, 0.5);
  color: #dce7ef;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.operation-hints::-webkit-scrollbar {
  display: none;
}

.operation-hints.is-empty {
  border-color: rgba(151, 172, 190, 0.12);
  background: rgba(17, 22, 27, 0.32);
}

.operation-hints span {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid color-mix(in srgb, var(--phase-accent) 32%, rgba(151, 172, 190, 0.28));
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    rgba(21, 27, 34, 0.74);
  color: #edf5ff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.3;
  white-space: nowrap;
}

.control-panel > .operation-hints {
  display: none;
}

.hand-operation-hints {
  display: none;
  position: absolute;
  left: 78px;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 26px;
  padding: 2px 4px;
  gap: 4px;
  border-radius: 999px;
  min-width: 0;
  max-width: none;
}

.hand-operation-hints:not(.is-empty) {
  display: flex;
}

.hand-operation-hints span {
  padding: 2px 6px;
  font-size: 10px;
  line-height: 1.15;
}

/* 次戦の確定も決着後の操作と同じ配色にし、対戦開始用の装飾は付けない。 */
.control-panel .actions button:not(.commander-action):not(.commander-select-action):not(.attack-action):not(.cancel-cost-action):not(.cancel-position-action):not(.cancel-attack-action):not(:where(.action-start-battle-phase, .action-end-battle-phase, .action-end-turn)),
.rematch-deck-dialog [data-rematch-deck="confirm"] {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 48%),
    linear-gradient(180deg, var(--phase-tint), transparent 52%),
    var(--phase-button);
  border-color: color-mix(in srgb, var(--phase-accent) 42%, #6c725f);
  font-weight: 800;
}

.control-panel .actions button:not(.commander-action):not(.commander-select-action):not(.attack-action):not(.cancel-cost-action):not(.cancel-position-action):not(.cancel-attack-action):not(:where(.action-start-battle-phase, .action-end-battle-phase, .action-end-turn)):hover:not(:disabled),
.rematch-deck-dialog [data-rematch-deck="confirm"]:hover:not(:disabled) {
  border-color: var(--phase-accent);
  color: #fff7d2;
}

/* ターンを飛ばす操作は控えめにし、メイン2に入ってから主操作へ切り替える。 */
.actions button:is(.action-start-battle-phase, .action-end-battle-phase, .action-end-turn) {
  --phase-action-surface: linear-gradient(180deg, #806637, #574222);
  --phase-action-border: #d8b969;
  --phase-action-text: #fff3d0;
  background: var(--phase-action-surface);
  color: var(--phase-action-text);
}

.actions button:is(.action-start-battle-phase, .action-end-battle-phase, .action-end-turn):not(:where(.tutorial-highlight)) {
  border-color: var(--phase-action-border);
  box-shadow: inset 0 1px 0 rgba(255, 247, 210, 0.14), 0 2px 6px rgba(0, 0, 0, 0.22);
}

.actions:not(.phase-main2) button.action-end-turn {
  --phase-action-surface: linear-gradient(180deg, #273130, #1b2424);
  --phase-action-border: #687773;
  --phase-action-text: #dce2d9;
}

.actions.phase-main2 button.action-start-battle-phase:disabled {
  --phase-action-surface:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 48%),
    linear-gradient(180deg, var(--phase-tint), transparent 52%),
    var(--phase-button);
  --phase-action-border: color-mix(in srgb, var(--phase-accent) 42%, #6c725f);
  --phase-action-text: var(--text);
}

.actions:not(.phase-main2) button.action-end-turn:not(:where(.tutorial-highlight)),
.actions.phase-main2 button.action-start-battle-phase:disabled:not(:where(.tutorial-highlight)) {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.actions button:is(.action-start-battle-phase, .action-end-battle-phase, .action-end-turn):hover:not(:disabled):not(:where(.tutorial-highlight)) {
  border-color: color-mix(in srgb, var(--phase-action-border) 70%, white);
  color: #fff8e5;
}

.actions button:is(.action-start-battle-phase, .action-end-battle-phase, .action-end-turn):focus-visible {
  outline: 2px solid #fff0b6;
  outline-offset: 2px;
}

.control-panel.phase-battle .actions .attack-action {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 48%),
    linear-gradient(180deg, rgba(255, 233, 166, 0.18), rgba(103, 44, 28, 0.14)),
    #4a352b;
  border-color: #dc9461;
}

.actions .commander-action,
.actions .commander-select-action {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 48%),
    linear-gradient(180deg, rgba(255, 239, 185, 0.16), rgba(95, 36, 36, 0.1)),
    #4e2d2d;
  border-color: #c2665e;
  color: #ffe1cf;
  font-weight: 700;
}

.actions .commander-action {
  grid-column: 1 / -1;
}

.actions .commander-action:hover:not(:disabled),
.actions .commander-select-action:hover:not(:disabled) {
  border-color: #f09a83;
  color: #fff4e8;
}

/* 大将指定だけは、同じ系統の「保留」より一段強く操作を促す。 */
.actions .commander-select-action,
.actions .commander-designate-action {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 42%),
    linear-gradient(135deg, rgba(151, 103, 24, 0.96), rgba(75, 42, 25, 0.98));
  border-color: #f2c861;
  color: #fff5c7;
  font-weight: 900;
  text-shadow: 0 0 7px rgba(255, 229, 137, 0.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 252, 218, 0.34),
    0 0 0 1px rgba(255, 213, 105, 0.2),
    0 0 14px rgba(255, 185, 54, 0.52),
    0 3px 9px rgba(0, 0, 0, 0.28);
}

.actions .commander-select-action:not(:disabled),
.actions .commander-designate-action:not(:disabled) {
  animation: commander-action-glow 1500ms ease-in-out infinite;
}

.actions .commander-select-action:hover:not(:disabled),
.actions .commander-designate-action:hover:not(:disabled) {
  border-color: #ffe18a;
  color: #fffbe8;
}

.actions .commander-select-action:disabled {
  border-color: rgba(224, 178, 78, 0.62);
  box-shadow:
    inset 0 1px 0 rgba(255, 252, 218, 0.18),
    0 0 10px rgba(222, 153, 34, 0.22);
}

.actions .attack-action {
  grid-column: 1 / -1;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 48%),
    linear-gradient(180deg, rgba(255, 233, 166, 0.18), rgba(88, 37, 20, 0.12)),
    #3e3424;
  border-color: #c49a4d;
  color: #fff0c7;
  font-weight: 900;
}

.actions .attack-action:hover:not(:disabled) {
  border-color: #f2bf62;
  color: #fff8e8;
}

.actions .cancel-cost-action,
.actions .cancel-position-action,
.actions .cancel-attack-action {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 48%),
    linear-gradient(180deg, rgba(151, 172, 190, 0.2), rgba(30, 42, 54, 0.16)),
    #26313b;
  border-color: #6f8497;
  color: #e5eef5;
  font-weight: 800;
}

.actions .cancel-attack-action {
  grid-column: 1 / -1;
}

.actions .cancel-cost-action:hover:not(:disabled),
.actions .cancel-position-action:hover:not(:disabled),
.actions .cancel-attack-action:hover:not(:disabled) {
  border-color: #9badbd;
  color: #f7fbff;
}

.mobile-context-menu {
  display: none;
}

.log-wrap {
  border: 1px solid var(--ui-panel-border);
  border-radius: var(--ui-radius-md);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 38%),
    rgba(20, 24, 20, 0.62);
  box-shadow:
    var(--shadow-panel),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.log-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--ui-gap-md);
  padding: 8px 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 52%),
    rgba(25, 28, 24, 0.68);
}

.log-wrap h2 {
  margin-right: auto;
  font-size: 14px;
}

.log-head button {
  min-height: 26px;
  padding: 4px 9px;
  font-size: 12px;
}

.log {
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  max-height: 260px;
  margin: 0;
  padding: 7px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.28;
  list-style: none;
  counter-reset: log-line;
}

.log li {
  counter-increment: log-line;
  position: relative;
  margin: 0;
  padding: 3px 7px 3px 28px;
  border: 1px solid rgba(242, 219, 157, 0.08);
  border-radius: var(--ui-radius-sm);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035), transparent 62%),
    rgba(10, 13, 10, 0.2);
  color: #e8e1cf;
}

.log li::before {
  content: counter(log-line);
  position: absolute;
  left: 6px;
  top: 3px;
  min-width: 16px;
  color: rgba(242, 219, 157, 0.52);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.28;
  text-align: right;
}

.log li:first-child {
  border-color: rgba(224, 184, 78, 0.2);
  background:
    linear-gradient(90deg, rgba(224, 184, 78, 0.09), transparent 64%),
    rgba(18, 21, 17, 0.34);
  color: #fff3cf;
}

.special-stack-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1200;
  width: 236px;
  display: grid;
  gap: 8px;
}

.special-stack-panel.special-stack-frozen {
  width: auto;
  min-width: 0;
}

.special-stack-panel.tutorial-special-wait-hidden {
  display: none !important;
}

.special-wait-option {
  position: relative;
  display: grid;
  grid-template-rows: auto auto;
  justify-items: center;
  align-content: center;
  gap: 3px;
  justify-self: end;
  min-width: 98px;
  padding: 8px 12px;
  border: 1px solid rgba(170, 156, 255, 0.48);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(94, 82, 150, 0.28), rgba(22, 18, 39, 0.62)),
    rgba(31, 27, 49, 0.62);
  backdrop-filter: blur(6px);
  color: #eee9ff;
  font-weight: 700;
  line-height: 1.05;
  text-align: center;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  user-select: none;
}

.special-wait-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.special-wait-label {
  font-size: 11px;
  letter-spacing: 0.02em;
}

.special-wait-state {
  min-width: 32px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(173, 158, 255, 0.24);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  box-shadow: inset 0 0 0 1px rgba(224, 216, 255, 0.18);
}

.special-wait-option.is-off {
  border-color: rgba(158, 166, 171, 0.34);
  background:
    linear-gradient(180deg, rgba(96, 103, 108, 0.16), rgba(17, 20, 22, 0.58)),
    rgba(18, 22, 25, 0.58);
  color: rgba(232, 236, 238, 0.72);
}

.special-wait-option.is-off .special-wait-state {
  background: rgba(117, 124, 130, 0.22);
  color: rgba(238, 241, 243, 0.78);
}

.special-wait-option.is-waiting {
  border-color: #f4d35e;
  color: #fff5b8;
  box-shadow: 0 0 0 2px rgba(244, 211, 94, 0.18), 0 12px 32px rgba(0, 0, 0, 0.28);
}

.special-wait-option.is-waiting .special-wait-state {
  background: rgba(244, 211, 94, 0.26);
  color: #fff8c7;
}

.special-stack {
  width: 100%;
  max-height: min(52vh, 360px);
  min-height: 126px;
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 10px 12px;
  border: 1px solid #7468b6;
  border-radius: 8px;
  background: rgba(31, 27, 49, 0.88);
  backdrop-filter: blur(3px);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.32);
  color: var(--text);
  text-align: left;
  overflow-y: auto;
}

.special-stack-panel.special-stack-frozen .special-stack {
  display: none;
}

.special-stack:hover {
  border-color: #aa9cff;
}

.special-stack.special-wait-active {
  border-color: #f4d35e;
  box-shadow:
    0 0 0 2px rgba(244, 211, 94, 0.25),
    0 0 22px rgba(244, 211, 94, 0.28),
    0 16px 42px rgba(0, 0, 0, 0.32);
}

.special-stack.special-stack-effect-source {
  border-color: #ffe19a;
  animation: special-stack-source-pulse 920ms ease-out both;
}

.special-stack.empty {
  border-style: dashed;
  color: var(--muted);
}

.special-event-visual {
  position: fixed;
  top: var(--special-event-top, 0);
  left: var(--special-event-left, 0);
  z-index: 19;
  width: var(--special-event-width, 100vw);
  height: var(--special-event-height, 100vh);
  overflow: hidden;
  border-radius: var(--ui-radius-md);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.special-event-visual.show {
  visibility: visible;
}

.special-event-visual.special-event-commander {
  background:
    radial-gradient(
      ellipse var(--special-event-focus-radius-x, 72px) var(--special-event-focus-radius-y, 96px)
      at var(--special-event-focus-x, 50%) var(--special-event-focus-y, 50%),
      transparent 0 48%,
      rgba(5, 7, 6, 0.22) 68%,
      rgba(4, 6, 5, 0.76) 100%
    );
  animation: special-event-commander-veil var(--special-event-duration, 1320ms) ease-in-out both;
}

.special-event-visual.special-event-awaken {
  background:
    radial-gradient(
      ellipse var(--special-event-focus-radius-x, 60px) var(--special-event-focus-radius-y, 82px)
      at var(--special-event-focus-x, 50%) var(--special-event-focus-y, 50%),
      rgba(19, 16, 10, 0.04) 0 54%,
      rgba(5, 7, 7, 0.42) 76%,
      rgba(4, 5, 6, 0.76) 100%
    );
  animation: special-event-awaken-veil var(--special-event-duration, 1800ms) ease-out both;
}

.special-event-visual.special-event-fallen {
  background:
    radial-gradient(circle at 50% 44%, rgba(74, 77, 70, 0.04), rgba(19, 19, 18, 0.26)),
    rgba(28, 24, 23, 0.18);
  -webkit-backdrop-filter: grayscale(0.78) saturate(0.16) brightness(0.82);
  backdrop-filter: grayscale(0.78) saturate(0.16) brightness(0.82);
  animation: special-event-fallen-wash var(--special-event-duration, 980ms) ease-out both;
}

.stack-title {
  color: #d8d0ff;
  font-size: 12px;
  font-weight: 700;
}

.stack-name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
}

.stack-meta,
.stack-remove {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.stack-effect {
  padding-top: 6px;
  border-top: 1px solid rgba(216, 208, 255, 0.22);
  color: #f2efe4;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

@keyframes special-wait-card-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 2px rgba(116, 232, 158, 0.52),
      0 0 18px rgba(116, 232, 158, 0.34),
      0 0 30px rgba(244, 211, 94, 0.14);
  }
  50% {
    box-shadow:
      0 0 0 3px rgba(116, 232, 158, 0.76),
      0 0 26px rgba(116, 232, 158, 0.5),
      0 0 44px rgba(244, 211, 94, 0.26);
  }
}
