:root {
  color-scheme: light;
  --bg: #f3f5f7;
  --panel: #ffffff;
  --ink: #1d2430;
  --muted: #647080;
  --line: #d8dee7;
  --accent: #1f6f8b;
  --accent-dark: #15546b;
  --good: #2f6f4e;
  --warn-bg: #fff7e8;
  --warn-line: #e4c582;
  --selected-bg:#192529;
  --selected-font-color:#f3f5f7;
}

html {
  scrollbar-gutter: stable;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, "Noto Sans JP", sans-serif;
}

html.dark-mode {
  color-scheme: dark;
  --bg: #0b0b0c;
  --panel: #171719;
  --ink: #f5f5f5;
  --muted: #a3a3aa;
  --line: #343438;
  --accent: #38bdf8;
  --accent-dark: #0ea5e9;
  --good: #34d399;
  --warn-bg: #2f2412;
  --warn-line: #8a6a2e;
  --dark-surface: #202023;
  --dark-surface-raised: #242427;
  --dark-surface-soft: #1d1d20;
  --dark-surface-hover: #2a2a2f;
  --dark-line-strong: #52525b;
  --dark-line-contrast: #71717a;
  --dark-overlay: rgb(11 11 12 / 78%);
  --selected-bg: #e4c582;
  --selected-font-color:#0b0b0c;
}

html.dark-mode[data-dark-theme="oled"] {
  --bg: #000000;
  --panel: #0d0d0d;
  --ink: #fafafa;
  --muted: #a0a0a0;
  --line: #2a2a2a;
  --dark-surface: #171717;
  --dark-surface-raised: #1c1c1c;
  --dark-surface-soft: #111111;
  --dark-surface-hover: #222222;
  --dark-line-strong: #444444;
  --dark-line-contrast: #686868;
  --dark-overlay: rgb(0 0 0 / 82%);
}

html.dark-mode[data-dark-theme="soft"] {
  --bg: #101010;
  --panel: #1b1b1b;
  --ink: #f1f1f1;
  --muted: #aaaaaa;
  --line: #3b3b3b;
  --dark-surface: #252525;
  --dark-surface-raised: #2c2c2c;
  --dark-surface-soft: #202020;
  --dark-surface-hover: #333333;
  --dark-line-strong: #555555;
  --dark-line-contrast: #767676;
  --dark-overlay: rgb(16 16 16 / 78%);
}

html.dark-mode[data-dark-theme="warm"] {
  --bg: #0f0e0d;
  --panel: #1c1a18;
  --ink: #f2efea;
  --muted: #b0a8a0;
  --line: #403b36;
  --dark-surface: #262321;
  --dark-surface-raised: #2e2a26;
  --dark-surface-soft: #211f1c;
  --dark-surface-hover: #37322e;
  --dark-line-strong: #5b534c;
  --dark-line-contrast: #81766c;
  --dark-overlay: rgb(15 14 13 / 80%);
}

html.dark-mode[data-dark-theme="contrast"] {
  --bg: #070707;
  --panel: #141414;
  --ink: #fafafa;
  --muted: #b8b8b8;
  --line: #454545;
  --dark-surface: #1e1e1e;
  --dark-surface-raised: #262626;
  --dark-surface-soft: #181818;
  --dark-surface-hover: #303030;
  --dark-line-strong: #686868;
  --dark-line-contrast: #949494;
  --dark-overlay: rgb(7 7 7 / 82%);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

input,
select {
  min-height: 38px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: #fff;
  color: var(--ink);
}

.app {
  width: calc(100% - 48px);
  max-width: 1056px;
  margin: 0 auto;
  padding: 24px 0;
}

.app-layout {
  display: block;
}


body.menu-open { overflow: hidden; }

dialog.side-menu {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(320px, 90vw);
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 24px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 420ms cubic-bezier(.22, 1, .36, 1);
}

dialog.side-menu[open] { display: flex; flex-direction: column; gap: 32px; }
dialog.side-menu.is-open { transform: translateX(0); }
dialog.side-menu::backdrop {
  background: rgb(0 0 0 / 35%);
  opacity: 0;
  transition: opacity 420ms ease;
}
dialog.side-menu.is-open::backdrop { opacity: 1; }
.drawer-heading, .header-brand { display: flex; align-items: center; gap: 18px; }
.header-brand {
  min-width: 0;
}
.drawer-heading { justify-content: space-between; }
.drawer-heading h1 { margin: 0; font-size: 18px; }
.drawer-nav { display: grid; gap: 8px; }
.drawer-nav .feature-link {
  display: flex;
  align-items: center;
  border-radius: 6px;
  padding: 0 14px;
  text-decoration: none;
  text-align: left;
  min-height: 52px;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--ink);
}
.drawer-nav .feature-link:hover {
  background: var(--bg);
}
.drawer-nav .feature-link.active {
  background: var(--selected-bg);
  color: var(--selected-font-color);
  font-weight: 700;
}
.drawer-nav .feature-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.drawer-icon-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}
.drawer-menu-icon {
  display: block;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  object-fit: contain;
}
dialog.side-menu .side-menu-settings { margin-top: auto; }
@media (prefers-reduced-motion: reduce) {
  dialog.side-menu, dialog.side-menu::backdrop { transition: none; }
}

.side-menu-settings {
  display: grid;
  gap: 12px;
  padding-top: 12px;
}

.side-menu-settings label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.side-menu-theme-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.side-menu-settings select {
  min-width: 0;
  min-height: 42px;
  height: 42px;
  font-size: 14px;
}

.app-content {
  min-width: 0;
}

@media (min-width: 1200px) {
  .app {
    width: calc(100% - 24px);
    max-width: 1304px;
    margin: 0;
    padding: 0;
  }

  .app-layout {
    display: grid;
    grid-template-columns: 224px minmax(0, 1056px);
    align-items: start;
    gap: 24px;
  }

  dialog.side-menu {
    position: sticky;
    inset: auto;
    top: 0;
    width: 224px;
    height: 100dvh;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 0;
    transform: none;
    transition: none;
  }

  dialog.side-menu::backdrop {
    display: none;
  }

  .app-content {
    width: 100%;
    max-width: 1056px;
    padding: 24px 0;
  }

  #openMenuBtn,
  #closeMenuBtn {
    display: none;
  }

  body.menu-open {
    overflow: auto;
  }
}

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






.theme-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
}

.theme-button:hover {
  border-color: var(--accent);
  background: var(--bg);
  color: var(--accent);
}

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

.theme-icon {
  grid-area: 1 / 1;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon-sun,
html.dark-mode .theme-icon-moon {
  opacity: 0;
}

html.dark-mode .theme-icon-sun {
  opacity: 1;
}

/* Animate palette changes without animating layout or the initial saved theme. */
@media (prefers-reduced-motion: no-preference) {
  body,
  body *,
  body *::before,
  body *::after {
    transition: background-color 450ms ease-in-out,
      color 450ms ease-in-out,
      border-color 450ms ease-in-out,
      box-shadow 450ms ease-in-out;
  }

  .theme-icon {
    transition: opacity 450ms ease-in-out, color 450ms ease-in-out;
  }
}

dialog.json-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 24px;
}

dialog.json-modal[open] {
  display: grid;
  place-items: center;
}

body.modal-open {
  overflow: hidden;
}

dialog.json-modal::backdrop {
  background: rgb(0 0 0 / 55%);
}

html.dark-mode dialog.json-modal::backdrop {
  background: var(--dark-overlay);
}

.json-modal-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  width: min(920px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}

.json-modal-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.json-modal-title h2 {
  margin: 0;
  font-size: 18px;
}

.json-modal-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.json-modal-close {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  padding: 0;
}

.json-modal-close-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}



.toggle-switch-control {
  position: relative;
  flex: 0 0 auto;
}

.toggle-switch-input {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.toggle-switch-track {
  display: block;
  width: 48px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  padding: 2px;
}

.toggle-switch-track span {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--muted);
  transform: translateX(0);
}

.toggle-switch-input:checked + .toggle-switch-track {
  border-color: var(--accent);
  background: var(--accent);
}

.toggle-switch-input:checked + .toggle-switch-track span {
  background: #fff;
  transform: translateX(22px);
}

.toggle-switch-input:focus-visible + .toggle-switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}



.face-edit-modal-panel {
  width: min(760px, 100%);
  height: min(650px, calc(100vh - 48px));
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.face-edit-table-wrap {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.face-edit-table {
  width: 100%;
  border-collapse: collapse;
}

.face-edit-table th,
.face-edit-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
}

.face-edit-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel);
}

.face-edit-table tbody tr:last-child th,
.face-edit-table tbody tr:last-child td {
  border-bottom: 0;
}

.face-edit-table .face-edit-level {
  min-width: 82px;
}

.face-edit-exp-field {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.face-edit-exp-max {
  min-width: 110px;
  color: var(--muted);
  font-size: 13px;
}

.face-edit-table tr.invalid .face-edit-exp {
  border-color: #c2413b;
}

.face-edit-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.face-edit-footer span {
  margin-right: auto;
  color: #c2413b;
  font-size: 13px;
}

.face-edit-footer button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}



@media (max-width: 640px) {
  .header {
    gap: 10px;
  }

  .header-brand {
    gap: 10px;
  }

  .json-modal {
    padding: 12px;
  }

  .face-edit-modal-panel {
    height: calc(100vh - 24px);
  }



}

.page-panel {
  display: block;
}

.home-introduction {
  display: grid;
  gap: 4px;
  margin-bottom: 18px;
}

.home-introduction .route-description {
  margin: 0;
}

.administrator-description {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.explanation-description {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-line;
}

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

h1 {
  margin-bottom: 0;
  font-size: 26px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.trust-stack {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  padding: 24px;
}

.accordion-panel {
  padding: 0;
  overflow: hidden;
}

.accordion-title {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 0;
  width: 100%;
  min-height: 56px;
  padding: 0 24px;
  background: transparent;
  color: var(--ink);
}

.face-edit-button {
  min-height: 40px;
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

.face-edit-button:hover {
  border-color: var(--accent);
  background: var(--panel);
  color: var(--accent);
}

.member-section {
  min-width: 0;
}





.member-section .member-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.route-title {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.route-title h3 {
  margin: 0;
  font-size: 18px;
}

.route-description {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.route-control-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.accordion-toggle {
  display: inline-grid;
  place-items: center;
  width: 40px;
  min-height: 40px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
}

.accordion-toggle:hover {
  background: transparent;
  color: var(--ink);
}

.accordion-toggle .accordion-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 220ms ease;
}

.accordion-panel.collapsed .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  position: relative;
  border-top: 1px solid var(--line);
  padding: 12px 24px 16px;
}

.route-loading .accordion-content::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  background: rgba(247, 249, 251, 0.78);
  backdrop-filter: blur(1px);
}

.route-loading .accordion-content::after {
  content: "ルートを計算中...";
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 18px 0 44px;
  background:
    radial-gradient(circle at 24px 50%, transparent 8px, #fff 9px),
    #fff;
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(29, 36, 48, 0.14);
  transform: translate(-50%, -50%);
  pointer-events: none;
  white-space: nowrap;
}

.route-loading .result {
  pointer-events: none;
}

.route-loading .result::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 7;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -80px;
  border: 3px solid #d8dee7;
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {to {
    transform: rotate(360deg);
  }


}

.face-controls {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 12px;
}

.role-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 15px;
}

.role-option {
  min-width: 74px;
  min-height: 32px;
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
  font-weight: 700;
}

.role-option:hover {
  color: #fff;
}

.role-option.active {
  color: #fff;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.role-option-tank.active {
  border-color: #2563eb;
  background: #2563eb;
}

.role-option-healer.active {
  border-color: #16a34a;
  background: #16a34a;
}

.role-option-dps.active {
  border-color: #dc2626;
  background: #dc2626;
}

#calculateBtn:disabled {
  border-color: var(--line);
  background: #e5e7eb;
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.7;
}



.member-list {
  overflow-x: auto;
}

.member-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.member-table th,
.member-table td {
  border-top: 1px solid var(--line);
  padding: 4px 12px;
  text-align: left;
}

.member-table thead th {
  border-top: 0;
  background: #f7f9fb;
}

.result {
  display: grid;
  gap: 10px;
}

.step-list {
  display: grid;
  gap: 8px;
}

.step {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.next-step {
  grid-template-columns: 42px minmax(0, 1fr) auto;
  border-color: #b7c7d5;
  background: #fbfdff;
  box-shadow: 0 8px 22px rgba(29, 36, 48, 0.08);
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 28px;
  border-radius: 999px;
  background: #e8edf2;
  color: var(--muted);
  font-size: 12px;
}

.step-body {
  min-width: 0;
}

.step strong {
  display: block;
  margin-bottom: 2px;
}

.step small {
  color: var(--muted);
}

.step-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.step-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0;
  color: var(--ink);
  white-space: nowrap;
}

.step-face-list {
  align-items: center;
  max-width: min(100%, 760px);
  white-space: normal;
}

.face-chip-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.face-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  border: 1px solid #dce3ec;
  border-radius: 5px;
  padding: 0 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.face-chip .role-badge {
  min-width: 42px;
  min-height: 18px;
  padding: 0 6px;
  font-size: 11px;
}

.meta-label {
  color: var(--muted);
  font-size: 12px;
}

.step-meta .role-badge {
  display: inline-flex;
  width: fit-content;
}

.step-meta-item > strong {
  display: inline;
  margin: 0;
  color: var(--good);
}

.route-rest {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.route-rest-toggle {
  display: grid;
  grid-template-columns: auto auto 32px;
  align-items: center;
  justify-content: start;
  gap: 8px;
  width: fit-content;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 8px 0 14px;
  background: #f7f9fb;
  color: var(--ink);
}

.route-rest-toggle:hover {
  background: #eef2f6;
  color: var(--ink);
}

.route-rest-toggle strong {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.route-rest-icon {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--muted);
  transition: transform 220ms ease;
}

.route-rest-toggle[aria-expanded="false"] .route-rest-icon {
  transform: rotate(180deg);
}

.route-rest-list {
  margin-top: 8px;
}

.route-rest-list[hidden] {
  display: none;
}

.route-rest-list .step {
  background: #fbfcfd;
}

.complete-button {
  align-self: center;
  justify-self: end;
  min-height: 40px;
  padding: 0 16px;
}

.complete-button:disabled {
  border-color: var(--line);
  background: #e5e7eb;
  color: var(--muted);
  cursor: not-allowed;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
}

.role-tank {
  background: #2563eb;
}

.role-healer {
  background: #16a34a;
}

.role-dps {
  background: #dc2626;
}

.warning {
  border: 1px solid var(--warn-line);
  border-radius: 8px;
  background: var(--warn-bg);
  padding: 12px;
  color: #6c4a0c;
}

.table-wrap {
  overflow-x: auto;
  max-height: min(70vh, 720px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.weapon-table-wrap {
  max-height: none;
  overflow-y: visible;
  background: #fff;
}

.weapon-segment-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  margin: 0 0 20px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
}

.weapon-progress-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "tank dps"
    "healer dps";
  align-items: start;
  gap: 40px 64px;
  margin: 12px 0 28px;
}

.weapon-progress-view[hidden],
.weapon-table-wrap[hidden] {
  display: none;
}

.weapon-progress-role-tank { grid-area: tank; }
.weapon-progress-role-healer { grid-area: healer; }
.weapon-progress-role-dps { grid-area: dps; }

.weapon-progress-role h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  font-size: 20px;
  font-weight: 500;
}

.weapon-progress-role-icon {
  display: block;
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.weapon-progress-role-tank h3 { color: #334fd3; }
.weapon-progress-role-healer h3 { color: #16a34a; }
.weapon-progress-role-dps h3 { color: #dc2626; }

.weapon-progress-role-items {
  display: grid;
  gap: 12px;
}

.weapon-progress-item {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.weapon-progress-item > label {
  font-weight: 700;
}

.weapon-job-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.weapon-job-icon {
  display: block;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.weapon-progress-control {
  --weapon-progress: 0%;
  position: relative;
  min-width: 0;
  min-height: 36px;
  overflow: hidden;
  border: 2px solid #7891a0;
  border-radius: 10px;
  background: var(--panel);
}

.weapon-progress-control::before,
.weapon-progress-control::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  pointer-events: none;
}

.weapon-progress-control::before {
  left: 0;
  width: var(--weapon-progress);
  background: #c9dbe4;
}

.weapon-progress-control::after {
  left: var(--weapon-progress);
  z-index: 3;
  width: 3px;
  transform: translateX(-1px);
  background: #7891a0;
}

.weapon-progress-role-tank .weapon-progress-control::before {
  background: #cfe3f1;
}

.weapon-progress-role-tank .weapon-progress-control::after {
  background: #7fa7c1;
}

.weapon-progress-role-healer .weapon-progress-control::before {
  background: #d5eadb;
}

.weapon-progress-role-healer .weapon-progress-control::after {
  background: #82aa8d;
}

.weapon-progress-role-dps .weapon-progress-control::before {
  background: #f1d8d8;
}

.weapon-progress-role-dps .weapon-progress-control::after {
  background: #c79292;
}


.weapon-progress-segments {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: repeating-linear-gradient(
    to right,
    transparent 0,
    transparent calc(var(--weapon-segment-size, 20%) - 1px),
    #91a7b5 calc(var(--weapon-segment-size, 20%) - 1px),
    #91a7b5 var(--weapon-segment-size, 20%)
  );
  pointer-events: none;
}

.weapon-progress-range {
  appearance: none;
  position: relative;
  z-index: 3;
  width: 100%;
  min-height: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  touch-action: none;
}


.weapon-progress-range::-webkit-slider-runnable-track {
  height: 32px;
  background: transparent;
}

.weapon-progress-range::-webkit-slider-thumb {
  appearance: none;
  width: 1px;
  height: 32px;
  border: 0;
  background: transparent;
}

.weapon-progress-range::-moz-range-track {
  height: 32px;
  background: transparent;
}

.weapon-progress-range::-moz-range-progress {
  height: 32px;
  background: transparent;
}

.weapon-progress-range::-moz-range-thumb {
  width: 1px;
  height: 32px;
  border: 0;
  border-radius: 0;
  background: transparent;
}


.weapon-progress-range:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 38%, transparent);
  outline-offset: -4px;
}

.weapon-progress-value {
  position: absolute;
  top: 50%;
  left: 14px;
  right: 14px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transform: translateY(-50%);
  color: var(--ink);
  font-weight: 700;
  pointer-events: none;
}

.weapon-progress-increment {
  flex: 0 0 auto;
  font-weight: 400;
}

.weapon-progress-label {
  margin-left: auto;
  font-weight: 400;
  text-align: right;
}

:is(html.dark-mode, body.dark-mode) .weapon-progress-control {
  border-color: var(--dark-line-strong);
}

:is(html.dark-mode, body.dark-mode) .weapon-progress-control::before {
  background: var(--dark-surface-raised);
}

:is(html.dark-mode, body.dark-mode) .weapon-progress-control::after {
  background: var(--dark-line-strong);
}

:is(html.dark-mode, body.dark-mode) .weapon-progress-role-tank .weapon-progress-control::before {
  background: #24485b;
}

:is(html.dark-mode, body.dark-mode) .weapon-progress-role-healer .weapon-progress-control::before {
  background: #234c38;
}

:is(html.dark-mode, body.dark-mode) .weapon-progress-role-dps .weapon-progress-control::before {
  background: #552f35;
}

:is(html.dark-mode, body.dark-mode) .weapon-progress-segments {
  background: repeating-linear-gradient(
    to right,
    transparent 0,
    transparent calc(var(--weapon-segment-size, 20%) - 1px),
    var(--dark-line-strong) calc(var(--weapon-segment-size, 20%) - 1px),
    var(--dark-line-strong) var(--weapon-segment-size, 20%)
  );
}

@media (min-width: 901px) {
  .weapon-progress-item {
    grid-template-columns: 160px minmax(0, 1fr);
  }

  .weapon-progress-item .weapon-job-icon {
    width: 28px;
    height: 28px;
  }

  .weapon-progress-item .weapon-job-label {
    font-size: 16px;
  }
}

@media (max-width: 900px) {
  .weapon-progress-list {
    grid-template-columns: 1fr;
    grid-template-areas:
      "tank"
      "healer"
      "dps";
    gap: 32px;
  }

  .weapon-progress-item {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 10px;
  }

  .weapon-progress-value {
    left: 10px;
    right: 10px;
    font-size: 14px;
  }
}

.weapon-table {
  width: 100%;
  min-width: 960px;
  border-collapse: collapse;
  table-layout: fixed;
}

/* 旧拡張はジョブ列180pxと段階列90pxを確保し、狭い画面では表内で横スクロールする。 */
:is(#page-Zodiac, #page-Anima) .weapon-table-wrap {
  max-width: 902px;
}

:is(#page-Zodiac, #page-Anima) .weapon-table {
  min-width: 900px;
}

#page-Eureka .weapon-table-wrap {
  max-width: 1532px;
}

#page-Eureka .weapon-table {
  min-width: 1530px;
}

/* 5.0も同じ列幅で表示する。 */
#page-Resistance .weapon-table-wrap {
  max-width: 722px;
}

#page-Resistance .weapon-table {
  min-width: 720px;
}

.weapon-table th,
.weapon-table td {
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 7px 10px;
  text-align: left;
  vertical-align: middle;
}

.weapon-table th:last-child,
.weapon-table td:last-child {
  border-right: 0;
}

.weapon-table thead th {
  border-top: 0;
  background: #f7f9fb;
  color: var(--ink);
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 2px 5px rgba(29, 36, 48, 0.08);
}

.weapon-table th:first-child {
  width: 180px;
}

/* IL見出しは列幅を保ったまま押せるようにし、段階名を表の外へ表示する。 */
.weapon-table .weapon-stage-heading {
  padding: 0;
}

.weapon-table .weapon-stage-trigger {
  width: 100%;
  padding: 7px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-decoration: underline dotted;
  text-underline-offset: 4px;
}

.weapon-table .weapon-stage-trigger:hover {
  background: var(--line);
}

.weapon-table .weapon-stage-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}

.weapon-stage-tooltip {
  position: fixed;
  z-index: 20;
  width: max-content;
  max-width: min(280px, calc(100vw - 16px));
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 3px 10px rgb(0 0 0 / 18%);
  font-size: 14px;
  overflow-wrap: anywhere;
  text-align: left;
  font-weight: 400;
}

.weapon-stage-tooltip-title {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
  line-height: 1.4;
}

.weapon-stage-tooltip-body {
  margin: 0;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  line-height: 1.6;
  white-space: pre-line;
}

.weapon-table th span,
.weapon-table th small {
  display: block;
}

/* 武器作成の表ではジョブアイコンと名前を同じ行に収める。 */
.weapon-table .weapon-job-label {
  display: inline-flex;
  white-space: nowrap;
}

.weapon-table th small {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
}

.weapon-check {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  color: var(--ink);
}

.weapon-check:has(input:only-child) {
  display: flex;
  justify-content: center;
}

.weapon-check input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  padding: 0;
}

.weapon-cell-completed {
  background: #3d5499;
  color: #fff;
}

.weapon-cell-completed .weapon-check {
  color: #fff;
}

:is(html.dark-mode, body.dark-mode) input,
:is(html.dark-mode, body.dark-mode) select {
  background: var(--dark-surface);
  color: var(--ink);
}

:is(html.dark-mode, body.dark-mode) .weapon-progress-range {
  background: transparent;
}

:is(html.dark-mode, body.dark-mode) .member-table thead th,
:is(html.dark-mode, body.dark-mode) .weapon-table thead th {
  background: var(--dark-surface-raised);
  color: var(--ink);
}

:is(html.dark-mode, body.dark-mode) .route-loading .accordion-content::before {
  background: var(--dark-overlay);
}

:is(html.dark-mode, body.dark-mode) .route-loading .accordion-content::after {
  background:
    radial-gradient(circle at 24px 50%, transparent 8px, var(--panel) 9px),
    var(--panel);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

:is(html.dark-mode, body.dark-mode) .route-loading .result::before {
  border-color: var(--dark-line-strong);
  border-top-color: var(--accent);
}

:is(html.dark-mode, body.dark-mode) .step,
:is(html.dark-mode, body.dark-mode) .face-chip {
  background: var(--dark-surface);
}

:is(html.dark-mode, body.dark-mode) .next-step,
:is(html.dark-mode, body.dark-mode) .route-rest-list .step {
  background: var(--dark-surface-soft);
}

:is(html.dark-mode, body.dark-mode) .route-panel {
  background: var(--panel);
}

:is(html.dark-mode, body.dark-mode) .route-panel .next-step {
  border-color: var(--dark-line-contrast);
  background: var(--dark-surface-raised);
  box-shadow: none;
}

:is(html.dark-mode, body.dark-mode) .face-chip {
  border-color: var(--dark-line-contrast);
}

:is(html.dark-mode, body.dark-mode) .step-num,
:is(html.dark-mode, body.dark-mode) .route-rest-toggle {
  background: var(--dark-surface-raised);
}

:is(html.dark-mode, body.dark-mode) .route-rest-toggle:hover {
  background: var(--dark-surface-hover);
}

:is(html.dark-mode, body.dark-mode) .table-wrap {
  background: var(--dark-surface);
}

:is(html.dark-mode, body.dark-mode) .weapon-table thead th {
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
}

:is(html.dark-mode, body.dark-mode) .warning {
  color: #f5d58a;
}

.collection-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 14px;
}

.collection-table th,
.collection-table td {
  padding: 3px 4px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.collection-table thead th { padding: 8px 4px; background: var(--bg); }
.collection-table thead th:first-child { width: 56px; }
.collection-table thead th:nth-child(2) { width: 28%; }
.collection-table thead th:first-child { text-align: center; }

.collection-table td.collection-number-cell {
  padding-right: 12px;
  text-align: right;
}

.feature-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.feature-toolbar h2 {
  flex: 0 0 auto;
  margin: 0;
  font-size: 20px;
}

.feature-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.feature-toolbar-summary {
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}

.collection-table-frame {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.collection-list-table {
  min-width: 720px;
}

.collection-list-table th,
.collection-list-table td {
  border-right: 1px solid var(--line);
}

.collection-list-table tr > :last-child {
  border-right: 0;
}

.collection-list-table tbody tr:last-child > * {
  border-bottom: 0;
}

.collection-table tbody tr[data-bluemage-number] {
  cursor: pointer;
}

.collection-table tbody tr.is-learned > th,
.collection-table tbody tr.is-learned > td {
  background: #3d5499;
  color: #fff;
}

.bluemage-check-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}

.bluemage-spell-control {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: inherit;
  cursor: pointer;
}

.bestiary-table tbody tr[data-beastmaster-number] {
  cursor: pointer;
}

.bestiary-location-cell {
  white-space: pre-line;
}

.bestiary-table tbody tr[data-beastmaster-number]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.bestiary-table tbody tr.is-contracted > th,
.bestiary-table tbody tr.is-contracted > td {
  background: #0098a6;
  color: #fff;
}

.bestiary-pet-control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.bestiary-list-icon.is-contracted {
  background: #fff;
  box-shadow: inset 0 0 0 2px #007b87;
}

.bestiary-contract-icon {
  display: block;
  width: 40px;
  height: 40px;
}

.bestiary-contract-icon text {
  fill: #007b87;
  font-size: 14px;
  font-weight: 700;
}

.collection-list-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  overflow: hidden;
  background: #737d87;
  box-shadow: inset 0 0 0 2px #929ba5;
  transition: box-shadow 160ms ease, filter 160ms ease, transform 160ms ease;
}

.collection-list-icon.is-learned {
  background: transparent;
  box-shadow: none;
}

.bluemage-spell-control:hover .collection-list-icon,
.bluemage-check-input:focus-visible + .collection-list-icon {
  box-shadow: 0 0 0 2px var(--accent);
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.bluemage-spell-name {
  min-width: 0;
}

.bluemage-list-image {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.collection-list-unknown {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #f1f5f9;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.view-switch-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border-color: var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
}

.view-switch-icon {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.view-switch-icon[hidden] {
  display: none;
}

.view-switch-button:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

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

.collection-game-view {
  overflow-x: auto;
}



.collection-game-board {
  width: 500px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px 24px;
  background: var(--bg);
}

.collection-game-selected {
  min-height: 24px;
  margin: 0 0 16px;
  font-size: 17px;
  font-weight: 700;
}

.collection-game-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 18px;
}

.collection-page-buttons {
  display: flex;
  gap: 4px;
}

.collection-page-button,
.collection-page-arrow {
  display: grid;
  place-items: center;
  min-width: 34px;
  min-height: 34px;
  border-color: transparent;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.collection-page-button:hover,
.collection-page-button.active,
.collection-page-arrow:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.collection-page-button:focus-visible,
.collection-page-arrow:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.collection-page-arrow:disabled {
  color: var(--line);
  cursor: default;
}

.collection-page-arrow svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.collection-game-grid {
  display: grid;
  grid-template-columns: repeat(4, 88px);
  grid-template-rows: repeat(4, 94px);
  justify-content: center;
  gap: 18px 20px;
}

.beastmaster-game-grid {
  grid-template-columns: repeat(5, 76px);
  grid-template-rows: repeat(5, 94px);
  gap: 18px 12px;
}

.collection-game-tile {
  display: grid;
  gap: 5px;
  min-height: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
}

.collection-game-tile:hover {
  background: transparent;
}

.collection-game-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
  background: #737d87;
  box-shadow: inset 0 0 0 2px #929ba5;
  transition: box-shadow 160ms ease, filter 160ms ease, transform 160ms ease;
}

.collection-game-tile:hover .collection-game-icon,
.collection-game-tile:focus-visible .collection-game-icon {
  box-shadow: 0 0 0 2px var(--accent);
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.collection-game-tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.collection-game-tile.is-learned .collection-game-icon {
  background: transparent;
  box-shadow: none;
}

.beastmaster-game-tile.is-contracted .collection-game-icon {
  background: #fff;
  box-shadow: inset 0 0 0 2px #007b87;
}

.beastmaster-game-contract-icon {
  display: block;
  width: 76px;
  height: 76px;
}

.beastmaster-game-contract-icon text {
  fill: #007b87;
  font-size: 20px;
  font-weight: 700;
}

.bluemage-game-image {
  display: block;
  width: 76px;
  height: 76px;
  object-fit: contain;
}

.collection-game-unknown {
  width: 38px;
  height: 38px;
  fill: none;
  stroke: #f1f5f9;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.collection-game-number {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.collection-game-progress {
  margin: 18px 0 0;
  text-align: right;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 640px) {
  .feature-toolbar {
    gap: 8px;
  }

  .feature-toolbar h2 {
    font-size: 18px;
  }

  .feature-toolbar-actions {
    gap: 6px;
  }

  .feature-toolbar-summary {
    font-size: 12px;
  }

  .route-description {
    font-size: 12px;
  }

  .collection-game-view {
    overflow-x: hidden;
  }

  .collection-game-board {
    width: 100%;
    padding: 16px 12px;
  }

  .collection-game-pager {
    gap: 2px;
  }

  .collection-page-buttons {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
    gap: 1px;
  }

  .collection-page-button {
    flex: 1 1 0;
    min-width: 0;
    max-width: 34px;
  }

  .collection-page-arrow {
    min-width: 28px;
  }

  .collection-game-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(4, auto);
    gap: 14px 8px;
  }

  .beastmaster-game-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(5, auto);
    gap: 14px 6px;
  }

  .collection-game-icon {
    width: min(64px, 100%);
    height: auto;
    aspect-ratio: 1;
  }

  .beastmaster-game-grid .collection-game-icon {
    width: min(56px, 100%);
  }

  .bluemage-game-image,
  .beastmaster-game-contract-icon {
    width: 100%;
    height: 100%;
  }

  .collection-game-unknown {
    width: 50%;
    height: 50%;
  }

  .collection-game-number {
    font-size: 12px;
  }
}

.bestiary-table-wrap { overflow-x: auto; }
.bestiary-table { min-width: 560px; }
.bestiary-table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

footer {
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

footer p {
  margin-bottom: 0;
}

@media (max-width: 980px) {.app-layout {
    grid-template-columns: 1fr;
  }

.side-menu {
    position: static;
  }

.face-controls {
    justify-content: start;
    padding-bottom: 12px;
  }

.panel + .panel {
    margin-top: 16px;
  }

}

/* 読み込み中も左メニューの配置幅を維持する。 */
.side-menu-placeholder { padding: 20px; color: var(--muted); font-size: 14px; }
.side-menu-placeholder p { margin: 0 0 12px; }
@media (min-width: 1200px) {
  .side-menu-container { position: sticky; top: 0; width: 224px; height: 100dvh; }
  .side-menu-placeholder { height: 100%; border: 1px solid var(--line); background: var(--panel); }
}
