:root {
  --bg: #f6f7fb;
  --panel: #fff;
  --text: #151922;
  --muted: #687184;
  --line: #e9edf4;
  --accent: #ff7a1a;
  --accent-soft: #fff3e7;
  --danger: #ec4b5f;
  --shadow: 0 16px 42px rgba(34, 40, 54, .10);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(circle at 16% 0%, rgba(255,122,26,.18), transparent 260px), linear-gradient(180deg, #fff8ef 0, #f6f7fb 280px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}
a { color: inherit; text-decoration: none; }
.shell { width: min(560px, 100%); margin: 0 auto; padding: 14px 14px 64px; }
.nav {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px; padding: 10px 2px;
}
.brand { font-weight: 850; }
.nav nav { display: flex; gap: 10px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.admin-nav .brand { color: #11151b; }
.top-card, .hero-card {
  border-radius: 24px; padding: 22px 18px; margin-bottom: 14px;
  background: linear-gradient(135deg, rgba(255,122,26,.96), rgba(255,185,84,.92));
  color: #fff; box-shadow: var(--shadow);
}
.top-card.compact { padding: 18px; }
.eyebrow { font-size: 12px; opacity: .85; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
h1 { margin: 8px 0; font-size: 28px; line-height: 1.1; }
h2 { margin: 0 0 16px; font-size: 22px; }
p { line-height: 1.7; }
.top-card p, .hero-card p { margin: 0; color: rgba(255,255,255,.88); font-size: 13px; }
.admin-hero { background: linear-gradient(135deg, #151922, #424a5a); }
.mode-pill {
  display: inline-block; margin-top: 14px; padding: 6px 10px; border-radius: 999px;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.34); font-size: 12px;
}
.card, .item-group {
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px;
  padding: 16px; margin-bottom: 12px; box-shadow: 0 12px 34px rgba(34, 40, 54, .07);
}
.card-title, .item-group h3 {
  margin: 0 0 12px; font-size: 16px; font-weight: 850; display: flex; align-items: center; justify-content: space-between;
}
.card-title::after, .item-group h3::after {
  content: ""; width: 34px; height: 4px; border-radius: 999px; background: linear-gradient(90deg, #ff7a1a, #ffc46b);
}
form { display: grid; gap: 12px; }
label { display: grid; gap: 7px; color: #303746; font-size: 14px; font-weight: 700; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 14px; background: #fbfcff;
  color: var(--text); padding: 12px 13px; font: inherit; font-weight: 500;
}
input:disabled {
  color: #7b8496;
  background: #eef1f6;
  cursor: not-allowed;
}
textarea { min-height: 78px; resize: vertical; line-height: 1.6; }
button, .primary, .secondary {
  min-height: 46px; border: 0; border-radius: 16px; padding: 0 16px; cursor: pointer; font-weight: 850; font: inherit;
}
.primary { color: #fff; background: linear-gradient(135deg, #ff7a1a, #ffb14a); box-shadow: 0 12px 26px rgba(255,122,26,.28); }
.primary.is-loading,
.primary:disabled {
  opacity: .72;
  cursor: wait;
  box-shadow: none;
}
.secondary { color: #a24b08; background: var(--accent-soft); border: 1px solid #ffd9b5; }
.text-btn { min-height: 34px; color: var(--accent); background: transparent; padding: 0 8px; }
.grid-2, .score-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.score-card {
  background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 13px 14px; box-shadow: 0 10px 26px rgba(34,40,54,.06);
}
.score-card span { display: block; color: var(--muted); font-size: 12px; }
.score-card b { color: #15b982; font-size: 25px; }
.tabs {
  display: flex; gap: 7px; overflow-x: auto; padding: 4px 0 10px; margin-bottom: 8px; border-bottom: 1px solid var(--line);
}
.tabs a {
  flex: 0 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 9px 13px; font-size: 13px; font-weight: 750;
}
.script {
  background: linear-gradient(180deg, #fff, #fff9f2); border: 1px solid #ffe0bd; border-radius: 18px;
  padding: 14px; line-height: 1.9; white-space: pre-wrap; font-size: 15px;
}
.script.small { margin-top: 10px; font-size: 14px; }
.item-card {
  display: flex; gap: 10px; align-items: flex-start; background: #fafbff; border: 1px solid #edf0f6;
  border-radius: 16px; padding: 12px; margin-top: 9px;
}
.item-card span {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 999px; background: #151922; color: #fff;
  font-size: 12px; font-weight: 850; display: flex; align-items: center; justify-content: center;
}
.item-card b { display: block; font-size: 14px; line-height: 1.55; }
.item-card p { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.story {
  background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 14px; margin-top: 10px;
}
.story-head { display: flex; align-items: center; gap: 9px; font-weight: 850; margin-bottom: 10px; }
.story-head span {
  width: 28px; height: 28px; border-radius: 10px; background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px;
}
.story p { color: var(--muted); font-size: 13px; margin: 7px 0 0; }
.story b { color: #3a4150; }
.variant {
  border: 1px solid var(--line); border-radius: 18px; padding: 12px; margin-bottom: 10px; background: #fff;
}
.variant summary { cursor: pointer; font-weight: 850; }
.persona-hub {
  padding: 0;
  overflow: hidden;
}
.persona-hub > summary,
.persona-child > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.persona-hub > summary::-webkit-details-marker,
.persona-child > summary::-webkit-details-marker {
  display: none;
}
.persona-hub > summary {
  padding: 15px 16px;
  font-size: 16px;
  font-weight: 850;
}
.persona-hub > summary small,
.persona-child > summary small {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.persona-hub > summary::after,
.persona-child > summary::after {
  content: "展开";
  flex: 0 0 auto;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #ffd9b5;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
}
.persona-hub[open] > summary::after,
.persona-child[open] > summary::after {
  content: "收起";
}
.persona-use {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #ffd2a6;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff, #fff8f0);
}
.persona-use-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.persona-use label,
.persona-use-head label {
  color: #a24b08;
  font-size: 14px;
  font-weight: 850;
}
.persona-selector {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #fff8f0);
}
.persona-use select,
.persona-selector select {
  border-color: #ffd2a6;
  background: #fff;
  color: #151922;
  font-weight: 850;
  box-shadow: 0 8px 20px rgba(255,122,26,.10);
}
.edit-current-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  white-space: nowrap;
  color: #a24b08;
  background: var(--accent-soft);
  border: 1px solid #ffd9b5;
  border-radius: 999px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 850;
}
.persona-selector label {
  color: #a24b08;
}
.persona-child {
  margin: 0 12px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfcff;
  overflow: hidden;
}
.persona-child > summary {
  padding: 12px;
  font-weight: 820;
}
.persona-child form {
  padding: 0 12px 12px;
}
.persona-delete-form {
  padding: 0 12px 12px;
}
.danger-btn {
  width: 100%;
  min-height: 42px;
  color: #b42335;
  background: #fff0f2;
  border: 1px solid #ffd3da;
  border-radius: 14px;
}
.persona-locked {
  margin: -2px 12px 12px;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
}
.add-persona {
  border-style: dashed;
  background: #fffaf4;
}
.mini-title { margin-top: 10px; font-weight: 800; }
.mini-hook { margin-top: 6px; color: var(--muted); font-size: 13px; }
.alert { border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; }
.alert.error { color: #b42335; background: #fff0f2; border: 1px solid #ffd3da; }
.config-status {
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 750;
}
.config-status.ok {
  color: #067647;
  background: #ecfdf3;
  border: 1px solid #abefc6;
}
.config-status.warn {
  color: #b42335;
  background: #fff0f2;
  border: 1px solid #ffd3da;
}
.hint { color: var(--muted); font-size: 13px; }
.inline-link { color: var(--accent); font-weight: 850; }
.login-page { min-height: 90vh; display: grid; align-content: center; gap: 14px; }
.history-row, .table-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line);
}
.history-row span, .table-row span { color: var(--muted); font-size: 12px; display: block; margin-top: 4px; }
.inline-form { grid-template-columns: 1fr 1fr auto auto; align-items: end; }
.invite-create-form {
  grid-template-columns: 1fr auto;
  align-items: end;
  margin-bottom: 8px;
}
.invite-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.invite-row b {
  display: inline-block;
  color: #11151b;
  background: #f4f6fa;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 7px 10px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .08em;
}
.invite-row span { color: var(--muted); font-size: 12px; display: block; margin-top: 6px; }
.json-box { overflow: auto; max-height: 380px; background: #11151b; color: #eef2f6; border-radius: 14px; padding: 14px; }
@media (max-width: 520px) {
  .shell { padding: 10px 10px 48px; }
  h1 { font-size: 25px; }
  .inline-form { grid-template-columns: 1fr; }
  .invite-create-form { grid-template-columns: 1fr; }
  .invite-row { align-items: flex-start; }
}
