:root {
  --paper: #eee9dc;
  --paper-light: #f6f2e7;
  --paper-high: #f9f5eb;
  --paper-wash: #e6decc;
  --ink: #232723;
  --muted: #616056;
  --faint: #756f62;
  --line: #d0c8b5;
  --seal: #973d2c;
  --seal-dark: #743022;
  --seal-wash: #f0e0d5;
  --jade: #4c6153;
  --serif: "Songti SC", "Noto Serif CJK SC", "Noto Serif SC", SimSun, STSong, serif;
  --kai: "Kaiti SC", KaiTi, STKaiti, "Songti SC", serif;
  --sans: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font: 14px/1.55 var(--sans);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(ellipse at 13% 14%, #f4edde 0, transparent 45%),
    radial-gradient(ellipse at 78% 95%, #e5ddca 0, transparent 46%),
    var(--paper);
}
body::before {
  position: fixed;
  inset: 0;
  z-index: 5;
  content: "";
  pointer-events: none;
  opacity: .2;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.76' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='.32' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: inherit; }
button, input, select { font: inherit; }
button {
  color: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--paper-light);
}
button:hover:not(:disabled) { border-color: #aa9e85; background-color: #eee7d7; }
button:disabled { opacity: .46; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--seal);
  outline-offset: 3px;
}
[hidden] { display: none !important; }
.chronicle-copy { white-space: pre-line; }
h1,h2,h3,h4,p { margin: 0; }
svg.ui-icon { width: 18px; height: 18px; flex: 0 0 auto; }
.topbar {
  height: 68px;
  border-bottom: 1px solid var(--line);
  background: #f3eee2;
}
.top-inner {
  max-width: 1600px;
  margin: auto;
  height: 100%;
  padding: 0 35px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand {
  display: flex;
  gap: 11px;
  text-decoration: none;
  align-items: center;
  white-space: nowrap;
}
.brand-seal {
  display: grid;
  place-content: center;
  width: 36px;
  height: 38px;
  border: 1px solid var(--seal);
  outline: 1px solid #f1d9c7;
  outline-offset: -4px;
  border-radius: 2px;
  background: var(--seal);
  color: #f6e9d8;
  font: bold 15px/.95 var(--kai);
  transform: rotate(-3deg);
}
.brand strong { display: block; font: 700 19px/1.2 var(--serif); letter-spacing: .11em; }
.brand small { display: block; font: 9px/1.4 Georgia, serif; letter-spacing: .12em; color: var(--muted); margin-top: 3px; }
.navigation { display: flex; height: 100%; gap: 6px; align-items: stretch; }
.navigation a {
  display: flex;
  position: relative;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 clamp(11px, 1.45vw, 24px);
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.navigation a:hover { color: var(--seal); background: #e8dfcd48; }
.navigation a[aria-current="page"] { color: var(--seal); font-weight: 650; }
.navigation a[aria-current="page"]::after {
  position: absolute;
  content: "";
  height: 2px;
  background: var(--seal);
  left: 12px;
  right: 12px;
  bottom: -1px;
}
.top-right { display: flex; align-items: center; gap: 12px; }
.save-mark { color: var(--faint); font-size: 12px; white-space: nowrap; }
.save-mark i { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; background: #73806a; vertical-align: 1px; }
.icon-button { border-radius: 3px; width: 36px; height: 36px; display: grid; place-items: center; }
.settings-button { background: transparent; }
.workspace { max-width: 1600px; margin: auto; padding: 21px 35px 0; }
.masthead {
  min-height: 216px;
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid #cfbfaa;
  background: #d9d3c0 url("../assets/fleet-ink.jpg") center 50%/cover no-repeat;
}
.masthead-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #eee7d6fa 0%, #eee7d6d6 21%, #eee7d653 44%, #eee7d600 62%);
}
.masthead-copy { padding: 20px 36px; position: relative; z-index: 1; }
.masthead-kicker { color: #614b3e; font: 600 13px/1.5 var(--sans); letter-spacing: .15em; display: flex; align-items: center; gap: 8px; }
.masthead-kicker span { display: inline-block; width: 16px; height: 1px; background: var(--seal); }
.masthead h1 { font: 700 clamp(38px, 4.65vw, 76px)/1.14 var(--kai); color: #282822; letter-spacing: .12em; margin: 7px 0 9px; }
.masthead p { color: #544d41; font: 15px/1 Georgia, serif; letter-spacing: .10em; }
.masthead-note {
  position: absolute;
  top: 19px;
  right: 18px;
  writing-mode: vertical-rl;
  padding: 8px 4px;
  font: 600 12px/1.3 var(--serif);
  letter-spacing: .22em;
  color: #eee3d2;
  background: #7c382cd9;
  border: 1px solid #d5b398;
  outline: 1px solid #7c382cd9;
  outline-offset: 1px;
}
.masthead.masthead--calendar {
  min-height: clamp(126px, 11vw, 153px);
  background-position: right 53%;
}
.masthead--calendar .masthead-shade {
  background: linear-gradient(90deg, #f4eddd 0%, #f4edddf5 24%, #f4eddde3 38%, #f4eddd63 55%, transparent 74%);
}
.masthead-calendar {
  display: grid;
  grid-template-columns: minmax(146px, 164px) minmax(204px, 236px);
  gap: 20px;
  margin: 15px clamp(17px, 3vw, 38px);
  padding-block: 8px 11px;
  position: relative;
  z-index: 1;
  border-block: 1px solid #a7927475;
}
.calendar-era, .calendar-season { display: grid; gap: 6px; min-width: 0; }
.calendar-label { color: #654c39; font-size: 14px; font-weight: 650; letter-spacing: .14em; line-height: 1.3; }
.calendar-era-control { position: relative; }
.calendar-era-control::after {
  border: solid #754c39;
  border-width: 0 1.5px 1.5px 0;
  content: '';
  height: 6px;
  pointer-events: none;
  position: absolute;
  right: 15px;
  top: calc(50% - 5px);
  transform: rotate(45deg);
  width: 6px;
}
.masthead-calendar .calendar-era select {
  appearance: none;
  background: #fcf7eacf;
  border: 1px solid #ae987a;
  border-radius: 3px;
  box-shadow: inset 0 1px 0 #fffcf2;
  color: var(--ink);
  cursor: pointer;
  font: 650 20px/1.2 var(--kai);
  min-height: 46px;
  min-width: 0;
  padding: 6px 31px 6px 12px;
  width: 100%;
}
.calendar-season-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(44px, 1fr));
  gap: 4px;
}
.calendar-season-choice { display: grid; position: relative; min-height: 46px; }
.calendar-season-choice input { opacity: 0; position: absolute; height: 100%; width: 100%; margin: 0; cursor: pointer; }
.calendar-season-choice span {
  background: #faf4e4a8;
  border: 1px solid #b9a283;
  border-radius: 3px;
  color: #4d473a;
  display: grid;
  font: 650 20px/1 var(--kai);
  place-items: center;
  pointer-events: none;
}
.calendar-season-choice:hover span, .calendar-era select:hover { background-color: #fffaf0; }
.calendar-season-choice input:checked + span {
  background: var(--seal-dark);
  border-color: var(--seal-dark);
  box-shadow: inset 0 0 0 2px var(--seal-dark), inset 0 0 0 3px #e6bc9680;
  color: #fff6e5;
}
.calendar-season-choice input:focus-visible + span { outline: 2px solid var(--seal); outline-offset: 2px; }
.desk { margin-top: 18px; }
.desk-header { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 12px; }
.desk-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.section-mark { width: 41px; height: 41px; border-radius: 3px; border: 1px solid #cdbfa9; display: grid; place-items: center; color: var(--seal); background: #eee1d3; }
.section-mark .ui-icon { width: 22px; height: 22px; }
.desk-heading h2 { font: 700 25px/1.07 var(--serif); letter-spacing: .10em; }
.desk-heading p { font-size: 12px; margin-top: 4px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.time-panel { flex-shrink: 0; display: flex; align-items: center; gap: 9px; }
.time-date { display: flex; align-items: center; gap: 7px; padding-right: 7px; color: var(--muted); white-space: nowrap; font-size: 12px; }
.time-date strong { color: var(--ink); font-weight: 650; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  min-height: 36px;
  border-radius: 3px;
  white-space: nowrap;
  text-align: center;
  font-size: 13px;
  font-weight: 550;
}
.btn .ui-icon { width: 15px; height: 15px; }
.btn-primary { background: var(--seal); border-color: var(--seal); color: #fff9eb; }
.btn-primary:hover:not(:disabled) { background: var(--seal-dark); border-color: var(--seal-dark); }
.btn-dark { background: #3c4b40; border-color: #3c4b40; color: var(--paper-light); }
.btn-dark:hover:not(:disabled) { background: #334136; border-color: #334136; }
.btn-full { width: 100%; }
.desk-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 315px); gap: 14px; align-items: start; }
.main-panel { position: relative; min-width: 0; border: 1px solid var(--line); background: var(--paper-light); }
.main-panel.chart-panel { min-height: 535px; overflow: hidden; background: #ded6c2; }
.main-panel.deck-panel { min-height: 550px; overflow: hidden; background: #9f9984; }
.sidebar { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.card { border: 1px solid var(--line); background: #f5f0e5; min-width: 0; }
.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 13px;
  gap: 7px;
  min-height: 40px;
  border-bottom: 1px solid var(--line);
  background: #eee8da;
}
.card-heading h3 { font: 700 16px/1.15 var(--serif); letter-spacing: .05em; display: flex; align-items: center; gap: 8px; }
.card-heading .ui-icon { width: 16px; height: 16px; color: var(--seal); }
.card-aside { color: var(--muted); font-size: 11px; white-space: nowrap; }
.card-body { padding: 12px 13px; }
.card-body > * + * { margin-top: 9px; }
.position { font: 700 21px/1.15 var(--serif); letter-spacing: .04em; }
.subtle { font-size: 12px; line-height: 1.55; color: var(--muted); }
.data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 8px 0; border-block: 1px solid #ddd4c2; }
.data-grid span { display: block; color: var(--muted); font-size: 11px; }
.data-grid strong { display: block; font-size: 12px; font-weight: 650; margin-top: 2px; }
.nav-location { display: flex; align-items: baseline; gap: 7px; }
.nav-location span, .nav-caption, .nav-route-label { color: var(--muted); font-size: 12px; }
.nav-location b { font-family: var(--serif); font-size: 15px; }
.sailing-difficulty { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px 8px; }
.sailing-difficulty > span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.sailing-difficulty > select { width: 100%; min-width: 0; height: 36px; }
.sailing-difficulty-note { grid-column: 1 / -1; font-size: 13px; line-height: 1.45; color: var(--muted); }
.navigation-instrument {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr);
  gap: 13px;
  align-items: center;
  padding: 9px 10px;
  background: radial-gradient(ellipse at 18% 36%, #f6ead1, transparent 69%), #ede4d2;
  border: 1px solid #d1c1a5;
}
.si-nan {
  position: relative;
  isolation: isolate;
  width: 96px;
  aspect-ratio: 1;
  color: #68543d;
  border: 1px solid #9a8361;
  box-shadow: inset 0 0 0 2px #f5e8cc, inset 0 0 0 3px #bdab87;
  background: radial-gradient(circle, #ecd9b3, #e2cca0 68%, #dbc494 71%);
  font: 700 10px/1 var(--serif);
}
.si-nan i { position: absolute; font-style: normal; z-index: 3; }
.dial-north { top: 6px; left: 50%; transform: translateX(-50%); }
.dial-south { bottom: 6px; left: 50%; transform: translateX(-50%); }
.dial-east { top: 50%; right: 5px; transform: translateY(-50%); }
.dial-west { top: 50%; left: 5px; transform: translateY(-50%); }
.dial-graduations {
  position: absolute;
  inset: 17px;
  border: 1px solid #8a6e47;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, #876b48 0deg 1deg, transparent 1deg 15deg);
  box-shadow: inset 0 0 0 4px #e6d2ae;
}
.dial-graduations::before { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: #e7d2ab; }
.dial-spoon, .dial-destination { position: absolute; transform: rotate(var(--bearing)); }
.dial-spoon { inset: 23px; z-index: 2; filter: drop-shadow(1px 1px 1px #71583a88); }
.dial-spoon::before, .dial-spoon::after, .dial-destination::before { content: ''; position: absolute; left: 50%; transform: translateX(-50%); }
.dial-spoon::before { top: 0; width: 5px; height: 72%; border-radius: 45% 36% 0 0; background: linear-gradient(90deg, #2b2922, #5a4c35 60%, #373128); }
.dial-spoon::after { bottom: 5%; width: 15px; height: 22px; border-radius: 52% 53% 46% 44%; background: radial-gradient(ellipse at 36% 34%, #75644b, #423627 65%, #27241e 74%); }
.dial-destination { inset: 13px; z-index: 3; }
.dial-destination::before { top: 0; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 8px solid var(--seal); }
.navigation-readings { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.navigation-readings strong { font: 700 20px/1.25 var(--serif); overflow-wrap: anywhere; }
.nav-reading { display: flex; align-items: center; gap: 7px; font-variant-numeric: tabular-nums; font-size: 12px; }
.destination-key { width: 0; height: 0; border-inline: 4px solid transparent; border-bottom: 7px solid var(--seal); }
.heading-key { width: 8px; height: 3px; border-radius: 3px; background: #484037; }
.nav-waypoint, .nav-progress { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 3px 6px; color: var(--muted); font-size: 11px; }
.nav-waypoint b, .nav-progress b { color: var(--ink); font-size: 12px; }
.nav-progress .progress { width: 100%; margin-top: 0; }
.nav-destination { display: block; width: 100%; }
.nav-route-label, .nav-route-length { display: block; }
.navigator-card .nav-destination, .navigator-card .nav-route-length { margin-top: 4px; }
.nav-bay-exit { display: grid; gap: 5px; padding-block: 7px; border-block: 1px solid var(--line); }
.nav-wind { border-top: 1px solid #d7cbb5; padding-top: 7px; }
.nav-wind > div { display: flex; align-items: center; gap: 5px; font-size: 12px; }
.nav-wind .ui-icon { width: 15px; height: 15px; color: var(--jade); }
.nav-wind > div > span { margin-left: auto; white-space: nowrap; color: var(--muted); }
.nav-wind p { margin-top: 3px; line-height: 1.45; font-size: 11px; color: var(--muted); }
.nav-wind .chart-wind-trend { color: var(--seal-dark); }
.monsoon-notes { margin-top: 4px; color: var(--seal-dark); font-size: 11px; }
.monsoon-notes summary { width: max-content; cursor: pointer; }
.sail-buttons { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.sail-choice { position: relative; border-radius: 2px; min-height: 37px; padding: 4px 0; font-weight: 600; font-size: 13px; }
.sail-choice[aria-pressed="true"] { color: var(--seal-dark); border-color: #aa6f59; background: #f0e0d3; }
.sail-choice span { position: absolute; top: -6px; right: -3px; border-radius: 2px; padding: 0 3px; color: #fff9e9; background: var(--jade); font-size: 9px; }
.helm-advice { color: var(--muted); font-size: 12px; line-height: 1.45; }
.helm-risk { color: var(--seal-dark); border-left: 1px solid #b89a7e; margin-left: 2px; padding-left: 5px; }
.helm-steering, .rowing-control { display: flex; align-items: center; justify-content: space-between; gap: 7px; border-top: 1px solid #ddd4c2; padding-top: 8px; }
.helm-steering > span { font-size: 12px; text-align: center; flex: 1; }
.helm-steering .btn, .rowing-control .btn { min-height: 32px; padding: 5px 8px; }
.rowing-control p { color: var(--muted); font-size: 11px; line-height: 1.4; }
.rowing-form { display: grid; gap: 8px; }
.rowing-order { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px; background: #f0e7d6; border: 1px solid #d9ccb5; }
.rowing-order small { display: block; color: var(--muted); font-size: 12px; }
.rowing-order input { width: 5em; }
.rowing-form > .btn { justify-self: start; }
.event-preview { display: flex; align-items: start; justify-content: space-between; gap: 8px; }
.event-preview p { margin-top: 3px; color: var(--muted); font-size: 12px; }
.event-preview .text-button { flex-shrink: 0; color: var(--seal); }
.event-card { border-left: 3px solid #9e4634; }
.event-card .card-heading { background: #f0e3d6; }
.text-button { border: 0; background: transparent !important; padding: 1px 0; color: var(--muted); font-size: 12px; }
.text-button:hover:not(:disabled) { color: var(--seal); text-decoration: underline; text-underline-offset: 3px; }
.journal-mini { padding: 0; list-style: none; margin: 0; }
.journal-mini li { display: flex; gap: 8px; margin-bottom: 7px; align-items: baseline; color: var(--muted); font-size: 12px; }
.journal-mini li:last-child { margin-bottom: 0; }
.journal-mini li::before { content: ""; width: 5px; height: 5px; transform: rotate(45deg); background: #978d77; flex: 0 0 auto; }
.journal-mini b { font-weight: 550; color: var(--ink); }
.survey-records { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; }
.survey-records .text-button { margin-left: auto; white-space: nowrap; }
.progress { height: 4px; background: #ded4c1; margin-top: 5px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--jade); }
.progress > span.low { background: var(--seal); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row > * { margin: 0; }
.footer {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  align-items: center;
  font-size: 11px;
  margin: 14px 0 0;
  padding: 9px 0 13px;
  border-top: 1px solid var(--line);
}
.footer-separator { color: #aaa086; padding: 0 4px; }
.chart-host { height: 535px; }
.deck-panel { height: 550px; }
.panel-content { min-height: 468px; padding: 23px; }
.content-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); padding-bottom: 13px; margin-bottom: 15px; }
.content-heading h3 { font: 700 23px/1.2 var(--serif); }
.content-heading p { color: var(--muted); font-size: 12px; }
.ship-grid { display: grid; gap: 12px; }
.ship-card { border: 1px solid var(--line); background: #f9f4e9; padding: 13px; }
.ship-card.boarded { border-color: #aeb5a5; background: #f3f1e4; }
.ship-card header { display: flex; gap: 10px; align-items: center; }
.ship-card h4 { font: 700 20px/1.18 var(--serif); }
.ship-card header p { color: var(--muted); margin-top: 3px; font-size: 12px; }
.ship-status { font-size: 11px; color: var(--jade); padding: 3px 6px; border: 1px solid #aeb5a5; margin-left: auto; }
.ship-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 11px 0; }
.ship-metrics span, .ship-metrics b { font-size: 12px; }
.ship-metrics b { float: right; font-variant-numeric: tabular-nums; }
.stocks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin: 0; }
.stocks > div { border-top: 1px dashed #cbbfac; padding: 6px 5px; }
.stocks dt { color: var(--muted); font-size: 11px; }
.stocks dd { margin: 0; color: var(--ink); font-size: 15px; font-weight: 650; white-space: nowrap; }
.ship-card > .row { margin-top: 10px; }
.crew-list { display: flex; flex-direction: column; }
.crew-row { display: flex; align-items: center; width: 100%; padding: 6px 0; gap: 8px; text-align: left; border: 0; border-bottom: 1px dashed #d6cbb9; background: transparent; }
.crew-row:last-child { border-bottom: 0; }
.crew-row small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.crew-row .ui-icon { color: var(--seal); margin-left: auto; width: 14px; height: 14px; }
.crew-avatar {
  display: grid;
  place-items: center;
  border: 1px solid #c6ac91;
  border-radius: 50%;
  flex-shrink: 0;
  color: #663b2e;
  background: radial-gradient(circle at 38% 27%, #f6ead6, #e0c9a9);
  font: 700 18px/1 var(--kai);
  width: 33px;
  height: 33px;
}
.crew-avatar-large { font-size: 27px; width: 50px; height: 50px; }
.journal-tabs { display: flex; align-items: stretch; flex-wrap: wrap; gap: 6px; padding: 0 0 11px; border-bottom: 1px solid var(--line); }
.journal-tabs button { padding: 6px 12px; border-radius: 2px; border-color: transparent; background: #ebe3d3; color: var(--muted); }
.journal-tabs button[aria-pressed="true"] { color: var(--seal-dark); background: var(--seal-wash); border-color: #b88c75; font-weight: 650; }
.journal-entry { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 13px; padding: 15px 0; border-bottom: 1px dashed var(--line); }
.journal-entry:last-child { border-bottom: 0; }
.journal-entry h4 { font: 700 19px/1.2 var(--serif); }
.journal-entry p { color: var(--muted); margin-top: 5px; }
.log-day { color: var(--seal-dark); font-size: 12px; padding-top: 2px; }
.empty { padding-top: 15px; }
.ink-plate { display: block; width: 100%; max-height: 320px; object-fit: cover; margin-top: 10px; border: 1px solid var(--line); }
.event-plate { margin-top: 0; object-position: center 57%; max-height: 185px; }
dialog {
  width: min(640px, calc(100vw - 28px));
  max-height: calc(100dvh - 34px);
  padding: 0;
  border: 1px solid #a89a7e;
  border-radius: 4px;
  color: var(--ink);
  background: #f5efe0;
  box-shadow: 0 18px 70px #201c126b;
}
dialog::backdrop { background: #26282184; backdrop-filter: blur(2px); }
.dialog-heading {
  display: flex;
  justify-content: space-between;
  gap: 13px;
  align-items: center;
  background: #e9dfcd;
  border-bottom: 1px solid #cbbca4;
  padding: 16px 20px;
  position: sticky;
  z-index: 2;
  top: 0;
}
.dialog-heading p { font-size: 11px; letter-spacing: .11em; color: var(--seal-dark); }
.dialog-heading h2 { font: 700 28px/1.16 var(--serif); letter-spacing: .05em; margin-top: 4px; }
.dialog-body { padding: 17px 20px 20px; }
.dialog-body > * + * { margin-top: 11px; }
.dialog-body h3 { font: 700 19px/1.25 var(--serif); }
.dialog-body p { overflow-wrap: anywhere; }
.choices { display: grid; gap: 8px; }
.choice-form .field { margin: 0 0 5px; }
.choice { display: grid; align-items: center; grid-template-columns: 31px 1fr 18px; width: 100%; text-align: left; border-radius: 2px; padding: 9px; gap: 8px; background: #fbf5e8; }
.choice .ui-icon { color: var(--seal); justify-self: center; width: 14px; height: 14px; }
.choice b { font-weight: 600; }
.choice small { display: block; margin-top: 1px; color: var(--muted); }
.choice-letter { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid #cab49c; color: var(--seal-dark); background: #f1e2ce; font-family: Georgia, serif; }
.folio-quote { background: #eee4d3; padding: 10px 13px; margin: 0; border-left: 3px solid var(--seal); font: 600 16px/1.6 var(--serif); }
.dialog-body > .folio-quote + * { margin-top: 13px; }
.transfer-form, .form-break { border-top: 1px solid var(--line); padding-top: 10px; }
.form-break { display: flex; gap: 7px; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: 1.3fr 1fr .7fr auto; gap: 8px; align-items: end; margin-top: 8px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field span { font-size: 12px; color: var(--muted); }
input:not([type="checkbox"]), select {
  color: var(--ink);
  background: #fbf7ed;
  border: 1px solid #c3b49a;
  border-radius: 2px;
  min-height: 36px;
  min-width: 0;
  padding: 6px 8px;
}
input[type="checkbox"] { accent-color: var(--seal); }
.board-note { background: #f9f3e5; border-left: 2px solid #b7a184; padding: 9px 11px; }
.board-note p { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.npc-profile { display: flex; align-items: center; gap: 11px; }
.npc-profile p + p { margin-top: 4px; }
.persona-archive { border: 1px solid #cfbea2; background: #f4ecdc; }
.persona-archive summary { display: flex; justify-content: space-between; align-items: center; gap: 8px; cursor: pointer; padding: 8px 10px; font-weight: 650; }
.persona-archive summary::-webkit-details-marker { display: none; }
.persona-archive summary > span { display: flex; align-items: center; gap: 6px; }
.persona-archive summary > span .ui-icon { color: var(--seal); width: 16px; height: 16px; }
.persona-archive summary small { color: var(--muted); font-weight: 500; }
.persona-archive summary small::after { content: ' ＋'; color: var(--seal); }
.persona-archive[open] summary small::after { content: ' −'; }
.persona-archive-body { max-height: min(340px, 42dvh); overflow: auto; padding: 11px; border-top: 1px solid #d9cdb7; }
.persona-archive-body > * + * { margin-top: 8px; }
.persona-archive-body h3 { color: var(--seal-dark); font-size: 15px; }
.persona-archive-body h4 { font-size: 14px; }
.persona-archive-body article { padding: 6px 8px; background: #f9f3e6; border-left: 2px solid #baa584; }
.persona-archive-body article p { margin-top: 3px; }
.persona-facts, .persona-relations { padding: 0; margin: 0; list-style: none; }
.persona-facts div, .persona-relations li { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 9px; padding: 3px 0; }
.persona-facts dt,.persona-relations b { color: var(--seal-dark); font-weight: 600; }
.persona-facts dd { margin: 0; }
.npc-model { display: flex; justify-content: space-between; align-items: center; gap: 9px; padding: 7px 9px; background: #e8eadf; border: 1px solid #c7caba; }
.npc-model b { color: #415549; }
.npc-model p,.npc-model small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.npc-model progress { width: clamp(55px, 18%, 116px); accent-color: var(--jade); }
.npc-model .btn { padding: 4px 7px; min-height: 30px; }
.chat-log { background: #eae2d2; border: 1px solid #d1c4ae; padding: 9px; min-height: 63px; max-height: 205px; overflow: auto; text-align: start; }
.chat-turn + .chat-turn { margin-top: 9px; }
.chat-you { background: #e5eadb; padding: 6px 9px; margin: 0 0 5px max(18px, 12%); border-left: 2px solid #87947b; }
.chat-them { background: #f8f2e4; padding: 6px 9px; margin-right: max(18px, 10%); border-left: 2px solid #bba988; }
.chat-them small { display: block; margin-top: 3px; font-size: 11px; color: #55634e; }
.chat-memory { color: var(--muted); font-size: 11px; padding: 3px 0; }
.quick-prompts, .assignment-form { display: flex; flex-wrap: wrap; gap: 5px; }
.quick-prompts .btn { min-height: 28px; padding: 4px 7px; font-size: 11px; }
.talk-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.talk-privacy { grid-column: 1 / -1; color: var(--muted); font-size: 12px; line-height: 1.4; }
.npc-actions .btn { min-height: 34px; padding: 4px 8px; }
.opinions { list-style: none; padding: 0; }
.opinions li { display: grid; grid-template-columns: 66px 1fr; gap: 9px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.opinions li b { color: var(--seal-dark); }
.council-roles { border: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 5px 12px; margin: 0 0 9px; }
.council-roles legend { color: var(--muted); font-size: 12px; }
.council-roles label { display: flex; align-items: center; gap: 4px; }
.inline-feedback { color: var(--seal-dark); background: var(--seal-wash); padding: 8px 10px; border-left: 2px solid var(--seal); }
.inline-feedback.success { color: #334739; background: #e5eadb; border-color: #718571; }
.about-list { margin: 0; }
.about-list div + div { margin-top: 10px; }
.about-list dt { color: var(--seal-dark); font-weight: 650; }
.about-list dd { margin: 3px 0 0; }
.toast {
  position: fixed;
  z-index: 10;
  bottom: 17px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  width: max-content;
  background: #364338;
  color: #f8f2e4;
  padding: 10px 15px;
  box-shadow: 0 3px 19px #1f231f44;
  border: 1px solid #697869;
  border-radius: 3px;
  font-size: 13px;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 1040px) {
  .top-inner, .workspace { padding-inline: 21px; }
  .desk-grid { grid-template-columns: minmax(0, 1fr) 266px; }
  .masthead { min-height: 188px; }
  .chart-host { height: 493px; }
  .main-panel.chart-panel { min-height: 493px; }
  .top-inner { gap: 10px; }
}
@media (max-width: 760px) {
  .topbar { height: auto; }
  .top-inner { flex-wrap: wrap; gap: 6px 12px; padding-top: 9px; }
  .top-right { margin-left: auto; }
  .navigation { order: 3; width: 100%; justify-content: space-between; min-height: 42px; gap: 0; }
  .navigation a { flex: 1 1 auto; padding-inline: 7px; }
  .navigation a[aria-current="page"]::after { left: 4px; right: 4px; }
  .workspace { padding-top: 13px; }
  .desk-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .sidebar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 9px; }
  .masthead { min-height: 160px; }
  .masthead-copy { padding-left: 22px; }
  .masthead h1 { font-size: clamp(34px, 7.8vw, 59px); }
  .masthead p { font-size: 13px; }
  .time-panel { gap: 5px; }
  .time-date { padding-right: 3px; gap: 4px; }
  .time-date > span { display: none; }
  .desk-header .btn { padding-inline: 7px; }
  .main-panel.chart-panel { min-height: 420px; }
  .chart-host { height: 420px; }
}
@media (max-width: 500px) {
  .top-inner, .workspace { padding-inline: 12px; }
  .brand strong { font-size: 16px; }
  .brand small { font-size: 8px; }
  .brand-seal { width: 29px; height: 31px; font-size: 12px; }
  .top-right { gap: 6px; }
  .topbar .ui-icon { width: 15px; height: 15px; }
  .navigation a { font-size: 12px; }
  .masthead { min-height: 143px; }
  .masthead-copy { padding: 10px 16px; }
  .masthead-kicker { font-size: 11px; }
  .masthead-note { display: none; }
  .desk { margin-top: 12px; }
  .desk-header { align-items: flex-start; flex-direction: column; gap: 7px; }
  .time-panel { width: 100%; }
  .time-date { margin-right: auto; }
  .time-panel .btn-primary { margin-left: 0; }
  .desk-heading h2 { font-size: 22px; }
  .section-mark { height: 34px; width: 34px; }
  .main-panel.chart-panel { min-height: 370px; }
  .chart-host { height: 370px; }
  .main-panel.deck-panel { height: 470px; min-height: 470px; }
  .sidebar { grid-template-columns: minmax(0, 1fr); }
  .panel-content { padding: 13px; }
  .content-heading { align-items: flex-start; flex-direction: column; gap: 3px; }
  .ship-metrics { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dialog-heading, .dialog-body { padding-inline: 12px; }
  .journal-entry { grid-template-columns: 52px minmax(0, 1fr); gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::after, *::before { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.jump-link { padding: 6px 3px; color: var(--seal-dark); font-size: 12px; text-decoration-thickness: 1px; text-underline-offset: 3px; }
