:root {
  --bg: #101c24;
  --surface: #1b2b35;
  --text: #f2eee5;
  --muted: #b1bfc6;
  --accent: #e5c68b;
  --border: #536570;
  --control-border: #8295a0;
  --control-bg: #14232c;
  --seat-empty-border: rgba(83, 101, 112, 0.65);
  --good: #a3dfbe;
  --evil: #f2b6ae;
  --third: #8ab8d9;
}

.web-account-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 12px 0 24px; }
.web-account-row button { min-height: 44px; }
.web-login-page { max-width: 440px; margin: 0 auto; padding: 20px 0 calc(24px + env(safe-area-inset-bottom)); text-align: center; }
.web-login-page .page-title { font-size: clamp(22px, 5vw, 30px); }
.web-login-page button { display: block; width: 100%; min-height: 48px; margin-top: 16px; }
.web-login-code { width: min(280px, 100%); min-height: 280px; margin: 28px auto 20px; display: grid; place-items: center; border-radius: 16px; overflow: hidden; background: var(--surface); }
.web-login-code img { display: block; width: 100%; height: auto; background: #fff; }
.web-login-placeholder { padding: 24px; color: var(--muted); }
.web-login-status { color: var(--accent); font-weight: 600; }
.web-login-note { margin: 24px 0; text-align: left; }

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}
button {
  font: inherit;
  font-size: 15px;
  border-radius: 8px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: normal;
  line-height: 1.5;
  padding: 10px 12px;
  border: 0;
  margin: 0;
  cursor: pointer;
  color: var(--text);
  background: transparent;
  width: 100%;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button:disabled {
  opacity: 0.5;
}
button:not(:disabled):active {
  opacity: 0.78;
}
button[aria-expanded]:not(:disabled):active {
  opacity: 1;
}
input,
select {
  font: inherit;
  color: var(--text);
}
.hidden {
  display: none !important;
}
[hidden] {
  display: none !important;
}

.page {
  padding: 18px 16px calc(24px + env(safe-area-inset-bottom));
  max-width: 460px;
  margin: 0 auto;
  box-sizing: border-box;
}
.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  flex-wrap: nowrap;
}
.brand-mark {
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--accent);
  font-weight: 700;
}
.brand-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
button.switch-table {
  width: auto;
  margin: 0;
  min-height: 44px;
  padding: 6px;
  font-size: 13px;
  color: var(--muted);
}
button.connection-button {
  width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
}
.connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.connection-dot.online {
  background: #83cba0;
  box-shadow: 0 0 0 3px rgba(131, 203, 160, 0.12);
}
.connection-dot.pending {
  background: var(--accent);
}
.connection-dot.offline {
  background: #ed9d94;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--muted);
}
.kicker {
  font-size: 12px;
  letter-spacing: 1.5px;
  color: var(--accent);
}
.muted {
  color: var(--muted);
  display: block;
}
.small {
  font-size: 13px;
}
.label {
  display: block;
  font-weight: 600;
  margin-bottom: 7px;
}
.headline {
  font-size: 30px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: 1px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: 10px;
  margin: 12px 0;
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}
.section-title {
  margin: 20px 0 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.status,
.notice {
  color: var(--accent);
  padding: 10px 0;
  font-size: 14px;
}
.error {
  background: #542d30;
  color: #ffe7e7;
  padding: 12px;
  border-radius: 8px;
  margin: 12px 0;
}

.primary {
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  margin-top: 12px;
}
.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  margin-top: 10px;
}
.page.has-lobby-actions { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }
.web-lobby-action-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(177,191,198,.13); background: var(--bg); }
.web-lobby-action-inner { display: flex; align-items: center; gap: 10px; max-width: 428px; margin: 0 auto; }
.web-lobby-action-inner button { flex: 1 1 0; width: 0; min-width: 0; min-height: 48px; margin: 0; padding: 10px 12px; border-radius: 13px; font-size: 14px; }
.web-lobby-action-inner button.web-avoidance-entry { flex: 0 0 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 64px; min-width: 64px; height: 48px; padding: 3px 4px; gap: 1px; border: 0; background: rgba(229,198,139,.08); color: var(--accent); font-size: 11px; }
.web-avoidance-entry .avoidance-entry-line { display: flex; align-items: center; gap: 4px; font-size: 12px; }
.web-avoidance-entry .avoidance-entry-line img { width: 18px; height: 18px; }
.web-avoidance-entry .avoidance-entry-state { color: var(--muted); font-size: 10px; }
.web-lobby-spectator-hint { flex: 1; min-width: 0; padding: 8px 0; color: var(--muted); font-size: 12px; }
@media (max-width: 359px) { .web-lobby-action-inner { gap: 8px; } }
@media (max-height: 500px) and (orientation: landscape) {
  .page.has-lobby-actions { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .web-lobby-action-bar { position: static; margin-top: 16px; padding: 12px 0; }
}
.text-button {
  background: transparent;
  color: var(--muted);
  margin-top: 6px;
  font-size: 14px;
  min-height: 44px;
}

.input {
  box-sizing: border-box;
  width: 100%;
  height: 52px;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0 12px;
  border-radius: 6px;
  margin: 6px 0 12px;
  color: var(--text);
  font-size: 16px;
}
select.input {
  appearance: auto;
  -webkit-appearance: auto;
}
.field-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 600;
  margin: 12px 0 8px;
}
.field-title .muted {
  font-weight: 400;
}
.role-line {
  font-size: 14px;
  line-height: 1.8;
  margin-top: 6px;
  color: var(--text);
}

.member-room {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-top: 10px;
}
button.room-open {
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  width: 0;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 12px;
}
.member-room-code {
  font-size: 16px;
  font-weight: 600;
}
.member-room-board {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  white-space: normal;
}
button.room-delete {
  flex-shrink: 0;
  width: 52px;
  margin: 0;
  background: transparent;
  color: #f2b6ae;
  border: 1px solid var(--border);
  padding: 8px 4px;
}

/* Room overview */
.room-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 6px 0 4px;
}
button.copy-room {
  width: auto;
  min-height: 44px;
  margin: 0;
  padding: 6px 0;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}
.copy-label {
  color: var(--accent);
  font-size: 12px;
}
.summary-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
button.room-invite {
  width: auto;
  min-height: 32px;
  margin: 0;
  padding: 4px 0;
  font-size: 12px;
  color: var(--accent);
}
.summary-seat {
  font-size: 13px;
  color: var(--muted);
  flex-shrink: 0;
}
.row.subline {
  flex-wrap: nowrap;
  gap: 0 8px;
}
.room-subline {
  flex-wrap: nowrap;
  gap: 0 8px;
}
.room-board-info {
  display: flex;
  flex: 1;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0 6px;
  min-width: 0;
}
.room-board-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
button.room-rules-button {
  width: auto;
  min-width: 0;
  flex-shrink: 0;
  min-height: 44px;
  margin: 0;
  padding: 6px 4px;
  color: var(--accent);
  font-size: 12px;
}
.room-host-label {
  flex-shrink: 0;
  white-space: nowrap;
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
}

/* Phase strip */
.phase-strip {
  border-left: 2px solid var(--accent);
  padding: 8px 10px;
  margin: 12px 0;
  background: var(--surface);
}
.phase-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.phase-label {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 12px;
}
.phase-name {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.phase-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.phase-title {
  font-size: 22px;
  font-weight: 600;
  margin: 4px 0;
}

/* Seats */
.seats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.seats-compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* Identity */
.identity-card-topline { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -10px 0 0; }
button.identity-history-entry { display: flex; align-items: center; gap: 6px; width: auto; min-height: 44px; margin: 0; padding: 0 2px; border: 0; background: transparent; color: var(--accent); font-size: 14px; }
.identity-history-icon { width: 16px; height: 16px; flex-shrink: 0; background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e5c68b' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4v5h5M3 9a9 9 0 1 1 0 6M12 7v5l3 2'/%3E%3C/svg%3E"); }
.dialog-backdrop.identity-history-backdrop { align-items: flex-end; padding: 0; }
.identity-history-sheet { display: flex; flex-direction: column; width: 100%; max-width: 450px; max-height: 92vh; max-height: 92dvh; padding: 12px 20px calc(18px + env(safe-area-inset-bottom)); background: var(--surface); border: 1px solid var(--border); border-bottom: 0; border-radius: 20px 20px 0 0; animation: identity-history-enter 200ms ease-out; }
.identity-history-handle { flex-shrink: 0; width: 32px; height: 4px; margin: 0 auto 14px; border-radius: 4px; background: var(--border); }
.identity-history-heading { display: flex; align-items: flex-start; justify-content: space-between; flex-shrink: 0; margin-bottom: 22px; text-align: left; }
.identity-history-title { font-size: 23px; font-weight: 600; margin-bottom: 4px; }
button.identity-history-close { flex-shrink: 0; width: 44px; min-height: 44px; margin: -4px -8px 0 0; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 26px; font-weight: 400; }
.identity-history-body { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.identity-role-help-sheet { background: var(--bg); }
.identity-role-help-sheet .identity-history-heading { align-items: center; margin-bottom: 12px; }
.identity-role-help-sheet .identity-history-title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 20px; }
.identity-role-help-sheet .identity-history-body { text-align: left; }
.identity-history-timeline { position: relative; padding: 0 0 0 22px; text-align: left; }
.identity-history-timeline::before { content: ''; position: absolute; left: 5px; top: 13px; bottom: 24px; width: 1px; background: var(--border); }
.identity-history-event { position: relative; padding-bottom: 26px; }
.identity-history-event:last-child { padding-bottom: 0; }
.identity-history-dot { position: absolute; left: -21px; top: 10px; width: 9px; height: 9px; border: 1px solid var(--muted); border-radius: 50%; background: var(--surface); }
.identity-history-dot.is-current { border-color: var(--accent); background: var(--accent); }
.identity-history-record-heading, button.identity-history-toggle { display: flex; align-items: center; gap: 9px; min-height: 28px; }
button.identity-history-toggle { width: 100%; min-height: 44px; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; text-align: left; justify-content: flex-start; }
.identity-history-role { font-size: 19px; font-weight: 600; overflow-wrap: anywhere; }
.identity-history-badge { flex-shrink: 0; border: 1px solid var(--border); border-radius: 4px; padding: 3px 6px; font-size: 12px; line-height: 1.1; color: var(--muted); font-weight: 400; }
.identity-history-badge.is-current { color: var(--accent); border-color: var(--accent); }
.identity-history-chevron { margin-left: auto; margin-right: 4px; flex-shrink: 0; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); }
.identity-history-chevron.is-expanded { transform: rotate(225deg); }
.identity-history-meta { margin-top: 7px; }
.identity-history-summary { margin-top: 11px; }
.identity-skill-history { margin-top: 12px; text-align: left; }
.identity-skill-record { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; font-size: 15px; line-height: 1.6; }
.identity-skill-round { flex-shrink: 0; }
.identity-skill-text { min-width: 0; overflow-wrap: anywhere; }
.identity-history-detail { margin-top: 13px; padding: 14px; border-radius: 8px; background: var(--bg); }
.identity-history-detail[hidden] { display: none; }
.identity-history-information { margin-top: 9px; white-space: pre-line; overflow-wrap: anywhere; font-size: 15px; line-height: 1.85; }
.identity-history-readonly { margin-top: 12px; }
.identity-history-footer { flex-shrink: 0; padding-top: 22px; text-align: center; }
.identity-history-footer button { margin-top: 12px; }
.identity-role-help-sheet .identity-history-footer { margin-top: 8px; padding-top: 12px; border-top: 1px solid rgba(177,191,198,.14); }
.identity-role-help-sheet .identity-history-footer button { margin: 0; }
body:has(.identity-history-backdrop) { overflow: hidden; }
.identity-history-sheet button:focus-visible, .identity-history-entry:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@keyframes identity-history-enter { from { transform: translateY(18px); opacity: 0.6; } to { transform: translateY(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .identity-history-sheet { animation: none; } }
@media (max-height: 500px) { .identity-history-heading { margin-bottom: 10px; } .identity-history-footer { padding-top: 10px; } }
.identity {
  padding: 18px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: center;
  margin: 16px 0;
  background: repeating-linear-gradient(
    135deg,
    #182831,
    #182831 9px,
    #1b2b35 9px,
    #1b2b35 10px
  );
}
.identity.open {
  background: var(--surface);
}
.identity-title {
  font-size: 23px;
  font-weight: 600;
  margin: 13px 0 6px;
}
.private-info {
  white-space: pre-line;
  margin-top: 12px;
  text-align: left;
  font-size: 14px;
}
button.identity-compact {
  width: 100%;
  min-height: 48px;
  margin: 12px 0;
  padding: 10px 12px;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 14px;
}
.identity-compact-action {
  color: var(--accent);
}
.action-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0 12px;
  font-size: 14px;
  color: var(--accent);
}
.action-entry button {
  width: auto;
  min-height: 44px;
  margin: 0;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border);
}

/* Faction + result coloring */
.faction-good {
  color: var(--good);
}
.faction-evil {
  color: var(--evil);
}
.faction-third {
  color: var(--third);
}
.result {
  background: #263c38;
  padding: 16px;
  border-radius: 10px;
  margin-top: 12px;
}
.result-good {
  background: #263c38;
}
.result-evil {
  background: #3a2a2c;
}
.result-neutral {
  background: var(--surface);
}

/* Host tools */
.host-panel {
  --host-panel-outline: rgba(229, 198, 139, .42);
  margin: 16px 0;
  padding: 12px;
  border: 1px solid var(--host-panel-outline);
  border-radius: 15px;
  background: var(--control-bg);
}
.host-panel-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 8px; }
.host-panel-heading .label { margin-bottom: 0; }
.tool-actions,
.tool-seat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.host-panel .tool-actions { margin-bottom: 0; }
.tool-actions button { margin: 0; border-color: rgba(177,191,198,.13); border-radius: 12px; background: var(--surface); }
.tool-actions button:nth-child(-n+2) { border-color: var(--host-panel-outline); }
.tool-actions.has-three-extras { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.tool-actions.has-three-extras button:nth-child(-n+2) { grid-column: span 3; }
.tool-actions.has-three-extras button:nth-child(n+3) { grid-column: span 2; min-width: 0; padding-left: 6px; padding-right: 6px; }
button.tool-seat-option {
  width: 100%;
  min-width: 0;
  margin: 0;
  min-height: 44px;
  padding: 6px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 13px;
}
button.tool-seat-option.active {
  color: var(--accent);
  border-color: var(--accent);
  background: #354039;
}
.tool-seat-scroll {
  margin: 12px 0;
  max-height: 220px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.tool-seat-scroll .tool-seat-grid {
  margin: 0;
}
.quest-threshold {
  margin-top: 12px;
}
.threshold-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 6px 0;
}
.threshold-hint {
  color: var(--accent);
  margin-top: 4px;
}
.operation-progress {
  --progress-line: rgba(83, 101, 112, .45);
  --progress-track: #354750;
  --progress-seat: #20323d;
  --progress-pending: #8299a5;
  --progress-completed-bg: rgba(229, 198, 139, .10);
  margin: 14px 0 0;
  padding: 14px 16px 16px;
  border: 1px solid var(--progress-line);
  border-radius: 16px;
  background: var(--bg);
}
.operation-progress.all-done { border-color: rgba(229, 198, 139, .25); }
button.progress-toggle { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 44px; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--text); text-align: left; flex-wrap: wrap; line-height: 1.5; }
.progress-title { flex: 1; font-size: 16px; font-weight: 600; white-space: nowrap; }
.progress-count { display: flex; align-items: baseline; gap: 5px; flex-shrink: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
.progress-completed-count { font-size: 20px; font-weight: 600; color: var(--accent); }
.progress-total { font-size: 14px; color: var(--muted); }
.progress-count-label { font-size: 12px; font-weight: 400; color: var(--muted); }
.progress-disclosure { display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-left: 5px; color: var(--muted); font-size: 12px; font-weight: 400; white-space: nowrap; }
.progress-chevron { flex-shrink: 0; width: 6px; height: 6px; margin: -3px 2px 0 0; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform .16s ease; }
.progress-chevron.expanded { transform: translateY(3px) rotate(225deg); }
.progress-meter { display: flex; gap: 4px; margin: 9px 0 12px; }
.progress-segment { flex: 1; min-width: 0; height: 4px; border-radius: 2px; background: var(--progress-track); }
.progress-segment.completed { background: var(--accent); }
.progress-note { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.progress-note-dot { flex-shrink: 0; width: 5px; height: 5px; border-radius: 50%; background: var(--progress-pending); }
.all-done .progress-note { color: var(--accent); }
.all-done .progress-note-dot { background: var(--accent); }
.progress-players { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; margin-top: 17px; }
.progress-player {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 47px;
  padding: 8px 0;
  border-bottom: 1px solid var(--progress-line);
  font-size: 14px;
}
.progress-player:last-child, .progress-player:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
.progress-seat { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 27px; min-height: 27px; border-radius: 7px; background: var(--progress-seat); color: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.progress-player-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.progress-player.completed .progress-seat { background: var(--progress-completed-bg); color: var(--accent); }
.progress-player.completed .progress-player-name { color: var(--accent); font-weight: 500; }
.progress-state { position: relative; flex-shrink: 0; width: 13px; height: 13px; margin: 0 2px; border: 1.3px solid var(--progress-pending); border-radius: 50%; }
.progress-state.completed { width: 17px; height: 17px; margin: 0; border: 0; background: var(--progress-completed-bg); color: var(--accent); }
.progress-state.completed::after { content: ""; position: absolute; width: 7px; height: 4px; left: 4px; top: 5px; border-left: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor; transform: rotate(-45deg); }
.progress-legend { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 12px; padding-top: 13px; border-top: 1px solid var(--progress-line); color: var(--muted); font-size: 12px; }
.progress-legend-item { display: flex; align-items: center; gap: 6px; }
@media (max-width: 360px) {
  .operation-progress { padding-right: 10px; padding-left: 10px; }
  button.progress-toggle { gap: 5px; }
  .progress-title { font-size: 15px; }
  .progress-count { gap: 4px; }
  .progress-completed-count { font-size: 18px; }
  .progress-count-label, .progress-disclosure { font-size: 11px; }
  .progress-disclosure { margin-left: 2px; }
  .progress-players { column-gap: 14px; }
  .progress-player { gap: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  .progress-chevron { transition: none; }
}
.finish-game-footer {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
button.finish-game-button {
  width: 100%;
  margin: 0;
  background: #35272b;
  color: #f2b6ae;
  border: 1px solid #ab7774;
  font-weight: 600;
}

/* Sticky host action bar */
.page.has-host-bar {
  padding-bottom: calc(120px + env(safe-area-inset-bottom));
}
.host-action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  box-sizing: border-box;
}
.host-action-bar-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 460px;
  margin: 0 auto;
}
.host-action-bar-inner button {
  margin: 0;
  min-height: 44px;
}
.host-action-bar-inner .bar-settle {
  flex: 2;
}
.host-action-bar-inner .bar-cancel {
  flex: 0 0 76px;
  font-size: 13px;
}

/* Quest summary + history */
.quest-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0;
  font-size: 14px;
}
.quest-summary-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.quest-result-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}
.quest-result-icon.success {
  color: #a3dfbe;
  background: #253e35;
}
.quest-result-icon.failure {
  color: #f2b6ae;
  background: #493033;
}
.history-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.history-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}
.history-vote-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 5px 0;
  font-size: 13px;
  line-height: 1.65;
}
.history-vote-count {
  display: flex;
  align-items: baseline;
  gap: 3px;
  flex: 0 0 70px;
}
.history-count {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}
.history-vote-seats {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.history-team {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}
.history-cards {
  display: flex;
  flex-wrap: wrap;
  column-gap: 14px;
  row-gap: 4px;
  margin-top: 5px;
}
.history-card-count {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}
.history-vote-count.approve,
.history-vote-count.approve .history-count {
  color: var(--good);
}
.history-vote-count.reject,
.history-vote-count.reject .history-count {
  color: var(--evil);
}
.history-detail {
  white-space: pre-line;
  line-height: 1.7;
  font-size: 13px;
}
.team-line {
  margin-top: 12px;
  color: var(--accent);
}

button.leave-button {
  width: 100%;
  margin: 16px 0 0;
  background: #35272b;
  color: #f2b6ae;
  border: 1px solid #ab7774;
  font-weight: 600;
}
.configuration-roles {
  margin: 12px 0;
}

/* Action dialog */
.action-dialog {
  max-width: 480px;
}
.action-identity {
  margin: 12px 0;
  overflow-wrap: break-word;
}
.action-identity-details {
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.action-identity .identity-title {
  margin-top: 0;
}
.action-identity .private-info {
  white-space: pre-wrap;
}
.action-identity button {
  margin: 0;
}
.action-choice-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.action-choice-list button {
  margin: 0;
  justify-content: flex-start;
  text-align: left;
  padding: 12px 16px;
  min-height: 52px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 500;
}
.action-choice-list button.primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 700;
}
.action-target-scroll {
  max-height: 240px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.action-target-scroll button {
  margin: 0;
  justify-content: flex-start;
  text-align: left;
  padding: 10px 14px;
  min-height: 48px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}
.swap-seat-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.swap-seat-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

/* Dialog */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(8, 14, 18, 0.68);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  animation: dialog-fade 0.18s ease-out;
}
@keyframes dialog-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.error-dialog {
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
  box-sizing: border-box;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
  animation: dialog-rise 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes dialog-rise {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.error-dialog.identity-reveal-dialog { display: flex; flex-direction: column; overflow: hidden; max-height: calc(100dvh - 32px); }
.identity-reveal-dialog > .dialog-title, .identity-reveal-footer { flex-shrink: 0; }
.identity-reveal-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.identity-reveal-footer { padding-top: 8px; }
.dialog-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--text);
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.dialog-message {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
  overflow-wrap: break-word;
  white-space: pre-line;
}
.dialog-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.dialog-actions button {
  flex: 1;
  min-height: 48px;
  margin: 0;
  border-radius: 10px;
  font-weight: 600;
}
.dialog-actions button.primary {
  background: var(--accent);
  color: var(--bg);
}
.dialog-actions button.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

/* Avoidance receipts use the same hierarchy as the mini-program. */
.error-dialog.is-avoidance-grant { display:flex; flex-direction:column; max-width:350px; max-height:calc(100dvh - 48px); overflow:hidden; padding:24px; border-radius:22px; border-color:rgba(177,191,198,.24); }
.is-avoidance-grant .dialog-title { display:flex; flex-shrink:0; align-items:center; gap:12px; padding:0; margin:0; border:0; font-size:20px; line-height:1.5; font-weight:600; letter-spacing:0; }
.is-avoidance-grant .dialog-title::before { content:""; flex-shrink:0; width:42px; height:42px; border-radius:13px; background:rgba(153,199,245,.10) url('/assets/table-cards.svg') center/27px 27px no-repeat; }
.dialog-grant-context { display:flex; flex-shrink:0; justify-content:space-between; align-items:center; gap:12px; margin-top:22px; padding-bottom:18px; border-bottom:1px solid rgba(177,191,198,.14); color:var(--muted); font-size:14px; line-height:1.5; }
.dialog-grant-amount { margin-left:auto; color:var(--accent); font-size:23px; font-weight:600; line-height:1.3; letter-spacing:.2px; }
.is-avoidance-grant .dialog-message { flex-shrink:1; min-height:0; margin:20px 0 0; overflow-y:auto; max-height:48vh; white-space:normal; }
.dialog-grant-lead { color:var(--text); font-size:16px; line-height:1.8; font-weight:500; white-space:pre-wrap; overflow-wrap:anywhere; }
.dialog-grant-hint { color:var(--muted); font-size:14px; line-height:1.8; font-weight:400; white-space:pre-wrap; overflow-wrap:anywhere; }
.dialog-grant-hint.has-lead { margin-top:14px; }
.is-avoidance-grant .dialog-actions { flex-shrink:0; margin-top:24px; }
.is-avoidance-grant .dialog-actions button { min-height:50px; border-radius:12px; font-size:16px; }
@media(max-width:350px) { .error-dialog.is-avoidance-grant { padding:22px 20px; }.is-avoidance-grant .dialog-title { gap:10px; font-size:19px; }.dialog-grant-context { margin-top:20px; } }
@media(max-height:500px) { .error-dialog.is-avoidance-grant { max-height:calc(100dvh - 32px); padding:20px 24px; }.is-avoidance-grant .dialog-title::before { width:36px; height:36px; border-radius:11px; background-size:24px 24px; }.dialog-grant-context { margin-top:14px; padding-bottom:12px; }.is-avoidance-grant .dialog-message { margin-top:14px; max-height:35vh; }.is-avoidance-grant .dialog-actions { margin-top:18px; } }

/* Settings dialog */
.settings-header {
  margin-bottom: 24px;
}
.settings-eyebrow {
  color: var(--accent);
  font-size: 13px;
  margin-bottom: 6px;
}
.settings-title {
  font-size: 21px;
  font-weight: 650;
  margin-bottom: 4px;
}
.settings-loading {
  padding: 12px 0;
}
.settings-section-title {
  color: var(--muted);
  font-size: 14px;
  margin: 20px 0 8px;
}
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.settings-row {
  min-height: 56px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-sizing: border-box;
}
.settings-row + .settings-row {
  border-top: 1px solid var(--border);
}
.settings-value {
  text-align: right;
  max-width: 70%;
  overflow-wrap: break-word;
}
.settings-caption {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}
.settings-help {
  color: var(--muted);
  font-size: 13px;
  margin: 8px 4px 0;
  line-height: 1.7;
}
.settings-footer {
  margin-top: 32px;
}
.settings-error {
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid #d89c92;
  border-radius: 8px;
  color: #f2b6ae;
}
.settings-select {
  max-width: 70%;
  height: 40px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0 8px;
}
button.transfer-button {
  width: auto;
  flex-shrink: 0;
  min-height: 40px;
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  margin: 0;
}

/* Toast */
#toast {
  position: fixed;
  left: 50%;
  bottom: 20%;
  transform: translateX(-50%);
  background: #2a3a45;
  color: var(--text);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 2000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
#toast.show {
  opacity: 1;
}
/* Themed option picker, shared by entry and room settings. */
.option-trigger {
  display: flex;
  justify-content: space-between;
  text-align: left;
  gap: 16px;
  min-height: 48px;
  height: auto;
}
.option-trigger::after {
  content: "";
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-2px) rotate(45deg);
  margin-right: 4px;
}
.option-trigger.settings-select { width: auto; }
.option-dialog {
  color-scheme: dark;
  width: min(420px, calc(100% - 32px));
  max-height: calc(100dvh - 48px);
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 80px #0008;
  overflow: auto;
}
.option-dialog::backdrop { background: #071018b8; }
.option-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.option-header h2 { margin: 2px 0 0; font-size: 22px; }
.option-close { width: 44px; min-height: 44px; flex-shrink: 0; font-size: 26px; color: var(--muted); }
.option-list { display: grid; gap: 8px; }
.option-item { justify-content: space-between; text-align: left; padding: 12px 16px; border: 1px solid transparent; background: var(--bg); }
.option-item[aria-pressed="true"] { border-color: var(--accent); background: #e5c68b14; color: var(--accent); }
.option-check { flex-shrink: 0; width: 20px; }
.option-trigger:focus-visible, .option-dialog button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (hover: hover) { .option-item:hover, .option-close:hover { background: #e5c68b20; } }
@media (max-width: 480px) {
  .option-dialog { margin: auto auto max(16px, env(safe-area-inset-bottom)); padding: 18px; }
}

.transfer-entry { margin-top: 24px; }
.option-dialog[open] { display: flex; flex-direction: column; }
.option-dialog .option-header { flex-shrink: 0; }
.option-dialog .option-list { overflow-y: auto; min-height: 0; padding: 4px; }

@media (prefers-reduced-motion: reduce) {
  .dialog-backdrop, .error-dialog { animation: none; }
  #toast { transition: none; }
}

/* Current action stays separate from the last durable public result. */
.action-status-copy { flex: 1; min-width: 0; }
.action-status-copy .small { margin-top: 4px; }
.latest-result { margin: 16px 0; padding: 16px; border: 1px solid var(--accent); border-radius: 12px; background: var(--surface); }
.latest-result-title { margin: 8px 0; font-size: 20px; font-weight: 600; }
.latest-result .history-detail { white-space: pre-line; overflow-wrap: anywhere; }
.host-waiting-copy { flex: 1; min-width: 0; }
.history-vote-count.abstain { color: var(--muted); }

.host-action-bar-inner .bar-cutoff { flex: 0 0 96px; padding: 8px 6px; font-size: 14px; }

button.kick-entry { color: var(--evil); }

/* Public seat cards use the same compact layout as the mini program. */
button.seat {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  justify-content: flex-start;
  gap: 6px;
  min-height: 112px;
  padding: 9px 7px 16px;
  border: 1px solid transparent;
  border-radius: 16px;
  line-height: 1.4;
}
button.seat:disabled { opacity: 1; }
button.seat.mine, button.seat.mine:disabled { border-color: var(--accent); }
button.seat.team, button.seat.selected { background: #293d39; box-shadow: inset 0 0 0 1px var(--good); }
.seat-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 2px; min-height: 18px; }
.seat-head .seat-number { display: block; flex-shrink: 0; font-size: 12px; line-height: 18px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.seat-head-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px; }
.seat-head .seat-self, .seat-head .seat-flag { float: none; padding: 0 3px; border-radius: 5px; font-size: 9px; line-height: 16px; }
.seat-head .seat-self { color: var(--bg); background: var(--accent); font-weight: 700; }
.seat-head .seat-flag { color: var(--muted); background: rgba(177, 191, 198, .1); }
.seat-player { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.seat-avatar { position: relative; display: block; flex: 0 0 40px; width: 40px; height: 40px; overflow: hidden; border-radius: 50%; background: var(--bg); color: var(--muted); }
.seat-avatar-fallback { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; font-size: 20px; font-weight: 600; }
.seat-avatar-image { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
button.seat .seat-name { width: 100%; min-height: 18px; font-size: 12px; font-weight: 600; line-height: 1.5; text-align: center; white-space: normal; overflow-wrap: anywhere; }
button.seat .seat-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 3px; margin-top: auto; color: var(--muted); font-size: 10px; line-height: 1.5; }
.seat-out { padding: 0 3px; border: 1px solid var(--evil); border-radius: 4px; color: var(--evil); }
.seat-ready-badge, .seat-fairy { position: absolute; right: 6px; bottom: 5px; display: grid; place-items: center; pointer-events: none; }
.seat-ready-badge { width: 15px; height: 15px; border-radius: 50%; background: var(--good); }
.seat-ready-check { width: 7px; height: 4px; margin-top: -1px; border: solid var(--bg); border-width: 0 0 2px 2px; transform: rotate(-45deg); }
button.seat.has-fairy { padding-bottom: 31px; }
.seat-fairy img { display: block; width: 20px; height: 20px; }
button.seat.seat-empty { background: var(--bg); border: 1px dashed var(--seat-empty-border); }
.seat-empty-body { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 66px; color: var(--muted); }
.seat-empty-mark { font-size: 26px; line-height: 34px; }
.seat-empty-label { font-size: 11px; line-height: 18px; }
.task-progress { margin: 18px 0 12px; }
.task-progress .section-title { gap: 6px 10px; margin: 0; font-size: 15px; line-height: 1.5; }
.seat-section-title { display: flex; align-items: center; gap: 8px; }
.seat-count { color: var(--muted); font-size: 12px; font-weight: 400; text-align: right; }
.fairy-setting .settings-caption { display: block; }
.fairy-setting input { width: 24px; height: 24px; flex-shrink: 0; accent-color: var(--accent); }
.fairy-setting input:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.result-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.result-team { font-size: 14px; font-weight: 400; color: var(--muted); margin-left: auto; }
.history-title { flex-wrap: wrap; }
.history-meta { display: flex; justify-content: space-between; margin-bottom: 4px; }
.action-team { margin: 8px 0 14px; font-size: 16px; font-weight: 600; color: var(--accent); }
.history-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
button.history-toggle { width: auto; margin: 0; background: transparent; color: var(--accent); }
button.history-more { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 56px; margin: 4px 0; padding: 10px; background: transparent; color: var(--muted); border: 0; border-radius: 0; box-shadow: none; font-size: 12px; font-weight: 400; line-height: 1.4; }
button.history-more:hover { color: var(--accent); background: transparent; }
button.history-more:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.history-more-chevron { display: block; width: 7px; height: 7px; border-right: 1.5px solid var(--accent); border-bottom: 1.5px solid var(--accent); transform: rotate(45deg); }
.history-more-chevron.is-expanded { transform: rotate(225deg); }
.quest-timeline { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
button.quest-step { width: auto; margin: 0; background: var(--surface); border: 1px solid var(--border); }
button.quest-step.success { color: var(--good); }
button.quest-step.failure { color: var(--evil); }

.fairy-result-summary { margin: 20px 0; font-size: 24px; line-height: 1.4; font-weight: 650; }
.host-action-bar-inner.has-waiting { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; gap: 6px 8px; }
.has-waiting .host-waiting-copy { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 8px; }
.host-action-bar-inner.has-waiting button { width: 100%; min-width: 0; min-height: 44px; padding: 8px 6px; line-height: 1.4; display: flex; align-items: center; justify-content: center; white-space: normal; overflow-wrap: anywhere; box-sizing: border-box; }
.host-action-bar-inner.has-single-action { grid-template-columns: minmax(0, 1fr); }
.host-action-bar-inner.has-waiting .host-waiting-copy { align-items: center; flex-wrap: wrap; gap: 2px 8px; padding: 2px 0 4px; }
.host-action-bar-inner.has-waiting .host-waiting-copy > div { font-size: 11px; }
.host-action-bar-inner button.bar-cancel, .host-action-bar-inner button.is-destructive { border-color: rgba(242,182,174,.28); border-radius: 11px; color: var(--evil); background: rgba(242,182,174,.045); }
.host-action-bar-inner button.bar-cutoff { border-radius: 11px; font-weight: 500; }
.host-action-bar-inner button:active { opacity: .78; }

.history-card-count .history-count.success { color: var(--good); }
.history-card-count .history-count.failure { color: var(--evil); }

.brand-identity { display: flex; align-items: center; min-width: 0; }
.brand-identity .brand-mark { flex-shrink: 0; }
.brand-identity button.connection-button { display: flex; align-items: center; justify-content: center; gap: 6px; width: auto; min-width: 44px; height: auto; padding: 0 10px; background: transparent; border: 0; }
.connection-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
button.home-entry { display: flex; align-items: center; justify-content: center; gap: 8px; flex-shrink: 0; min-width: 76px; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 12px; background: var(--surface); color: var(--accent); font-size: 14px; line-height: 1.4; }
.home-entry::after, .connection-button::after { border: 0; }
.home-icon { position: relative; display: block; width: 18px; height: 18px; flex-shrink: 0; color: var(--accent); }
.home-icon::before { content: ""; position: absolute; width: 11px; height: 11px; left: 3px; top: 1px; border-top: 1.5px solid currentColor; border-left: 1.5px solid currentColor; transform: rotate(45deg); }
.home-icon::after { content: ""; position: absolute; width: 11px; height: 9px; left: 3px; bottom: 0; border: 1.5px solid currentColor; border-top: 0; border-radius: 0 0 2px 2px; }

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

/* Table hierarchy: context, current action, private identity, public results. */
.room-summary { margin: 4px 0 0; gap: 8px; }
.row.room-subline { flex-wrap: wrap; align-items: flex-start; gap: 0 8px; margin: 0 0 8px; }
.room-board-info { flex-wrap: wrap; gap: 0 8px; }
.room-board-name { white-space: normal; overflow: visible; overflow-wrap: anywhere; padding: 4px 0; }
.room-test-label { order: 3; flex-basis: 100%; font-size: 11px; line-height: 1.5; color: var(--muted); }
.phase-strip { padding: 12px 0; margin: 8px 0 0; border: 0; border-top: 1px solid var(--border); border-radius: 0; background: transparent; }
.phase-heading { flex-wrap: wrap; gap: 4px 12px; }
.phase-name { font-size: 16px; }
.phase-strip .action-entry { margin: 12px 0 0; padding: 12px 0 0; border: 0; border-top: 1px solid var(--border); border-radius: 0; background: transparent; gap: 12px; flex-wrap: wrap; }
.phase-strip .action-entry button { margin: 0; min-height: 44px; flex-shrink: 0; }
.action-status-copy { min-width: 0; flex: 1 1 160px; }
button.identity-compact { min-height: 48px; margin: 0 0 16px; padding: 10px 12px; border: 0; border-radius: 8px; background: var(--surface); }
.latest-result { margin: 16px 0 24px; padding: 8px 16px 16px; border: 1px solid var(--accent); border-radius: 14px; background: var(--surface); }
.result-summary-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 8px; }
.latest-result-title { margin: 2px 0 0; font-size: 24px; font-weight: 700; line-height: 1.4; letter-spacing: 0.2px; }
.latest-result .history-detail { margin-top: 10px; font-size: 14px; color: var(--text); }
.latest-result .history-detail:empty { display: none; }
button.history-toggle { width: auto; min-height: 44px; padding: 8px 4px; margin: 0; flex-shrink: 0; }
.seat-summary { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.task-progress .quest-summary { margin: 8px 0; flex-wrap: wrap; }
.task-progress .quest-timeline { margin: 8px 0 0; }
.history-heading { flex-wrap: wrap; }

.result-summary-heading > .small { color: var(--accent); font-size: 12px; letter-spacing: 0.5px; }
.result-summary-heading button.history-toggle { font-size: 12px; color: var(--muted); }
.history-row { scroll-margin-top: 20px; }
.history-row-focused { animation: record-locate 2.4s ease-out forwards; }

.history-meta { font-size: 11px; opacity: 0.8; }
.history-row { border-radius: 0; }
@keyframes record-locate {
  0%, 65% { background-color: var(--surface); }
  100% { background-color: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .history-row-focused { animation-timing-function: steps(1, end); }
}

/* Shared stage/result panel. Order changes only with the game phase. */
button.home-entry { background: transparent; padding: 8px; min-height: 44px; }
.brand { padding-bottom: 12px; }
.room-summary { flex-wrap: wrap; margin-top: 4px; }
button.room-identity { width: auto; min-height: 44px; margin: 0; padding: 8px 0 8px 8px; color: var(--accent); background: transparent; font-size: 13px; }
.room-identity-anchor { position: relative; flex-shrink: 0; }
button.room-identity.identity-entry-highlight { outline: 1px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.identity-entry-hint { position: absolute; top: calc(100% + 8px); right: 0; z-index: 950; display: flex; align-items: center; width: 244px; max-width: calc(100vw - 40px); padding: 6px 4px 6px 12px; box-sizing: border-box; border: 1px solid var(--accent); border-radius: 8px; background: var(--surface); color: var(--text); box-shadow: 0 4px 12px rgba(0,0,0,0.2); font-size: 13px; line-height: 1.6; }
.identity-entry-hint::before { content: ''; position: absolute; top: -5px; right: 18px; width: 8px; height: 8px; border-top: 1px solid var(--accent); border-left: 1px solid var(--accent); background: var(--surface); transform: rotate(45deg); }
.identity-entry-hint > span { flex: 1; }
button.identity-hint-close { flex-shrink: 0; width: 44px; min-height: 44px; margin: 0; padding: 0; border: 0; color: var(--muted); background: transparent; font-size: 18px; }
.identity-privacy-note { margin-top: 4px; }
.identity-return-note { margin: 12px 0; line-height: 1.6; }
.table-dynamics { margin: 16px 0; padding: 16px; border-radius: 22px; background: var(--surface); }
.table-dynamics .latest-result { margin: 0; padding: 0 0 12px; border: 0; border-radius: 0; background: transparent; }
.table-dynamics .phase-strip { margin: 0; padding: 0; border: 0; }
.table-dynamics .phase-heading { align-items: center; flex-wrap: nowrap; gap: 10px; }
.phase-symbol { display: grid; place-items: center; flex: 0 0 28px; height: 28px; border-radius: 9px; background: #263e52; }
.phase-symbol img { width: 18px; height: 18px; }
.phase-heading-copy { min-width: 0; }
.phase-heading-copy .phase-label, .phase-heading-copy .phase-name { display: block; }
.phase-heading-copy .phase-label { font-size: 11px; }
.result-first .latest-result + .phase-strip { border-top: 1px solid rgba(177, 191, 198, .13); padding-top: 14px; }
.result-first .phase-name { font-size: 14px; font-weight: 500; }
.operation-first .phase-name { font-size: 20px; }
.table-dynamics + .task-progress { margin-top: 16px; }

.table-dynamics .action-entry button.primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.phase-team { margin-top: 8px; font-size: 13px; }
.phase-team .label { display: block; margin: 0; font-size: 14px; }
.phase-team .muted { display: block; font-size: 12px; }

/* Personal table directory */
.room-count { margin-left: 8px; font-size: 13px; font-weight: 400; color: var(--muted); }
.member-room.room-list-item { position: relative; display: block; margin: 0 0 12px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.room-swipe { --swipe-remove-bg:#263b47; --swipe-remove-text:#d4e0e6; --swipe-remove-border:#4a606d; --swipe-danger-bg:#3c2a2e; --swipe-danger-text:#efb0a5; --swipe-danger-border:#79504e; position:relative; overflow:hidden; border-radius:12px; margin-bottom:12px; touch-action:pan-y pinch-zoom; }
.room-swipe .room-swipe-content { position: relative; z-index: 1; width: 100%; min-height:166px; margin: 0; background: var(--surface); transition: transform 180ms ease-out; touch-action: pan-y pinch-zoom; }
.room-swipe .room-swipe-content button { touch-action: pan-y pinch-zoom; }
.room-swipe.is-open .room-swipe-content { transform: translateX(-124px); }
.room-swipe.is-dragging .room-swipe-content { transition: none; }
.room-swipe-actions { position:absolute; top:0; right:0; bottom:0; display:flex; flex-direction:column; justify-content:center; gap:10px; width:116px; padding:12px 0; box-sizing:border-box; visibility:hidden; }
.room-swipe.is-exposed .room-swipe-actions { visibility: visible; }
button.room-swipe-action { display:flex; flex-direction:row; align-items:center; justify-content:center; flex-shrink:0; gap:6px; width:116px; min-width:116px; height:64px; min-height:64px; margin:0; padding:6px; box-sizing:border-box; border:1px solid var(--swipe-remove-border); border-radius:14px; background:var(--swipe-remove-bg); color:var(--swipe-remove-text); font-size:13px; font-weight:500; line-height:1.5; }
button.room-swipe-action.danger { border-color:var(--swipe-danger-border); background:var(--swipe-danger-bg); color:var(--swipe-danger-text); }
button.room-swipe-action:disabled { opacity: 1; }
.room-swipe-label { flex-shrink:0; white-space:nowrap; }
.room-swipe-remove-icon { position:relative; flex-shrink:0; width:18px; height:18px; border:1.5px solid currentColor; border-radius:50%; box-sizing:border-box; }
.room-swipe-remove-icon::after { content:''; position:absolute; width:8px; height:1.5px; top:50%; left:50%; transform:translate(-50%,-50%); background:currentColor; }
.room-swipe-dissolve-icon { position:relative; flex:0 0 16px; width:16px; height:20px; margin-right:2px; border:1.5px solid currentColor; border-radius:2px; box-sizing:border-box; }
.room-swipe-dissolve-icon > span { position:absolute; width:11px; height:1.5px; right:-4px; top:8px; background:currentColor; box-shadow:0 0 0 3px var(--swipe-danger-bg); }
.room-swipe-dissolve-icon > span::after { content: ''; position: absolute; width: 6px; height: 6px; left: 0; top: -3px; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
.room-swipe-action:focus-visible { outline: 2px solid var(--text); outline-offset: -5px; }
@media (prefers-reduced-motion: reduce) { .room-swipe .room-swipe-content { transition: none; } }
button.room-list-open { display: block; width: 100%; margin: 0; padding: 14px 48px 14px 14px; text-align: left; background: transparent; border: 0; border-radius: 0; }
.room-list-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.room-list-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; font-weight: 600; }
.room-status { flex-shrink: 0; color: var(--muted); font-size: 11px; }
.room-status.playing { color: var(--accent); }
.room-list-board { display: block; color: var(--muted); font-size: 13px; margin-top: 6px; overflow-wrap: anywhere; }
.room-list-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--muted); font-size: 12px; margin-top: 6px; }
.room-host-name { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.room-list-time { display: block; font-size: 11px; color: var(--muted); margin-top: 6px; }
button.room-more { position: absolute; right: 2px; top: 4px; width: 44px; min-height: 44px; padding: 0; margin: 0; font-size: 24px; color: var(--muted); background: transparent; }
.is-unavailable button.room-list-open:disabled { opacity: 0.7; }
button.room-refresh { width: 72px; }
.room-filters { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
button.room-filter { width: auto; min-height: 44px; margin: 0; padding: 8px 10px; font-size: 12px; color: var(--muted); background: transparent; }
button.room-filter.active { color: var(--accent); background: var(--surface); }
.room-empty { padding: 20px 12px; text-align: center; color: var(--muted); }
.room-list-dialog .input { margin: 12px 0; }

.history-heading-line { display:flex; align-items:baseline; justify-content:space-between; gap:12px; }
.history-heading-line .history-title { min-width:0; margin:0; align-items:baseline; }
.history-number { flex-shrink:0; color:var(--muted); font-size:12px; font-weight:400; }
.history-row { padding:14px 0; border-bottom-color:rgba(177,191,198,.22); }
.history-subtitle { margin-top:4px; }
.history-result-rows { margin-top:10px; }
.history-result-line { display:flex; align-items:baseline; gap:12px; color:var(--muted); font-size:14px; margin-top:4px; }
.history-result-label { flex:0 0 84px; }
.history-result-value { min-width:0; overflow-wrap:anywhere; }
.history-result-line.is-final { color:var(--text); font-weight:600; margin-bottom:10px; }
.latest-result-note { margin-top:4px; }
.latest-result .history-result-line { margin-top:8px; line-height:1.65; }
.latest-result .history-result-value { color:var(--text); }
.latest-result .history-result-label { flex-basis:6em; }

/* Skill selection: scrollable choices, persistent private confirmation. */
.error-dialog.skill-dialog {
  display: flex;
  flex-direction: column;
  max-height: 88vh;
  overflow: hidden;
  padding: 0;
}
.skill-header { flex-shrink: 0; padding: 22px 20px 16px; }
.skill-title { font-size: 20px; line-height: 1.35; font-weight: 700; color: var(--text); }
.skill-hint { margin-top: 10px; font-size: 14px; line-height: 1.6; color: var(--text); }
.skill-body { min-height: 0; max-height: 42vh; flex-shrink: 1; overflow-y: auto; overscroll-behavior: contain; box-sizing: border-box; padding: 0 20px; }
.skill-target-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.skill-dialog button.skill-option {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; min-width: 0; min-height: 72px; margin: 0; padding: 10px 8px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--text); line-height: 1.4;
}
.skill-seat { font-size: 17px; font-weight: 600; }
.skill-name { display: block; width: 100%; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 400; }
.skill-check { position: absolute; top: 4px; right: 7px; font-size: 12px; font-weight: 700; }
.skill-other-choices { display: flex; flex-direction: column; flex-shrink: 0; gap: 10px; padding: 14px 20px 0; }
.skill-dialog button.skill-other { display: flex; align-items: center; justify-content: flex-start; width: 100%; min-height: 48px; margin: 0; padding: 10px 14px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 12px; text-align: left; font-size: 14px; line-height: 1.5; }
.skill-other-mark { width: 24px; flex-shrink: 0; font-size: 18px; }
.skill-dialog button.is-selected { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.skill-context { margin-bottom: 10px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.skill-footer { flex-shrink: 0; margin-top: 16px; padding: 16px 20px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface); }
.skill-summary { font-size: 14px; line-height: 1.5; color: var(--text); overflow-wrap: anywhere; }
.skill-dialog button.skill-confirm { width: 100%; min-height: 48px; margin: 12px 0 0; padding: 10px 12px; font-size: 16px; line-height: 1.5; white-space: normal; }
.skill-dialog button.skill-later { width: 100%; min-height: 44px; margin: 2px 0 0; font-size: 13px; }
.skill-dialog button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Very short viewports must keep every control reachable. */
@media (max-height: 480px) {
  .error-dialog.skill-dialog { display: block; overflow-y: auto; max-height: calc(100vh - 24px); }
  .skill-dialog .skill-body { height: auto !important; max-height: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .skill-dialog { animation: none; }
}

.history-time { white-space:nowrap; color:var(--muted); font-size:12px; font-weight:400; }

/* Player-target skills share a compact seat picker with a persistent footer. */
.dialog-backdrop.skill-target-backdrop { padding: 16px; }
.error-dialog.skill-target-dialog { --skill-footer-bg: #1f303a; --skill-disabled-bg: #34464f; width: 100%; max-width: 390px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); border-radius: 22px; border-color: var(--border); }
.skill-target-dialog .skill-header { padding: 22px 20px 16px; }
.skill-meta { margin-bottom: 8px; color: var(--accent); font-size: 12px; line-height: 1.5; }
.skill-target-dialog .skill-title { font-size: 24px; font-weight: 650; line-height: 1.4; }
.skill-target-dialog .skill-hint { margin-top: 7px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.skill-target-dialog .skill-body { max-height: 52vh; padding: 0 20px 16px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.skill-target-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; font-size: 13px; line-height: 1.5; }
.skill-target-caption { color: var(--muted); font-size: 12px; }
.skill-target-dialog .skill-target-grid { gap: 9px; }
.skill-target-dialog button.skill-option { gap: 0; min-height: 68px; padding: 8px 6px; border: 1px solid var(--control-border); border-radius: 12px; background: var(--control-bg); transition: background .14s, color .14s, border-color .14s; }
.skill-target-dialog .skill-check { top: 4px; right: 7px; font-size: 12px; line-height: 1.4; }
.skill-target-dialog .skill-seat { font-size: 22px; font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; }
.skill-target-dialog .skill-seat-unit { font-size: 11px; font-weight: 400; }
.skill-target-dialog .skill-name { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.skill-target-dialog button.skill-option.is-selected { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.skill-target-dialog .is-selected .skill-name { color: var(--bg); }
.skill-target-dialog button.skill-option-unavailable[disabled] { opacity: 1; background: var(--surface); color: var(--muted); border-color: var(--border); border-style: dashed; }
.skill-target-dialog .skill-option-unavailable .skill-name { font-size: 11px; }
.skill-target-dialog .skill-other-choices { padding: 0 20px 16px; }
.skill-target-dialog button.skill-other { min-height: 48px; padding: 10px 13px; border: 1px solid var(--control-border); border-radius: 12px; justify-content: space-between; gap: 12px; font-size: 13px; background: var(--control-bg); border-color: var(--control-border); }
.skill-target-dialog button.skill-other.is-selected { color: var(--accent); border-color: var(--accent); background: var(--surface); }
.skill-target-dialog button.skill-navigation { justify-content: center; }
.skill-target-dialog .skill-context { font-size: 13px; }
.skill-pass-mark { display: flex; align-items: center; justify-content: center; width: 17px; height: 17px; flex-shrink: 0; border: 1px solid var(--muted); border-radius: 50%; }
.is-selected .skill-pass-mark { border-color: var(--accent); }
.is-selected .skill-pass-mark::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.skill-target-dialog .skill-footer { background: var(--skill-footer-bg); margin-top: 0; padding: 15px 20px calc(8px + env(safe-area-inset-bottom)); }
.skill-consequence { margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.skill-target-dialog button.skill-confirm { min-height: 48px; padding: 12px; margin-top: 12px; font-size: 15px; font-weight: 650; border-radius: 12px; }
.skill-target-dialog button.skill-confirm[disabled] { opacity: 1; background: var(--skill-disabled-bg); color: var(--muted); }
.skill-target-dialog button[disabled] { cursor: default; }
.skill-target-dialog button.skill-later { padding: 0; min-height: 44px; margin: 0; font-size: 12px; }
@media (max-height: 480px) {
  .error-dialog.skill-target-dialog { display: block; overflow-y: auto; }
  .skill-target-dialog .skill-body { height: auto !important; max-height: none !important; overflow: visible; overscroll-behavior: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .skill-target-dialog button.skill-option { transition: none; }
}

/* Personal match records and explicit result selection. */
.stats-section { margin-top: 24px; border-block: 1px solid var(--border); }
.stats-toggle { width: 100%; min-height: 52px; display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; text-align: left; }
.stats-content { padding: 8px 0 20px; }
.stats-summary { display: flex; align-items: center; gap: 32px; flex-wrap: wrap; margin-bottom: 16px; }
.stats-rate { color: var(--accent); font-size: 36px; font-weight: 600; line-height: 1.3; }
.stats-note { margin-top: 12px; }
.stats-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 16px; flex-wrap: wrap; padding: 8px 0; }
.stats-row > :first-child { min-width: 0; overflow-wrap: anywhere; }
.stats-row > :last-child { flex-shrink: 0; }
.stats-match { border-top: 1px solid var(--border); padding: 8px 0; }
.stats-outcome { font-weight: 600; }
.stats-outcome.win { color: var(--good); }
.stats-outcome.loss { color: var(--evil); }
.result-options { display: grid; gap: 8px; margin: 20px 0; }
.result-options .is-selected { border-color: var(--accent); background: var(--surface); color: var(--accent); outline: 2px solid var(--accent); outline-offset: -2px; }
/* Personal destinations: shared palette, quieter hierarchy, generous touch targets. */
.page-title { margin: 6px 0 10px; font-size: 30px; line-height: 1.25; font-weight: 650; letter-spacing: -.5px; }
.page-subtitle { font-size: 20px; line-height: 1.4; font-weight: 600; }
.personal-heading { padding: 24px 0 18px; }
.personal-page .personal-heading { padding-top: 12px; }
.personal-page .page-back { justify-content: flex-start; padding-left: 0; }
.lobby-heading { padding: 22px 0 8px; }
.profile-hero { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; padding: 22px 0 26px; }
.profile-avatar { display: block; width: 68px; height: 68px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 1px solid var(--border); }
.profile-avatar.large { width: 104px; height: 104px; }
.avatar-fallback { display: flex; align-items: center; justify-content: center; color: var(--accent); background: var(--surface); font-size: 28px; font-weight: 600; }
.profile-identity { flex: 1; min-width: 96px; overflow-wrap: anywhere; }
.profile-name { font-size: 23px; font-weight: 600; line-height: 1.5; }
.profile-edit { width: auto; flex: 0 0 auto; min-height: 44px; color: var(--accent); padding: 8px 0 8px 8px; font-size: 14px; }
.account-note { margin: 0 0 24px; max-width: 40em; }
.personal-section { border-top: 1px solid var(--border); padding: 12px 0 28px; }
.score-rules h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 24px 0 12px; font-size: 16px; }
.score-rules h3 .small { font-weight: 400; }
.score-rules-table { overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.score-rules table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.score-rules .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.score-rules th, .score-rules td { padding: 15px 4px; text-align: center; overflow-wrap: anywhere; }
.score-rules thead { background: var(--control-bg); }
.score-rules thead th { font-size: 12px; font-weight: 400; }
.score-rules th:first-child { width: 27%; padding-left: 12px; text-align: left; }
.score-rules tbody tr { border-top: 1px solid var(--border); }
.score-rules-caption { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.score-rules-role { font-size: 14px; font-weight: 500; }
.score-rules-role.good { color: var(--third); }
.score-rules-role.evil { color: var(--evil); }
.score-rules td { font-size: 21px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.score-rules td.is-zero { color: var(--muted); font-weight: 400; }
.score-rules-bonus { padding: 16px 0; border-bottom: 1px solid var(--border); }
.score-rules-bonus h4 { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin: 0 0 6px; font-size: 15px; font-weight: 500; }
.score-rules-bonus h4 span { font-size: 20px; color: var(--accent); white-space: nowrap; }
.score-rules-bonus p { margin: 0; }
.score-rules-bonus.is-shield { padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.score-rules-bonus.is-shield h4 span { font-size: 26px; }
.personal-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; padding: 18px 0 26px; }
.metric-value { font-size: 28px; font-weight: 600; line-height: 1.4; font-variant-numeric: tabular-nums; }
.accent { color: var(--accent); }
.personal-links { border-top: 1px solid var(--border); }
.personal-link { width: 100%; justify-content: space-between; text-align: left; gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--border); border-radius: 0; min-height: 64px; }
.link-note { display: block; margin-top: 3px; }
.personal-footer { padding: 36px 0 12px; color: var(--muted); font-size: 12px; text-align: center; letter-spacing: 1px; }
.avatar-editor { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 30px 0; }
.avatar-picker { padding: 0; border-radius: 50%; }
.profile-save { width: 100%; margin-top: 32px; }
.inline-error { margin: 16px 0; padding: 14px; border: 1px solid var(--evil); border-radius: 12px; color: var(--evil); }
.inline-error button { margin-top: 12px; width: 100%; }
.empty-records { padding: 32px 0; }

.has-bottom-nav { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
.bottom-navigation { position: fixed; z-index: 90; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; padding: 6px 16px calc(6px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--border); }
.nav-destination { flex: 1; max-width: 240px; min-height: 56px; display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 12px; padding: 4px; }
.nav-destination.active { color: var(--accent); }
.profile-form { margin-top: 4px; }
.page-title:focus { outline: none; }

/* Profile editing follows the mini program's layout and avatar catalog. */
.profile-navigation { position: sticky; top: 0; z-index: 100; background: var(--bg); border-bottom: 1px solid var(--border); }
.profile-navigation-content { position: relative; display: flex; align-items: center; justify-content: center; min-height: 56px; max-width: 460px; margin: 0 auto; }
.profile-title { max-width: 52%; margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.3; }
.profile-title:focus { outline: none; }
button.profile-back { position: absolute; left: 12px; width: 44px; min-height: 48px; padding: 0; justify-content: flex-start; font-size: 30px; line-height: 1; }
.page.profile-page { padding-top: 12px; padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
.page.profile-page.has-pending-save { padding-bottom: calc(132px + env(safe-area-inset-bottom)); }
.profile-page .profile-form { margin: 0; }
.profile-page .avatar-editor { gap: 8px; padding: 8px 0 20px; }
.profile-page .avatar-preview .profile-avatar.large { width: 92px; height: 92px; }
.nickname-editor { width: 100%; max-width: 300px; text-align: center; }
button.nickname-display { width: auto; max-width: 100%; min-height: 48px; margin: 0 auto; padding: 6px 10px; gap: 8px; }
.nickname-text { min-width: 0; font-size: 1.25rem; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.nickname-edit-icon { flex-shrink: 0; width: 18px; height: 18px; color: var(--accent); }
.nickname-input-row { display: flex; align-items: center; gap: 6px; min-height: 48px; }
.input.nickname-input { flex: 1; min-width: 0; width: 0; height: 48px; margin: 0; border-color: var(--accent); text-align: center; font-size: 1.125rem; }
.input.nickname-input.is-invalid { border-color: var(--evil); }
button.nickname-done { width: auto; flex-shrink: 0; min-height: 48px; padding: 6px 8px; color: var(--accent); font-size: .875rem; }
.nickname-error { margin-top: 6px; color: var(--evil); font-size: .8125rem; }
.avatar-library { margin: 0; }
.avatar-library .field-title { margin: 0; padding-bottom: 10px; border-bottom: 1px solid var(--border); font-size: .9375rem; }
.avatar-styles { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 8px; padding-top: 8px; }
button.avatar-style { width: 100%; min-width: 0; min-height: 44px; margin: 0; padding: 6px 2px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); background: transparent; font-size: .875rem; line-height: 1.5; white-space: nowrap; }
button.avatar-style.is-active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
button.avatar-style:not(:disabled):hover { color: var(--accent); }
.avatar-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; padding: 10px 0 0; }
.avatar-grid button.avatar-option { position: relative; width: 100%; min-width: 0; min-height: 68px; padding: 6px 2px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted); scroll-margin-block: 72px 110px; }
.avatar-option-image { display: block; width: 52px; height: 52px; max-width: 100%; object-fit: cover; border-radius: 50%; }
.avatar-option-selected { position: absolute; right: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); color: var(--bg); font-size: 12px; line-height: 16px; text-align: center; }
.avatar-grid button.avatar-option.is-selected { border-color: var(--accent); background: var(--surface); color: var(--accent); }
.avatar-grid button.avatar-option:not(:disabled):hover, .avatar-grid button.avatar-option:not(:disabled):active { background: var(--surface); }
.profile-save-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; border-top: 1px solid var(--border); background: var(--bg); padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); }
.profile-save-content { max-width: 428px; margin: 0 auto; }
.profile-save-bar .profile-save { width: 100%; min-height: 48px; margin: 0; }
.profile-save-hint { margin-bottom: 8px; text-align: center; }
.profile-page button:focus-visible, .profile-navigation button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: none) and (pointer: coarse) {
  .profile-page:has(.nickname-input:focus) .profile-save-bar { display: none; }
}

.leaderboard-page { padding-bottom: calc(11rem + env(safe-area-inset-bottom)); }
.rank-period { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: var(--surface); }
.rank-period button { flex: 1 1 0%; width: 0; min-width: 0; color: var(--muted); }
.rank-period button[aria-pressed="true"] { background: var(--bg); color: var(--text); }
.rank-period button:not(:disabled):active, button.rank-metric:not(:disabled):active { opacity: 1; }
.rank-metrics { display: flex; width: 100%; margin: 16px 0 20px; border-bottom: 1px solid var(--border); }
button.rank-metric { flex: 1 1 0%; width: 0; min-width: 0; max-width: 25%; padding: 0; border: 0; border-radius: 0; color: var(--muted); font-size: 14px; text-align: center; }
.rank-metric-label { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 12px 0; white-space: nowrap; }
.rank-metric-indicator { position: absolute; bottom: 0; left: 0; right: 0; height: 2px; border-radius: 2px; background: transparent; }
button.rank-metric[aria-pressed="true"] { color: var(--accent); }
button.rank-metric.good[aria-pressed="true"] { color: var(--good); }
button.rank-metric.evil[aria-pressed="true"] { color: var(--evil); }
.rank-metric[aria-pressed="true"] .rank-metric-indicator { background: currentColor; }
.rank-list-heading { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
.rank-list { padding: 0; margin: 0; list-style: none; }
.rank-row { display: flex; align-items: center; gap: 10px; box-sizing: border-box; min-height: 78px; padding: 12px 10px; border-bottom: 1px solid rgba(177,191,198,.18); }
.rank-row.is-self { background: var(--surface); border-radius: 10px; border-bottom-color: transparent; box-shadow: inset 2px 0 var(--accent); }
.rank-number { flex-shrink: 0; width: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank-place-1 { color: var(--accent); }
.rank-place-2 { color: #c1cdd6; }
.rank-place-3 { color: #c99778; }
.rank-crown { width: 20px; height: 16px; }
.rank-avatar { flex-shrink: 0; width: 36px; height: 36px; object-fit: cover; border-radius: 50%; background: var(--surface); }
.rank-avatar-fallback { display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.rank-identity { min-width: 0; flex: 1; }
.rank-name { font-weight: 500; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-value { flex-shrink: 0; font-size: 22px; font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.rank-unit { margin-left: 3px; font-size: 12px; color: var(--muted); font-weight: 400; }
.rank-empty { padding: 36px 0; text-align: center; }
button.rank-more { margin-top: 16px; color: var(--accent); }
button.rank-refresh { margin: 20px 0; }
.rank-mine { position: fixed; z-index: 10; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 460px; padding: 16px 20px calc(16px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); }
.rank-mine-content { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.rank-mine-copy { min-width: 0; }
.rank-mine-label { color: var(--muted); font-size: 12px; line-height: 1.5; margin-bottom: 4px; }
.rank-mine-place, .rank-mine-value { color: var(--accent); font-size: 28px; font-weight: 600; line-height: 1.25; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-mine-prefix, .rank-mine-unit, .rank-mine-value .rank-unit { color: var(--muted); font-size: 14px; font-weight: 400; }
.rank-mine-prefix { margin-right: 4px; }
.rank-mine-unit { margin-left: 4px; }
.rank-mine-place.is-unranked { color: var(--muted); font-size: 18px; line-height: 35px; }
.rank-mine-metric { min-width: 0; text-align: right; }
.leaderboard-page .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.leaderboard-page button:focus-visible, .rank-visibility input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 360px) { .rank-row { gap: 8px; } .rank-metric { font-size: 13px; } }
@media (max-height: 500px) { .rank-mine { position: static; transform: none; margin-top: 24px; } .leaderboard-page { padding-bottom: 0; } }

.rank-visibility { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; margin-top: 8px; border-top: 1px solid var(--border); font-size: 14px; }
.rank-visibility input { appearance: none; flex-shrink: 0; width: 48px; height: 28px; border-radius: 20px; background: var(--bg); border: 1px solid var(--border); position: relative; cursor: pointer; }
.rank-visibility input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); }
.rank-visibility input:checked { background: var(--accent); }
.rank-visibility input:checked::after { left: 23px; background: var(--bg); }
.rank-visibility input:disabled { opacity: .5; cursor: wait; }
.rank-visibility-error { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--evil); }

.rank-rates, .matches-filters { display: flex; gap: 8px; margin: 0 0 20px; }
.rank-rates button, .matches-filters button { flex: 1; width: 0; min-width: 0; min-height: 48px; margin: 0; }
.rank-rates button[aria-pressed="true"], .matches-filters button[aria-pressed="true"] { color: var(--accent); background: var(--surface); }
.score-reasons { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.score-reasons button { margin: 0; width: 100%; min-height: 48px; white-space: normal; }
.score-targets { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-bottom: 16px; }
.score-targets button { min-width: 0; min-height: 48px; margin: 0; overflow-wrap: anywhere; }
.score-reasons button.is-selected, .score-targets button.is-selected { border-color: var(--accent); color: var(--accent); outline: 2px solid var(--accent); outline-offset: -2px; }
.score-dialog { max-height: 85dvh; overflow-y: auto; }
.score-breakdown { margin: 16px 0; padding: 12px 0; }
.score-breakdown summary, .stats-match > summary { min-height: 48px; cursor: pointer; }
.score-award { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; }
.score-stats { padding: 16px 0; line-height: 1.8; }
.score-overview .history-heading .text-button { flex: 0 0 auto; width: auto; margin: 0; color: var(--accent); }
.score-overview .personal-metrics .text-button { color: var(--accent); }
button.rank-metric { max-width: 25%; }
.stats-tabs { display: flex; gap: 8px; margin: 20px 0; }
.stats-tabs button { flex: 1; width: 0; min-height: 48px; margin: 0; color: var(--muted); border-bottom: 1px solid var(--border); border-radius: 0; }
.stats-tabs button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.fun-card { padding: 24px 0; border-bottom: 1px solid var(--border); }
.fun-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.fun-heading h2 { margin: 0; font-size: 18px; }
.fun-metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin: 16px 0; }
.fun-metrics.three { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
button.fun-metric { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; min-width: 0; min-height: 72px; padding: 8px 0; margin: 0; text-align: left; }
.fun-number { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fun-number .small { display: inline; }
.fun-number.good { color: var(--good); } .fun-number.evil { color: var(--evil); }
.fun-bar { width: 100%; height: 6px; display: block; overflow: hidden; border-radius: 4px; background: var(--border); }
.fun-bar-good { fill: var(--good); } .fun-bar-evil { fill: var(--evil); } .fun-bar-muted { fill: var(--muted); }
.fun-caption { margin: 12px 0; line-height: 1.7; }
.fun-roles summary { cursor: pointer; min-height: 48px; padding-top: 12px; color: var(--accent); }
.fun-role { padding: 12px; background: var(--surface); border-radius: 8px; margin-bottom: 8px; }
.fun-role-metrics { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.fun-role-metrics button { font-size: 13px; min-height: 48px; margin: 0; padding: 0; }
.fun-note, .fun-empty { margin: 20px 0; }
.match-fun { margin-top: 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.match-fun-label { color: var(--accent); margin-top: 8px; font-size: 13px; }
.fun-event { padding: 12px 0; }
.fun-filter { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--accent); }
.fun-rank-filters { margin-bottom: 24px; }
.fun-rank-tabs { position: relative; display: flex; gap: 8px; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; padding: 4px 4px 12px; margin-bottom: 8px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.fun-rank-tab { flex: none; width: auto; min-height: 48px; margin: 0; padding: 10px 14px; font-size: 13px; white-space: nowrap; color: var(--muted); background: var(--surface); border: 1px solid transparent; }
.fun-rank-tab[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.fun-rank-tab:active { opacity: .75; }
.fun-rank-selects { display: flex; gap: 8px; margin-bottom: 12px; }
.fun-select { flex: 1; min-width: 0; }
.fun-picker, .fun-picker.option-trigger { min-width: 0; width: 100%; min-height: 48px; margin: 0; font-size: 13px; padding: 10px 8px; overflow-wrap: anywhere; }
.fun-sort { flex: 1; min-width: 0; display: flex; }
.fun-sort button { flex: 1; width: 0; min-height: 48px; margin: 0; padding: 10px 8px; font-size: 13px; color: var(--muted); }
.fun-sort button[aria-pressed="true"] { color: var(--accent); background: var(--surface); }
.fun-mine-sample { margin-top: 12px; }
.leaderboard-page.fun-leaderboard { padding-bottom: calc(15rem + env(safe-area-inset-bottom)); }
@media (max-height: 500px) { .leaderboard-page.fun-leaderboard { padding-bottom: 0; } }

/* Compact personal overview and consistent record hierarchy. */
.personal-page .personal-heading { padding: 8px 0 16px; }
.personal-page .page-title { font-size: 24px; margin: 0; }
.personal-page .page-back { min-height: 44px; margin: 0; }
.stats-breakdown { margin-top: 24px; }
.stats-breakdown .page-subtitle { font-size: 18px; margin: 0 0 8px; }
.faction-group { border-bottom: 1px solid var(--border); }
.faction-group > summary { cursor: pointer; min-height: 64px; padding: 12px 0; }
.faction-heading { display: inline-flex; flex-direction: column; gap: 4px; }
.role-list { padding: 8px 12px; background: var(--surface); border-radius: 12px; margin-bottom: 12px; }
.role-row { display: grid; grid-template-columns: minmax(0,1.6fr) repeat(3,minmax(0,.7fr)); gap: 8px; padding: 12px 0; font-size: 14px; font-variant-numeric: tabular-nums; border-bottom: 1px solid rgba(177,191,198,.14); }
.role-row > span { overflow-wrap: anywhere; }
.role-row > span:not(:first-child) { text-align: right; }
.role-list-heading { color: var(--muted); font-size: 12px; }
.stats-record-link { width: 100%; justify-content: flex-start; padding: 12px 0; color: var(--accent); min-height: 48px; margin-top: 16px; font-size: 14px; }
.fun-card { padding: 16px; margin: 12px 0; border: 0; border-radius: 12px; background: var(--surface); }
.fun-heading { align-items: flex-start; }
.fun-heading h2 { min-width: 0; overflow-wrap: anywhere; font-size: 17px; }
.fun-heading > span { flex-shrink: 0; }
.fun-number { overflow-wrap: anywhere; font-size: 24px; }
.fun-description { margin: 8px 0; font-size: 12px; line-height: 1.75; }
.fun-role-toggle { min-height: 48px; margin: 0; padding: 12px 0; color: var(--accent); font-size: 14px; }
.stats-summary { padding: 16px; border-radius: 12px; background: var(--surface); }
.stats-tabs { margin: 12px 0; }
/* Ranking controls leave room for the actual list. */
.leaderboard-page, .leaderboard-page.fun-leaderboard { padding-bottom: calc(7rem + env(safe-area-inset-bottom)); }
.rank-metrics { margin: 8px 0 12px; }
.rank-row { min-height: 64px; padding-top: 12px; padding-bottom: 12px; }
.rank-name { white-space: normal; overflow-wrap: anywhere; }
.rank-filter-heading, .rank-rule-heading, .rank-details-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rank-filter-heading { justify-content: flex-end; }
.rank-disclosure { flex-shrink: 0; width: auto; min-height: 44px; margin: 0; padding: 8px 0 8px 8px; color: var(--accent); font-size: 13px; }
.rank-rule-detail { padding: 10px 12px; background: var(--surface); border-radius: 8px; }
.fun-rank-filters { margin-bottom: 12px; }
.fun-rank-tabs { margin: 0; padding-bottom: 8px; }
.fun-rank-tabs.is-expanded { flex-wrap: wrap; }
.fun-rank-tabs.is-expanded .fun-rank-tab { max-width: 100%; white-space: normal; }
.rank-mine { padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); }
.rank-mine-toggle { width: 100%; min-height: 56px; margin: 0; padding: 0; display: flex; justify-content: space-between; text-align: left; gap: 12px; }
.rank-mine-brief { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rank-mine .rank-mine-place, .rank-mine .rank-mine-value { font-size: 18px; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
.rank-details-dialog { padding: 0; max-width: 440px; display: flex; flex-direction: column; overflow: hidden; }
.rank-details-header { padding: 12px 20px; flex-shrink: 0; border-bottom: 1px solid var(--border); }
.rank-details-body { overflow-y: auto; padding: 20px; min-height: 0; max-height: 55dvh; }
.rank-details-body .rank-mine-content { align-items: flex-start; }
.rank-details-body .rank-mine-value { overflow-wrap: anywhere; white-space: normal; }
/* Result registration: one selection task, a separate fallback panel, fixed actions. */
.score-backdrop { padding: 16px; }
.error-dialog.score-dialog { --score-inset: #15252f; --score-selected: #303832; --score-border: #647984; --score-divider: #344954; width: 100%; max-width: 440px; height: auto; max-height: min(760px, calc(100dvh - 32px)); padding: 0; display: flex; flex-direction: column; overflow: hidden; border-radius: 20px; }
.score-header { padding: 24px 22px 22px; flex-shrink: 0; border-bottom: 1px solid var(--score-divider); }
.score-header .dialog-title { padding: 0; margin: 0 0 23px; border: 0; font-size: 23px; line-height: 1.4; font-weight: 650; }
.rank-details-header .dialog-title { padding: 0; margin: 0; border: 0; }
.score-step-label { outline: none; }
.score-step-label:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; border-radius: 4px; }
.score-steps { display: flex; align-items: center; gap: 8px; list-style: none; padding: 0; margin: 0; }
.score-step { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.score-step.is-current { color: var(--accent); font-weight: 600; }
.score-step.is-complete { color: var(--text); }
.score-step-number { width: 21px; height: 21px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border: 1px solid #7b8c94; border-radius: 50%; font-size: 11px; line-height: 1; font-variant-numeric: tabular-nums; }
.score-step.is-current .score-step-number { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.score-step-connector { flex: 1; min-width: 5px; height: 1px; background: #50646f; }
.score-steps.has-extra-step { justify-content: space-between; gap: 6px; }
.score-steps.has-extra-step .score-step { gap: 4px; font-size: 11px; }
.score-steps.has-extra-step .score-step-number { width: 18px; height: 18px; }
.score-steps.has-extra-step .score-step-connector { display: none; }
.score-body { min-height: 0; flex: 0 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 23px 22px 22px; scroll-padding: 10px; }
.score-body.score-registration-body { padding-top: 18px; padding-bottom: 18px; }
.score-section-title { margin: 0 0 5px; font-size: 17px; font-weight: 600; line-height: 1.5; }
.score-helper { color: var(--muted); margin: 0 0 18px; font-size: 13px; line-height: 1.65; white-space: pre-line; }
.score-dialog .score-reasons { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.score-dialog button.score-choice { width: 100%; min-height: 64px; display: flex; align-items: center; justify-content: flex-start; gap: 13px; margin: 0; padding: 14px; border: 1px solid var(--score-border); border-radius: 12px; background: var(--score-inset); color: var(--text); text-align: left; white-space: normal; line-height: 1.5; transition: background 150ms, border-color 150ms; }
.score-dialog button.score-choice.is-selected { background: var(--score-selected); border-color: var(--accent); outline: none; box-shadow: inset 0 0 0 .5px var(--accent); }
.score-choice-mark { position: relative; width: 21px; height: 21px; flex-shrink: 0; border: 1.5px solid #96a7af; border-radius: 50%; box-sizing: border-box; }
.is-selected .score-choice-mark { border-color: var(--accent); background: var(--accent); }
.is-selected .score-choice-mark::after { content: ""; position: absolute; left: 6px; top: 3px; width: 4px; height: 8px; border-right: 2px solid var(--bg); border-bottom: 2px solid var(--bg); transform: rotate(45deg); }
.score-choice-title { display: block; font-size: 16px; font-weight: 550; line-height: 1.5; overflow-wrap: anywhere; }
.is-selected .score-choice-title { color: var(--accent); }
.score-dialog button.score-other-entry { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; min-height: 52px; margin: 0 0 12px; padding: 10px 14px; border: 1px solid var(--score-border); border-radius: 10px; color: var(--text); background: var(--score-inset); text-align: left; line-height: 1.5; font-size: 16px; font-weight: 550; }
.score-other-entry strong { font-size: inherit; font-weight: inherit; }
.score-entry-title { font-size: 14px; font-weight: 550; }
.score-chevron { width: 8px; height: 8px; margin-right: 4px; flex-shrink: 0; border-top: 1.7px solid currentColor; border-right: 1.7px solid currentColor; transform: rotate(45deg); color: var(--muted); }
.score-option-heading { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin: 0 0 12px; font-size: 14px; }
.score-option-heading > :last-child { color: var(--muted); font-size: 12px; }
.score-winners { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.score-dialog .score-winners button.score-choice { min-height: 62px; gap: 9px; padding: 13px 12px; }
.score-winners button:last-child:nth-child(odd) { grid-column: 1 / -1; }
.score-dialog .score-winners + button.score-excluded { margin-top: 18px; }
.score-footer { flex-shrink: 0; border-top: 1px solid var(--score-divider); padding: 15px 22px calc(22px + env(safe-area-inset-bottom)); }
.score-footer.has-other-entry { padding-top: 6px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.score-next-hint { display: flex; align-items: center; gap: 7px; min-height: 19px; margin: 0 0 12px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.score-dialog .dialog-actions { gap: 12px; padding: 0; margin: 0; border: 0; }
.score-dialog .dialog-actions button { min-height: 50px; padding: 12px 16px; font-size: 16px; line-height: 1.5; border-radius: 10px; }
.score-dialog .dialog-actions button.score-back-button { flex: 0 0 70px; width: 70px; min-width: 70px; padding: 12px 8px; background: transparent; border: 0; font-size: 15px; font-weight: 500; }
.score-dialog .dialog-actions button.primary { display: flex; align-items: center; justify-content: center; gap: 10px; }
.score-dialog .dialog-actions button.primary:disabled { background: #354852; color: #a1b0b8; opacity: 1; }
.score-forward { position: relative; width: 18px; height: 14px; flex-shrink: 0; }
.score-forward::before { content: ""; position: absolute; width: 14px; height: 1.5px; top: 6px; left: 1px; background: currentColor; }
.score-forward::after { content: ""; position: absolute; width: 6px; height: 6px; border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor; transform: rotate(45deg); right: 2px; top: 3px; }
button:disabled .score-forward { display: none; }
.score-dialog .score-targets { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin: 18px 0 0; }
.score-targets button.secondary { margin: 0; min-height: 78px; padding: 12px 4px; flex-direction: column; gap: 4px; border-radius: 12px; }
.score-dialog button.score-empty-target { grid-column: 1 / -1; min-height: 54px; }
.score-player-name { font-size: 13px; max-width: 100%; overflow-wrap: anywhere; }
.result-review-row { display: flex; flex-direction: column; gap: 7px; padding: 15px 0; border-bottom: 1px solid var(--score-divider); overflow-wrap: anywhere; }
.result-review-note { margin: 18px 0 0; color: var(--accent); font-size: 13px; line-height: 1.7; }
.result-warning { color: var(--evil); margin-top: 16px; font-size: 13px; }
.score-dialog button:focus-visible, .rank-details-dialog button:focus-visible, .rank-mine-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (max-width: 390px) {
  .score-header, .score-body, .score-footer { padding-left: 18px; padding-right: 18px; }
  .score-step { gap: 5px; font-size: 11px; }
  .score-dialog button.score-choice { padding-left: 11px; padding-right: 11px; gap: 11px; }
  .score-choice-title { font-size: 15px; }
}
@media (max-height: 500px) {
  .score-header { padding-top: 14px; padding-bottom: 14px; }
  .score-header .dialog-title { margin-bottom: 12px; font-size: 21px; }
  .score-body { padding-top: 16px; padding-bottom: 16px; }
  .score-footer { padding-top: 10px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .score-next-hint { margin-bottom: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .score-dialog button.score-choice { transition: none; }
}



  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b1bfc6' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4v5h5M3 9a9 9 0 1 1 0 6M12 7v5l3 2'/%3E%3C/svg%3E");
}
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e6b0bd' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cellipse cx='12' cy='5' rx='8' ry='3'/%3E%3Cpath d='M4 5v14c0 1.7 3.6 3 8 3s8-1.3 8-3V5M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3'/%3E%3C/svg%3E");
}

  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b1bfc6' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5.5C9 3.5 5.5 3.5 2 4.5v15c3.5-1 7-1 10 1 3-2 6.5-2 10-1v-15c-3.5-1-7-1-10 1Zm0 0v15'/%3E%3C/svg%3E");
}


/* Same-room historical player summary; game actions retain their own dialogs. */
.player-card-backdrop { align-items: flex-end; padding: 0; }
.player-card-sheet { display: flex; flex-direction: column; max-height: 92vh; width: 100%; max-width: 450px; margin: 0 auto; box-sizing: border-box; background: var(--surface); border: 0.5px solid var(--border); border-bottom: 0; border-radius: 18px 18px 0 0; padding: 8px 16px calc(12px + env(safe-area-inset-bottom)); }
.player-card-handle { flex-shrink: 0; width: 32px; height: 3px; border-radius: 3px; background: var(--border); margin: 0 auto 4px; }
.player-card-heading { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
button.player-card-close { margin: 0 -8px 0 0; padding: 0; width: 48px; min-height: 48px; font-size: 24px; font-weight: 400; }
.player-card-body { flex-shrink: 1; min-height: 0; max-height: 70vh; scrollbar-width: none; }
.player-card-body::-webkit-scrollbar { display: none; width: 0; height: 0; }
.player-card-identity { display: flex; align-items: center; gap: 12px; padding: 6px 0 14px; }
.player-card-avatar { position: relative; flex-shrink: 0; width: 56px; height: 56px; border-radius: 50%; overflow: hidden; background: var(--bg); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 22px; }
.player-card-avatar-image { position: absolute; inset: 0; width: 100%; height: 100%; }
.player-card-name { min-width: 0; overflow-wrap: anywhere; }
.player-card-display-name { display: block; font-size: 19px; font-weight: 600; }
.player-card-summary { display: flex; flex-wrap: wrap; padding: 4px 12px; border: 0.5px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.02); }
.player-card-stat { position: relative; flex: 0 0 50%; min-width: 0; box-sizing: border-box; padding: 8px 12px; }
.player-card-stat:nth-child(-n+2) { border-bottom: 0.5px solid var(--border); }
.player-card-stat:nth-child(odd)::after { content: ''; position: absolute; right: 0; top: 8px; bottom: 8px; width: 0.5px; background: var(--border); }
.player-card-number { display: block; font-size: 26px; line-height: 1.25; margin-top: 2px; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.player-card-score-value { color: var(--accent); }
.player-card-section-title { display: block; font-size: 18px; font-weight: 600; }
.player-card-overview-title { padding: 16px 0 10px; border-top: 0.5px solid var(--border); }
.player-card-factions { margin-top: 24px; }
.player-card-factions-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.player-card-faction { padding: 14px 0; }
.player-card-faction + .player-card-faction { border-top: 0.5px solid var(--border); }
.player-card-faction-info { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.player-card-faction-label { font-size: 16px; font-weight: 600; }
.player-card-faction-rate { margin-left: auto; text-align: right; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.player-card-faction-track { height: 7px; margin-top: 10px; border-radius: 7px; overflow: hidden; background: var(--border); }
.player-card-faction-fill { height: 100%; max-width: 100%; border-radius: inherit; background: currentColor; }
.player-card-empty { padding-top: 10px; }
.player-card-message { padding: 24px 0; text-align: center; }
.proposal-player-options { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; }
.proposal-player-options button { min-width: 28%; margin: 0; border: 0.5px solid var(--border); }
.proposal-player-options button.selected { border-color: var(--accent); color: var(--accent); }

.player-card-body { overflow-y: auto; overscroll-behavior: contain; }
body:has(.player-card-backdrop) { overflow: hidden; }
.player-card-sheet button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button.rank-avatar-button { flex: 0 0 48px; width: 48px; min-height: 48px; margin: 0; padding: 0; border-radius: 50%; }
button.rank-avatar-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Public record drawer. Scoped independently from the latest-result card. */
.page.has-public-history { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
.page.has-public-history.has-host-bar { padding-bottom: calc(190px + env(safe-area-inset-bottom)); }
.public-history-dock { position: fixed; z-index: 900; left: 0; right: 0; bottom: 0; padding: 4px 16px calc(4px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 0.5px solid var(--accent); box-shadow: 0 -4px 16px rgba(0,0,0,.16); box-sizing: border-box; }
button.public-history-entry { display: flex; gap: 12px; width: 100%; max-width: 450px; min-height: 48px; margin: 0 auto; padding: 4px 0; border: 0; border-radius: 0; background: transparent; text-align: left; justify-content: flex-start; }
.public-history-icon { flex-shrink: 0; width: 22px; height: 22px; border: 1.5px solid var(--accent); border-radius: 50%; position: relative; box-sizing: border-box; }
.public-history-icon::before { content: ''; position: absolute; top: 3.5px; left: 8.5px; width: 5px; height: 6.5px; border-left: 1.5px solid var(--accent); border-bottom: 1.5px solid var(--accent); }
.public-history-entry-copy { flex: 1; min-width: 0; }
.public-history-entry-title { display: flex; align-items: baseline; gap: 6px; color: var(--text); font-size: 15px; font-weight: 600; }
.public-history-total { color: var(--muted); font-size: 12px; font-weight: 400; }
.public-history-preview { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.public-history-preview.success, .public-history-count.success, .public-history-count.approve { color: var(--good); }
.public-history-preview.failure, .public-history-count.failure, .public-history-count.reject { color: var(--evil); }
.public-history-count.abstain { color: var(--muted); }
.public-history-badge { flex-shrink: 0; border-radius: 14px; padding: 2px 8px; background: var(--accent); color: var(--bg); font-size: 12px; font-weight: 600; }
.public-history-chevron { flex-shrink: 0; width: 6px; height: 6px; border-right: 1.5px solid var(--accent); border-bottom: 1.5px solid var(--accent); transform: rotate(45deg); margin: 0 3px; }
.public-history-chevron.is-expanded { transform: rotate(225deg); }
.public-history-chevron.is-forward { transform: rotate(-45deg); }
.public-history-dock.with-host-actions .public-history-entry { min-height: 44px; padding: 2px 0 6px; }
.public-history-dock.with-host-actions .public-history-icon { width: 18px; height: 18px; }
.public-history-dock.with-host-actions .public-history-icon::before { top: 2.5px; left: 6.5px; height: 5.5px; width: 4px; }
.public-history-dock .host-action-bar-inner { padding-top: 6px; border-top: 0.5px solid var(--border); }
.dialog-backdrop.public-history-backdrop { align-items: flex-end; padding: 0; background: rgba(0,0,0,.58); }
.public-history-sheet { --history-divider: rgba(177,191,198,.14); --history-latest-bg: #303934; display: flex; flex-direction: column; box-sizing: border-box; width: 100%; max-width: 450px; height: 84vh; max-height: calc(100vh - env(safe-area-inset-top) - 12px); padding: 10px 12px calc(8px + env(safe-area-inset-bottom)); border: 1px solid var(--history-divider); border-bottom: 0; border-radius: 20px 20px 0 0; background: var(--surface); text-align: left; animation: public-history-enter 200ms ease-out; }
.public-history-handle { flex-shrink: 0; width: 32px; height: 3px; margin: 0 auto 8px; border-radius: 4px; background: var(--border); }
.public-history-header { display: flex; flex-shrink: 0; align-items: center; gap: 8px; padding: 0 4px; }
.public-history-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; flex: 1; min-width: 0; }
.public-history-title { font-size: 21px; font-weight: 650; line-height: 1.4; }
.public-history-subtitle { color: var(--muted); font-size: 13px; }
button.public-history-close { flex-shrink: 0; width: 44px; min-width: 44px; min-height: 44px; margin: 0; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 28px; font-weight: 400; }
.public-history-filters { display: flex; flex-shrink: 0; gap: 8px; margin: 8px 4px 0; border-bottom: 1px solid var(--history-divider); }
button.public-history-filter { flex: 1; min-width: 0; min-height: 44px; padding: 8px 0; margin: 0; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); font-size: 14px; font-weight: 400; }
button.public-history-filter.is-active { border-bottom-color: var(--accent); color: var(--accent); font-weight: 600; }
.public-history-toolbar { display: flex; flex-shrink: 0; justify-content: space-between; align-items: center; gap: 8px; min-height: 34px; padding: 0 4px; }
.public-history-order { color: var(--muted); font-size: 12px; }
button.public-history-new { min-height: 44px; width: auto; margin: 0; padding: 4px 0; background: transparent; border: 0; color: var(--accent); font-size: 12px; }
.public-history-body { flex: 1; height: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.public-history-row { position: relative; padding: 10px 0; border-radius: 10px; scroll-margin-top: 4px; }
.public-history-row::before { content: ''; position: absolute; top: 0; bottom: 0; left: 14px; width: 1px; background: var(--history-divider); pointer-events: none; }
.public-history-row:first-child::before { top: 32px; }
.public-history-row:last-child::before { bottom: auto; height: 32px; }
.public-history-row:only-child::before { display: none; }
.public-history-row::after { content: ''; position: absolute; bottom: 0; left: 36px; right: 4px; height: 1px; background: var(--history-divider); pointer-events: none; }
.public-history-row.is-latest { background: var(--history-latest-bg); }
.public-history-row.is-latest::after { display: none; }
.public-history-row.is-focused { animation: public-history-locate 2.4s ease-out; }
.public-history-summary { position: relative; display: flex; align-items: flex-start; gap: 12px; width: 100%; min-width: 0; min-height: 44px; padding: 10px 4px; box-sizing: border-box; }
.public-history-copy { flex: 1; min-width: 0; }
.public-history-headline { display: flex; align-items: center; gap: 8px; min-width: 0; }
.public-history-row-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; font-size: 16px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
button.public-history-row-toggle { display: block; width: 100%; min-height: 44px; margin: 0; padding: 0; border: 0; border-radius: 8px; background: transparent; text-align: left; }
button.public-history-row-toggle:active { opacity: 1; background: rgba(177,191,198,.06); }
.public-history-chevron-slot { display: flex; flex: 0 0 12px; width: 12px; min-height: 24px; align-items: center; justify-content: center; }
.public-history-chevron-slot > .public-history-chevron { width: 6px; height: 6px; border-width: 1.5px; margin: 0; }
.public-history-new-mark { white-space: nowrap; font-size: 12px; font-weight: 500; color: var(--bg); background: var(--accent); border-radius: 3px; padding: 0 4px; }
.public-history-latest-mark { flex-shrink: 0; white-space: nowrap; padding: 1px 6px; border: 1px solid rgba(229,198,139,.3); border-radius: 5px; color: var(--accent); font-size: 12px; font-weight: 500; line-height: 20px; }
.public-history-meta { display: block; flex: 0 0 46px; width: 46px; min-height: 24px; text-align: right; white-space: nowrap; color: var(--muted); font-size: 12px; font-weight: 400; line-height: 24px; font-variant-numeric: tabular-nums; }
.public-history-team, .public-history-inspection { color: var(--muted); font-size: 13px; font-weight: 400; margin-top: 8px; line-height: 1.6; overflow-wrap: anywhere; }
.public-history-inspection { display: block; }
.public-history-team { display: flex; align-items: baseline; gap: 10px; }
.public-history-team-label { flex-shrink: 0; }
.public-history-team-seats { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.public-history-team-seat { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; min-height: 26px; padding: 0 8px; border: 1px solid var(--history-divider); border-radius: 8px; color: var(--text); font-size: 13px; line-height: 24px; white-space: nowrap; }
.public-history-counts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 13px; font-weight: 400; }
.public-history-count { padding: 2px 8px; border: 1px solid var(--history-divider); border-radius: 6px; line-height: 22px; }
.public-history-count.success, .public-history-count.approve { border-color: rgba(163,223,190,.28); background: rgba(163,223,190,.06); }
.public-history-count.failure, .public-history-count.reject { border-color: rgba(242,182,174,.28); background: rgba(242,182,174,.06); }
.public-history-details { position: relative; margin: 0 4px 8px 36px; padding: 8px 0 4px; }
.public-history-details > .public-history-team:first-child, .public-history-details > .public-history-counts:first-child { margin-top: 0; }
.public-history-details .public-history-voters { margin-top: 12px; }
.public-history-details > .public-history-note:last-child:not(:first-child) { margin-top: 12px; }
.public-history-note { color: var(--muted); font-size: 13px; white-space: pre-line; overflow-wrap: anywhere; line-height: 1.7; }
.public-history-note-badge { display: inline-block; max-width: 100%; box-sizing: border-box; padding: 2px 8px; margin-bottom: 10px; border: 1px solid rgba(229,198,139,.24); border-radius: 6px; background: rgba(229,198,139,.06); color: var(--accent); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.public-history-vote-group { display: flex; align-items: flex-start; gap: 12px; margin-top: 10px; }
.public-history-vote-group:first-child { margin-top: 0; }
.public-history-vote-label { flex: 0 0 2em; color: var(--muted); font-size: 13px; line-height: 26px; }
.public-history-seat-list { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); flex: 1; gap: 5px; min-width: 0; }
.public-history-seat { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; min-width: 0; min-height: 26px; padding: 0 2px; border: 1px solid var(--history-divider); border-radius: 5px; color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.public-history-result { font-weight: 400; display: flex; align-items: flex-start; gap: 8px; padding: 10px 0; font-size: 13px; color: var(--text); line-height: 28px; }
.public-history-result + .public-history-result { border-top: 1px solid var(--history-divider); }
.public-history-result:first-child { padding-top: 0; }
.public-history-result:last-child { padding-bottom: 0; }
.public-history-result-label { flex: 0 0 5em; }
.public-history-result-value { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; color: var(--muted); }
.public-history-result-seat { display: inline-flex; align-items: center; justify-content: center; padding: 0 8px; min-height: 28px; border-radius: 6px; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.public-history-result-seat.failure { background: rgba(242,182,174,.12); color: var(--evil); }
.public-history-result-seat.success { background: rgba(163,223,190,.12); color: var(--good); }
.public-history-result.is-final .public-history-result-label { font-weight: 600; }
.public-history-outcome-icon { position: relative; flex: 0 0 16px; width: 16px; height: 16px; margin-top: 5px; border: 1.5px solid currentColor; border-radius: 50%; box-sizing: border-box; }
.public-history-outcome-icon.success { color: var(--good); }
.public-history-outcome-icon.failure { color: var(--evil); transform: rotate(45deg); }
.public-history-outcome-icon::before, .public-history-outcome-icon::after { content: ''; position: absolute; top: 5.5px; left: 2.5px; width: 8px; height: 1.5px; background: currentColor; }
.public-history-outcome-icon::after { transform: rotate(90deg); }
.public-history-event-icon { display: block; flex-shrink: 0; width: 20px; height: 20px; margin-top: 2px; box-shadow: 0 0 0 4px var(--surface); background: var(--surface) center / contain no-repeat; }
.is-latest .public-history-event-icon { background-color: var(--history-latest-bg); box-shadow: 0 0 0 4px var(--history-latest-bg); }
.public-history-empty { padding: 32px 8px; color: var(--muted); text-align: center; font-size: 14px; }
.public-history-end { padding: 20px 0; color: var(--muted); text-align: center; font-size: 12px; }
@keyframes public-history-enter { from { transform: translateY(16px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
@keyframes public-history-locate { 0%, 65% { background: rgba(229,198,139,.12); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .public-history-sheet, .public-history-row.is-focused { animation: none; } }
@media (max-height: 500px) { .public-history-sheet { height: calc(100vh - env(safe-area-inset-top) - 6px); } .public-history-filters { margin-top: 0; } .public-history-handle { display: none; } }
.public-history-event-icon.is-inspect { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23e5c68b%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M2%2012s3.5-7%2010-7%2010%207%2010%207-3.5%207-10%207S2%2012%202%2012Z%22%2F%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%223%22%2F%3E%3C%2Fsvg%3E"); }
.public-history-event-icon.is-conversion { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23e5c68b%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%207h17m-5-5%205%205-5%205M21%2017H4m5-5-5%205%205%205%22%2F%3E%3C%2Fsvg%3E"); }
.public-history-event-icon.is-skill { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23e5c68b%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m9%203%202.5%206.5L18%2012l-6.5%202.5L9%2021l-2.5-6.5L0%2012l6.5-2.5ZM19%202v6m-3-3h6M20%2017v4m-2-2h4%22%2F%3E%3C%2Fsvg%3E"); }
.public-history-event-icon.is-record { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23e5c68b%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%224%22%20y%3D%223%22%20width%3D%2216%22%20height%3D%2218%22%20rx%3D%222%22%2F%3E%3Cpath%20d%3D%22M8%208h8M8%2012h8M8%2016h5%22%2F%3E%3C%2Fsvg%3E"); }
.public-history-event-icon.is-success { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23a3dfbe%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%229%22%2F%3E%3Cpath%20d%3D%22m7%2012%203%203%207-7%22%2F%3E%3C%2Fsvg%3E"); }
.public-history-event-icon.is-failure { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23f2b6ae%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%229%22%2F%3E%3Cpath%20d%3D%22m8%208%208%208m0-8-8%208%22%2F%3E%3C%2Fsvg%3E"); }
@media (hover: none) and (pointer: coarse) {
  .public-history-body { scrollbar-width: none; }
  .public-history-body::-webkit-scrollbar { display: none; width: 0; height: 0; }
}

body:has(.public-history-backdrop) { overflow: hidden; }
.public-history-sheet { height: 84dvh; max-height: calc(100dvh - env(safe-area-inset-top) - 12px); }
.public-history-sheet button:focus-visible, .public-history-entry:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (max-height: 500px) { .public-history-sheet { height: calc(100dvh - env(safe-area-inset-top) - 6px); } }

/* Keep the existing play-seat layout, with a small height reduction. */

/* Monthly leader badges: artwork only in the player identity row. */
.player-card-identity { flex-wrap: wrap; }
.player-card-name { flex: 1 1 50px; }
.player-card-badges { flex: 0 0 156px; width: 156px; max-width: 100%; white-space: nowrap; text-align: right; overflow-x: auto; scrollbar-width: thin; }
button.player-badge-button { display: inline-flex; vertical-align: middle; width: 48px; height: 48px; min-height: 48px; padding: 2px; margin: 0 4px 0 0; border-radius: 8px; }
.player-badge-button img { width: 44px; height: 44px; }
/* Permanent badge art has more transparent padding than monthly badge art. */
.badge-art-permanent { transform: scale(1.14); }
.badge-pressed { opacity: .7; }
.player-badge-detail { padding: 10px 0; border-top: 0.5px solid var(--border); }
.player-badge-detail-heading { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.player-badge-detail-heading img { width: 60px; height: 60px; flex-shrink: 0; }
.player-badge-detail-heading span { flex: 1; }
button.player-badge-detail-close { width: 48px; height: 48px; min-height: 48px; padding: 0; margin: 0; font-size: 24px; }
.player-badge-detail .muted { margin-top: 6px; }
.badge-manager { padding: 8px 0 12px; }
.badge-manager-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 0.5px solid var(--border); }
.badge-manager-image { flex-shrink: 0; width: 56px; height: 56px; }
.badge-manager-copy { flex: 1; min-width: 0; overflow-wrap: anywhere; }
button.badge-wear-button { flex-shrink: 0; min-height: 48px; min-width: 64px; width: auto; margin: 0; padding: 8px; font-size: 13px; border: 0.5px solid var(--border); }
button.badge-wear-button.is-equipped { color: var(--accent); border-color: var(--accent); }
.badge-manager-empty { padding: 16px 0; }

.player-badge-button img,.badge-manager-image,.player-badge-detail-heading img { object-fit: contain; }
.badge-wear-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.player-card-identity.is-long-name .player-card-name { flex-basis: calc(100% - 70px); }
.player-card-identity.is-long-name .player-card-badges { flex-basis: calc(100% - 68px); width: calc(100% - 68px); margin-left: 68px; }

.badge-equipped-count { margin: 12px 0; color: var(--accent, #e6c27a); font-weight: 600; }

.monthly-reset-backdrop { position:fixed; z-index:1100; inset:0; display:flex; align-items:center; justify-content:center; padding:24px 20px calc(24px + env(safe-area-inset-bottom)); background:rgba(4,12,17,.8); box-sizing:border-box; }
.monthly-reset-dialog { width:100%; max-width:350px; max-height:100%; overflow-y:auto; padding:28px 24px 24px; box-sizing:border-box; border:1px solid rgba(177,191,198,.18); border-radius:28px; background:var(--surface); color:var(--text); text-align:center; }
.monthly-reset-mark { display:flex; align-items:center; justify-content:center; width:52px; height:52px; margin:0 auto 16px; border:1px solid rgba(229,198,139,.2); border-radius:17px; background:rgba(229,198,139,.08); }
.monthly-reset-mark img { width:28px; height:28px; }
.monthly-reset-eyebrow { color:var(--accent); font-size:12px; letter-spacing:1px; }
.monthly-reset-title { margin-top:10px; font-size:23px; line-height:1.5; font-weight:600; }
.monthly-reset-copy { margin:10px auto 24px; max-width:260px; color:var(--muted); font-size:13px; line-height:1.8; }
.monthly-reset-report { padding:18px 12px 16px; border:1px solid rgba(177,191,198,.18); border-radius:18px; background:var(--bg); }
.monthly-reset-period { color:var(--muted); font-size:12px; }
.monthly-reset-stats { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); margin-top:18px; gap:4px; }
.monthly-reset-stats>view { display:flex; flex-direction:column; gap:6px; min-width:0; }
.monthly-reset-value { font-size:25px; font-weight:600; line-height:1.3; overflow-wrap:anywhere; font-variant-numeric:tabular-nums; }
.monthly-reset-points { color:var(--accent); }
.monthly-reset-label { color:var(--muted); font-size:12px; }
.monthly-reset-result { margin-top:16px; color:var(--muted); font-size:12px; line-height:1.6; }
.monthly-reset-footnote { margin:20px 0 18px; font-size:11px; line-height:1.7; color:var(--muted); }
.monthly-reset-confirm { min-height:48px; width:100%; margin:0; border:0; border-radius:14px; background:var(--accent); color:var(--bg); font-size:15px; font-weight:600; }
.monthly-reset-confirm:focus-visible { outline:2px solid var(--text); outline-offset:3px; }
.monthly-reset-confirm[disabled] { opacity:.6; }
.monthly-reset-error { margin-bottom:12px; font-size:12px; line-height:1.6; color:var(--evil); }

.rank-month-label { display:flex; flex-direction:column; gap:4px; padding:8px 4px; color:var(--accent); font-size:16px; }
.rank-month-label span { color:var(--muted); font-size:12px; }

.monthly-reset-stats>div:nth-child(2) .monthly-reset-value { font-size:22px; letter-spacing:-.5px; white-space:nowrap; }
