.harbor-table {
  --harbor-ink: #173e3c;
  --harbor-cream: #fffae8;
  --harbor-line: #789892;
  --harbor-water: #e4eeea;
  margin-top: 24px;
  padding: clamp(11px, 2.5vw, 26px);
  border: 1px solid #40665d;
  border-radius: 14px;
  background: radial-gradient(ellipse at top right, #2c5550, transparent 72%), #193c37;
  color: var(--harbor-cream);
}

.harbor-table:has([data-harbor-search-panel][hidden]) {
  max-width: 710px;
}

.harbor-header,
.harbor-chart-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px 22px;
  flex-wrap: wrap;
}

.harbor-header {
  margin-bottom: clamp(14px, 2vw, 23px);
}

.harbor-status {
  flex: 1 1 330px;
}

.harbor-status h2 {
  font-size: clamp(1.85rem, 3.1vw, 2.8rem);
}

.harbor-status p {
  max-width: 64ch;
  margin-top: 7px;
  font-size: .94rem;
}

.harbor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.harbor-table .btn {
  min-height: 44px;
}

.harbor-table .btn.primary {
  background: var(--gold);
  color: #16372c;
}

.harbor-table .btn.secondary {
  border-color: #a6b9a4;
}

.harbor-table .btn:focus-visible {
  outline-color: #ffce74;
}

.harbor-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 22px);
}

.harbor-chart {
  min-width: 0;
  padding: clamp(8px, 1.5vw, 17px);
  border: 1px solid #e2d4ae;
  border-radius: 10px;
  color: var(--harbor-ink);
  background: #fcf5e3;
  box-shadow: 0 6px 14px #0c29264d;
}

.harbor-search {
  background: #fffaf0;
}

.harbor-charts:has(.harbor-search[hidden]) {
  grid-template-columns: minmax(0, 1fr);
}

.harbor-chart-heading {
  margin-bottom: 4px;
  padding-inline: 3px;
}

.harbor-chart-heading h3 {
  font-size: clamp(1.52rem, 3.4vw, 2.12rem);
}

.harbor-chart-heading p {
  font-size: .87rem;
}

.harbor-grid {
  --harbor-axis-width: clamp(15px, 3vw, 24px);
  display: grid;
  width: 100%;
  max-width: 500px;
  margin-inline: auto;
}

.harbor-row {
  display: grid;
  grid-template-columns: var(--harbor-axis-width) repeat(6, minmax(0, 1fr));
}

.harbor-axis {
  display: grid;
  place-items: center;
  color: #385a55;
  font-size: .74rem;
  font-weight: 750;
  line-height: 1;
}

.harbor-label-row .harbor-axis {
  min-height: 22px;
}

.harbor-slot {
  min-width: 0;
  aspect-ratio: 1;
  border-top: 1px solid var(--harbor-line);
  border-left: 1px solid var(--harbor-line);
}

.harbor-row .harbor-slot:last-child {
  border-right: 1px solid var(--harbor-line);
}

.harbor-row:last-child .harbor-slot {
  border-bottom: 1px solid var(--harbor-line);
}

.harbor-tile {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--harbor-ink);
  background: var(--harbor-water);
  font: 750 clamp(.92rem, 2.3vw, 1.35rem)/1 var(--sans);
}

.harbor-search .harbor-tile[data-state="fog"] {
  background: linear-gradient(157deg, #f1f6f3, #e1ece9);
}

.harbor-search .harbor-tile[aria-disabled="false"]:hover {
  z-index: 1;
  box-shadow: inset 0 0 0 2px #2e665c;
}

.harbor-search .harbor-tile[aria-disabled="true"] {
  cursor: default;
}

.harbor-tile[data-echo-area="true"]::before {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1px dashed #4b6a6d;
  pointer-events: none;
}

.harbor-tile[data-last="true"]::after {
  content: "";
  position: absolute;
  inset: 1px;
  border: 2px solid #365f74;
  pointer-events: none;
}

.harbor-tile:focus-visible {
  z-index: 2;
  outline: 3px solid #562d19;
  outline-offset: -3px;
  box-shadow: inset 0 0 0 5px #ffc973;
}

.harbor-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 63%;
  height: 56%;
  max-width: 34px;
  max-height: 31px;
  flex: none;
  font-weight: 800;
  line-height: 1;
}

.harbor-legend-fog,
.harbor-tile[data-state="fog"] .harbor-mark {
  color: #526f68;
}

.harbor-legend-empty,
.harbor-tile[data-state="empty"] .harbor-mark {
  color: #32636d;
  font-size: 1.33em;
}

.harbor-legend-spotted,
.harbor-tile[data-state="spotted"] .harbor-mark {
  border: 2px solid #966229;
  border-radius: 50%;
  color: #6c421f;
  background: #fff0c5;
}

.harbor-legend-found,
.harbor-tile[data-state="found"] .harbor-mark {
  border: 1px solid #66341d;
  border-radius: 5px 9px 9px 5px;
  color: #fffae8;
  background: #874825;
}

.harbor-legend-revealed,
.harbor-tile[data-state="revealed"] .harbor-mark {
  border: 1px dashed #285d61;
  border-radius: 5px 9px 9px 5px;
  color: #214f52;
  background: #f0f7f3;
}

.harbor-tile[data-state="docked"] .harbor-mark,
.harbor-fleet-key span {
  border: 1px solid #416e6c;
  border-radius: 5px 9px 9px 5px;
  background: #c1ddd4;
}

.harbor-echo-number {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 1;
  min-width: 15px;
  padding: 2px;
  border: 1px solid #edf5eb;
  border-radius: 5px;
  color: #fff;
  background: #244e55;
  font-size: .68rem;
  font-weight: 750;
}

.harbor-grid[data-echo-mode="true"] .harbor-tile:hover,
.harbor-grid[data-echo-mode="true"] .harbor-tile:focus-visible {
  background: #bfded8;
}

.harbor-echo {
  display: flex;
  align-items: center;
  gap: 7px 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.harbor-echo .btn {
  min-height: 44px;
  padding-inline: 12px;
}

.harbor-echo .btn[aria-pressed="true"] {
  color: var(--harbor-cream);
  background: #244e55;
}

.harbor-echo .btn:focus-visible {
  outline-color: #8c481e;
}

.harbor-echo p {
  font-size: .85rem;
}

.harbor-legend,
.harbor-fleet-key {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 15px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  font-size: .84rem;
}

.harbor-legend li,
.harbor-fleet-key li {
  display: flex;
  align-items: center;
  gap: 5px;
}

.harbor-legend .harbor-mark,
.harbor-fleet-key span {
  display: inline-grid;
  place-items: center;
  width: 21px;
  height: 20px;
  font: 750 .78rem/1 var(--sans);
}

.harbor-legend .harbor-mark {
  background-color: var(--harbor-water);
}

.harbor-legend .harbor-legend-spotted {
  background-color: #fff0c5;
}

.harbor-legend .harbor-legend-found {
  background-color: #874825;
}

.harbor-rules {
  max-width: 75ch;
  margin-top: 20px;
  padding: 14px 17px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fffdf6;
}

.harbor-rules summary {
  width: fit-content;
  cursor: pointer;
  font-weight: 750;
}

.harbor-rules ul {
  margin-bottom: 0;
  padding-left: 1.25em;
}

.harbor-rules li + li {
  margin-top: 6px;
}

.harbor-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 700px) {
  .harbor-table,
  .harbor-table:has([data-harbor-search-panel][hidden]) {
    max-width: 510px;
  }

  .harbor-charts {
    grid-template-columns: minmax(0, 1fr);
  }
}
