.harbor-dialog {
  width: min(1110px, calc(100% - 24px));
  border-color: #9c7955;
  background: #201f21;
}

.harbor-dialog .dialog-head {
  align-items: center;
  padding: 12px 18px;
  border-color: #71593f;
  background: #292a27;
}

.harbor-dialog .dialog-head h2 {
  margin-top: 2px;
  color: #f5e6c2;
}

.harbor-dialog .dialog-head .kicker { color: #d2b68b; }

.harbor-dialog #dialog-body {
  padding: clamp(8px, 1.6vw, 17px);
  background: repeating-linear-gradient(1deg, #322720 0 2px, #3b2b23 2px 4px, #3d2e25 4px 23px, #50382b 23px 24px);
}

.dispatch-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(222px, .36fr);
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas: "chart call" "chart tools" "chart budget" "note action";
  align-items: start;
  gap: 11px 15px;
  color: #f2e4c7;
}

.dispatch-chart {
  grid-area: chart;
  padding: clamp(5px, 1.05vw, 12px);
  border: 1px solid #c9a16b;
  box-shadow: inset 0 0 0 2px #e2c48b52, 0 4px 0 #291b18, 0 6px 14px #1c1614;
  background: repeating-linear-gradient(175deg,#b58e5e 0 3px,#ab8255 3px 5px,#c69d69 5px 11px);
}

.chart-sheet {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid #463c30;
  background: #204c59;
}

.chart-art {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.chart-caption {
  position: absolute;
  top: 3.8%;
  left: 3.1%;
  padding: 4px 7px;
  background: #203b33ed;
  border: 1px solid #acac81;
  color: #f5e1af;
  font: 800 clamp(.56rem, 1.25vw, .75rem)/1.2 var(--mono);
  letter-spacing: .075em;
  pointer-events: none;
}
.chart-caption span { color: #9cc5aa; }

.chart-buoy, .chart-sea {
  position: absolute;
  z-index: 1;
  color: #c6dfd7;
  font: 700 clamp(.625rem, 1.4vw, .8125rem)/1.15 var(--mono);
  text-shadow: 0 2px #173944, 1px 0 #173944;
  pointer-events: none;
}
.chart-buoy { left: 57%; top: 66%; }
.chart-sea { left: 50%; top: 91%; transform: translateX(-50%); letter-spacing: .08em; text-transform: uppercase; }

.chart-site {
  --station-color: #a4cfb0;
  position: absolute;
  z-index: 2;
  left: var(--x);
  top: var(--y);
  display: grid;
  justify-items: stretch;
  gap: 3px;
  width: max-content;
  min-width: 95px;
  max-width: 25%;
  min-height: 42px;
  padding: 5px 7px;
  border: 1px solid #9eb2a3;
  border-radius: 3px;
  color: #f2ecd9;
  background: #203635f5;
  text-align: left;
  transform: translate(-50%, -50%);
  box-shadow: 0 3px 0 #132929d9;
}
.chart-site:hover { z-index: 3; background: #2c4c45; border-color: #f0d7a1; }
.chart-site:active { box-shadow: 0 1px 0 #132929d9; }
.chart-site.is-damaged { --station-color: #ffc09e; border-color: #d4a180; }
.chart-site.is-on { --station-color: #ffda87; border-color: #f6cd78; background: #443d2ceF; }
.chart-site.has-tool { --station-color: #f3ce87; border-color: #f1c27c; }
.chart-site[aria-disabled="true"] { cursor: default; }
.chart-site[data-berth] { outline: 2px solid #ffe39a; outline-offset: 2px; }
.chart-site:focus-visible { z-index: 4; outline: 2px solid #fff2b3; outline-offset: 4px; }
.chart-site::before { content: ""; position: absolute; inset: 0 0 -30px; }
:is(.site-ramp,.site-pier)::before { inset: -27px 0 0; }

.site-radio { --x: 16%; --y: 16%; }
.site-beacon { --x: 50%; --y: 16%; }
.site-flood { --x: 84%; --y: 16%; }
.site-ramp { --x: 17%; --y: 54.5%; }
.site-pier { --x: 83%; --y: 54.5%; }

.chart-site-head { display: flex; gap: 7px; justify-content: space-between; align-items: baseline; }
.chart-site-head strong { font-size: .875rem; line-height: 1.1; }
.chart-watts { white-space: nowrap; color: #f4dba4; font: 700 .75rem/1 var(--mono); }
.chart-site-status { color: var(--station-color); font: 700 .75rem/1.1 var(--mono); }

.chart-site-pin {
  position: absolute;
  top: 100%;
  left: 50%;
  width: 2px;
  height: clamp(11px, 2.4vw, 23px);
  background: var(--station-color);
  pointer-events: none;
}
:is(.site-ramp, .site-pier) .chart-site-pin { top: auto; bottom: 100%; }
.chart-site-pin i {
  position: absolute;
  top: 100%;
  left: 50%;
  width: 10px;
  height: 10px;
  border: 2px solid #2c3d36;
  background: var(--station-color);
  transform: translate(-50%,-50%) rotate(45deg);
}
:is(.site-ramp, .site-pier) .chart-site-pin i { top: 0; }
.is-damaged .chart-site-pin i { background: linear-gradient(105deg,#e5a27b 0 37%,#663e37 37% 59%,#ffbd93 59%); }
.is-on .chart-site-pin i { box-shadow: 0 0 9px #ffdf91; }
.chart-site-pin canvas {
  position: absolute;
  top: 100%;
  left: 50%;
  width: clamp(27px, 4vw, 43px);
  transform: translate(-50%, -50%);
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 1px #1d2224);
}
:is(.site-ramp, .site-pier) .chart-site-pin canvas { top: 0; }
.has-tool .chart-site-pin i { visibility: hidden; }
.placing .is-damaged { outline: 2px dashed #ffe09d; outline-offset: 3px; cursor: crosshair; }

.chart-boat {
  position: absolute;
  z-index: 1;
  width: clamp(35px, 7vw, 72px);
  aspect-ratio: 1;
  transform: translate(-50%,-57%);
  pointer-events: none;
}
.chart-boat canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  image-rendering: pixelated;
  transform: rotate(var(--heading, 0deg));
  filter: drop-shadow(0 1px 2px #0b282fe8);
}
.chart-boat i {
  position: absolute;
  left: 35%;
  top: 66%;
  width: 30%;
  height: 35%;
  opacity: 0;
  border: solid #84bfc8b5;
  border-width: 0 2px;
  transform-origin: center top;
  transform: rotate(var(--heading, 0deg));
  border-radius: 0 0 50% 50%;
}
.sailing .chart-boat i { opacity: 1; }

.dispatch-call {
  grid-area: call;
  display: grid;
  gap: 9px;
  padding: 14px 14px 12px;
  border: 1px solid #e7cd92;
  border-radius: 3px;
  box-shadow: 0 3px 0 #a48357, 0 5px 10px #201918a0, inset 0 0 20px #c6a66a44;
  background: #f0e1b8;
  color: #282d2a;
}
.dispatch-round {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: #535847;
  font: 800 .75rem/1.15 var(--mono);
  letter-spacing: .07em;
  text-transform: uppercase;
}
.dispatch-pips { display: flex; gap: 5px; }
.dispatch-pips i { width: 10px; height: 10px; border: 1px solid #728175; border-radius: 50%; }
.dispatch-pips .past { background: #718e79; }
.dispatch-pips .current { border-color: #193d3d; background: #284e4b; box-shadow: 0 0 0 2px #c9c9a0; }

.harbor-dialog #dialog-body .dispatch-call h3 {
  margin: 0;
  font-size: clamp(1.15rem, 2.2vw, 1.55rem);
  line-height: 1.05;
  letter-spacing: -.03em;
}
.dispatch-quote { margin: 0; color: #44483b; font-size: 1rem; line-height: 1.3; }
.dispatch-needs { display: flex; flex-wrap: wrap; gap: 4px; }
.dispatch-needs > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border: 1px solid #a49e79;
  border-radius: 2px;
  color: #3c493d;
  font-size: .8125rem;
  font-weight: 750;
}
.dispatch-needs .ready { border-color: #6b9277; background: #ccdcaf; color: #254639; }
.dispatch-needs i { font-style: normal; }
.dispatch-needs .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.dispatch-tools {
  grid-area: tools;
  display: flex;
  gap: 5px;
  align-items: center;
  min-width: 0;
  padding: 5px;
  border: 1px solid #876749;
  background: #2f2823;
  box-shadow: inset 0 2px 3px #1e1b19;
  border-radius: 3px;
}
.dispatch-wrench {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 45px;
  padding: 0 5px;
  align-items: center;
  gap: 2px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  text-align: left;
  touch-action: none;
}
.dispatch-wrench:hover, .dispatch-wrench[aria-pressed="true"] { border-color: #bf9963; background: #4b382a; }
.dispatch-wrench canvas { flex: 0 0 39px; width: 39px; height: 39px; image-rendering: pixelated; }
.dispatch-wrench strong, .dispatch-wrench small { display: block; }
.dispatch-wrench strong { color: #ffe8b0; font-size: .9rem; line-height: 1.1; }
.dispatch-wrench small { margin-top: 3px; color: #e2ccaa; font-size: .8125rem; line-height: 1.1; }
.dispatch-clear {
  padding: 6px 4px;
  border: 0;
  background: transparent;
  color: #e9cd9e;
  font-size: .8125rem;
  text-decoration: underline;
}
.dispatch-drag {
  position: fixed;
  z-index: 10;
  width: 42px;
  height: 42px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  image-rendering: pixelated;
  filter: drop-shadow(0 4px 3px #130e0ab0);
}

.dispatch-budget {
  grid-area: budget;
  padding: 9px;
  border: 1px solid #987d54;
  border-radius: 3px;
  background: #242c2a;
  box-shadow: 0 2px 0 #231c19;
}
.dispatch-load, .dispatch-track-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2px 5px;
}
.dispatch-load span { font-size: .8125rem; font-weight: 750; }
.dispatch-load strong { color: #fae0a2; white-space: nowrap; font: 800 .875rem/1.15 var(--mono); }
.dispatch-track {
  display: grid;
  grid-template-columns: repeat(var(--cells, 11),minmax(0,1fr));
  gap: 3px;
  margin: 7px 0 6px;
}
.dispatch-track i { height: 15px; border: 1px solid #6d7765; border-radius: 2px; background: #151f21; }
.dispatch-track .filled { border-color: #ffe4a2; background: #e1a95d; box-shadow: inset 0 -3px #b17548; }
.dispatch-track .overflow { border: 1px dashed #ffc7aa; background: repeating-linear-gradient(135deg,#a75c4c 0 3px,#643b37 3px 6px); box-shadow: none; }
.dispatch-track .filled + .overflow:not(.overflow + .overflow) { margin-left: 2px; }
.dispatch-track-foot { color: #c6c9aa; font-size: .75rem; }
.dispatch-track-foot strong { color: #c8dfae; }
.over .dispatch-load strong, .over .dispatch-track-foot strong { color: #ffb89b; }
.dispatch-note {
  grid-area: note;
  align-self: center;
  min-height: 2.4em;
  margin: 0;
  padding: 0 5px;
  color: #f1ddbc;
  font-size: .875rem;
  line-height: 1.3;
}
.dispatch-note.warn { color: #ffbb9f; }
.dispatch-action { grid-area: action; }
.dispatch-send { width: 100%; min-height: 40px; }
.dispatch-send[aria-disabled="true"] { opacity: .78; cursor: default; }

@media (max-width: 720px) {
  .dispatch-board {
    grid-template-columns: repeat(2, minmax(0,1fr));
    grid-template-rows: auto;
    grid-template-areas: "call call" "chart chart" "tools budget" "note note" "action action";
    gap: 8px;
  }
  .dispatch-call { grid-template-columns: 1fr auto; gap: 4px 6px; padding: 8px; }
  .dispatch-round, .dispatch-quote { grid-column: 1 / -1; }
  .dispatch-needs { grid-row: 2; grid-column: 2; align-self: center; }
  .dispatch-needs > span { padding: 2px 3px; font-size: .75rem; }
  .dispatch-quote { font-size: .875rem; }
  .dispatch-track { gap: 2px; margin: 4px 0; }
  .dispatch-track i { height: 10px; }
}

@media (max-width: 430px) {
  .harbor-dialog .dialog-head { padding: 8px 9px; }
  .chart-site { padding: 4px; min-width: min(77px, 26%); max-width: 29%; min-height: 38px; gap: 2px; }
  .chart-site-head { gap: 2px; }
  .chart-site-head strong { font-size: clamp(.61rem,3vw,.75rem); }
  .chart-watts, .chart-site-status { font-size: .625rem; }
  .chart-caption { top: 2%; }
  .site-radio { --y: 19%; }
  .site-beacon { --y: 19%; }
  .site-flood { --y: 19%; }
  .site-ramp, .site-pier { --y: 56%; }
  .dispatch-wrench { padding: 0; }
  .dispatch-wrench canvas { flex-basis: 29px; width: 29px; height: 29px; }
  .dispatch-wrench strong { font-size: .8rem; }
  .dispatch-wrench small { font-size: .75rem; }
}
