/* 晶核助手 — 手机优先记录界面 */
:root {
  color-scheme: light;
  --ink: #3d3455;
  --ink-soft: #514665;
  --ink-900: #3d3455;
  --ink-800: #3d3455;
  --ink-700: #514665;
  --ink-600: #6e657c;
  --ink-500: #91879f;
  --ink-400: #afa5bc;
  --canvas: #faf7ff;
  --surface: #fffeff;
  --surface-soft: #fcf9ff;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --bg: var(--canvas);
  --surface-raised: var(--surface-soft);
  --muted: #91879f;
  --muted-strong: #6e657c;
  --line: #e7dff1;
  --line-soft: #f0eaf7;
  --line-strong: #e1d6ef;
  --accent: #7b67ca;
  --accent-deep: #6751aa;
  --accent-soft: #f6f1ff;
  --accent-edge: #e1d6ef;
  --active-ink: #ffffff;
  --pink: #e85f91;
  --teal: #5fb9ad;
  --teal-700: #39877e;
  --teal-600: #5fb9ad;
  --teal-soft: #effbf8;
  --teal-edge: #c1e9df;
  --teal-50: #effbf8;
  --teal-100: #d8f3ee;
  --danger: #e95f91;
  --danger-soft: #fff3f8;
  --danger-edge: #ffd1e1;
  --check-ink: #ffffff;
  --hover: rgba(103, 81, 170, 0.06);
  --shadow: 0 16px 38px rgba(105, 81, 170, 0.08);
  --shadow-sm: 0 16px 38px rgba(105, 81, 170, 0.08);
  --shadow-lg: 0 24px 54px rgba(95, 75, 161, 0.15);
  --shadow-strong: 0 24px 54px rgba(95, 75, 161, 0.15);
  --backdrop: rgba(80, 64, 130, 0.32);
  --topbar-bg: transparent;
  --zone: #514665;
  --zone-soft: #f6f1ff;
  --scene: none;
  --max-content: 1180px;
  --gutter: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

body[data-server="season"] {
  --accent: #5aa8d4;
  --accent-deep: #3d87b0;
  --accent-soft: #eef8fc;
  --accent-edge: #cfeff5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 8% 8%, rgba(255, 184, 213, 0.2), transparent 20rem),
    radial-gradient(circle at 92% 14%, rgba(152, 221, 255, 0.24), transparent 22rem),
    linear-gradient(180deg, #faf7ff 0%, #f7fbff 58%, #fff8fb 100%);
  color: var(--ink);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  padding-bottom: var(--safe-bottom);
}

h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled, select:disabled { cursor: default; }
a, button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent-deep); }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid rgba(127, 103, 202, 0.28);
  outline-offset: 2px;
}

::selection { background: #ede6ff; color: var(--ink); }

.app-shell {
  min-height: 100dvh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  overflow: visible;
  padding-top: var(--safe-top);
  border-bottom: 0;
  color: #ffffff;
  background:
    radial-gradient(circle at 84% 8%, rgba(255, 211, 231, 0.42), transparent 12rem),
    radial-gradient(circle at 10% 120%, rgba(136, 226, 255, 0.34), transparent 14rem),
    linear-gradient(125deg, #6c5cc5 0%, #8293e8 55%, #71c7db 120%);
}

.topbar-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 10px;
  width: min(100%, calc(var(--max-content) + 2 * var(--gutter)));
  margin-inline: auto;
  position: relative;
  z-index: 1;
  padding: 12px max(var(--gutter), var(--safe-right)) 0 max(var(--gutter), var(--safe-left));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: #ffffff;
  white-space: nowrap;
}

.brand-copy { min-width: 0; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
  color: #fff4fb;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.eyebrow-line {
  width: 18px;
  height: 1px;
  background: rgba(255, 244, 251, 0.8);
}

.brand-name {
  display: block;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.2;
  text-shadow: 0 4px 12px rgba(69, 55, 135, 0.2);
}

.brand-icon {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border: 3px solid rgba(255, 255, 255, 0.72);
  border-radius: 16px;
  box-shadow: 0 8px 17px rgba(72, 59, 143, 0.24);
  transform: rotate(-3deg);
  object-fit: cover;
  background: #ffffff;
}

.more-wrap { justify-self: end; position: relative; }

.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  background: rgba(67, 54, 136, 0.16);
  color: #f4fbff;
  font-size: 14px;
  font-weight: 800;
}

.nav-button:hover,
.nav-button[aria-expanded="true"] {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.18);
}

.server-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-column: 1 / -1;
  gap: 4px;
  min-width: 0;
  position: relative;
  z-index: 4;
  margin: 8px 0 -22px;
  padding: 6px;
  border: 1px solid #e1d6ef;
  border-radius: 20px;
  background: rgba(255, 254, 255, 0.97);
  box-shadow: 0 12px 27px rgba(95, 75, 161, 0.15);
}

.server-option {
  display: flex;
  position: relative;
  align-items: center;
  min-width: 0;
  min-height: 52px;
  padding: 6px 10px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: #91879f;
  text-align: left;
}

.server-option:hover { color: #3d3455; background: #f6f1ff; }

.server-option[aria-pressed="true"] {
  color: #ffffff;
  background:
    radial-gradient(circle at 90% 18%, rgba(255, 220, 235, 0.28), transparent 8rem),
    linear-gradient(135deg, #7f67ca, #7387df);
  box-shadow: 0 6px 14px rgba(102, 82, 177, 0.22);
}

.server-option[data-select-server="season"][aria-pressed="true"] {
  background:
    radial-gradient(circle at 90% 18%, rgba(200, 240, 255, 0.35), transparent 8rem),
    linear-gradient(135deg, #5aa8d4, #71c7db);
  box-shadow: 0 6px 14px rgba(80, 150, 190, 0.22);
}

.server-option-text { min-width: 0; width: 100%; }
.server-option-text strong,
.server-option-text small { display: block; }
.server-option-text strong {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
}
.server-option-text small {
  margin-top: 2px;
  color: inherit;
  opacity: 0.78;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.server-option[aria-pressed="true"] small { color: rgba(255, 255, 255, 0.86); opacity: 1; }

.workspace {
  width: min(100%, calc(var(--max-content) + 2 * var(--gutter)));
  margin-inline: auto;
  padding: 40px max(var(--gutter), var(--safe-right)) 32px max(var(--gutter), var(--safe-left));
}

.today-strip {
  position: relative;
  overflow: hidden;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid #e7dff1;
  border-radius: 22px;
  background:
    radial-gradient(circle at 96% -20%, rgba(255, 190, 216, 0.2), transparent 16rem),
    linear-gradient(145deg, #fffefe, #fbf8ff);
  box-shadow: 0 16px 38px rgba(105, 81, 170, 0.08);
}

.today-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.today-header h1 {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.today-subtitle,
.roster-meta {
  margin-top: 3px;
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1.4;
}

.roster-meta { color: var(--muted-strong); }

.data-status {
  display: grid;
  justify-items: end;
  gap: 5px;
  flex: 0 0 auto;
  max-width: 46%;
  text-align: right;
}

.local-status {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.save-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid #e1d6ef;
  border-radius: 999px;
  background: #f6f1ff;
  color: #6751aa;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.save-status::before {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 99px;
  background: #8b70d6;
  box-shadow: 0 0 0 5px rgba(139, 112, 214, 0.16);
  content: "";
}

.sync-trigger:hover { border-color: var(--accent); }
.local-status[data-state="error"],
.sync-trigger:has([data-state="error"], [data-state="conflict"]) { color: var(--danger); }
.sync-trigger:has([data-state="error"], [data-state="conflict"])::before { background: var(--danger); }

.tool-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
  padding: 6px;
  border: 1px solid #e1d6ef;
  border-radius: 20px;
  background: rgba(255, 254, 255, 0.97);
  box-shadow: 0 12px 27px rgba(95, 75, 161, 0.12);
}

.tool-button {
  display: inline-flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  color: #91879f;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
}

.tool-button:hover { background: #f6f1ff; color: #514665; }

.tool-button[aria-pressed="true"] {
  border-color: transparent;
  color: #ffffff;
  background:
    radial-gradient(circle at 90% 18%, rgba(255, 220, 235, 0.28), transparent 8rem),
    linear-gradient(135deg, #7f67ca, #7387df);
  box-shadow: 0 6px 14px rgba(102, 82, 177, 0.22);
}

.tool-button[aria-pressed="true"] .nav-icon {
  color: #ffe4f0;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.16);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric {
  display: grid;
  align-content: start;
  gap: 2px;
  min-width: 0;
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid #e7dff1;
  border-radius: 22px;
  background: #fffefe;
  box-shadow: 0 12px 28px rgba(105, 81, 170, 0.07);
  color: inherit;
  text-align: left;
}

.metric:hover { border-color: var(--line-strong); background: var(--surface-raised); }

.metric[aria-pressed="true"] {
  border-color: var(--accent-edge);
  background: var(--accent-soft);
}

.metric-label,
.metric-detail {
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1.35;
}

.metric-value {
  color: var(--pink);
  font-size: 28px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.metric[data-cleared="true"] .metric-value { color: var(--teal-700); }

.metric--link { position: relative; padding-inline-end: 21px; }

.metric-arrow {
  position: absolute;
  top: 9px;
  inset-inline-end: 9px;
  color: var(--accent);
  font-size: 12px;
  line-height: 1;
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.section-heading,
.dialog-header,
.character-header,
.account-header,
.zone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.section-heading { margin-bottom: 4px; }

.section-heading h2,
.dialog-header h2 {
  font-size: 18px;
  font-weight: 730;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.section-title { min-width: 0; }
.section-title p {
  margin-top: 4px;
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1.45;
}

.action-group,
.filter-bar,
.dialog-actions,
.settings-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.work-toolbar { margin: 8px 0 10px; }

.button,
.filter-button,
.raid-pill,
.more-trigger,
.stamina-all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid #e1d6ef;
  border-radius: 16px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
  text-align: center;
}

.button--primary {
  border-color: transparent;
  background: linear-gradient(135deg, #8b70d7, #6f83d9);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(116, 92, 199, 0.22);
}

.button--primary:hover:not(:disabled) {
  filter: brightness(1.05);
}

.button--secondary:hover:not(:disabled),
.filter-button:hover,
.raid-pill:hover,
.more-trigger:hover {
  border-color: var(--line-strong);
  background: var(--surface-raised);
}

.button--quiet {
  border-color: transparent;
  color: var(--muted);
  min-height: 36px;
  padding-inline: 8px;
}

.button--quiet:hover { background: var(--surface-raised); color: var(--ink); }

.button--danger {
  border-color: #ffd1e1;
  background: #fff3f8;
  color: #e95f91;
}

.button--danger:hover { border-color: var(--danger); }
.button:disabled { opacity: 0.5; }

.filter-button {
  min-height: 40px;
  padding-inline: 10px;
  border-color: transparent;
  color: var(--muted);
}

.filter-bar {
  padding: 6px;
  border: 1px solid #e1d6ef;
  border-radius: 17px;
  background: rgba(255, 254, 255, 0.96);
}

.filter-button[aria-pressed="true"] {
  border-color: transparent;
  background: linear-gradient(135deg, #7f67ca, #7387df);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(102, 82, 177, 0.2);
}

body[data-server="season"] .filter-button[aria-pressed="true"] {
  background: linear-gradient(135deg, #5aa8d4, #71c7db);
  box-shadow: 0 6px 16px rgba(80, 150, 190, 0.2);
}

.accounts-region { min-width: 0; }

.account-list {
  display: grid;
  gap: 10px;
}

.account-card {
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 1px solid #e7dff1;
  border-left: 5px solid var(--account-accent, #8b70d6);
  border-radius: 22px;
  background: rgba(255, 254, 255, 0.97);
  box-shadow: 0 16px 38px rgba(105, 81, 170, 0.08);
}

.account-header {
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0;
  padding: 12px 14px;
  background: linear-gradient(90deg, var(--account-soft, #f6f1ff), #fbfdff);
}

.account-header:has(.account-fold[aria-expanded="false"]) { margin-bottom: 0; }

.account-heading { flex: 1 1 140px; min-width: 0; }

.account-fold {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 18px;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 1px 10px;
  min-height: 44px;
  padding: 4px 6px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  text-align: start;
}

.account-fold:hover .account-name { color: var(--account-deep, var(--teal-700)); }

.account-avatar {
  grid-area: 1 / 1 / span 2;
}

.account-name-line { grid-column: 2; grid-row: 1; }
.account-fold > small { grid-column: 2; grid-row: 2; }

.fold-indicator {
  grid-area: 1 / 3 / span 2;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: var(--accent);
  font-size: 0;
}

.fold-indicator::after {
  width: 7px;
  height: 7px;
  border-inline-end: 1.5px solid currentColor;
  border-block-end: 1.5px solid currentColor;
  content: "";
  transform: translateY(-1px) rotate(45deg);
}

.account-fold[aria-expanded="true"] .fold-indicator::after {
  transform: translateY(2px) rotate(225deg);
}

.account-name-line, .character-identity {
  display: inline-grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: baseline;
  gap: 7px;
  max-width: 100%;
  min-width: 0;
}

.entry-kind {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 640;
  line-height: 1.35;
  white-space: nowrap;
}

.entry-kind--account {
  border-color: var(--accent-edge);
  color: var(--accent);
}

.entry-kind--character {
  border-color: var(--teal-edge);
  color: var(--teal);
}

.account-name {
  min-width: 0;
  font-size: 16px;
  font-weight: 740;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.account-heading small {
  display: block;
  margin-top: 2px;
  color: var(--muted-strong);
  font-size: 12px;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-inline-start: auto;
}

.account-content {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px 14px 14px;
  border-inline-start: 0;
}

.zone-card { min-width: 0; }

.zone-header {
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 3px 5px 3px 7px;
  border-bottom: 1px solid var(--line);
  border-radius: 7px 7px 0 0;
  background: var(--surface-soft);
}

.zone-heading {
  display: flex;
  flex: 1 1 98px;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 7px;
  min-width: 0;
}

.entry-kind--zone { border-color: #C5CDD6; color: var(--zone); }

.zone-name {
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.zone-heading small { color: var(--muted-strong); font-size: 12px; white-space: nowrap; }

.zone-actions, .character-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 4px;
  margin-inline-start: auto;
}

.zone-card > .character-list, .zone-card > .stamina-list { margin-top: 5px; }
.stamina-toggle .character-identity { flex: 1 1 auto; }

.account-actions > .button, .zone-actions > .button {
  min-height: 44px;
  padding-inline: 7px;
  font-size: 13px;
}

.stamina-all[aria-pressed="true"] {
  border-color: var(--teal-edge);
  background: var(--teal-soft);
  color: var(--teal);
}

.character-list,
.stamina-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.character-card,
.stamina-row {
  min-width: 0;
  padding: 10px;
  border: 1px solid #eadff3;
  border-left: 3px solid var(--character-accent, #9076d8);
  border-radius: 18px;
  background: var(--character-soft, rgba(247, 242, 255, 0.82));
}

.character-header,
.stamina-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.character-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 15px;
  font-weight: 680;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.raid-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.raid-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px 44px;
  gap: 6px;
  align-items: stretch;
}

.raid-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.remaining-field {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  color: var(--muted-strong);
  font-size: 12px;
  white-space: nowrap;
}

.remaining-field input {
  width: 36px;
  min-height: 44px;
  padding: 0;
  border: 1px solid #e1d8ed;
  border-radius: 12px;
  background: #fcf9ff;
  color: #e85f91;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-align: center;
}

.remaining-field input::-webkit-inner-spin-button,
.remaining-field input::-webkit-outer-spin-button { appearance: none; }
.remaining-field input[type="number"] { appearance: textfield; }

.raid-toggle,
.stamina-toggle {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid #e1d6ef;
  border-radius: 16px;
  background: #fffeff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
}

.stamina-toggle { background: transparent; }

.raid-name,
.stamina-toggle .character-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }

.raid-count {
  flex: 0 0 auto;
  color: var(--pink);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.raid-toggle:not(:disabled):hover,
.stamina-toggle:hover { background: var(--hover); }

.raid-toggle[aria-pressed="true"],
.stamina-toggle[aria-pressed="true"] {
  border-color: var(--teal-edge);
  background: var(--teal-soft);
  color: var(--teal);
}

.raid-toggle[aria-pressed="true"] .raid-count { color: var(--teal); }

.raid-toggle:disabled {
  color: var(--muted);
  background: var(--surface-raised);
  border-color: var(--line);
}

.raid-toggle:disabled .raid-count { color: var(--muted); }

.task-check {
  display: inline-grid;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--active-ink);
}

[aria-pressed="true"] > .task-check {
  border-color: var(--teal);
  background: var(--teal);
  color: var(--check-ink);
}

[aria-pressed="true"] > .task-check:empty::before {
  width: 8px;
  height: 5px;
  margin-top: -2px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(-45deg);
  content: "";
}

.stepper-button, .attempt-adjust {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid #e1d6ef;
  border-radius: 14px;
  background: #fffeff;
  color: var(--ink);
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
}

.stepper-button:hover:not(:disabled), .attempt-adjust:hover:not(:disabled) {
  border-color: var(--accent-edge);
  background: var(--accent-soft);
  color: var(--accent);
}

.stepper-button:disabled, .attempt-adjust:disabled { opacity: 0.4; }
.attempt-adjust { touch-action: manipulation; }

.more-details, .entry-menu { position: relative; flex: 0 0 auto; }
.entry-menu[open] { z-index: 21; }

.more-trigger, .menu-trigger {
  display: inline-grid;
  min-width: 44px;
  min-height: 44px;
  place-items: center;
  padding: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
}

.menu-trigger {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
}

.menu-trigger:hover, .entry-menu[open] > .menu-trigger {
  border-color: var(--line-strong);
  background: var(--surface-raised);
  color: var(--ink);
}

.entry-menu:not([open]) > .entry-menu-items { display: none; }

.more-details > summary, .menu-trigger { list-style: none; }
.more-details > summary::-webkit-details-marker,
.menu-trigger::-webkit-details-marker { display: none; }

.menu, .entry-menu-items {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 20;
  min-width: 148px;
  max-width: calc(100vw - 32px);
  padding: 4px;
  border: 1px solid #e1d6ef;
  border-radius: 16px;
  background: #fffeff;
  box-shadow: 0 16px 38px rgba(105, 81, 170, 0.16);
}

.menu-item, .entry-menu-items > button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 620;
  text-align: left;
}

.menu-item:hover, .entry-menu-items > button:hover { background: var(--accent-soft); }
.menu-item--danger, .entry-menu-items > .button--danger { color: var(--danger); }

.empty-state {
  display: grid;
  justify-items: start;
  gap: 8px;
  min-height: 120px;
  padding: 28px 20px;
  border: 1px dashed #e1d6ef;
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(253, 249, 255, 0.9), rgba(245, 251, 255, 0.9));
  color: #91879f;
  font-size: 14px;
}

.empty-title { color: var(--ink); font-size: 16px; font-weight: 710; }
.account-note { color: var(--muted-strong); font-size: 13px; padding: 4px 2px 0; }

.panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid #e7dff1;
  border-radius: 22px;
  background: rgba(255, 254, 255, 0.97);
  box-shadow: 0 16px 38px rgba(105, 81, 170, 0.08);
  scroll-margin-top: calc(var(--safe-top) + 96px);
}

.settings-body { display: grid; gap: 12px; margin-top: 12px; }
.raid-controls { min-width: 0; }

.raid-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.raid-pill { min-height: 40px; padding-inline: 10px; color: var(--muted); }

.raid-pill[aria-pressed="true"] {
  border-color: var(--accent-edge);
  background: var(--accent-soft);
  color: var(--accent);
}

.raid-selects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.raid-selects label,
.dialog-field {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.attempt-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted-strong);
  font-size: 13px;
}

.attempt-stepper {
  display: grid;
  grid-template-columns: 44px 40px 44px;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
}

.attempt-stepper > button {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: var(--surface-raised);
  color: var(--accent);
  font-size: 20px;
  font-weight: 610;
}

.attempt-stepper > button:not(:disabled):hover { background: var(--accent-soft); }
.attempt-stepper > button:disabled { opacity: 0.4; }
.attempt-stepper strong {
  align-self: center;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.settings-actions {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.raid-overview {
  display: grid;
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.raid-overview:empty { display: none; }

.raid-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.raid-summary:last-child { padding-bottom: 0; border-bottom: 0; }
.raid-summary strong { color: var(--ink); font-size: 14px; }
.raid-summary small { color: var(--muted-strong); font-size: 12px; text-align: right; }

.dialog {
  width: min(508px, calc(100% - 28px));
  max-height: calc(100dvh - 32px - var(--safe-top) - var(--safe-bottom));
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border: 1px solid #e7dff1;
  border-radius: 22px;
  background: #fffeff;
  color: var(--ink);
  box-shadow: 0 24px 54px rgba(95, 75, 161, 0.16);
}

.dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(3px); }
.dialog-header { align-items: start; margin-bottom: 12px; }
.dialog-message, .dialog-section p { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.dialog-message[data-state="error"], .dialog-message[role="alert"] { color: var(--danger); }
.dialog-field, .dialog-section { margin: 12px 0; }
.dialog-section + .dialog-section { padding-top: 12px; border-top: 1px solid var(--line); }
.dialog-section > .dialog-actions { justify-content: flex-start; }
.dialog-section > .dialog-field:first-child { margin-top: 0; }
.dialog-actions { margin-top: 14px; }

.sync-state {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--accent-soft);
}

.sync-conflict {
  padding: 12px;
  border: 1px solid var(--accent-edge);
  border-radius: 12px;
}

.sync-conflict h3 { margin: 0 0 6px; font-size: 15px; }
.sync-conflict-list {
  margin: 8px 0 0;
  padding-inline-start: 20px;
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.dialog-field input,
.dialog-field textarea,
.raid-selects select,
.raid-mode-field select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #e1d8ed;
  border-radius: 16px;
  background: #fcf9ff;
  color: #6650a5;
  font-size: 16px;
}

.dialog-field textarea { min-height: 96px; resize: vertical; }

.dialog-field input:focus,
.dialog-field textarea:focus,
.raid-selects select:focus,
.raid-mode-field select:focus,
.remaining-field input:focus {
  outline: none;
  border-color: #c5b3e8;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(127, 103, 202, 0.16);
}


.dialog-field input[type="file"]::file-selector-button {
  margin-inline-end: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-raised);
  color: var(--ink);
  cursor: pointer;
}

.raid-catalog-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.raid-mode-field {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 620;
}

.catalog-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  margin-top: 12px;
}

.catalog-form .dialog-field { margin: 0; }
#catalog-message { margin-top: 8px; }

.catalog-list {
  display: grid;
  align-content: start;
  max-height: min(44dvh, 320px);
  margin-top: 12px;
  padding: 0 3px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-block: 1px solid var(--line);
}

.catalog-list:empty { display: none; }

.catalog-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 5px 8px;
  min-width: 0;
  padding: 6px 2px;
  border-bottom: 1px solid var(--line);
}

.catalog-row:last-child { border-bottom: 0; }

.catalog-identity {
  display: grid;
  flex: 1 1 107px;
  gap: 2px;
  min-width: 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.catalog-identity strong { font-size: 14px; }
.catalog-identity small { color: var(--muted); font-size: 12px; }

.catalog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 4px;
  margin-inline-start: auto;
}

.catalog-actions > .button { min-height: 44px; padding-inline: 7px; font-size: 13px; }

.roster-dialog { width: min(560px, calc(100% - 28px)); }

.roster-section {
  display: grid;
  gap: 9px;
  margin-top: 10px;
  padding: 9px 0 0;
  border-top: 1px solid var(--line);
}

.roster-section .dialog-field { margin: 0; }
.roster-section .dialog-field small { color: var(--muted-strong); font-size: 12px; overflow-wrap: anywhere; }
.roster-section .dialog-field select {
  min-width: 0;
  min-height: 44px;
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
}

.roster-source, .roster-destination {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 8px;
}

.roster-source { grid-template-columns: minmax(114px, .8fr) minmax(0, 1.2fr); }
.roster-source .dialog-field input { padding-inline: 6px; }

.roster-source-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
}

.roster-source-actions p { flex: 1 1 190px; min-width: 0; font-size: 12px; }
.roster-source-actions .button { margin-inline-start: auto; }
.roster-section .dialog-field textarea { min-height: 64px; }

.roster-preview {
  max-height: min(35dvh, 210px);
  overflow: auto;
  overscroll-behavior: contain;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.roster-preview > :not(:first-child) { margin-top: 4px; }

.roster-actions {
  position: sticky;
  z-index: 1;
  bottom: -18px;
  gap: 6px;
  padding-block: 7px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

@media (max-width: 430px) {
  .accounts-region > .section-heading:has(#open-roster-import) { flex-wrap: wrap; }
  .roster-source { grid-template-columns: minmax(0, 1fr); }
}

.batch-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 13px;
}

.batch-list {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: min(44vh, 315px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 3px 6px 4px 3px;
}

.batch-group {
  display: grid;
  gap: 3px;
  min-width: 0;
  margin: 0;
  padding: 3px 7px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.batch-group legend {
  max-width: 100%;
  padding-inline: 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 680;
  overflow-wrap: anywhere;
}

.batch-option {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 44px;
  padding: 3px 4px;
  border-radius: 4px;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}

.batch-option:hover, .batch-option:has(input:checked) { background: var(--teal-soft); }

.batch-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin: 0;
  accent-color: var(--teal);
}

.batch-option > span { min-width: 0; overflow-wrap: anywhere; }

.toast {
  position: fixed;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 40;
  right: max(16px, var(--safe-right));
  bottom: max(16px, var(--safe-bottom));
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 16px;
  background: linear-gradient(135deg, #7f67ca, #7387df);
  color: #ffffff;
  font-size: 14px;
  box-shadow: 0 16px 38px rgba(105, 81, 170, 0.22);
}

#toast-message { min-width: 0; overflow-wrap: anywhere; }

.toast-undo {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 2px 10px;
  border: 0;
  border-radius: 10px;
  background: #ffffff;
  color: #6751aa;
  font-size: 13px;
  font-weight: 800;
}

.toast-undo:hover { background: #f6f1ff; }

.toast:empty { display: none; }

@media (min-width: 860px) {
  :root { --gutter: 24px; }

  .topbar-inner {
    grid-template-columns: auto minmax(280px, 460px) auto;
    align-items: end;
    gap: 16px;
    min-height: 92px;
    padding-top: 10px;
  }

  .brand { align-self: center; }
  .brand-icon { width: 56px; height: 56px; flex-basis: 56px; }
  .brand-name { font-size: 24px; }
  .server-switch { margin-bottom: -24px; }
  .more-wrap { align-self: center; }

  .server-switch {
    grid-column: auto;
    justify-self: stretch;
  }

  .server-option { min-height: 56px; padding-inline: 12px; }
  .server-option-text strong { font-size: 16px; }

  .workspace { padding-top: 42px; }

  .today-header h1 { font-size: 24px; }
  .metric-value { font-size: 32px; }
  .metric { min-height: 84px; }

  .work-grid {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    align-items: start;
    gap: 20px;
  }

  .section-heading h2,
  .dialog-header h2 { font-size: 20px; }
}

@media (max-width: 560px) {
  .account-actions { gap: 3px; }
  .character-card { padding-inline: 6px; }

  .remaining-field > span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
}

@media (max-width: 379px) {
  .raid-selects { grid-template-columns: minmax(0, 1fr); }
  .account-heading { flex-basis: 105px; }
  .account-actions { margin-inline-start: auto; }
}


/* —— 粉紫软萌气质：顶栏装饰、色调头像、工具图标 —— */
.hero-sparkles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.hero-sparkles span {
  position: absolute;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1;
}

.hero-sparkles span:nth-child(1) { top: 14px; right: 36px; font-size: 18px; }
.hero-sparkles span:nth-child(2) { right: 28%; bottom: 36px; font-size: 16px; color: #ffd6e7; }
.hero-sparkles span:nth-child(3),
.hero-sparkles span:nth-child(4) { display: none; }

.nav-icon {
  display: inline-grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border: 1px solid #dfd4f6;
  border-radius: 10px;
  color: #775fbe;
  background: linear-gradient(145deg, #fff3fa, #e9edff);
  font-size: 13px;
  font-weight: 900;
}

.account-avatar,
.character-avatar {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  color: #ffffff;
  background: linear-gradient(145deg, var(--account-accent, #8b70d6), var(--account-deep, #684eaa));
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.character-avatar {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--character-accent, #9076d8), var(--character-deep, #6c55ae));
  font-size: 12px;
}

.character-identity {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.account-tone-0 { --account-accent: #8b70d6; --account-deep: #684eaa; --account-soft: #f6f1ff; }
.account-tone-1 { --account-accent: #ea7da8; --account-deep: #b9507b; --account-soft: #fff2f7; }
.account-tone-2 { --account-accent: #6ca7e4; --account-deep: #477eb7; --account-soft: #eef7ff; }
.account-tone-3 { --account-accent: #5fb9ad; --account-deep: #39877e; --account-soft: #eefbf8; }
.account-tone-4 { --account-accent: #e6a05f; --account-deep: #b77436; --account-soft: #fff7ed; }
.account-tone-5 { --account-accent: #7e91df; --account-deep: #5669b9; --account-soft: #f1f4ff; }

.character-tone-0 { --character-accent: #9076d8; --character-deep: #6c55ae; --character-soft: rgba(247, 242, 255, 0.82); }
.character-tone-1 { --character-accent: #e981ab; --character-deep: #b6537d; --character-soft: rgba(255, 244, 248, 0.82); }
.character-tone-2 { --character-accent: #65a9df; --character-deep: #477fac; --character-soft: rgba(241, 249, 255, 0.84); }
.character-tone-3 { --character-accent: #61b9ad; --character-deep: #3b847c; --character-soft: rgba(241, 251, 248, 0.84); }
.character-tone-4 { --character-accent: #e5a063; --character-deep: #ad733e; --character-soft: rgba(255, 249, 240, 0.84); }
.character-tone-5 { --character-accent: #7d91df; --character-deep: #596bb5; --character-soft: rgba(244, 246, 255, 0.84); }
.character-tone-6 { --character-accent: #c77bcf; --character-deep: #96529f; --character-soft: rgba(253, 243, 255, 0.84); }
.character-tone-7 { --character-accent: #74b78a; --character-deep: #4e8a63; --character-soft: rgba(243, 251, 245, 0.84); }

.account-content { background: var(--surface); }

.menu, .entry-menu-items { color: #3d3455; }

.raid-toggle[aria-pressed="true"],
.stamina-toggle[aria-pressed="true"],
.stamina-all[aria-pressed="true"] {
  color: #397c78;
  border-color: #c1e9df;
  background: #effbf8;
}

.section-heading h2 { font-weight: 900; color: #3d3455; }
.section-title p { color: #91879f; }

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

.character-details {
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.character-identity:has(> .character-details) {
  display: inline-grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  column-gap: 8px;
  row-gap: 1px;
}

.character-identity:has(> .character-details) > .character-avatar { grid-row: span 2; }
.character-identity > .character-details { grid-column: 2; }
