:root {
  font-family:
    Inter, "Noto Sans CJK SC", "PingFang SC", "Microsoft Yahei", sans-serif;
  color: #242e2a;
  background: #f5f3ee;
  line-height: 1.55;
  --paper: #f5f3ee;
  --card: #fffdf9;
  --ink: #242e2a;
  --quiet: #57655d;
  --line: #dfe3d8;
  --green: #2f5b48;
  --nav: #192e27;
  --pale: #edf3e9;
  --gold: #746033;
  --warning: #8a402d;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.55;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid #7e9469;
  outline-offset: 2px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: clamp(26px, 4vw, 50px);
  line-height: 1.22;
  letter-spacing: -0.015em;
}
h2 {
  font-size: 18px;
}
h3 {
  font-size: 14px;
}
small,
.quiet {
  color: var(--quiet);
}
.skip {
  position: absolute;
  transform: translateY(-160%);
  z-index: 10;
  background: white;
  padding: 8px;
}
.skip:focus {
  transform: none;
}
.shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 222px minmax(0, 1fr);
}
.sidebar {
  background: var(--nav);
  color: #bed0c3;
  display: flex;
  position: sticky;
  top: 0;
  height: 100dvh;
  flex-direction: column;
  padding: 24px 14px;
  gap: 28px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 690;
  font-size: 15px;
  color: #f2f3e8;
  padding: 2px 6px;
}
.mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 37px;
  height: 37px;
  border: 1px solid #819786;
  border-radius: 9px;
  background: #384f41;
  font-family: "Noto Serif CJK SC", "Songti SC", serif;
  font-size: 20px;
}
.sidebar nav {
  display: grid;
  gap: 4px;
}
.sidebar nav a {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
}
.sidebar nav a:hover,
.sidebar nav [aria-current="page"] {
  color: #f4f3e6;
  background: #344c3e;
}
.sidebar nav small {
  margin: 15px 10px 2px;
  font-size: 11px;
  color: #9fb5a6;
  letter-spacing: 0.09em;
}
.sidebar-end {
  margin-top: auto;
  border-top: 1px solid #496151;
  font-size: 12px;
  padding: 13px 9px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a9c0a4;
}
.main-shell {
  min-width: 0;
}
.topbar {
  display: flex;
  min-height: 57px;
  padding: 9px clamp(18px, 3vw, 44px);
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.topbar #breadcrumb {
  margin-right: auto;
  min-width: 0;
  overflow-wrap: anywhere;
}
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 99px;
  font-size: 11px;
  padding: 4px 9px;
  background: var(--pale);
  color: var(--green);
  white-space: nowrap;
}
.badge.muted {
  background: #f2ede0;
  color: var(--gold);
}
.mobile-home,
.mobile-navigation {
  display: none;
}
.content {
  max-width: 1450px;
  margin: 0 auto;
  padding: clamp(15px, 3vw, 44px);
  display: grid;
  gap: 22px;
}
.content.section {
  max-width: 1250px;
}
.hero {
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(ellipse at 93% 115%, #56634b 0%, transparent 55%),
    linear-gradient(110deg, #213c32, #384e3e);
  min-height: 230px;
  padding: 32px clamp(19px, 4vw, 52px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 10px;
  border-radius: 14px;
  color: #f5f4e8;
  overflow: hidden;
}
.hero:after {
  content: "";
  z-index: -1;
  position: absolute;
  inset: 0 0 0 39%;
  background: repeating-radial-gradient(
    ellipse at 90% 130%,
    transparent 0 31px,
    #c2b88e38 32px 33px,
    transparent 34px 55px
  );
  mask-image: linear-gradient(90deg, transparent, #000 30%);
  pointer-events: none;
}
.hero .eyebrow {
  color: #e1cd9d;
}
.hero h1 {
  font-family: "Noto Serif CJK SC", "Songti SC", serif;
  letter-spacing: 0.09em;
}
.hero p {
  color: #d3dfce;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 0.12em;
  font-weight: 650;
}
.title {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.title h1 {
  font-size: clamp(25px, 3vw, 34px);
}
.title p {
  margin-top: 5px;
}
.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.hero .actions {
  margin-top: 8px;
}
.btn,
.text-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  padding: 8px 13px;
  color: var(--ink);
  font-size: 13px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:hover {
  background: var(--pale);
}
.btn.primary {
  background: var(--green);
  color: white;
  border-color: var(--green);
  font-weight: 670;
}
.hero .btn.primary {
  background: #dce8cf;
  color: #26392d;
  border-color: #dce8cf;
}
.hero .btn.secondary {
  background: #ffffff0b;
  color: #f4f2e5;
  border-color: #82978a;
}
.text-button {
  background: none;
  border-color: transparent;
  color: var(--green);
  padding: 4px 7px;
  min-height: 34px;
}
.text-button:hover {
  text-decoration: underline;
}
.danger {
  color: var(--warning);
}
.wide {
  width: 100%;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(265px, 100%), 1fr));
  gap: 14px;
}
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 17px;
  min-width: 0;
}
.panel > h2,
.panel > .panel-title {
  margin-bottom: 12px;
}
.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.project-card {
  display: grid;
  gap: 13px;
}
.project-card h2 {
  font-family: "Noto Serif CJK SC", "Songti SC", serif;
  font-size: 23px;
}
.project-card .card-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.project-icon {
  display: grid;
  place-items: center;
  background: var(--pale);
  color: var(--green);
  border-radius: 9px;
  width: 41px;
  height: 41px;
  font-weight: 700;
}
.row-list {
  display: grid;
  gap: 4px;
}
.row {
  display: flex;
  min-height: 43px;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  text-align: left;
  padding: 7px 9px;
  border: 0;
  background: none;
  border-radius: 7px;
  color: var(--ink);
  width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}
.row:hover,
.row.active {
  background: var(--pale);
}
.row span:last-child:not(.badge) {
  flex: none;
  color: var(--quiet);
}
.empty {
  padding: 14px 0;
  color: var(--quiet);
  white-space: normal;
}
.error {
  color: var(--warning);
}
.loading {
  padding: 20px;
  color: var(--quiet);
}
label.field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 630;
  color: var(--ink);
}
input:not([type="checkbox"]),
textarea,
select {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: #f9f8f3;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
}
textarea {
  resize: vertical;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.form-stack {
  display: grid;
  gap: 13px;
}
.form-stack .actions {
  margin-top: 3px;
}
.editor-grid,
.chat-grid {
  display: grid;
  grid-template-columns: minmax(190px, 0.35fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.catalog {
  padding: 11px;
}
.catalog summary {
  padding: 7px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}
.catalog details + details {
  border-top: 1px solid var(--line);
}
.catalog .row {
  font-size: 12px;
}
.catalog-list {
  max-height: 65vh;
  overflow: auto;
}
.small {
  font-size: 12px;
}
.editor textarea {
  display: block;
  min-height: 52vh;
  font-family: "Noto Sans Mono CJK SC", ui-monospace, monospace;
  line-height: 1.75;
  padding: 15px;
  white-space: pre-wrap;
}
.editor .panel-title {
  align-items: flex-start;
  flex-wrap: wrap;
  overflow-wrap: anywhere;
}
.editor-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}
.preview {
  padding: 5px 12px 12px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.preview h1,
.preview h2,
.preview h3 {
  font-size: 1.25rem;
  margin: 10px 0;
}
.preview p {
  white-space: pre-wrap;
  margin: 7px 0;
}
.preview blockquote {
  border-left: 3px solid #bdcdb7;
  margin: 9px 0;
  padding-left: 10px;
  color: var(--quiet);
}
.preview pre,
.diff pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  font-size: 13px;
  margin: 6px 0;
  max-height: 430px;
  overflow: auto;
}
.conflict {
  border: 1px solid #dfa98f;
  border-radius: 8px;
  background: #fcf2ea;
  padding: 11px;
  margin: 9px 0;
}
.conflict summary {
  cursor: pointer;
}
.diff {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.diff > div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
}
.diff > div:last-child {
  background: var(--pale);
}
.scenario {
  display: grid;
  gap: 11px;
}
.scenario textarea {
  min-height: 90px;
}
.message {
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message.author {
  background: #ebf0e8;
  margin-left: 18px;
}
.message.codex {
  background: #faf7ef;
  margin-right: 18px;
}
.message b {
  display: block;
  font-size: 12px;
  margin-bottom: 3px;
}
.messages {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}
.dimension-list {
  display: grid;
  gap: 5px;
}
.dimension {
  border-top: 1px solid var(--line);
  padding: 11px 0;
}
.dimension summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}
.dimension p {
  margin-top: 6px;
}
.dimension blockquote {
  margin: 8px 0;
  color: var(--quiet);
  border-left: 2px solid #adc0aa;
  padding-left: 10px;
}
.policy-list {
  display: grid;
  gap: 8px;
}
.policy-list details {
  border-top: 1px solid var(--line);
  padding: 7px 0;
}
.policy-list summary {
  cursor: pointer;
}
.memory-list {
  display: grid;
  gap: 7px;
}
.memory-list .row {
  justify-content: flex-start;
}
.memory-list details {
  padding: 7px 0;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.memory-list p {
  white-space: pre-wrap;
}
.agent-row {
  padding: 9px 0;
  border-top: 1px solid var(--line);
}
.agent-row > .panel-title {
  margin-bottom: 3px;
}
dialog {
  width: min(520px, calc(100% - 24px));
  max-height: calc(100dvh - 32px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
}
dialog::backdrop {
  background: #13271ee0;
}
dialog h2 {
  margin: 0 0 14px;
}
.notice {
  position: fixed;
  z-index: 9;
  right: 19px;
  bottom: 20px;
  max-width: min(450px, calc(100% - 36px));
  background: #284232;
  color: #fff;
  padding: 11px 17px;
  border-radius: 8px;
  box-shadow: 0 10px 26px #172b2020;
}
.login {
  max-width: 460px;
  margin: 10vh auto;
  padding: 20px;
}
.login h1 {
  font-size: 26px;
  margin-bottom: 15px;
}
[hidden] {
  display: none !important;
}
@media (max-width: 820px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .topbar {
    padding-inline: 12px;
    min-height: 52px;
  }
  .topbar #breadcrumb {
    font-weight: 600;
  }
  .mobile-home {
    display: inline-block;
    color: var(--green);
    font-size: 12px;
  }
  .mobile-navigation {
    position: sticky;
    bottom: 0;
    display: flex;
    justify-content: space-around;
    gap: 2px;
    padding: 4px 6px max(6px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--card);
    z-index: 5;
  }
  .mobile-navigation a {
    min-height: 45px;
    padding: 7px 4px;
    display: grid;
    place-items: center;
    flex: 1;
    color: var(--quiet);
    font-size: 12px;
    white-space: nowrap;
  }
  .mobile-navigation [aria-current="page"] {
    background: var(--pale);
    color: var(--green);
    border-radius: 7px;
    font-weight: 700;
  }
  .content {
    min-height: calc(100dvh - 103px);
    align-content: start;
    gap: 13px;
    padding: 13px;
  }
  .hero {
    min-height: 195px;
    padding: 23px 18px;
  }
  .grid,
  .editor-grid,
  .chat-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .catalog-list {
    max-height: 220px;
  }
  .panel {
    padding: 12px;
  }
  .title {
    flex-wrap: wrap;
  }
  .topbar #connection {
    font-size: 10px;
  }
  .editor textarea {
    min-height: 45vh;
  }
  .notice {
    bottom: 65px;
  }
  .btn {
    min-height: 43px;
  }
  input:not([type="checkbox"]),
  textarea,
  select {
    font-size: 16px;
  }
  .diff {
    grid-template-columns: 1fr;
  }
  .messages {
    gap: 7px;
  }
  .message.author {
    margin-left: 9px;
  }
  .message.codex {
    margin-right: 9px;
  }
}

.creation-settings {
  display: grid;
  grid-template-columns: 2fr minmax(80px, 1fr);
  gap: 10px;
}
.context-sources {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 6px;
  white-space: normal;
}
.context-sources summary,
#reference-fields summary {
  cursor: pointer;
}
.context-sources ul {
  margin: 6px 0;
  padding-left: 1.4rem;
}
#reference-fields .field {
  margin-top: 6px;
}
.context-sources pre,
#revision-scope blockquote {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 16rem;
  overflow: auto;
  margin: 5px 0;
}
.context-sources pre {
  padding: 8px;
  font: inherit;
  font-size: .85rem;
  background: var(--paper);
}

.story-change { margin-block: .8rem; }
.story-change h3 { overflow-wrap: anywhere; }
.story-change pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 30vh;
  overflow: auto;
  padding: .65rem;
  background: var(--paper);
  font: inherit;
}

#event-references {
  border-block: 1px solid var(--line);
  padding-block: .6rem;
}
#event-references summary { cursor: pointer; }
.reference-workflow { display: grid; gap: .75rem; padding-top: .75rem; }
.reference-workflow textarea { min-height: 4rem; }
.reference-passage blockquote {
  max-height: 9rem;
  overflow: auto;
  margin: .4rem 0;
  padding-inline-start: .8rem;
  border-inline-start: 2px solid var(--line);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
#case-results:empty { display: none; }
.case-card { border-top: 1px solid var(--line); padding-block: .7rem; }
.case-card .check { align-items: baseline; }
.case-card dl { display: grid; gap: .2rem; }
.case-card dt { font-weight: 600; }
.case-card dd { margin: 0 0 .4rem; }
.case-card p { margin: .35rem 0; }
.case-card details, .reference-passage { font-size: .88rem; }
