@font-face {
  font-family: DM Sans;
  src: url('./assets/dm-sans.woff2') format('woff2');
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: Fraunces;
  src: url('./assets/fraunces.woff2') format('woff2');
  font-weight: 400 800;
  font-display: swap;
}
:root {
  color-scheme: light;
  --ink: #24413e;
  --navy: #183c42;
  --navy-2: #244e50;
  --teal: #28645c;
  --muted: #62706a;
  --light: #f9f4e7;
  --paper: #f2ecdc;
  --cream: #eae2ce;
  --line: #d7ceba;
  --gold: #eac582;
  --good: #427452;
  --bad: #a0523f;
  --serif: Fraunces, Georgia, serif;
  font-family: DM Sans, Arial, sans-serif;
  font-size: 13px;
  color: var(--ink);
  background: #527f7d;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; overflow: hidden; overscroll-behavior: none; }
button, input { font: inherit; }
button { border: 0; background: none; color: inherit; cursor: pointer; }
button, a, canvas { -webkit-tap-highlight-color: transparent; }
button:focus-visible, canvas:focus-visible { outline: 2px solid #d3924b; outline-offset: -2px; }
button:disabled { cursor: default; }
button svg, [data-icon] svg { flex: 0 0 auto; display: block; }
[hidden] { display: none !important; }
#game { height: 100vh; height: 100dvh; display: grid; grid-template-rows: 63px minmax(0,1fr) 97px; }
.topbar {
  display: flex; gap: 12px; align-items: center; padding: 0 15px 0 17px;
  position: relative; z-index: 4; color: var(--light); background: var(--navy);
  border-bottom: 1px solid #aeb38b; box-shadow: 0 2px 6px #213c3f4a;
}
.brand {
  display: flex; align-items: center; gap: 9px; flex: 0 0 auto; padding: 0 12px 0 0;
  border-right: 1px solid #e8e4ba26; text-align: left; height: 38px;
}
.brand-mark {
  width: 37px; height: 37px; display: grid; place-items: center;
  background: #efc68212; color: #f2cb85; border: 1px solid #f3cb804c; border-radius: 50%;
}
.brand-mark svg { width: 24px; height: 24px; }
.brand:hover .brand-mark { background: #efc6822b; }
.brand-name { font-family: var(--serif); font-size: 25px; letter-spacing: -.05em; font-weight: 660; white-space: nowrap; }
#resources { display: flex; align-items: center; gap: 3px; min-width: 0; }
.resource {
  position: relative; min-width: 67px; padding: 5px 9px 5px 8px; border-radius: 6px;
  display: grid; grid-template: auto auto / 21px auto; column-gap: 6px; align-items: center; text-align: left;
}
.resource + .resource::before {
  content: ''; width: 1px; background: #f6e8cc19; position: absolute; top: 10px; bottom: 10px; left: -2px;
}
.resource:hover, .resource[aria-pressed=true] { background: #fff3da13; }
.resource-icon { grid-row: 1/3; align-self: center; }
.resource[data-value=wood] .resource-icon { color: #e3aa78; }
.resource[data-value=food] .resource-icon { color: #bfd296; }
.resource[data-value=stone] .resource-icon { color: #b7c8c0; }
.resource[data-value=coin] .resource-icon { color: #eac981; }
.resource[data-value=people] .resource-icon { color: #d8d1b3; }
.resource-name { font-size: 10px; color: #d1d8ca; line-height: 1.1; }
.resource-number { font-weight: 750; line-height: 1.04; font-variant-numeric: tabular-nums; font-size: 17px; }
.rate-mark { font-size: 9px; color: #c4d6a0; margin-left: 4px; white-space: nowrap; }
.rate-mark.loss { color: #f3aa8f; }
.rate-mark.full { color: #f4d395; }
.top-spacer { flex: 1; }
.clock { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
#day { color: #dddccd; font-size: 12px; padding: 0 3px 0 0; white-space: nowrap; }
#day b { color: #f5dfb0; font-variant-numeric: tabular-nums; }
.speeds { display: flex; align-items: center; border: 1px solid #dce5ca37; border-radius: 7px; padding: 2px; gap: 1px; }
.speeds button {
  min-width: 26px; height: 27px; padding: 0; display: grid; place-items: center;
  border-radius: 4px; font-size: 11px; font-weight: 750; color: #edebd8;
}
.speeds button svg { width: 15px; height: 15px; }
.speeds button:hover { background: #fcf1d629; }
.speeds button[aria-pressed=true] { background: #ead09a; color: #2b4742; box-shadow: inset 0 1px #fff3c880; }
.top-tools { display: flex; align-items: center; gap: 3px; padding-left: 3px; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 6px; color: #d6dfcd; }
.icon-btn:hover { background: #fff3da20; color: #fff1ca; }
.icon-btn svg { width: 18px; height: 18px; }
.table { display: grid; grid-template-columns: minmax(0,1fr) clamp(254px,25.3vw,332px); min-height: 0; }
.map { position: relative; overflow: hidden; background: #6a9c97; isolation: isolate; min-height: 0; }
#world { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; cursor: default; }
#world.placing { cursor: crosshair; }
#world.panning, #world.space-held { cursor: grab; }
#world.panning { cursor: grabbing; }
.location {
  position: absolute; top: 15px; left: 16px; display: flex; align-items: center; text-align: left; gap: 10px;
  border: 1px solid #f9e9bd57; border-radius: 6px; padding: 8px 11px 8px 9px;
  background: #214e51ed; color: #f9e9c2; box-shadow: 0 2px 8px #2c5150a1;
}
.location:hover { background: #21474a; }
.location-icon { color: #edc781; }
.location-icon svg { width: 25px; height: 25px; }
#region-name { display: block; font-family: var(--serif); font-size: 18px; line-height: 1.05; font-weight: 650; letter-spacing: -.025em; }
#region-kind { color: #dde4cd; font-size: 11px; margin-top: 2px; display: block; }
.location-arrow { opacity: .8; margin-left: 6px; }
.location-arrow svg { width: 13px; height: 13px; }
.chart-tools, .camera { position: absolute; right: 12px; display: flex; gap: 4px; }
.chart-tools { top: 15px; }
.camera { bottom: 13px; flex-direction: column; }
.map-btn {
  display: grid; place-items: center; padding: 0; width: 34px; height: 34px; color: var(--paper);
  background: #245052e8; border: 1px solid #f7ebbf46; border-radius: 6px; box-shadow: 0 2px 5px #204a4c55;
}
.map-btn:hover { background: #183c42; }
.map-btn[aria-pressed=true] { background: #f3dfae; color: #325e58; border-color: #faebbb; }
.map-btn svg { width: 17px; height: 17px; }
#layer-key {
  position: absolute; top: 57px; right: 12px; background: #244f50f2; color: #f8edcb; padding: 7px 10px;
  border: 1px solid #e9dfa658; border-radius: 5px; font-size: 10px; font-weight: 700;
}
.layer-sample { display: inline-block; vertical-align: middle; width: 8px; height: 8px; border-radius: 2px; margin: -1px 5px 0 0; }
.layer-sample + .layer-sample { margin-left: 6px; }
#map-status {
  position: absolute; right: 58px; bottom: 15px; display: flex; gap: 5px; color: #f3ebce;
  font-size: 10px; letter-spacing: .045em; align-items: center; text-shadow: 0 1px 3px #264647;
  pointer-events: none;
}
#map-status svg { width: 12px; height: 12px; }
#map-hint {
  position: absolute; left: 15px; bottom: 13px; color: #f5ead1; pointer-events: none; max-width: calc(100% - 155px);
}
.hint {
  padding: 7px 10px; background: #20494be8; box-shadow: 0 1px 5px #2b5556a8; border: 1px solid #f2dda345;
  border-radius: 5px; display: flex; gap: 7px; align-items: center; font-size: 11px;
}
.hint strong { color: #f6d395; white-space: nowrap; }
.hint kbd { color: #fae3b1; background: #f5dfab1b; border-color: #e0d1a353; }
#site-tip {
  z-index: 2; position: absolute; pointer-events: none; min-height: 32px; max-width: 225px; white-space: normal;
  padding: 7px 9px; color: #fff1ce; background: #224849f5; box-shadow: 0 2px 7px #18323668;
  border: 1px solid #fff4d244; border-radius: 5px; font-size: 11px;
}
#site-tip b { font-size: 12px; font-weight: 750; color: #fff4d8; }
#site-tip small { display: block; color: #d8e1c4; font-size: 10px; margin-top: 1px; }
#site-tip .needs { color: #f1bd9d; }
#site-tip .price { margin-top: 4px; color: #f1d7a2; }
#site-tip .good-icon { color: #e4d3a9; }
#notices { z-index: 3; position: absolute; right: 53px; bottom: 47px; display: grid; gap: 6px; max-width: min(340px,65%); pointer-events: none; }
.notice {
  display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: 6px; color: #fff2d6;
  background: #275b54f5; box-shadow: 0 2px 8px #29494978; border: 1px solid #f4e0ab53;
  animation: notice-in .20s ease-out;
}
.notice.warn { background: #745148f6; }
.notice svg { color: #f2d89b; width: 16px; height: 16px; }
@keyframes notice-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
#gamepad-cursor { position: fixed; z-index: 20; pointer-events: none; width: 16px; height: 16px; border: 2px solid #fff0ba; border-radius: 100%; box-shadow: 0 0 0 1px #274742; margin: -8px; }

.sidebar {
  min-height: 0; min-width: 0; display: grid; grid-template-rows: 43px minmax(0,1fr) auto; background: var(--light);
  border-left: 1px solid #75928a; box-shadow: -2px 0 7px #25494637; position: relative; z-index: 2;
}
.journal-tabs {
  display: grid; grid-template-columns: 1fr 1.1fr 1fr; gap: 0; padding: 0 11px; border-bottom: 1px solid var(--line);
  background: #ece5d1;
}
.journal-tabs button {
  position: relative; margin-bottom: -1px; padding: 0 5px; display: flex; justify-content: center;
  align-items: center; gap: 5px; color: #536961; font-size: 11px; font-weight: 700;
  border-bottom: 2px solid transparent;
}
.journal-tabs button:hover { color: #223f3d; background: #f7eedc; }
.journal-tabs button[aria-selected=true] { color: #214c46; border-color: #3c7263; background: #f8f2e4; }
.journal-tabs svg { width: 14px; height: 14px; }
.tab-dot { width: 6px; height: 6px; background: #af683b; border-radius: 50%; }
#journal { min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #bdbca2 transparent; }
.panel { padding: 17px 17px 15px; }
.kicker {
  font-weight: 800; letter-spacing: .125em; font-size: 9.5px; text-transform: uppercase; color: #637769;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 16px; }
.chapter-counter { display: flex; gap: 3px; align-items: center; }
.chapter-counter i { width: 12px; height: 4px; display: block; background: #e3dbc6; border-radius: 2px; }
.chapter-counter .done { background: #79947a; }
.chapter-counter .at { background: #bd8657; }
h1,h2,h3,p { margin: 0; }
.panel h1 { font-family: var(--serif); font-weight: 650; font-size: clamp(24px,2.4vw,32px); line-height: 1.06; letter-spacing: -.042em; margin: 5px 0 6px; }
.panel h2 { font-family: var(--serif); font-weight: 660; font-size: 19px; line-height: 1.15; letter-spacing: -.017em; }
.letter { color: #4a6056; margin-bottom: 11px; font-size: 12px; line-height: 1.37; }
.letter cite { color: #667467; font-size: 10px; font-style: normal; display: block; margin-top: 5px; font-weight: 700; }
.task-list { display: grid; gap: 4px; margin: 0 0 10px; padding: 0; list-style: none; }
.task {
  width: 100%; padding: 7px 7px 7px 8px; display: grid; gap: 7px; grid-template-columns: 13px 1fr auto;
  align-items: center; text-align: left; border: 1px solid #ded5bf; border-radius: 5px;
  color: #344f44; background: #fff9eb; font-size: 11.5px; font-weight: 700;
}
.task:not(:disabled):hover { border-color: #728b6e; background: #f2edda; }
.task.done { background: #e9eddb; border-color: #d7dfca; color: #42654d; }
.task-medal {
  display: grid; place-items: center; width: 13px; height: 13px; border: 1px solid #a1a78f;
  border-radius: 50%; color: #f3efd9;
}
.task-medal svg { width: 9px; height: 9px; stroke-width: 2.5; }
.task.done .task-medal { background: #64886a; border-color: #64886a; }
.task-count { display: flex; gap: 3px; white-space: nowrap; align-items: center; color: #617063; font-variant-numeric: tabular-nums; font-size: 10px; }
.task-count svg { width: 11px; height: 11px; }
.charter-award { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin-bottom: 5px; }
.award-text { display: block; color: #536e5e; font-size: 10.5px; line-height: 1.3; }
.award-text b { font-weight: 800; }
.primary, .secondary, .danger, .paper-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; border-radius: 5px;
  padding: 7px 10px; min-height: 32px; font-size: 11.5px; line-height: 1.25; font-weight: 750; text-align: center;
}
.primary { color: #fff5d9; background: #2a6258; border: 1px solid #20544e; box-shadow: inset 0 1px #eff4b842; }
.primary:hover { background: #347668; }
.primary:disabled { background: #e4e6d3; border-color: #d5dac5; color: #647568; box-shadow: none; }
.secondary, .paper-btn { border: 1px solid #d1c9b0; background: #f8f1df; color: #34574e; }
.secondary:hover, .paper-btn:hover { background: #ede8d3; border-color: #9caa8c; }
.secondary:disabled, .paper-btn:disabled { opacity: .56; }
.danger { background: #f1dfce; border: 1px solid #d5b9a2; color: #8c4f40; }
.danger:hover { background: #edd4c2; }
.primary svg,.secondary svg,.danger svg,.paper-btn svg { width: 15px; height: 15px; }
.top-note {
  padding: 6px 8px; width: 100%; border-radius: 5px; border: 1px solid #e4ca99;
  background: #f5e6bf; text-align: left; color: #795b33; margin-bottom: 9px;
  display: flex; align-items: center; justify-content: space-between; gap: 7px; font-size: 11px; font-weight: 800;
}
.top-note:hover { background: #efdbad; }
.top-note span { flex: 1; }
.top-note svg { width: 14px; height: 14px; }
.short-hint {
  padding: 6px 8px; border-left: 2px solid #a2b193; line-height: 1.35; color: #536d60;
  background: #efefdf; font-size: 11px; margin-top: 7px;
}
.lead { font-size: 12px; line-height: 1.42; color: #506860; margin-bottom: 11px; }
.panel-label { font-size: 10px; letter-spacing: .10em; font-weight: 800; text-transform: uppercase; color: #607066; margin-bottom: 6px; }
.split { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.split + .split { margin-top: 6px; }
.split small { color: var(--muted); font-size: 10px; }
.box { border: 1px solid #ddd6c2; background: #f6f0e2; padding: 8px; border-radius: 5px; margin: 7px 0; }
.box p { font-size: 11px; line-height: 1.35; margin-top: 4px; color: #5b6d61; }
.ship-head { color: #405e53; font-weight: 750; line-height: 1.12; display: block; }
.ship-card { padding: 8px; border: 1px solid #ded4bf; border-radius: 5px; background: #fff8e9; margin-bottom: 5px; }
.ship-card .price { margin: 5px 0; }
.ship-card.fulfilled { opacity: .65; }
.ship-card button { min-height: 26px; padding: 4px 7px; font-size: 10.5px; }
.ship-card .split svg { color: #648476; }
.ship-note { display: flex; justify-content: space-between; color: #5a7164; font-size: 10px; margin-top: 1px; margin-bottom: 6px; }
.trade-line { display: flex; align-items: center; justify-content: space-between; gap: 7px; border-top: 1px solid #ded6c2; padding: 5px 0; }
.trade-line button { min-height: 25px; padding: 4px 6px; white-space: nowrap; width: auto; font-size: 10px; }
.trade-line strong { display: flex; align-items: center; gap: 5px; font-size: 11px; }
.trade-line small { color: #536d61; font-size: 10px; }
.price { display: inline-flex; gap: 7px; align-items: center; flex-wrap: wrap; font-size: 10.5px; font-weight: 750; line-height: 1.15; }
.unit { display: inline-flex; gap: 3px; align-items: center; white-space: nowrap; }
.unit svg { flex: 0 0 auto; }
.good-icon { display: inline-flex; align-items: center; }
.good-icon.wood { color: #a66a43; }
.good-icon.food { color: #567d55; }
.good-icon.stone { color: #617b7e; }
.good-icon.coin { color: #9b7234; }
.good-icon.people { color: #5a7a69; }
.price .short { color: var(--bad); }
.rate { color: var(--good); font-weight: 750; font-variant-numeric: tabular-nums; }
.loss { color: var(--bad); }
.seal {
  padding: 10px 11px; border-radius: 6px; background: #e9edd6; border: 1px solid #c8d7b8;
  color: #426448; font-size: 11px; line-height: 1.45; margin: 8px 0;
}
.honor-progress { height: 4px; background: #ded8c4; border-radius: 4px; overflow: hidden; margin-top: 6px; }
.honor-progress i { display: block; background: #749378; height: 100%; border-radius: inherit; }
.small-tabs { display: flex; gap: 3px; padding-bottom: 8px; }
.small-tabs button { flex: 1; border-radius: 4px; padding: 6px 2px; border: 1px solid #d9d3be; background: #f7f0dd; }
.small-tabs button span { display: flex; justify-content: center; }
.small-tabs button:hover { background: #ebebd7; }
.small-tabs button[aria-pressed=true] { background: #dfe8d2; border-color: #9eb69a; }
.ledger-head { padding: 5px 0 8px; display: flex; justify-content: space-between; align-items: center; }
.ledger-head strong { font-family: var(--serif); font-weight: 650; font-size: 22px; }
.ledger-head small { color: #526e63; }
.ledger-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; border-top: 1px solid #e3dbc7; padding: 6px 1px; color: #466255; font-size: 11px; }
.census { margin-top: 11px; }
.inspect-header { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.inspect-header h1 { margin: 2px 0; }
.inspect-header [data-action=back] { margin-left: auto; }
.sidebar-x { padding: 4px; color: #557064; }
.sidebar-x:hover { background: #ede8d5; border-radius: 4px; }
.sidebar-x svg { width: 16px; height: 16px; }
.inspect-icon { flex: 0 0 55px; border-radius: 5px; background: #eae7cf; width: 55px; height: 44px; }
.status-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 5px; font-size: 10px; border-radius: 4px; color: #416251; background: #e6ecda; }
.tag.alert { color: #875840; background: #f2e0c8; }
.tag svg { width: 12px; height: 12px; }
.action-list { display: grid; gap: 5px; margin-top: 9px; }
.action-list .secondary { justify-content: space-between; text-align: left; }
.action-list .secondary span:last-child { white-space: nowrap; }
.dispatch-choice { display: grid; gap: 3px; text-align: left; justify-content: stretch; margin-bottom: 5px; }
.dispatch-choice .price { font-size: 10px; }
.dispatch-choice small { font-size: 10px; color: #597269; font-weight: 500; }

#tides {
  padding: 8px 14px 7px; background: #e8ebd9; border-top: 1px solid #cbd4bc;
  box-shadow: 0 -2px 5px #5670530c; z-index: 1; position: relative;
}
.tide-header { display: flex; justify-content: space-between; align-items: center; gap: 5px; }
.tide-title { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; color: #3b6559; }
.tide-title svg { width: 14px; height: 14px; }
.tide-toggle { color: #365d53; font-size: 9px; font-weight: 800; letter-spacing: .005em; padding: 3px 5px; border-radius: 4px; border: 1px solid #92afa0; }
.tide-toggle:hover, .tide-toggle[aria-pressed=true] { background: #d1dfc7; }
.tide-curve { display: block; width: 100%; height: 26px; margin: 2px 0 1px; overflow: visible; }
.tide-footer { display: flex; justify-content: space-between; gap: 3px; color: #526a5c; font-size: 9.5px; line-height: 1.2; }
.tide-footer b { color: #416658; }

.toolbar {
  display: flex; min-width: 0; align-items: stretch; gap: 12px; padding: 8px 14px 9px;
  background: linear-gradient(180deg,#f3ebd7,#e9e2cd); border-top: 1px solid #f7edce;
  box-shadow: 0 -2px 8px #2b4a4540; z-index: 3; position: relative;
}
.plan-tabs { flex: 0 0 125px; align-self: center; }
.toolbar-label { font-weight: 800; font-size: 9px; letter-spacing: .145em; color: #547064; margin: 0 0 4px 5px; }
#groups { display: grid; gap: 2px; }
#groups button { text-align: left; padding: 2px 7px; border-radius: 4px; font-size: 11px; line-height: 1.25; font-weight: 750; color: #566a5d; }
#groups button:hover { background: #e3ddc6; }
#groups button[aria-pressed=true] { background: #d6dfc7; color: #2e5e4d; box-shadow: inset 2px 0 #70977a; }
#pieces { display: grid; flex: 1; grid-auto-columns: minmax(63px,94px); grid-auto-flow: column; gap: 5px; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.piece {
  position: relative; display: grid; grid-template-rows: minmax(0,1fr) auto auto; justify-items: center;
  align-items: center; padding: 1px 2px 4px; gap: 1px; border-radius: 6px; background: #fff7e585;
  border: 1px solid #d7cdb5; color: #2f4d44; min-width: 0;
}
.piece:hover { background: #fff9ec; border-color: #839b81; }
.piece[aria-pressed=true] { background: #e4ebd0; border-color: #598068; box-shadow: inset 0 0 0 1px #83a48b; }
.piece[aria-pressed=true] .piece-name { color: #224b41; }
.piece.locked { background: #e9e4d2; border-color: #d5cebc; color: #6d7569; }
.piece.locked canvas { opacity: .57; }
.piece.short .price { opacity: .70; }
.piece canvas { display: block; width: 100%; height: 100%; max-height: 47px; max-width: 77px; object-fit: contain; }
.piece-name { font-weight: 800; white-space: nowrap; font-size: 11px; line-height: 1; }
.piece .price { gap: 4px; font-size: 9px; white-space: nowrap; flex-wrap: nowrap; padding: 1px 0; }
.piece .price svg { width: 12px; height: 12px; }
.piece .unit { gap: 1px; }
.piece-key, .piece-lock { position: absolute; top: 4px; left: 4px; }
.piece-lock { color: #6b7767; }
kbd {
  display: inline-flex; min-width: 14px; justify-content: center; padding: 1px 3px;
  border-radius: 3px; line-height: 1.1; color: #59705e; font: 800 9px/1.1 DM Sans,sans-serif;
  border: 1px solid #cec8ad; background: #f9f2df;
}
.plan-tools { display: flex; align-items: center; justify-content: flex-end; gap: 4px; padding-left: 9px; border-left: 1px solid #d1cab5; flex: 0 0 auto; }
.utility { min-width: 48px; min-height: 47px; border-radius: 5px; display: grid; justify-items: center; gap: 2px; padding: 6px; color: #557368; }
.utility:hover { background: #e1e3cc; }
.utility[aria-pressed=true] { background: #d4dfc8; color: #245349; box-shadow: inset 0 0 0 1px #8aa38a; }
.utility[data-value=remove][aria-pressed=true] { color: #8a4c41; background: #f1dbca; box-shadow: inset 0 0 0 1px #b58d7b; }
.utility svg { width: 21px; height: 21px; }
.utility-label { font-size: 9px; font-weight: 800; }
#tool-undo { min-width: 30px; min-height: 37px; place-content: center; }
#tool-undo:disabled { color: #9a9d8b; background: none; }
#tool-undo svg { width: 16px; height: 16px; }

#tooltip {
  position: fixed; z-index: 15; pointer-events: none; padding: 7px 9px; border-radius: 5px;
  max-width: 238px; width: max-content; background: #213f42; border: 1px solid #658176;
  box-shadow: 0 3px 9px #1c373d60; color: #f8eed5; line-height: 1.35; font-size: 11px;
}
#tooltip strong { display: block; color: #f9deb0; margin-bottom: 3px; font-size: 12px; }
#tooltip small { display: block; color: #dae2c9; margin-top: 4px; font-size: 10px; }
#tooltip .good-icon { color: #e7cd99; }

#modal {
  width: min(744px,calc(100vw - 42px)); max-height: calc(100vh - 38px); max-height: calc(100dvh - 38px);
  border: 1px solid #ccb995; background: var(--light); color: var(--ink); padding: 0;
  border-radius: 11px; box-shadow: 0 12px 65px #0f2c33aa; scrollbar-width: thin; scrollbar-color: #aab398 #f1ead7;
}
#modal::backdrop { background: #12363dda; }
.modal-top {
  min-height: 137px; padding: 21px 23px 16px; background: #25575b;
  color: #fff2d1; position: relative; isolation: isolate;
}
.modal-top::before {
  content: ''; background: linear-gradient(90deg,#173e42e0 0%,#1b484abe 35%,transparent 80%), url('./assets/sound-atlas.webp') center 38%/cover no-repeat;
  position: absolute; inset: 0; z-index: -1;
}
.modal-top .kicker { color: #ebd39e; }
.modal-top h1 { font-family: var(--serif); font-size: 41px; font-weight: 670; letter-spacing: -.06em; line-height: 1.04; margin: 5px 0; }
.modal-top p { color: #faefd2; font-size: 11.5px; max-width: 53%; line-height: 1.4; }
.modal-x {
  position: absolute; right: 12px; top: 11px; border: 1px solid #f5dfaa60; border-radius: 6px; color: #f9e8c2;
  background: #1b4144cb; padding: 5px; display: grid; place-items: center; width: 32px; height: 32px;
}
.modal-x:hover { background: #2e6160; }
.modal-main { padding: 14px 20px 17px; }
.modal-main h2 { font-family: var(--serif); font-size: 22px; font-weight: 660; letter-spacing: -.03em; margin: 0 0 7px; }
.region-list { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.region-card { display: grid; grid-template-rows: 65px 1fr; text-align: left; background: #fff8e6; border: 1px solid #d8cfb6; border-radius: 6px; overflow: hidden; padding: 0; }
.region-card:hover { border-color: #71947d; background: #edf0dc; }
.region-card[aria-current=true] { border-color: #628a74; background: #e7ecda; }
.region-card canvas { width: 100%; height: 65px; object-fit: cover; background: #689c97; display: block; }
.region-info { padding: 7px 8px 8px; }
.region-info b { font-family: var(--serif); font-size: 17px; line-height: 1; font-weight: 650; display: block; white-space: nowrap; }
.region-info small { display: block; margin-top: 5px; color: #5e7260; font-size: 10px; line-height: 1.2; }
.region-info .region-action { display: flex; justify-content: space-between; align-items: center; color: #386e5e; margin-top: 6px; font-size: 10px; font-weight: 800; }
.atlas-footer { margin-top: 8px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
.atlas-card { display: grid; grid-template-columns: 25px 1fr auto; text-align: left; align-items: center; gap: 5px; border-radius: 5px; padding: 7px 8px; background: #f2e8cc; border: 1px solid #dfcfaa; color: #4d5949; }
.atlas-card:hover { background: #ede3c6; border-color: #9ba98b; }
.atlas-card strong { display: block; font-size: 12px; color: #335949; }
.atlas-card small { font-size: 10px; line-height: 1.2; color: #607467; display: block; margin-top: 2px; }
.atlas-card svg { color: #718873; }
.chart-history { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.chart-history button { width: auto; min-height: 24px; padding: 4px 6px; font-size: 10px; }
.guide-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; row-gap: 12px; }
.guide-grid h2 { font-size: 18px; }
.guide-grid p, .guide-grid li { color: #486358; font-size: 12px; line-height: 1.4; }
.guide-grid ul { padding-left: 17px; margin: 3px 0; }
.guide-grid kbd { vertical-align: 1px; font-size: 10px; }
.ending { text-align: center; padding: 18px 26px; }
.ending p { max-width: 480px; margin: 0 auto 10px; line-height: 1.5; color: #506a5c; }
.end-stats { display: flex; justify-content: center; gap: 6px; margin-bottom: 12px; }
.end-stats .box { min-width: 84px; padding: 7px; margin: 2px 0; }
.end-stats b { display: block; font-family: var(--serif); font-size: 22px; font-weight: 670; line-height: 1.1; }
.end-stats span { display: block; color: #567067; font-size: 10px; padding-top: 3px; }
.ending button { max-width: 255px; margin: auto; }
.honors-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.honor-card {
  display: grid; grid-template-columns: 28px 1fr; gap: 6px; align-items: center;
  padding: 8px; background: #f4ebd8; border: 1px solid #ded2b7; border-radius: 5px;
}
.honor-card svg { color: #77877b; }
.honor-card.earned { background: #e6edd5; border-color: #c4d1b1; }
.honor-card.earned svg { color: #9b773b; }
.honor-card strong { font-size: 12px; display: block; }
.honor-card small { font-size: 10px; color: #5a6e60; display: block; margin-top: 2px; }
.honor-card .honor-progress { grid-column: 2; margin-top: 0; }

@media (min-width: 1500px) {
  .toolbar { gap: 16px; }
  .resource { min-width: 82px; }
}
@media (max-width: 1100px) {
  .topbar { gap: 8px; padding-left: 12px; padding-right: 7px; }
  .brand { gap: 7px; padding-right: 9px; }
  .brand-name { font-size: 22px; }
  .brand-mark { width: 33px; height: 33px; }
  .resource { min-width: 57px; padding: 5px 6px 5px 5px; grid-template-columns: 17px auto; gap: 2px 4px; }
  .resource-icon svg { width: 17px; height: 17px; }
  .resource-number { font-size: 15px; }
  .top-tools { gap: 0; }
  .icon-btn { width: 30px; }
  .toolbar { gap: 8px; padding-left: 10px; padding-right: 9px; }
  .plan-tabs { flex-basis: 100px; }
  .plan-tools { padding-left: 5px; gap: 3px; }
  .utility { min-width: 39px; padding: 5px; }
  .panel { padding-left: 12px; padding-right: 12px; }
}
@media (max-height: 600px) {
  #game { grid-template-rows: 54px minmax(0,1fr) 84px; }
  .sidebar { grid-template-rows: 37px minmax(0,1fr) auto; }
  .panel { padding-top: 10px; padding-bottom: 9px; }
  .panel h1 { font-size: 24px; margin-top: 3px; }
  .letter { margin-bottom: 7px; }
  .letter cite { margin-top: 2px; }
  .task-list { gap: 3px; margin-bottom: 7px; }
  .task { padding-top: 5px; padding-bottom: 5px; }
  .charter-award { margin-bottom: 4px; }
  .primary { min-height: 29px; padding: 5px 7px; }
  #tides { padding-top: 4px; padding-bottom: 4px; }
  .tide-curve { height: 20px; margin-top: 0; }
  .toolbar { padding-top: 6px; padding-bottom: 6px; }
  .piece canvas { max-height: 41px; }
}
@media (max-width: 900px) {
  .atlas-icon { display: none; }
  .clock { gap: 4px; }
  .top-tools { padding-left: 0; }
  .rate-mark { display: none; }
  .resource-name { font-size: 9px; }
  .resource { min-width: 49px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; } }
.commission-link {
  display: flex; width: 100%; gap: 5px; align-items: center; padding: 5px 7px; margin: 5px 0;
  color: #426654; background: #e8ebd7; border: 1px solid #d5dcc4; border-radius: 4px;
  font-size: 10px; font-weight: 800; text-align: left;
}
.commission-link:hover { border-color: #9db59a; background: #e0e8d0; }
.commission-link span { flex: 1; }
