:root {
  color-scheme: light;
  --ink: #10242b;
  --muted: #5a6e75;
  --line: #d7e4e7;
  --paper: #f7fbfa;
  --panel: #ffffff;
  --sea: #0b5f73;
  --reef: #0f8a87;
  --sand: #f3d9a4;
  --coral: #d46b58;
  --shadow: 0 16px 40px rgba(13, 42, 48, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Yu Gothic UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
.import-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
}

.primary {
  background: var(--sea);
  color: #fff;
}

.secondary,
.import-button {
  background: #d9f0ee;
  color: #083f4b;
}

.ghost {
  background: #eef5f4;
  color: #23474f;
}

.danger {
  background: #f8dfd9;
  color: #8f2f1f;
}

.hero {
  min-height: 42svh;
  position: relative;
  display: flex;
  align-items: end;
  padding: max(28px, env(safe-area-inset-top)) 20px 34px;
  background: url("assets/ocean-hero.png") center / cover;
  overflow: hidden;
}

.hero__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 42, 52, 0.12), rgba(4, 33, 42, 0.74));
}

.hero__content {
  position: relative;
  width: min(980px, 100%);
  margin: 0 auto;
  color: #fff;
}

.eyebrow,
.subhead {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.76rem;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 12vw, 5.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.lead {
  max-width: 650px;
  margin: 14px 0 0;
  font-size: clamp(1rem, 3.8vw, 1.35rem);
  line-height: 1.65;
}

.shell {
  width: min(980px, 100%);
  margin: -18px auto 48px;
  padding: 0 14px 24px;
  position: relative;
}

.profile-panel,
.backup-panel,
.map-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.profile-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin: 14px 0;
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 8px 0;
  background: rgba(247, 251, 250, 0.9);
  backdrop-filter: blur(16px);
}

.tab {
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line);
}

.tab.is-active {
  color: #fff;
  background: var(--sea);
  border-color: var(--sea);
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin: 20px 0 14px;
}

.section-head h2 {
  margin: 0;
  font-size: clamp(1.55rem, 7vw, 2.3rem);
}

.subhead {
  color: var(--reef);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 12px;
}

.search-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(180px, 0.8fr) auto;
  align-items: end;
  gap: 10px;
  margin: 0 0 10px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.stat b {
  display: block;
  font-size: 1.5rem;
  line-height: 1.1;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 4px;
}

.log-list,
.map-log-list {
  display: grid;
  gap: 12px;
}

.empty {
  background: #fff;
  border: 1px dashed #aac4ca;
  border-radius: 8px;
  padding: 24px;
  color: var(--muted);
  line-height: 1.7;
}

.log-card {
  display: grid;
  grid-template-columns: 148px 1fr;
  min-height: 164px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 22px rgba(13, 42, 48, 0.08);
}

.log-card__photo {
  width: 100%;
  height: 100%;
  min-height: 164px;
  object-fit: cover;
  background: linear-gradient(135deg, #0b5f73, #f3d9a4);
}

.log-card__body {
  padding: 14px;
}

.log-card__top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.log-card__date,
.log-card__number {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.log-card h3 {
  margin: 4px 0 10px;
  font-size: 1.2rem;
}

.log-card__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 10px;
}

.log-card__facts div {
  background: #eef7f6;
  border-radius: 8px;
  padding: 6px 9px;
}

.log-card__facts dt {
  color: var(--muted);
  font-size: 0.68rem;
}

.log-card__facts dd {
  margin: 1px 0 0;
  font-weight: 800;
}

.log-card__notes {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.55;
}

.log-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

label {
  display: grid;
  gap: 7px;
  color: #24434a;
  font-size: 0.87rem;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #c8d9dd;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

input[readonly] {
  background: #eef5f4;
  color: #23474f;
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

.calculated-time {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef7f6;
  padding: 12px;
}

.calculated-time strong {
  font-size: 1.45rem;
  white-space: nowrap;
  padding-bottom: 10px;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.map-card {
  padding: 12px;
}

.map-actions,
.backup-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.map,
.overview-map {
  width: 100%;
  height: 320px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.overview-map {
  height: 56svh;
  min-height: 380px;
  margin-bottom: 12px;
}

.hint {
  color: var(--muted);
  line-height: 1.6;
}

.photo-input input,
.import-button input {
  display: none;
}

.photo-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(94px, 1fr));
  gap: 8px;
}

.photo-tile {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-tile button {
  position: absolute;
  right: 6px;
  top: 6px;
  min-height: 32px;
  padding: 0 10px;
  color: #fff;
  background: rgba(10, 31, 38, 0.72);
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 0 max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(247, 251, 250, 0), var(--paper) 22%);
}

.backup-panel {
  padding: 16px;
  line-height: 1.7;
}

.detail-dialog {
  width: min(760px, calc(100% - 24px));
  max-height: min(86svh, 900px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(10, 31, 38, 0.28);
}

.detail-dialog::backdrop {
  background: rgba(8, 29, 36, 0.45);
}

.detail-dialog__head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.detail-dialog__head h2 {
  margin: 0;
}

.detail-body {
  padding: 16px;
}

.detail-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.detail-photos img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.detail-list div {
  background: #eef7f6;
  border-radius: 8px;
  padding: 10px;
}

.detail-list dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.detail-list dd {
  margin: 4px 0 0;
  white-space: pre-wrap;
  line-height: 1.55;
  font-weight: 700;
}

@media (max-width: 720px) {
  .profile-panel,
  .grid.two,
  .grid.three,
  .log-card {
    grid-template-columns: 1fr;
  }

  .log-card__photo {
    height: 210px;
    min-height: 210px;
  }

  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .section-head button {
    width: 100%;
  }

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

  .search-panel {
    grid-template-columns: 1fr;
  }

  .calculated-time,
  .detail-list {
    grid-template-columns: 1fr;
  }

  .map,
  .overview-map {
    height: 360px;
  }
}
