button.avatar {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
button.avatar:active .avatar-face { opacity: .86; }
button.avatar:focus-visible { outline: 2px solid var(--ink, #2a241c); outline-offset: 2px; }

.role-sheet {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.role-sheet[hidden] { display: none; }
.role-sheet .scrim {
  position: absolute;
  inset: 0;
  background: rgba(42, 36, 28, .45);
}
.role-sheet .panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(480px, 100%);
  /* 角色下面留空，以后放设置时不用再把抽屉撑高 */
  min-height: 86dvh;
  max-height: calc(100dvh - 24px);
  overflow: auto;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  border-radius: 16px 16px 0 0;
  background: var(--paper, #f7f1e6);
  color: var(--ink, #2a241c);
}
.role-sheet[data-open] .panel { animation: role-sheet-rise 240ms cubic-bezier(.2, .7, .2, 1); }
@keyframes role-sheet-rise {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .role-sheet[data-open] .panel { animation: none; }
}
.role-sheet .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.role-sheet h2 { margin: 0; font-size: 18px; font-weight: 600; }
.role-sheet .close {
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink, #2a241c);
}
.role-sheet .close:active { background: var(--disabled-bg, #e7e0d6); }
.role-sheet .close:focus-visible { outline: 2px solid var(--ink, #2a241c); outline-offset: 2px; }
.role-sheet .close svg { width: 18px; height: 18px; }
.role-sheet .roles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.role-sheet .sheet-rest { flex: 1; min-height: 160px; }
.role-sheet .role {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 12px;
  border: 2px solid var(--line, #e4d8c4);
  border-radius: 12px;
  background: var(--card, #fffdf8);
  color: var(--ink, #2a241c);
  text-align: left;
}
.role-sheet .role input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.role-sheet .role:has(input:focus-visible) { outline: 2px solid var(--ink, #2a241c); outline-offset: 2px; }
.role-sheet .role:has(input:active) { background: #f3eee6; }
.role-sheet .role-on .role-title { font-weight: 700; }
.role-sheet .role-soon { background: var(--disabled-bg, #e7e0d6); color: #6a5b48; }
.role-sheet .role-copy { min-width: 0; flex: 1; }
.role-sheet .role-line { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.role-sheet .role-title { font-size: 16px; line-height: 1.3; color: var(--ink, #2a241c); }
.role-sheet .role-state { flex: none; font-size: 14px; font-weight: 600; }
.role-sheet .role-desc { margin: 4px 0 0; font-size: 14px; line-height: 1.45; }
.role-sheet .role-face {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
}
.role-sheet .role-glyph { position: relative; top: -1px; }
.role-sheet .face-soon {
  background: linear-gradient(145deg, #8a8278 0%, #5c564e 55%, #3f3a34 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .28), 0 3px 8px rgba(63, 58, 52, .22);
}
