:root {
  color-scheme: light;
  --bark: #2f261c;
  --charcoal: #1f2822;
  --cedar: #5b341f;
  --dark-green: #1f3228;
  --fern: #49633f;
  --lake: #2f6f7f;
  --paper: #efe6cf;
  --sun: #c78b3a;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--dark-green);
  color: var(--charcoal);
  font-family: Georgia, "Times New Roman", serif;
}

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 18px;
}

.map-frame {
  width: min(calc(100vw - 36px), calc((100vh - 36px) * 16 / 9));
  aspect-ratio: 16 / 9;
  border: 8px solid var(--bark);
  border-radius: 6px;
  background: #dccba7;
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.34),
    inset 0 0 0 2px rgba(239, 230, 207, 0.55);
  overflow: hidden;
}

#fishmap-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.lake-list-panel,
.campsite-list-panel {
  width: min(calc(100vw - 36px), calc((100vh - 36px) * 16 / 9));
  border: 6px solid var(--bark);
  border-radius: 6px;
  background: var(--paper);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  padding: 12px 14px 14px;
}

.lake-list-panel h2,
.campsite-list-panel h2 {
  margin: 0 0 10px;
  color: var(--bark);
  font-size: 26px;
  line-height: 1.1;
  font-weight: 700;
}

.lake-list-header,
.lake-list li {
  display: grid;
  grid-template-columns:
    minmax(170px, 1.35fr)
    minmax(96px, 0.75fr)
    minmax(96px, 0.75fr)
    repeat(3, minmax(95px, 1fr))
    minmax(86px, 0.7fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  white-space: nowrap;
}

.lake-list-header {
  padding: 7px 8px;
  border-top: 2px solid rgba(91, 52, 31, 0.36);
  border-bottom: 2px solid rgba(91, 52, 31, 0.36);
  color: var(--cedar);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.1;
}

.lake-list-header span,
.lake-list-header button {
  overflow: hidden;
  text-overflow: ellipsis;
}

.lake-list-header span:not(:first-child),
.lake-list-header button:not(:first-child) {
  text-align: center;
}

.lake-list-header button {
  min-width: 0;
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-align: left;
}

.lake-list-header button:hover,
.lake-list-header button:focus-visible {
  color: var(--bark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.lake-list-header button[data-active="true"]::after {
  content: " ▲";
  font-size: 0.82em;
}

.lake-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.lake-list li {
  min-height: 36px;
  padding: 6px 8px;
  border-top: 1px solid rgba(91, 52, 31, 0.22);
  color: var(--charcoal);
  font-size: 18px;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}

.lake-list li:hover {
  background: rgba(255, 249, 234, 0.45);
}

.lake-list li:focus-visible {
  outline: 2px solid var(--sun);
  outline-offset: -2px;
  background: rgba(255, 249, 234, 0.55);
}

.lake-list li:first-child {
  border-top: 0;
}

.lake-list span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.lake-list .lake-name {
  font-weight: 700;
}

.lake-list .lake-time {
  color: var(--cedar);
  font-weight: 700;
  text-align: center;
}

.lake-list .lake-fish {
  text-align: center;
}

.lake-list .lake-size {
  color: var(--cedar);
  font-weight: 700;
  text-align: right;
}

.campsite-list-header,
.campsite-list li {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) repeat(2, minmax(130px, 0.75fr));
  gap: 12px;
  align-items: center;
  min-width: 0;
  white-space: nowrap;
}

.campsite-list-header {
  padding: 7px 8px;
  border-top: 2px solid rgba(91, 52, 31, 0.36);
  border-bottom: 2px solid rgba(91, 52, 31, 0.36);
  color: var(--cedar);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.1;
}

.campsite-list-header button {
  min-width: 0;
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  overflow: hidden;
  padding: 0;
  text-align: left;
  text-overflow: ellipsis;
}

.campsite-list-header button:not(:first-child) {
  text-align: center;
}

.campsite-list-header button:hover,
.campsite-list-header button:focus-visible {
  color: var(--bark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.campsite-list-header button[data-active="true"]::after {
  content: " ▲";
  font-size: 0.82em;
}

.campsite-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.campsite-list li {
  min-height: 36px;
  padding: 6px 8px;
  border-top: 1px solid rgba(91, 52, 31, 0.22);
  color: var(--charcoal);
  cursor: pointer;
  font-size: 18px;
  line-height: 1.2;
}

.campsite-list li:hover {
  background: rgba(255, 249, 234, 0.45);
}

.campsite-list li:focus-visible {
  outline: 2px solid var(--sun);
  outline-offset: -2px;
  background: rgba(255, 249, 234, 0.55);
}

.campsite-list li:first-child {
  border-top: 0;
}

.campsite-list span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.campsite-list .campsite-name {
  font-weight: 700;
}

.campsite-list .campsite-time {
  color: var(--cedar);
  font-weight: 700;
  text-align: center;
}

@media (orientation: portrait) {
  html,
  body {
    min-height: 100dvh;
  }

  .shell {
    gap: 10px;
    min-height: 100dvh;
    padding: 6px;
  }

  .map-frame,
  .lake-list-panel,
  .campsite-list-panel {
    width: calc(100vw - 12px);
    max-width: none;
  }

  .map-frame {
    aspect-ratio: 4 / 3;
    border-width: 4px;
    border-radius: 4px;
  }

  #fishmap-canvas {
    touch-action: manipulation;
  }

  .lake-list-panel,
  .campsite-list-panel {
    border-width: 4px;
    border-radius: 4px;
    overflow-x: auto;
    padding: 9px 8px 10px;
    -webkit-overflow-scrolling: touch;
  }

  .lake-list-panel h2,
  .campsite-list-panel h2 {
    font-size: 22px;
    margin-bottom: 8px;
  }

  .lake-list-header,
  .lake-list li {
    grid-template-columns:
      minmax(132px, 1.35fr)
      minmax(76px, 0.75fr)
      minmax(76px, 0.75fr)
      repeat(3, minmax(82px, 1fr))
      minmax(64px, 0.7fr);
    gap: 8px;
    min-width: 668px;
  }

  .campsite-list-header,
  .campsite-list li {
    grid-template-columns: minmax(156px, 1.5fr) repeat(2, minmax(88px, 0.75fr));
    gap: 8px;
    min-width: 360px;
  }

  .lake-list-header,
  .campsite-list-header {
    font-size: 12px;
    padding: 7px 6px;
  }

  .lake-list li,
  .campsite-list li {
    min-height: 40px;
    padding: 8px 6px;
    font-size: 16px;
  }
}
