:root {
  color-scheme: light;
  --bg: #eef2f3;
  --panel: #ffffff;
  --text: #172026;
  --muted: #5e6b73;
  --line: #d5dde1;
  --accent: #0b6b76;
  --accent-strong: #084e57;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  margin: -1px;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

html {
  height: 100%;
}

html:has(body:not(.tracks-page)) {
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

body:not(.tracks-page) {
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

button,
input,
fieldset {
  font: inherit;
}

button,
input {
  max-width: 100%;
}

textarea {
  max-width: 100%;
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  height: 100vh;
  height: 100svh;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  padding: 32px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.eyebrow-link {
  text-decoration: none;
}

.eyebrow-link:hover,
.eyebrow-link:focus-visible {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 8vw, 2.7rem);
  line-height: 1;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.enc-tile-debug-control {
  margin-top: 16px;
  padding: 16px 0;
  border-top: 1px solid #d8e2e7;
}
.enc-tile-debug-control select {
  width: 100%;
  min-width: 0;
}

.tracks-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  justify-content: space-between;
}

.sidebar-section {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.sidebar-section--primary {
  gap: 16px;
}

.sidebar-section--panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f9fa;
}

.sidebar-section__heading {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
}

.account-menu {
  position: relative;
}

.account-menu__summary {
  display: grid;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #f6f9fa;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 800;
  list-style: none;
  place-items: center;
}

.account-menu__summary::-webkit-details-marker {
  display: none;
}

.account-menu__summary:hover,
.account-menu__summary:focus-visible {
  background: #eef5f6;
}

.account-menu__summary:focus-visible {
  outline: 3px solid #8ed1d8;
  outline-offset: 2px;
}

.account-menu__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 500;
  display: grid;
  gap: 12px;
  width: min(280px, calc(100vw - 32px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(23, 32, 38, 0.18);
}

.map-search-form {
  display: grid;
  gap: 10px;
}

.upload-form {
  display: grid;
  gap: 14px;
}

.upload-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.upload-actions button:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.upload-actions button {
  min-width: 0;
  padding: 0 10px;
  line-height: 1.15;
}

#share-track-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: #ffffff;
}

#share-track-button:hover,
#share-track-button:focus-visible {
  color: var(--text);
  background: #eef5f6;
}

.auth-status,
.my-tracks-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.auth-status.is-error {
  color: var(--danger);
}

.button-link {
  display: grid;
  min-height: 48px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: var(--accent);
  font-weight: 700;
  place-items: center;
  text-align: center;
  text-decoration: none;
}

.button-secondary {
  min-height: 44px;
  border: 1px solid var(--line);
  color: var(--text);
  background: #ffffff;
}

.button-secondary:hover,
.button-secondary:focus-visible {
  background: #eef5f6;
}

.button-link:hover,
.button-link:focus-visible {
  background: var(--accent-strong);
}

.button-link:focus-visible {
  outline: 3px solid #8ed1d8;
  outline-offset: 2px;
}

.button-link--secondary {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #ffffff;
  font-size: 0.86rem;
}

.button-link--secondary:hover,
.button-link--secondary:focus-visible {
  color: var(--text);
  background: #eef5f6;
}

.my-track-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.custom-auth-form {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.custom-auth-heading {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.custom-auth-form--panel {
  padding-top: 0;
  border-top: 0;
}

.custom-auth-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.custom-auth-actions button {
  min-width: 0;
  min-height: 44px;
  padding: 0 10px;
}

.text-field {
  display: grid;
  gap: 8px;
}

.text-field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.text-field input {
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
}

.text-field input:focus {
  border-color: var(--accent);
  outline: 3px solid #8ed1d8;
  outline-offset: 1px;
}

.drop-zone {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 20px;
  border: 2px dashed #9eb2bb;
  border-radius: 8px;
  background: #f8fbfc;
  cursor: pointer;
  align-content: center;
  transition: border-color 160ms ease, background 160ms ease;
}

.drop-zone.has-track {
  min-height: 74px;
  padding: 14px 16px;
  border-style: solid;
  align-content: center;
}

.drop-zone:hover,
.drop-zone:focus-within,
.drop-zone.is-dragging {
  border-color: var(--accent);
  background: #f2f8f9;
}

.drop-zone.is-loading {
  cursor: wait;
  opacity: 0.72;
}

.drop-zone__title {
  font-weight: 700;
}

.drop-zone__meta,
.status {
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.drop-zone input {
  width: 1px;
  height: 1px;
  opacity: 0;
  position: absolute;
}

.text-field textarea {
  width: 100%;
  min-height: 140px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #ffffff;
  resize: vertical;
}

.text-field textarea:focus {
  outline: 3px solid #8ed1d8;
  outline-offset: 2px;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

#save-track-button:disabled {
  border: 1px solid var(--line);
  color: var(--muted);
  background: #eef5f6;
  opacity: 1;
}

#save-track-button:disabled::before {
  content: "✓";
  margin-right: 6px;
}

.map-switcher,
.format-switcher {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f9fa;
}

.map-switcher {
  grid-template-columns: 1fr 1fr;
}

.format-switcher {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.map-switcher legend,
.format-switcher legend {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0 4px 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.settings-control-heading {
  margin: 4px 0 -8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.map-switcher label,
.format-switcher label {
  position: relative;
  min-width: 0;
}

.map-switcher input,
.format-switcher input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.map-switcher span,
.format-switcher span {
  display: grid;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
  place-items: center;
  text-align: center;
}

.map-switcher input:checked + span,
.format-switcher input:checked + span {
  color: #ffffff;
  background: var(--accent);
}

.map-switcher input:focus-visible + span,
.format-switcher input:focus-visible + span {
  outline: 3px solid #8ed1d8;
  outline-offset: 2px;
}

.track-style-switcher {
  display: grid;
  gap: 8px;
}

.track-style-switcher label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.track-style-switcher input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.track-style-switcher input:focus-visible {
  outline: 3px solid #8ed1d8;
  outline-offset: 2px;
}

.track-style-switcher span {
  line-height: 1.25;
}

.overlay-toggles {
  display: grid;
  gap: 8px;
}

.overlay-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--text);
  font-weight: 700;
}

.overlay-toggle input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.overlay-toggle.is-disabled {
  color: var(--muted);
  opacity: 0.58;
}

.feedback-button {
  width: 100%;
  border: 1px solid var(--line);
  color: var(--text);
  background: #ffffff;
}

.feedback-button:hover,
.feedback-button:focus-visible {
  color: var(--text);
  background: #eef5f6;
}

.sidebar-section--feedback {
  gap: 8px;
}

.feedback-link {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.feedback-link:hover,
.feedback-link:focus-visible {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.app-dialog,
.feedback-dialog {
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100svh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #ffffff;
  box-shadow: 0 22px 60px rgba(23, 32, 38, 0.26);
  overflow: auto;
}

.app-dialog::backdrop,
.feedback-dialog::backdrop {
  background: rgba(23, 32, 38, 0.34);
}

.share-dialog__content,
.feedback-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.dialog-header,
.feedback-dialog__header,
.feedback-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.dialog-header h2,
.feedback-dialog__header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.dialog-close-button,
.feedback-close-button {
  width: 36px;
  min-height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  color: var(--text);
  background: #ffffff;
  font-size: 1.3rem;
  line-height: 1;
}

.dialog-close-button:hover,
.dialog-close-button:focus-visible,
.feedback-close-button:hover,
.feedback-close-button:focus-visible {
  background: #eef5f6;
}

.feedback-actions button {
  flex: 1;
}

.feedback-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.feedback-status.is-error {
  color: var(--danger);
}

.channel-marker-dot-halo {
  pointer-events: none;
}

.channel-marker-number-icon {
  --channel-marker-number-halo: rgba(0, 0, 0, 0.92);

  color: #ffd400;
  font-size: 11px;
  font-weight: 800;
  line-height: 12px;
  pointer-events: none;
  text-align: center;
  text-shadow:
    0 0 2px var(--channel-marker-number-halo),
    0 0 3px var(--channel-marker-number-halo),
    -1px -1px 0 var(--channel-marker-number-halo),
    1px -1px 0 var(--channel-marker-number-halo),
    -1px 1px 0 var(--channel-marker-number-halo),
    1px 1px 0 var(--channel-marker-number-halo);
  white-space: nowrap;
}

.channel-marker-number-label {
  display: block;
}

.depth-sounding-icon {
  background: transparent;
  border: 0;
  color: rgba(8, 28, 43, 0.86);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  text-align: center;
  text-shadow:
    0 0 2px rgba(255, 255, 255, 0.95),
    0 0 3px rgba(255, 255, 255, 0.95),
    -1px -1px 0 rgba(255, 255, 255, 0.86),
    1px -1px 0 rgba(255, 255, 255, 0.86),
    -1px 1px 0 rgba(255, 255, 255, 0.86),
    1px 1px 0 rgba(255, 255, 255, 0.86);
  white-space: nowrap;
}

.depth-sounding-label {
  display: inline-block;
  transform: translate(-50%, -50%);
}

.track-start-icon,
.track-finish-icon {
  width: 16px;
  height: 16px;
}

.track-start-circle {
  display: block;
  width: 16px;
  height: 16px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.34);
  box-sizing: border-box;
}

.track-finish-circle {
  display: grid;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.34);
  place-items: center;
}

.track-finish-checker {
  display: block;
  width: 12px;
  height: 12px;
  shape-rendering: crispEdges;
}

.track-finish-checker-square {
  fill: #111827;
}

.status {
  min-height: 44px;
  margin: 0;
}

.status.is-error {
  color: var(--danger);
}

.stats-panel {
  display: grid;
  gap: 10px;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 0;
  padding-top: 4px;
}

.stats div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stats dt {
  color: var(--muted);
  font-size: 0.78rem;
}

.stats dd {
  margin: 4px 0 0;
  font-size: 1.1rem;
  font-weight: 750;
}

.map-panel {
  display: grid;
  grid-column: 2;
  grid-row: 1;
  height: 100vh;
  height: 100svh;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.tracks-page {
  min-height: 100vh;
  min-height: 100svh;
}

.seo-fallback {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 32px;
  color: var(--text);
  background: var(--panel);
  overflow: auto;
}

.seo-fallback h2,
.seo-fallback p {
  max-width: 64ch;
  margin: 0;
}

.seo-fallback h2 {
  font-size: 1.6rem;
  line-height: 1.15;
}

.seo-fallback p {
  color: var(--muted);
  line-height: 1.55;
}

.tracks-shell {
  display: grid;
  gap: 24px;
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 32px;
}

.account-shell {
  width: min(720px, 100%);
  padding-block: 40px;
}

.about-page {
  background: #f6f9fa;
}

.about-shell {
  width: min(860px, 100%);
  padding-block: 40px;
}

.about-header h1 {
  max-width: 12ch;
}

.about-content {
  display: grid;
  gap: 12px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.about-content h2,
.about-content p {
  margin: 0;
}

.about-content h2 {
  font-size: 1.2rem;
  line-height: 1.25;
}

.about-content p,
.about-list {
  color: var(--muted);
  line-height: 1.55;
}

.about-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}

.tracks-header__actions {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.tracks-auth-panel,
.tracks-content {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.admin-section {
  display: grid;
  gap: 12px;
}

.tracks-auth-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.account-auth-panel h2 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.2;
}

.account-auth-panel {
  gap: 18px;
  padding: 24px;
}

.account-auth-panel .auth-status {
  max-width: 56ch;
  font-size: 0.94rem;
}

.account-auth-panel .custom-auth-form {
  width: min(100%, 520px);
  gap: 12px;
}

.account-auth-panel .text-field input {
  min-height: 46px;
}

.account-auth-panel #account-google-button,
.account-auth-panel .custom-auth-form button,
.account-auth-panel #account-signout-button {
  width: min(100%, 320px);
  min-height: 46px;
  padding: 0 18px;
  justify-self: start;
}

.account-auth-panel .custom-auth-form + .custom-auth-form {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

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

.tracks-list li {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.tracks-list h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
}

.admin-content-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.admin-content-header h2 {
  margin: 0;
  font-size: 1.08rem;
}

.admin-section-count {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.admin-summary-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin: 0;
}

.admin-setting-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: var(--text);
  font-weight: 800;
}

.admin-setting-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.admin-summary-list div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.admin-summary-list dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.admin-summary-list dd {
  margin: 4px 0 0;
  font-size: 1.5rem;
  font-weight: 800;
}

.track-list-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.admin-users-list .track-list-header,
.admin-feedback-list .track-list-header {
  grid-template-columns: minmax(0, 1fr);
}

.admin-feedback-message {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
}

.admin-feedback-details {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 10px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-feedback-details dt {
  font-weight: 800;
}

.admin-feedback-details dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.track-title-link {
  color: var(--text);
  text-decoration: none;
}

.track-title-link:hover,
.track-title-link:focus-visible {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.track-delete-button {
  display: grid;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--danger);
  background: transparent;
  place-items: center;
}

.track-delete-button:hover,
.track-delete-button:focus-visible {
  border-color: #f0b8b3;
  color: #8f1c13;
  background: #fff1f0;
}

.track-delete-button:focus-visible {
  outline: 3px solid #f0b8b3;
  outline-offset: 2px;
}

.track-delete-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.tracks-pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
}

.tracks-pagination button {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #ffffff;
  font-size: 0.86rem;
}

.tracks-pagination button:hover,
.tracks-pagination button:focus-visible {
  color: var(--text);
  background: #eef5f6;
}

.tracks-page-status {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
}

.location-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.locations-section {
  display: grid;
  gap: 10px;
}

.location-button {
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #f6f9fa;
  font-size: 0.86rem;
  font-weight: 700;
  text-align: center;
}

.location-button:hover,
.location-button:focus-visible {
  color: var(--text);
  background: #eef5f6;
}

.location-button:focus-visible {
  outline: 3px solid #8ed1d8;
  outline-offset: 2px;
}

.location-button.is-active {
  border-color: var(--accent);
  color: #ffffff;
  background: var(--accent);
}

.map-stage {
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: stretch;
}

.map-panel[data-map-format="portrait"] .map-stage,
.map-panel[data-map-format="square"] .map-stage,
.map-panel[data-map-format="landscape"] .map-stage {
  padding: 24px;
  background: #dbe4e8;
  place-items: center;
}

.map-panel[data-map-format="portrait"] #map,
.map-panel[data-map-format="square"] #map,
.map-panel[data-map-format="landscape"] #map {
  min-height: 0;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.download-frame {
  position: absolute;
  width: 1px;
  height: 1px;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

@media (min-width: 761px) and (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .sidebar {
    padding: 24px;
  }

  .map-panel[data-map-format="portrait"] .map-stage,
  .map-panel[data-map-format="square"] .map-stage,
  .map-panel[data-map-format="landscape"] .map-stage {
    padding: 12px;
  }
}

@media (max-width: 760px) {
  body {
    background: var(--panel);
  }

  .app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100svh;
    overflow: hidden;
  }

  .sidebar {
    flex: 1 1 auto;
    order: 2;
    gap: 18px;
    min-height: 0;
    padding: 20px;
    padding-right: calc(20px + env(safe-area-inset-right));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    padding-left: calc(20px + env(safe-area-inset-left));
    border-right: 0;
    border-top: 1px solid var(--line);
  }

  h1 {
    font-size: clamp(1.85rem, 10vw, 2.3rem);
    line-height: 1.05;
  }

  .tracks-header {
    display: grid;
  }

  .account-menu__panel {
    right: auto;
    left: 0;
    width: min(240px, calc(100vw - 32px));
  }

  .tracks-shell {
    padding: 20px;
    padding-right: calc(20px + env(safe-area-inset-right));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    padding-left: calc(20px + env(safe-area-inset-left));
  }

  .tracks-header__actions {
    flex-wrap: wrap;
  }

  .tracks-header__actions .account-menu__panel {
    right: 0;
    left: auto;
  }

  .upload-form {
    gap: 10px;
  }

  .drop-zone {
    min-height: 96px;
    padding: 16px;
  }

  button {
    min-height: 44px;
  }

  .stats {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .stats div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: baseline;
    min-width: 0;
    padding: 10px 12px;
  }

  .stats dd {
    margin: 0;
    font-size: 1rem;
    overflow-wrap: anywhere;
    text-align: right;
  }

  .map-panel {
    flex: 0 0 62vh;
    flex-basis: 62svh;
    order: 1;
    height: 62vh;
    height: 62svh;
  }

  .location-bar {
    gap: 6px;
  }

  .location-button {
    min-height: 44px;
    padding: 0 12px;
    font-size: 0.8rem;
  }

  .map-panel[data-map-format="portrait"] .map-stage,
  .map-panel[data-map-format="square"] .map-stage,
  .map-panel[data-map-format="landscape"] .map-stage {
    padding: 12px;
  }

  #map {
    min-height: 0;
  }

  .map-panel .leaflet-bar a {
    width: 44px;
    height: 44px;
    min-height: 44px;
  }

  .map-panel .leaflet-bar a {
    line-height: 44px;
  }

}

@media (max-width: 760px) and (orientation: landscape) {
  .map-panel {
    flex-basis: 72svh;
    height: 72vh;
    height: 72svh;
  }
}

@media (max-width: 430px) {
  .sidebar {
    gap: 16px;
    padding: 16px;
    padding-right: calc(16px + env(safe-area-inset-right));
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    padding-left: calc(16px + env(safe-area-inset-left));
  }

  .map-panel {
    flex-basis: 58svh;
    height: 58vh;
    height: 58svh;
  }

  .upload-actions {
    grid-template-columns: 1fr;
  }

  #map {
    height: 100%;
    min-height: 0;
  }

  .map-switcher span,
  .format-switcher span {
    min-height: 38px;
    padding: 0 8px;
    font-size: 0.92rem;
  }

  .overlay-toggles {
    gap: 4px;
  }

  .overlay-toggle {
    min-height: 40px;
  }

  .status {
    min-height: 0;
  }

  .tracks-pagination {
    grid-template-columns: 1fr 1fr;
  }

  .tracks-page-status {
    grid-column: 1 / -1;
    grid-row: 1;
    text-align: center;
  }
}

@media (max-width: 360px) {
  h1 {
    font-size: 1.8rem;
  }

  .stats {
    grid-template-columns: 1fr;
  }
}

.app-intro {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.app-intro a, .about-content a {
  color: var(--accent-strong);
}

.about-content h3 {
  margin: 12px 0 0;
  font-size: 1rem;
}

.depth-units-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

.depth-units-field select {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: var(--panel);
  font: inherit;
}

.depth-units-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.iphone-app-info {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
  text-align: left;
}

.iphone-app-info a {
  color: var(--accent-strong);
}

/* Google requires a 16px logo with 10px left/right/top and 5px bottom clear space. */
.google-map-credit { display: inline-block; height: 16px; width: auto; margin: 10px 10px 5px; vertical-align: middle; }
.leaflet-control-attribution:has(.google-map-credit) { display: flex; align-items: center; padding: 0; background: rgba(255, 255, 255, 0.95); }
.google-data-sources { position: relative; font: 11px/1.4 system-ui, sans-serif; color: #202124; }
.google-data-sources summary { cursor: pointer; list-style: none; padding: 7px 8px 7px 0; white-space: nowrap; }
.google-data-sources summary::-webkit-details-marker { display: none; }
.google-data-sources summary:focus-visible { outline: 2px solid #0f766e; outline-offset: -2px; }
.google-data-sources-panel { position: absolute; right: 0; bottom: calc(100% + 5px); width: min(300px, calc(100vw - 24px)); max-height: min(180px, 35vh); overflow: auto; overscroll-behavior: contain; padding: 10px; box-sizing: border-box; border-radius: 6px; background: #fff; box-shadow: 0 2px 12px #0003; white-space: normal; overflow-wrap: anywhere; text-align: left; }
