.desktop-app {
  display: block;
}

.mobile-app {
  display: none;
  color-scheme: dark;
  --brand-600: #2563eb;
  --brand-500: #3b82f6;
  --brand-100: #dbeafe;
  --bg: #0b1220;
  --panel: #0f172a;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #22d3ee;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --shadow-1: 0 8px 16px rgba(0, 0, 0, 0.2);
  --shadow-2: 0 12px 24px rgba(0, 0, 0, 0.35);
  --radius-card: 12px;
  --radius-cta: 20px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --picker-search-icon-offset: 44px;
  font-size: 16px;
  font-family: 'Noto Sans JP', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  width: 100%;
  margin: 0;
  color: var(--text);
  background: radial-gradient(circle at top, rgba(59, 130, 246, 0.15), transparent 60%), var(--bg);
  justify-content: center;
}


.mobile-app *,
.mobile-app *::before,
.mobile-app *::after {
  box-sizing: border-box;
}

.mobile-app img {
  display: block;
  max-width: 100%;
}

.mobile-app button {
  font: inherit;
}

.desktop-app[hidden],
.mobile-app[hidden] {
  display: none !important;
}

@media (max-width: 768px) {
  .mobile-app {
    display: flex;
    align-items: stretch;
  }

  .desktop-app {
    display: none;
  }
}

.app-shell {
  position: relative;
  width: min(100%, 720px);
  min-height: 100%;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.85), rgba(11, 18, 32, 0.95));
  padding-bottom: calc(68px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.app-header {
  padding: var(--space-4) var(--space-4) 0;
}

.app-title {
  font-size: 20px;
  line-height: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.app-main {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--space-4) var(--space-5);
}

.screen {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4) 0 var(--space-5);
}

.screen[hidden] {
  display: none !important;
}

.panel {
  position: relative;
  background: rgba(15, 23, 42, 0.9);
  border-radius: var(--radius-card);
  padding: var(--space-4);
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.12);
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(140deg, rgba(37, 99, 235, 0.32), transparent 55%);
  opacity: 0.35;
  pointer-events: none;
  mix-blend-mode: lighten;
}

.panel.hero-card::before {
  opacity: 0.2;
  background: linear-gradient(140deg, rgba(37, 99, 235, 0.45), transparent 60%);
}

.panel > * {
  position: relative;
  z-index: 1;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.panel-title {
  font-size: 18px;
  line-height: 24px;
  font-weight: 600;
}

.panel-subtitle {
  font-size: 14px;
  color: var(--muted);
}

.panel-description {
  margin: 0 0 var(--space-3);
  line-height: 1.6;
}

.panel--spotlight {
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 20px 36px rgba(13, 148, 136, 0.2), 0 0 0 1px rgba(14, 165, 233, 0.25);
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.22), rgba(14, 165, 233, 0.12)), rgba(15, 23, 42, 0.92);
}

.panel--spotlight::before {
  opacity: 0.65;
  background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.4), transparent 55%),
    linear-gradient(130deg, rgba(37, 99, 235, 0.45), transparent 60%);
  mix-blend-mode: screen;
}

.panel-title--spotlight {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 19px;
  line-height: 1.4;
  font-weight: 700;
  color: #f8fafc;
}

.panel-title__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.8), rgba(14, 165, 233, 0.65));
  color: #0f172a;
  box-shadow: 0 8px 16px rgba(14, 165, 233, 0.35);
  font-size: 18px;
}

.panel-title__text {
  display: inline-block;
}


.hero-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.4), rgba(15, 23, 42, 0.9));
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(34, 211, 238, 0.45), transparent 55%);
  opacity: 0.6;
  /*
   * Decorative glow overlay must stay non-interactive so the hero CTA buttons
   * remain tappable on touch devices. Do not remove pointer-events: none.
   */
  pointer-events: none;
}

.hero-content {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.hero-description {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
}

.cta-secondary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-card);
  background: rgba(15, 23, 42, 0.65);
  color: var(--text);
  border: 1px solid rgba(59, 130, 246, 0.35);
  text-decoration: none;
  min-height: 44px;
}

.quick-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  position: relative;
}

.quick-list::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: calc(var(--radius-card) - 4px);
  border: 1px dashed rgba(37, 99, 235, 0.2);
  pointer-events: none;
  z-index: 0;
}

.quick-list > * {
  position: relative;
  z-index: 1;
}

.quick-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  padding-left: calc(var(--space-4) + 12px);
  padding-right: calc(var(--space-4) + 16px);
  border-radius: var(--radius-card);
  background: linear-gradient(130deg, rgba(37, 99, 235, 0.24), rgba(15, 23, 42, 0.88));
  border: 1px solid rgba(37, 99, 235, 0.28);
  box-shadow: 0 14px 30px rgba(10, 15, 28, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.quick-item::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--brand-500), var(--accent));
  opacity: 0.85;
  pointer-events: none;
}

.quick-item--history {
  cursor: pointer;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: var(--space-5);
  padding: var(--space-5);
  padding-right: calc(var(--space-5) + 36px);
}

.mobile-app .history-label {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.mobile-app .history-characters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
  width: 100%;
}

.mobile-app .history-character {
  position: relative;
  z-index: 0;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
  padding: var(--space-4);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.35), rgba(14, 116, 144, 0.4));
  box-shadow: 0 14px 28px rgba(8, 14, 24, 0.45);
}

.mobile-app .history-character--active {
  position: relative;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.5), rgba(14, 165, 233, 0.6));
  box-shadow: 0 20px 38px rgba(8, 14, 24, 0.6);
  outline: 2px solid rgba(165, 243, 252, 0.7);
  outline-offset: 0;
}

.mobile-app .history-character[data-role='player'].history-character--active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.55), rgba(37, 99, 235, 0.65));
  outline-color: rgba(191, 219, 254, 0.8);
}

.mobile-app .history-character[data-role='partner'].history-character--active {
  background: linear-gradient(135deg, rgba(253, 186, 116, 0.5), rgba(236, 72, 153, 0.6));
  outline-color: rgba(251, 191, 183, 0.75);
}

.mobile-app .history-character--active::after {
  content: '';
  position: absolute;
  inset: 24px;
  border-radius: inherit;
  background: radial-gradient(circle at 20% 20%, rgba(224, 242, 254, 0.75), transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(186, 230, 253, 0.6), transparent 65%);
  z-index: -1;
  filter: blur(18px);
  opacity: 0.75;
  pointer-events: none;
}

.mobile-app .history-character__thumb {
  position: relative;
  flex: 0 0 auto;
  width: 78px;
  height: 78px;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.6), rgba(8, 145, 178, 0.6));
  box-shadow: 0 16px 34px rgba(8, 14, 24, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-app .history-character__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mobile-app .history-character__placeholder {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(241, 245, 249, 0.9);
}

.mobile-app .history-character__text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.mobile-app .history-character__role {
  font-size: 14px;
  color: var(--brand-100);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mobile-app .history-character--active .history-character__role {
  color: #f0f9ff;
}


.mobile-app .history-character__name {
  font-weight: 800;
  font-size: 20px;
  color: #f8fafc;
  line-height: 1.4;
  white-space: normal;
}

.mobile-app .history-character--active .history-character__name {
  color: #ffffff;
}

.mobile-app .history-character__result {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  padding: 2px 12px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.4);
  color: #e0f2fe;
  box-shadow: inset 0 0 0 1px rgba(224, 242, 254, 0.35);
}

.mobile-app .history-character--active .history-character__result {
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.95), rgba(165, 243, 252, 0.85));
  color: #0f172a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
  box-shadow: 0 8px 16px rgba(8, 14, 24, 0.35), inset 0 0 0 1px rgba(14, 116, 144, 0.35);
}


.quick-item--history::after {
  content: "";
  position: absolute;
  top: 50%;
  right: var(--space-4);
  width: 14px;
  height: 14px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: translateY(-50%) rotate(-45deg);
  opacity: 0.75;
  transition: opacity 0.2s ease;
}

.quick-item--history:hover,
.quick-item--history:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(34, 211, 238, 0.6);
  box-shadow: 0 18px 34px rgba(8, 14, 24, 0.45);
  background: linear-gradient(130deg, rgba(37, 99, 235, 0.35), rgba(15, 23, 42, 0.9));
  outline: none;
}

.quick-item--history:hover::after,
.quick-item--history:focus-visible::after {
  opacity: 1;
}

.quick-item[data-nav-target] {
  cursor: pointer;
}

.quick-item[data-nav-target]::after {
  content: "";
  position: absolute;
  top: 50%;
  right: var(--space-3);
  width: 12px;
  height: 12px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: translateY(-50%) rotate(-45deg);
}

.quick-item[data-nav-target]:hover,
.quick-item[data-nav-target]:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(34, 211, 238, 0.6);
  box-shadow: 0 18px 34px rgba(8, 14, 24, 0.45);
  background: linear-gradient(130deg, rgba(37, 99, 235, 0.35), rgba(15, 23, 42, 0.9));
  outline: none;
}

.quick-item[data-nav-target]:active {
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(8, 14, 24, 0.45);
}

.quick-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quick-label span:first-child {
  font-weight: 600;
}

.quick-label span:last-child {
  font-size: 14px;
  color: var(--muted);
}

.mobile-app .history-character--active .history-character__text > .history-character__result {
  /* quick-label のフォールバックカラーより優先して読みやすさを確保 */
  color: #0f172a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.quick-value {
  font-weight: 700;
  color: var(--accent);
}

.section-group {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-2);
  z-index: 0;
}

.section-group::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  inset-block-start: 0;
  inset-block-end: 0;
  border-radius: var(--radius-card);
  border: 1px solid rgba(37, 99, 235, 0.12);
  pointer-events: none;
  opacity: 0.35;
  z-index: -1;
}

.section-toggle {
  border: none;
  background: rgba(15, 23, 42, 0.75);
  border-radius: var(--radius-card);
  padding: var(--space-3) var(--space-4);
  font-size: 16px;
  color: inherit;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(8, 14, 24, 0.28);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.section-toggle svg {
  transition: transform 0.2s ease;
}

.section-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.collapse {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease;
  border-radius: calc(var(--radius-card) - 4px);
}

.collapse[data-open="true"] {
  max-height: 9999px;
  margin-top: var(--space-3);
  padding: var(--space-3);
  border: 1px solid rgba(59, 130, 246, 0.22);
  background: rgba(9, 14, 26, 0.9);
  box-shadow: 0 16px 32px rgba(8, 14, 24, 0.45);
  overflow: visible;
}

.input-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.inline-result {
  margin-top: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-card);
  background: linear-gradient(140deg, rgba(59, 130, 246, 0.2), rgba(165, 180, 252, 0.25));
  border: 1px solid rgba(129, 140, 248, 0.35);
  box-shadow: 0 16px 32px rgba(76, 29, 149, 0.35);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.inline-result__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.inline-result__title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.inline-result__status {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.22);
  color: rgba(226, 232, 240, 0.92);
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.35);
}

.inline-result__status--ready {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
  box-shadow: inset 0 0 0 1px rgba(22, 163, 74, 0.4);
}

.inline-result__status--not-ready {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.35);
}

.awakening-possible {
  color: #16a34a;
  font-weight: 600;
}

.awakening-not-possible {
  color: #dc2626;
  font-weight: 600;
}

.inline-result__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.inline-result__item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.inline-result__label {
  font-size: 12px;
  color: rgba(191, 219, 254, 0.8);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.inline-result__value {
  font-size: 28px;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: 0.01em;
}

.inline-result__note {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.form-field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-card);
  background: rgba(12, 19, 33, 0.9);
  border: 1px solid rgba(59, 130, 246, 0.28);
  box-shadow: 0 12px 26px rgba(8, 14, 24, 0.28);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-field::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(34, 211, 238, 0.28);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.form-field label {
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.form-field:focus-within {
  border-color: rgba(34, 211, 238, 0.6);
  box-shadow: 0 16px 32px rgba(8, 14, 24, 0.45);
}

.form-field:focus-within::before {
  opacity: 1;
}

.mobile-app input[type="text"],
.mobile-app input[type="number"],
.mobile-app select {
  width: 100%;
  padding: var(--space-3);
  border-radius: var(--radius-card);
  border: 1px solid rgba(59, 130, 246, 0.35);
  background: rgba(9, 14, 26, 0.92);
  color: var(--text);
  font-size: 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}
#simPlayerPickerSearch {
    padding: 12px 32px;
}

.mobile-app .character-picker-search {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  border-radius: var(--radius-card);
  background: rgba(12, 19, 33, 0.9);
  border: 1px solid rgba(59, 130, 246, 0.28);
  box-shadow: 0 12px 26px rgba(8, 14, 24, 0.28);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mobile-app .character-picker-search.is-filtering {
  border-color: rgba(34, 211, 238, 0.5);
}

.mobile-app .character-picker-search.has-results {
  border-color: rgba(34, 211, 238, 0.6);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.22), 0 14px 28px rgba(8, 14, 24, 0.32);
}

.mobile-app .character-picker-search.no-results {
  border-color: rgba(251, 191, 36, 0.65);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.18), 0 14px 28px rgba(8, 14, 24, 0.28);
}

.mobile-app .character-picker-search-input-wrapper {
  position: relative;
}

.mobile-app .character-picker-search-input-wrapper i {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  font-size: 14px;
}

.mobile-app .character-picker-search-input {
  padding: var(--space-3);
  padding-left: calc(var(--space-3) + var(--picker-search-icon-offset));
}

.mobile-app .character-picker-search-helper {
  font-size: 12px;
  color: var(--muted);
}

.mobile-app .character-picker-search-helper.has-results {
  color: var(--accent);
}

.mobile-app .character-picker-search-helper.no-results {
  color: var(--warning);
}

.mobile-app select {
  appearance: none;
  background-image: url('data:image/svg+xml,%3Csvg width="12" height="8" viewBox="0 0 12 8" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M1 1.5L6 6.5L11 1.5" stroke="%2394a3b8" stroke-width="1.5" stroke-linecap="round"/%3E%3C/svg%3E');
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 12px;
  padding-right: 36px;
}

.mobile-app input[type="text"]:focus,
.mobile-app input[type="number"]:focus,
.mobile-app select:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.65);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.2);
}

.input-helper {
  font-size: 12px;
  color: var(--muted);
}

.chip-row {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding: var(--space-2);
  border-radius: var(--radius-card);
  border: 1px solid rgba(59, 130, 246, 0.25);
  background: rgba(15, 23, 42, 0.65);
  box-shadow: 0 10px 24px rgba(8, 14, 24, 0.28);
}

.filter-chip {
  flex: 0 0 auto;
  padding: var(--space-2) var(--space-3);
  border-radius: 999px;
  border: 1px solid rgba(59, 130, 246, 0.3);
  background: rgba(15, 23, 42, 0.55);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.filter-chip[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--brand-600), var(--accent));
  border-color: rgba(34, 211, 238, 0.6);
  box-shadow: 0 12px 24px rgba(8, 14, 24, 0.45);
  color: #0b1120;
}

.filter-chip:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.65);
  outline-offset: 2px;
}


.sort-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.filter-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-card);
  background: rgba(37, 99, 235, 0.16);
  color: var(--text);
  font-size: 14px;
}

.filter-notice__text {
  flex: 1;
}

.filter-notice__action {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--brand-500);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}


.filter-notice__action:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

.sort-select {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: rgba(15, 23, 42, 0.55);
  border-radius: var(--radius-card);
  font-size: 14px;
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.sort-select[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--brand-600), var(--accent));
  color: #0b1120;
  border-color: rgba(34, 211, 238, 0.6);
  box-shadow: 0 12px 24px rgba(8, 14, 24, 0.45);
}

.sort-select:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.65);
  outline-offset: 2px;
}


.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3);
}

@media (max-width: 389px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
}

.character-card {
  position: relative;
  padding: var(--space-4);
  border-radius: var(--radius-card);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(59, 130, 246, 0.25);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  cursor: default;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.character-card.is-selected {
  border-color: rgba(59, 130, 246, 0.85);
  box-shadow: 0 12px 28px rgba(59, 130, 246, 0.3);
}

.character-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(150deg, rgba(37, 99, 235, 0.28), transparent 55%);
  pointer-events: none;
  opacity: 0.5;
}

.character-card > * {
  position: relative;
  z-index: 1;
}


.character-card:focus-visible,
.character-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}

.character-card-selection-badge {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.9);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.35);
  z-index: 2;
}


.card-header {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(59, 130, 246, 0.65);
  padding: 2px;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.25);
  color: var(--accent);
  font-weight: 700;
  font-size: 18px;
}

.card-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.card-name {
  font-weight: 600;
}

.cost-badge {
  align-self: flex-start;
  padding: var(--space-1) var(--space-2);
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.25);
  border: 1px solid rgba(59, 130, 246, 0.35);
  font-size: 12px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  font-size: 14px;
  color: var(--muted);
}

.metric-row strong {
  color: var(--text);
  font-size: 16px;
  margin-left: auto;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.hp-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.4);
  overflow: hidden;
  box-shadow: inset 0 2px 5px rgba(15, 23, 42, 0.25);
}

.hp-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(
      90deg,
      var(--hp-low) 0%,
      var(--hp-medium) 50%,
      var(--hp-high) 100%
    ),
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0.45) 50%,
      rgba(255, 255, 255, 0) 100%
    );
  background-size: 100% 100%, 200% 100%;
  background-repeat: no-repeat;
  transition: width 0.3s ease;
  animation: hpShine 2.6s linear infinite;
}

@keyframes hpShine {
  0% {
    background-position: 0% 0%, -100% 0%;
  }

  100% {
    background-position: 0% 0%, 100% 0%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hp-bar span {
    animation: none;
  }
}

.hp-info {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  column-gap: var(--space-2);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.hp-info .hp-current {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.hp-info .hp-ratio-text {
  justify-self: end;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
  min-width: 0;
}

.durability-table {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: var(--space-2);
  font-size: 12px;
}

.durability-cell {
  padding: var(--space-2);
  border-radius: var(--radius-card);
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(59, 130, 246, 0.2);
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.durability-cell:nth-child(even) {
  background: rgba(17, 24, 39, 0.9);
}

.durability-cell.is-active {
  border-color: rgba(59, 130, 246, 0.6);
  background: rgba(37, 99, 235, 0.25);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
}

.durability-cell:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.7);
  outline-offset: 2px;
}

.durability-label {
  font-size: 11px;
  color: var(--muted);
}

.durability-value {
  font-weight: 600;
  color: var(--text);
}

.bottom-nav {
  position: sticky;
  bottom: 0;
  inset-inline: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(59, 130, 246, 0.25);
  padding-bottom: env(safe-area-inset-bottom);
  height: calc(68px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 24px rgba(8, 14, 24, 0.45);
}

.tab-button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  padding: 10px 4px;
  min-height: 44px;
  transition: color 0.2s ease, transform 0.2s ease;
  position: relative;
  font-weight: 600;
}

.tab-button svg {
  width: 24px;
  height: 24px;
  position: relative;
  z-index: 1;
}

.tab-button[aria-selected="true"] {
  color: #fff;
  transform: translateY(-2px);
}

.tab-button[aria-selected="true"]::after {
  content: "";
  width: 24px;
  height: 3px;
  border-radius: 999px;
  background: var(--brand-500);
  display: block;
}

.tab-button::before {
  content: "";
  position: absolute;
  inset-inline: 14px;
  inset-block: 8px 14px;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(37, 99, 235, 0.38), rgba(34, 211, 238, 0.25));
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 0;
}

.tab-button[aria-selected="true"]::before {
  opacity: 1;
  transform: translateY(0);
}

.tab-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}


.sticky-footer-cta {
  position: sticky;
  bottom: calc(68px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  padding: var(--space-4) 0;
}


.results-panel-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.results-panel {
  background: rgba(15, 23, 42, 0.9);
  border-radius: var(--radius-card);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  border: 1px solid rgba(37, 99, 235, 0.25);
}

.results-panel--redeploy {
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.24);
}

.results-panel--awakening {
  border-color: rgba(129, 140, 248, 0.35);
  box-shadow: 0 12px 28px rgba(76, 29, 149, 0.2);
}

.results-panel--awakening .panel-title {
  color: rgba(191, 219, 254, 0.92);
}

.results-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-card);
  background: rgba(12, 19, 33, 0.85);
  border: 1px solid rgba(59, 130, 246, 0.22);
  box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.08);
}

.results-panel--awakening .results-section {
  background: rgba(17, 24, 49, 0.85);
  border-color: rgba(129, 140, 248, 0.28);
  box-shadow: inset 0 1px 0 rgba(165, 180, 252, 0.1);
}

.results-details {
  margin: 0;
  display: grid;
  gap: var(--space-2);
}

.results-details__item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-card-sm, 10px);
  background: rgba(30, 41, 72, 0.55);
  border: 1px solid rgba(59, 130, 246, 0.18);
  box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.08);
}

.results-details__label {
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.8);
  letter-spacing: 0.02em;
}

.results-details__value {
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(191, 219, 254, 0.95);
  letter-spacing: 0.01em;
}

.results-panel-group .results-history-note {
  text-align: center;
}



.team-summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.info-details {
  margin-top: var(--space-3);
  border-radius: var(--radius-card);
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(12, 19, 33, 0.78);
  padding: var(--space-3);
  display: block;
  color: var(--text);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.28);
}

.info-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text);
  outline: none;
}

.info-details summary::-webkit-details-marker {
  display: none;
}

.info-details summary::after {
  content: '\25BC';
  margin-left: auto;
  font-size: 12px;
  transition: transform 0.2s ease;
}

.info-details[open] {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(12, 19, 33, 0.92);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.35);
}

.info-details[open] summary::after {
  transform: rotate(180deg);
}

.info-details__section {
  margin-top: var(--space-3);
  display: grid;
  gap: var(--space-2);
  font-size: 14px;
  color: var(--text);
}

.info-details__section h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.info-details__section ul {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 6px;
}

.info-details__formula {
  margin: 0;
  padding: var(--space-2);
  background: rgba(37, 99, 235, 0.18);
  border-radius: 8px;
  font-size: 14px;
}

.info-details__tip {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.info-details__note {
  margin-top: var(--space-3);
  border-left: 3px solid var(--warning);
  background: rgba(15, 23, 42, 0.7);
  padding: var(--space-3);
  display: grid;
  gap: var(--space-2);
  font-size: 14px;
}

.info-details__note h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--warning);
}

.info-details__note ul {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 6px;
}

.team-summary-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 768px) {
  .team-summary-grid {
    grid-template-columns: 1fr;
  }
}

.team-summary-card {
  background: rgba(15, 23, 42, 0.85);
  border-radius: var(--radius-card);
  padding: var(--space-3);
  border: 1px solid rgba(37, 99, 235, 0.18);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.team-summary-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--muted);
  margin: 0;
}

.team-summary-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
}

.scenario-details {
  background: rgba(12, 19, 33, 0.85);
  border-radius: 10px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.scenario-details summary {
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}

.scenario-details[open] summary {
  color: var(--accent);
}

.scenario-details summary::-webkit-details-marker {
  display: none;
}

.scenario-details summary::after {
  content: '\25BC';
  float: right;
  transition: transform 0.2s ease;
  font-size: 12px;
}

.scenario-details[open] summary::after {
  transform: rotate(180deg);
}

.scenario-list {
  list-style: none;
  margin: var(--space-2) 0 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
  font-size: 13px;
}

.scenario-step {
  background: rgba(15, 23, 42, 0.7);
  border-radius: 8px;
  padding: var(--space-2);
  border: 1px solid rgba(59, 130, 246, 0.18);
  display: grid;
  gap: 4px;
}

.scenario-step-header {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  font-weight: 600;
}

.scenario-step-value {
  color: var(--accent);
}

.scenario-step-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.scenario-step-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.selected-characters {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.selected-character-grid {
  gap: var(--space-3);
}

.selected-character-grid .character-card {
  height: 100%;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
  font-size: 14px;
}

.results-section .results-grid {
  padding: 0;
}

.result-figure {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.result-figure strong {
  font-size: 18px;
  color: var(--accent);
}

.checkbox-field {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  justify-items: start;
  gap: var(--space-2);
  font-size: 14px;
  padding: var(--space-3);
  border-radius: var(--radius-card);
  background: rgba(12, 19, 33, 0.85);
  border: 1px solid rgba(59, 130, 246, 0.22);
  box-shadow: 0 10px 22px rgba(8, 14, 24, 0.32);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.checkbox-field__control {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  grid-column: 1 / -1;
}

.checkbox-field:focus-within {
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 14px 28px rgba(8, 14, 24, 0.42);
}

.checkbox-field input {
  width: 20px;
  height: 20px;
}

.checkbox-field__helper {
  grid-column: 1 / -1;
}

.section-toggle {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(37, 99, 235, 0.22);
  box-shadow: 0 12px 26px rgba(8, 14, 24, 0.32);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.section-toggle::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(130deg, rgba(37, 99, 235, 0.22), rgba(34, 211, 238, 0.12));
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.section-toggle:hover::before,
.section-toggle:focus-visible::before {
  opacity: 1;
}

.section-toggle:hover,
.section-toggle:focus-visible {
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 16px 32px rgba(8, 14, 24, 0.45);
  outline: none;
}

.section-toggle:active {
  box-shadow: 0 10px 20px rgba(8, 14, 24, 0.45);
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.setting-item {
  background: rgba(15, 23, 42, 0.8);
  border-radius: var(--radius-card);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.setting-item__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #f8fafc;
}

.setting-item__description {
  margin: 0 0 var(--space-2);
  font-size: 13px;
  color: var(--muted);
}

.setting-item__accent {
  color: #f8fafc;
  font-weight: 600;
}

.setting-item__link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  transition: color 180ms ease;
}

.setting-item__link:hover,
.setting-item__link:focus-visible {
  color: #bae6fd;
  text-decoration: underline;
  outline: none;
}

.setting-item label {
  font-size: 14px;
  color: var(--muted);
}

[hidden] {
  display: none !important;
}

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

.calc-breakdown {
  margin-top: var(--space-3);
  border-radius: var(--radius-card);
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(13, 20, 34, 0.92);
  box-shadow: 0 12px 28px rgba(8, 14, 24, 0.35);
  overflow: hidden;
}

.calc-breakdown__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  background: linear-gradient(120deg, rgba(59, 130, 246, 0.25), rgba(99, 102, 241, 0.18));
  transition: background 0.2s ease;
}

.calc-breakdown__summary::-webkit-details-marker {
  display: none;
}

.calc-breakdown__summary:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.6);
  outline-offset: 2px;
}

.calc-breakdown__summary:hover {
  background: linear-gradient(120deg, rgba(59, 130, 246, 0.32), rgba(99, 102, 241, 0.24));
}

.calc-breakdown__summary-text {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 14px;
  letter-spacing: 0.02em;
}

.calc-breakdown__summary-text i {
  color: var(--brand-500);
}

.calc-breakdown__content {
  padding: var(--space-3) var(--space-4) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.calc-breakdown__list {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.calc-breakdown__item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.calc-breakdown__item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.calc-breakdown__item--total {
  border-bottom: none;
  padding: var(--space-3) var(--space-2);
  margin: 0;
  background: linear-gradient(120deg, rgba(59, 130, 246, 0.22), rgba(59, 130, 246, 0.12));
  border-radius: var(--radius-card);
}

.calc-breakdown__item dt {
  margin: 0;
  font-size: 13px;
  color: rgba(226, 232, 240, 0.92);
  font-weight: 600;
}

.calc-breakdown__item dd {
  margin: 0;
  text-align: right;
  min-width: 120px;
}

.calc-breakdown__item--total dt {
  font-size: 14px;
}

.calc-breakdown__value,
.calc-breakdown__item span[data-awakening-mobile] {
  display: block;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--brand-100);
}

.calc-breakdown__item--total span[data-awakening-mobile="total"] {
  font-size: 1.2rem;
  color: #f8fafc;
}

.calc-breakdown__note,
.calc-breakdown__status,
.calc-breakdown__item small[data-awakening-mobile],
.calc-breakdown__item small[data-awakening-mobile-status] {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 480px) {
  .calc-breakdown__item {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }

  .calc-breakdown__item dd {
    text-align: left;
    min-width: 0;
  }
}
