.characters-main { width: min(860px, calc(100% - 32px)); margin: 0 auto; padding: 38px 0 72px; }
.profile-main { width: min(1360px, calc(100% - 32px)); margin: 0 auto; padding: 58px 0 90px; }
.characters-heading { margin-bottom: 26px; }
.characters-heading h1 { margin: 0 0 8px; font-size: clamp(2rem,5vw,3.3rem); font-weight: 700; }
.characters-heading > p:last-child { color: var(--muted); line-height: 1.8; }
.characters-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 20px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(12, 15, 31, .8);
}
.characters-tabs button,
.stage-members-sort button {
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: var(--weight-bold) .82rem/1.3 var(--font-sans);
  cursor: pointer;
}
.characters-tabs button[aria-selected="true"],
.stage-members-sort button[aria-pressed="true"] {
  border-color: rgba(174, 188, 255, .44);
  background: linear-gradient(135deg, rgba(112, 137, 238, .86), rgba(142, 105, 216, .84));
  color: #fff;
  box-shadow: 0 0 18px rgba(131, 152, 255, .2);
}
.stage-members-panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(20, 24, 47, .7);
  box-shadow: var(--shadow);
}
.stage-members-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}
.stage-members-heading h2 { margin: 0 0 6px; font-size: clamp(1.35rem, 3vw, 2rem); }
.stage-members-heading p:not(.eyebrow) { margin: 0; color: var(--muted); font: .78rem/1.65 var(--font-sans); }
.stage-members-sort { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.stage-members-sort button { min-height: 36px; border-color: var(--line); background: #090b1b; }
.stage-members-sort button:not(:disabled) { color: #cbd2ff; }
.stage-members-sort button:not(:disabled):hover { border-color: rgba(174,188,255,.52); background: rgba(131,152,255,.12); }
.stage-members-sort button:disabled {
  border-color: rgba(190, 199, 255, .09);
  color: #60657c;
  background: #070916;
  box-shadow: none;
  cursor: not-allowed;
  opacity: .65;
}
.stage-member-list { display: grid; gap: 10px; }
.stage-unit-group {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(11, 14, 32, .98), rgba(21, 25, 51, .88));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}
.stage-unit-group > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stage-unit-heading > span { color: var(--accent); font: .64rem/1.3 var(--font-sans); letter-spacing: .12em; }
.stage-unit-heading h3 { margin: 2px 0 0; font-size: 1.18rem; }
.stage-unit-schedule { display: grid; justify-items: end; gap: 5px; }
.stage-unit-schedule > div { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.stage-unit-schedule time { color: #d9deff; font: var(--weight-bold) .73rem/1.4 var(--font-sans); }
.stage-part-badge,
.stage-order-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: var(--weight-bold) .68rem/1.2 var(--font-sans);
}
.stage-part-badge.is-day { color: #ffe1a3; background: rgba(190, 128, 38, .12); }
.stage-part-badge.is-night { color: #becaff; background: rgba(82, 100, 192, .15); }
.stage-order-badge { color: var(--muted); }
.stage-order-badge.is-pending { color: #858aa0; background: rgba(255,255,255,.02); }
.stage-unit-members {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.stage-character-card {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .035);
}
.stage-character-icon {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(2,4,14,.55);
  text-decoration: none;
}
.stage-character-icon img { width: 100%; height: 100%; object-fit: cover; }
.stage-character-body { min-width: 0; }
.stage-character-body > span { display: block; margin-bottom: 2px; color: var(--accent); font: .64rem/1.3 var(--font-sans); }
.stage-character-body > strong { display: block; overflow: hidden; font-size: .9rem; text-overflow: ellipsis; white-space: nowrap; }
.stage-character-body a {
  color: var(--text);
  text-decoration: none;
}
.stage-character-body a:hover { color: var(--accent); }
.stage-character-permissions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.stage-character-permissions .permission-badge { padding: 3px 6px; font-size: .58rem; }
.stage-member-unavailable { color: var(--muted); font: .75rem/1.4 var(--font-sans); }
.character-list { display: grid; gap: 12px; }
.character-card { display: grid; grid-template-columns: 100px minmax(0,1fr); align-items: center; gap: 18px; min-height: 116px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); }
.character-card-icon { display: grid; width: 94px; height: 94px; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: rgba(2,4,14,0.55); text-decoration: none; }
.character-card-icon img { width: 100%; height: 100%; object-fit: cover; }
.no-profile-image { display: grid; width: 100%; height: 100%; place-items: center; color: var(--muted); background: rgba(255,255,255,0.035); font: 0.72rem/1.2 var(--font-sans); }
.character-card-body { text-align: center; }
.character-color-label, .profile-character-color { display: inline-flex; align-items: center; gap: 7px; margin: 5px 0 9px; color: var(--muted); font: .76rem/1.4 var(--font-sans); }
.character-color-label > span, .profile-character-color > span { width: 12px; height: 12px; flex: 0 0 12px; border: 1px solid rgba(255,255,255,.45); border-radius: 50%; background: var(--character-color, #7a8eff); box-shadow: 0 0 0 2px color-mix(in srgb, var(--character-color, #7a8eff) 25%, transparent); }
.character-card-body > p { margin: 0 0 4px; color: var(--accent); font-size: .78rem; }
.character-card h2 { margin: 0 0 10px; font-size: 1.28rem; }
.character-card h2 a { color: var(--text); text-decoration: none; }
.character-card h2 a:hover { color: var(--accent); }
.character-card-permissions, .profile-permission-view { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.permission-badge, .profile-permission-view span { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; font: 0.74rem/1.2 var(--font-sans); }
.permission-badge.is-allowed { color: var(--success); }
.permission-badge.is-denied { color: var(--muted); }
.profile-view { display: grid; grid-template-columns: minmax(320px,600px) minmax(0,1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: var(--shadow); }
.profile-visual { min-height: 800px; overflow: hidden; border-right: 1px solid var(--line); background: rgba(2,4,14,0.42); }
.profile-standing { display: grid; width: 100%; min-height: 800px; grid-template-rows: minmax(0,1fr); }
.profile-standing img {
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  object-fit: scale-down;
  object-position: center;
  image-rendering: auto;
  -ms-interpolation-mode: bicubic;
}
.profile-content { display: grid; align-content: start; gap: 26px; padding: clamp(24px,4vw,54px); }
.profile-identity { display: flex; align-items: center; gap: 18px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.profile-identity h1 { margin: 0; font-size: clamp(2rem,5vw,3.8rem); font-weight: 700; }
.profile-description-wrap { display: grid; min-height: 0; grid-template-rows: minmax(0,1fr) auto; overflow: hidden; }
.profile-description { min-height: 160px; overflow: hidden; font-size: calc(1.02rem + 1px); line-height: 2; letter-spacing: 0.1em; white-space: pre-wrap; overflow-wrap: anywhere; }
.profile-description .dialogue-text { font-size: inherit; letter-spacing: inherit; }
.profile-description-toggle {
  justify-self: start;
  margin-top: 8px;
  padding: 4px 0;
  border: 0;
  color: var(--accent);
  background: transparent;
  font: 700 0.82rem/1.4 var(--font-sans);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.25em;
}
.profile-description-toggle:hover { color: var(--text); }
.profile-permission-view { justify-content: flex-start; padding-block: 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.profile-icons-section h2 { margin: 0 0 16px; padding-left: 12px; border-left: 3px solid var(--accent); font-size: 1.25rem; }
.profile-icons { display: grid; grid-template-columns: repeat(auto-fill,minmax(82px,1fr)); gap: 10px; }
.profile-icons figure { margin: 0; }
.profile-icons img { display: block; width: 100%; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 7px; object-fit: cover; }
.field-note { color: var(--muted); font: 0.78rem/1.6 var(--font-sans); }
@media (min-width: 761px) {
  .profile-main { padding-top: 28px; padding-bottom: 38px; }
  .profile-view {
    height: calc(100dvh - 136px);
    min-height: 560px;
    max-height: 800px;
    grid-template-columns: minmax(300px,600px) minmax(0,1fr);
  }
  .profile-visual,
  .profile-standing {
    width: 100%;
    height: 100%;
    min-height: 0;
  }
  .profile-visual { display: grid; }
  .profile-standing {
    padding: clamp(10px,1.8vh,18px) 16px;
    overflow: hidden;
  }
  .profile-standing img {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: scale-down;
    object-position: center;
  }
  .profile-content {
    min-width: 0;
    min-height: 0;
    grid-template-rows: auto minmax(88px,1fr) auto auto;
    align-content: stretch;
    gap: clamp(9px,1.2vh,14px);
    padding: clamp(22px,2.4vw,34px);
    overflow: hidden;
  }
  .profile-identity { padding-bottom: 10px; }
  .profile-identity .eyebrow { margin-bottom: 5px; }
  .profile-identity h1 {
    font-size: clamp(1.9rem,3vw,2.7rem);
    line-height: 1.2;
  }
  .profile-description {
    min-height: 0;
    overflow: hidden;
  }
  .profile-permission-view { padding-block: 10px; }
  .profile-icons-section {
    min-width: 0;
    overflow: visible;
  }
  .profile-icons-section h2 {
    margin-bottom: 7px;
    font-size: 1.08rem;
    line-height: 1.3;
  }
  .profile-icons {
    display: grid;
    width: min(100%,672px);
    grid-template-columns: repeat(10,minmax(0,1fr));
    gap: 8px;
    overflow: visible;
  }
  .profile-icons figure { min-width: 0; }
  .profile-icons img { width: 100%; height: auto; aspect-ratio: 1; }
  .profile-view.is-description-expanded,
  .profile-view.has-multiple-icon-rows {
    height: auto;
    max-height: none;
    align-items: stretch;
  }
  .profile-view.is-description-expanded .profile-visual,
  .profile-view.has-multiple-icon-rows .profile-visual {
    height: auto;
    min-height: 560px;
    max-height: none;
    align-self: stretch;
  }
  .profile-view.is-description-expanded .profile-standing,
  .profile-view.has-multiple-icon-rows .profile-standing {
    height: calc(100dvh - 136px);
    min-height: 560px;
    max-height: 800px;
    align-self: start;
  }
  .profile-view.has-multiple-icon-rows .profile-content {
    grid-template-rows: auto minmax(88px,clamp(180px,34dvh,320px)) auto auto;
    overflow: visible;
  }
  .profile-view.is-description-expanded .profile-content {
    grid-template-rows: auto auto auto auto;
    overflow: visible;
  }
  .profile-view.is-description-expanded .profile-description-wrap,
  .profile-view.is-description-expanded .profile-description { overflow: visible; }
}
@media (max-width: 760px) {
  .stage-members-panel { padding: 14px; }
  .stage-members-heading { align-items: stretch; flex-direction: column; }
  .stage-members-sort { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stage-members-sort button { padding-inline: 5px; font-size: .66rem; }
  .stage-unit-group > header { align-items: flex-start; flex-direction: column; }
  .stage-unit-schedule { justify-items: start; }
  .stage-unit-schedule > div { justify-content: flex-start; }
  .stage-unit-members { grid-template-columns: 1fr; }
  .character-card { grid-template-columns: 92px minmax(0,1fr); gap: 14px; min-height: 112px; }
  .character-card-icon { width: 88px; height: 88px; }
  .character-card-body { text-align: left; }
  .character-card-permissions { justify-content: flex-start; }
  .profile-view { grid-template-columns: 1fr; }
  .profile-visual { min-height: 460px; border-right: 0; border-bottom: 1px solid var(--line); }
  .profile-standing {
    min-height: 460px;
    padding: 12px 10px;
  }
  .profile-standing img {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: scale-down;
    object-position: center;
  }
  .profile-description-wrap { max-height: calc(30em + 2.2rem); }
  .profile-description { min-height: 0; overflow: hidden; }
  .profile-view.is-description-expanded .profile-description-wrap {
    max-height: none;
    overflow: visible;
  }
  .profile-view.is-description-expanded .profile-description { overflow: visible; }
  .profile-icons {
    display: grid;
    grid-template-columns: repeat(5,minmax(0,60px));
    gap: 8px;
  }
  .profile-icons img { width: 60px; height: 60px; }
}
@media (max-width: 520px) {
  .characters-main, .profile-main { width: min(100% - 20px,1360px); padding-top: 28px; }
  .characters-tabs button { padding-inline: 7px; font-size: .72rem; }
  .profile-identity { align-items: flex-start; }
}
@media (max-width: 640px) {
  .profile-description {
    font-size: var(--reading-font-size);
    font-weight: var(--weight-normal);
    line-height: 1.7;
  }
}

/* ページ送り（50人ごと／100人ごと／全て）：上は右寄せ、一番下は真ん中 */
.clist-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 14px; }
.clist-pager[hidden] { display: none; }
.clist-pager.is-top { justify-content: flex-end; }
.clist-pager.is-bottom { justify-content: center; margin: 18px 0 0; }
.clist-pager-size { display: flex; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #090b1b; }
.clist-pager-size button { min-height: 34px; padding: 6px 12px; border: 0; border-radius: 0; color: #9aa1c2; background: transparent; font: 700 .78rem/1.3 var(--font-sans, "Noto Sans JP", sans-serif); cursor: pointer; }
.clist-pager-size button + button { border-left: 1px solid var(--line); }
.clist-pager-size button[aria-pressed="true"] { color: #fff; background: linear-gradient(135deg, rgba(112, 137, 238, .86), rgba(142, 105, 216, .84)); }
.clist-pager-move { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; }
.clist-pager-arrow { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 38px; padding: 0 6px; border: 1px solid var(--line); border-radius: 8px; color: #cbd2ff; background: #090b1b; line-height: 0; cursor: pointer; }
.clist-pager-arrow svg { width: 24px; height: 24px; stroke-width: 2.4; }
.clist-pager-arrow:disabled { opacity: .38; cursor: default; }
.clist-pager-count { min-width: 64px; color: #cbd2ff; font: 700 .86rem/1 var(--font-sans, "Noto Sans JP", sans-serif); text-align: center; }
.clist-pager-numbers { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; }
.clist-pager-numbers button { min-width: 36px; min-height: 34px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 8px; color: #cbd2ff; background: #090b1b; font: 700 .82rem/1 var(--font-sans, "Noto Sans JP", sans-serif); cursor: pointer; }
.clist-pager-numbers button[aria-current="page"] { color: #fff; border-color: transparent; background: linear-gradient(135deg, #657ae1, #8768cf); }
.clist-pager-gap { color: var(--muted); }
@media (max-width: 760px) {
  .clist-pager.is-top { justify-content: center; }
}
/* 一番下のページ送り：ページを直接入力して移動（真ん中） */
.clist-pager.is-bottom { flex-direction: column; }
.clist-pager-jump { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; color: #cbd2ff; font: 700 .82rem/1.3 var(--font-sans, "Noto Sans JP", sans-serif); }
.clist-pager-jump label { display: flex; align-items: center; gap: 6px; }
.clist-pager-jump input { width: 72px; min-height: 34px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; color: #fff; background: #090b1b; font: inherit; text-align: center; }
.clist-pager-jump button { min-height: 34px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 8px; color: #cbd2ff; background: #090b1b; font: inherit; cursor: pointer; }
.clist-pager-jump button:hover { border-color: rgba(174, 188, 255, .52); background: rgba(131, 152, 255, .12); }
