:root {
  --bg-page: #F7F1EB;
  --bg-card: #FFFFFF;
  --color-teal: #4ECDC4;
  --color-teal-dark: #2BB5AD;
  --color-teal-light: #7EDCD5;
  --color-coral: #FF6B5A;
  --color-coral-light: #FF8A7A;
  --color-sand: #E8DDD3;
  --color-sand-dark: #D4C5B5;
  --color-text: #2C3E50;
  --color-text-secondary: #7F8C8D;
  --color-text-muted: #B0B8BC;
  --color-title: #1A3A4A;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
}

body {
  background: var(--bg-page);
  color: var(--color-text);
  font-family: -apple-system, 'PingFang SC', 'Helvetica Neue', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ====== Page transitions ====== */
#app-content {
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.page-exit {
  opacity: 0;
  transform: translateX(-8px);
}
.page-enter {
  opacity: 1;
  transform: translateX(0);
}

/* ====== Glass Card ====== */
.glass-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 16px;
  margin: 8px 12px 12px;
  box-shadow: 0 2px 12px rgba(44, 62, 80, 0.06);
}

.card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 16px;
  margin: 8px 12px;
  box-shadow: 0 2px 12px rgba(44, 62, 80, 0.06);
}

/* ====== Tags ====== */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: bold;
  white-space: nowrap;
}
.tag-teal {
  background: rgba(78,205,196,0.12);
  color: var(--color-teal-dark);
}
.tag-coral {
  background: rgba(255,107,90,0.12);
  color: var(--color-coral);
}
.tag-white {
  background: rgba(255,255,255,0.25);
  color: #fff;
}

/* ====== Buttons ====== */
.btn-primary {
  background: linear-gradient(135deg, var(--color-teal-dark), var(--color-teal));
  color: #fff;
  border-radius: 12px;
  padding: 14px 0;
  text-align: center;
  font-size: 16px;
  font-weight: bold;
  box-shadow: 0 2px 10px rgba(78,205,196,0.3);
  cursor: pointer;
  min-height: 44px;
  user-select: none;
}
.btn-primary:active {
  opacity: 0.85;
}

/* ====== Utility ====== */
.text-coral { color: var(--color-coral); }
.text-teal { color: var(--color-teal-dark); }
.text-muted { color: var(--color-text-secondary); }

/* ====== Trips List Page ====== */
.container {
  padding: 8px 0 100px;
  min-height: 100vh;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 120px;
}
.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.empty-text {
  font-size: 16px;
  color: var(--color-text);
  margin-bottom: 4px;
}
.empty-sub {
  font-size: 13px;
  color: var(--color-text-muted);
}

/* Year group */
.year-group {
  margin-bottom: 8px;
}
.year-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 16px 6px;
}
.year-title {
  font-size: 20px;
  font-weight: bold;
  color: var(--color-teal-dark);
}
.year-count {
  font-size: 12px;
  color: var(--color-text-secondary);
}

/* Trip card */
.trip-card {
  margin: 4px 12px 8px;
  cursor: pointer;
}
.trip-card:active {
  opacity: 0.9;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.location-text {
  font-size: 17px;
  font-weight: bold;
  color: var(--color-title);
  flex: 1;
  margin-right: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.date-text {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}
.card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dive-count {
  display: flex;
  align-items: baseline;
}
.count-num {
  font-size: 22px;
  font-weight: bold;
}
.count-label {
  font-size: 12px;
  color: var(--color-text-secondary);
}
.delete-btn {
  margin-left: auto;
  font-size: 11px;
  color: var(--color-text-muted);
  padding: 4px 10px;
  border: 1px solid var(--color-sand);
  border-radius: 6px;
  min-height: 28px;
  display: flex;
  align-items: center;
  cursor: pointer;
}
.delete-btn:active {
  background: var(--color-sand);
}

/* FAB */
.fab {
  position: fixed;
  right: 20px;
  bottom: 80px;
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--color-teal-dark), var(--color-teal));
  color: #fff;
  font-size: 28px;
  border-radius: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(78,205,196,0.35);
  cursor: pointer;
  user-select: none;
  z-index: 100;
}
.fab:active {
  transform: scale(0.95);
}

/* ====== Page Header ====== */
.page-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-page);
  position: sticky;
  top: 0;
  z-index: 10;
}
.back-btn {
  font-size: 28px;
  color: var(--color-teal-dark);
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  user-select: none;
}
.page-title {
  flex: 1;
  font-size: 17px;
  font-weight: bold;
  color: var(--color-title);
  text-align: center;
}
.header-spacer {
  width: 44px;
}

/* ====== Add/Edit Trip Form ====== */
.form-container {
  padding: 8px 8px 40px;
  min-height: 100vh;
}
.section {
  margin-bottom: 12px;
  background: var(--bg-card);
  border: 1px solid var(--color-sand);
  border-radius: 16px;
  padding: 16px;
}
.section-title {
  font-size: 14px;
  font-weight: bold;
  color: var(--color-teal-dark);
  margin-bottom: 12px;
}
.search-box {
  background: var(--bg-page);
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.search-input {
  font-size: 14px;
  width: 100%;
  color: var(--color-text);
  border: none;
  background: transparent;
  outline: none;
}
.search-input::placeholder {
  color: var(--color-text-muted);
}
.search-results {
  border: 1px solid var(--color-sand);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 8px;
  max-height: 200px;
  overflow-y: auto;
}
.search-item {
  padding: 12px 14px;
  border-bottom: 1px solid #F0E8E0;
  font-size: 14px;
  cursor: pointer;
}
.search-item:last-child {
  border-bottom: none;
}
.search-item:active {
  background: #f5f0ea;
}
.country {
  color: var(--color-text-secondary);
}
.spot {
  color: var(--color-text);
  font-weight: bold;
}
.search-empty {
  font-size: 12px;
  color: var(--color-text-muted);
  padding: 4px 0;
}
.selected-location {
  display: flex;
  align-items: center;
  padding: 8px 0;
}
.selected-label {
  font-size: 13px;
  color: var(--color-text-secondary);
}
.selected-name {
  font-size: 15px;
  font-weight: bold;
  color: var(--color-teal-dark);
  flex: 1;
}
.clear-btn {
  color: var(--color-text-muted);
  font-size: 22px;
  padding: 0 8px;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.manual-input {
  background: var(--bg-page);
  border: 1px solid var(--color-sand);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  width: 100%;
  color: var(--color-text);
  outline: none;
}
.manual-input::placeholder {
  color: var(--color-text-muted);
}

/* Date rows */
.date-row {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #F0E8E0;
}
.date-row:last-child {
  border-bottom: none;
}
.date-label {
  font-size: 14px;
  color: var(--color-text-secondary);
  width: 44px;
}
.date-picker-input {
  font-size: 14px;
  color: var(--color-teal-dark);
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  min-height: 44px;
}

/* Radio group */
.radio-group {
  display: flex;
  gap: 12px;
}
.radio-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border: 1px solid var(--color-sand);
  border-radius: 8px;
  font-size: 14px;
  color: var(--color-text);
  flex: 1;
  justify-content: center;
  cursor: pointer;
  min-height: 44px;
  user-select: none;
}
.radio-item.selected {
  border-color: var(--color-teal);
  background: rgba(78,205,196,0.08);
  color: var(--color-teal-dark);
}
.radio-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--color-sand-dark);
  flex-shrink: 0;
  position: relative;
}
.radio-dot.active {
  border-color: var(--color-teal);
}
.radio-dot.active::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-teal);
}

/* Count control */
.count-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}
.count-btn {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--color-teal-dark), var(--color-teal));
  color: #fff;
  border-radius: 50%;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}
.count-btn:active {
  opacity: 0.85;
}
.count-btn.disabled {
  background: var(--color-sand);
  color: var(--color-text-muted);
  pointer-events: none;
}
.count-input {
  width: 60px;
  text-align: center;
  font-size: 28px;
  font-weight: bold;
  color: var(--color-coral);
  border: none;
  outline: none;
  background: transparent;
}
.count-input::-webkit-inner-spin-button,
.count-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.count-input[type=number] {
  -moz-appearance: textfield;
}

/* Notes */
.notes-input {
  width: 100%;
  font-size: 14px;
  min-height: 60px;
  color: var(--color-text);
  border: none;
  outline: none;
  resize: vertical;
  font-family: inherit;
}
.notes-input::placeholder {
  color: var(--color-text-muted);
}

.save-btn {
  margin: 16px 12px;
}

/* ====== Trip Detail Page ====== */
.detail-container {
  min-height: 100vh;
  padding-bottom: 24px;
}
.hero-card {
  background: linear-gradient(180deg, var(--color-teal), var(--color-teal-light));
  padding: 24px 16px 20px;
  position: relative;
}
.back-btn-hero {
  font-size: 28px;
  color: #fff;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  user-select: none;
  margin-bottom: 8px;
}
.hero-location {
  display: block;
  font-size: 22px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 10px;
}
.hero-tags {
  display: flex;
  gap: 8px;
}

.info-card {
  margin: 12px 12px;
  background: var(--bg-card);
  border: 1px solid var(--color-sand);
  border-radius: 16px;
  padding: 16px;
}
.info-row {
  display: flex;
  padding: 10px 0;
  border-bottom: 1px solid #F0E8E0;
}
.info-row:last-child {
  border-bottom: none;
}
.info-label {
  font-size: 14px;
  color: var(--color-text-secondary);
  width: 80px;
  flex-shrink: 0;
}
.info-value {
  font-size: 14px;
  color: var(--color-text);
  flex: 1;
}

.checklist-entry {
  margin: 0 12px;
  background: rgba(78,205,196,0.08);
  border: 1px solid rgba(78,205,196,0.2);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
  min-height: 44px;
}
.checklist-entry:active {
  background: rgba(78,205,196,0.14);
}
.entry-text {
  font-size: 16px;
  font-weight: bold;
  color: var(--color-text);
  flex: 1;
}
.entry-count {
  font-size: 12px;
  color: var(--color-teal-dark);
  margin-right: 8px;
}
.entry-arrow {
  font-size: 22px;
  color: var(--color-text-muted);
}

.edit-btn {
  margin: 12px;
  background: linear-gradient(135deg, var(--color-teal), #3BB8B0);
  color: #fff;
  text-align: center;
  padding: 14px 0;
  border-radius: 16px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.edit-btn:active {
  opacity: 0.85;
}

/* ====== Statistics Page ====== */
.stats-container {
  min-height: 100vh;
  padding-bottom: 32px;
}

/* Depth gauge */
.depth-gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 0 20px;
}
.gauge-ring {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(78,205,196,0.06);
  border: 2px solid rgba(78,205,196,0.4);
  box-shadow: 0 0 24px rgba(78,205,196,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.gauge-inner {
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--color-sand);
  border-radius: 50%;
  width: 116px;
  height: 116px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.gauge-num {
  font-size: 42px;
  font-weight: bold;
  display: block;
  line-height: 1;
}
.gauge-unit {
  font-size: 14px;
  color: var(--color-text-secondary);
}
.gauge-label {
  font-size: 11px;
  font-weight: bold;
  color: rgba(78,205,196,0.6);
  letter-spacing: 4px;
  margin-bottom: 2px;
}
.gauge-sub {
  font-size: 12px;
  color: var(--color-text-secondary);
}

/* Mini cards */
.stats-row {
  display: flex;
  gap: 8px;
  padding: 0 12px;
  margin-bottom: 12px;
}
.stat-mini-card {
  flex: 1;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--color-sand);
}
.stat-mini-num {
  display: block;
  font-size: 26px;
  font-weight: bold;
  margin-bottom: 4px;
  color: var(--color-teal-dark);
}
.stat-mini-label {
  font-size: 11px;
  color: var(--color-text-secondary);
}

/* Section cards */
.section-card {
  margin: 0 12px 12px;
  background: var(--bg-card);
  border: 1px solid var(--color-sand);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 2px 12px rgba(44, 62, 80, 0.06);
}
.section-title {
  font-size: 15px;
  font-weight: bold;
  margin-bottom: 12px;
  color: var(--color-teal-dark);
}

/* Gear bars */
.gear-row {
  margin-bottom: 0;
}
.gear-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.gear-bar-wrap {
  flex: 1;
  height: 10px;
  background: #F0E8E0;
  border-radius: 5px;
  overflow: hidden;
}
.gear-bar {
  height: 100%;
  border-radius: 5px;
  transition: width 0.3s;
}
.teal-bar {
  background: linear-gradient(90deg, var(--color-teal-dark), var(--color-teal));
}
.coral-bar {
  background: linear-gradient(90deg, #E85D4A, var(--color-coral));
}
.gear-name {
  font-size: 12px;
  color: var(--color-text-secondary);
  width: 32px;
  flex-shrink: 0;
}
.gear-count {
  font-size: 12px;
  font-weight: bold;
  width: 52px;
  text-align: right;
  flex-shrink: 0;
}

/* Yearly */
.year-row {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #F0E8E0;
}
.year-row:last-child {
  border-bottom: none;
}
.year-text {
  font-size: 16px;
  font-weight: bold;
  width: 60px;
  color: var(--color-teal-dark);
}
.year-total {
  font-size: 14px;
  font-weight: bold;
  color: var(--color-text);
  flex: 1;
}
.year-detail {
  font-size: 11px;
  color: var(--color-text-muted);
}

/* Top locations */
.loc-row {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #F0E8E0;
}
.loc-row:last-child {
  border-bottom: none;
}
.loc-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: bold;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  flex-shrink: 0;
}
.rank-1 {
  background: linear-gradient(135deg, #E85D4A, var(--color-coral));
}
.rank-n {
  background: rgba(78,205,196,0.2);
  color: var(--color-teal-dark);
}
.loc-name {
  flex: 1;
  font-size: 14px;
  color: var(--color-text);
}
.loc-count {
  font-size: 14px;
  font-weight: bold;
}

/* ====== Checklist Page ====== */
.cl-container {
  min-height: 100vh;
  padding-bottom: 32px;
}

/* Oxygen progress bar */
.progress-section {
  background: var(--bg-card);
  border: 1px solid var(--color-sand);
  border-radius: 16px;
  padding: 14px 16px;
  margin: 8px 12px;
}
.progress-header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}
.bubble-icon {
  font-size: 20px;
  margin-right: 8px;
}
.progress-text {
  font-size: 14px;
  font-weight: bold;
  color: var(--color-teal-dark);
}
.oxygen-bar-wrap {
  height: 8px;
  background: #F0E8E0;
  border-radius: 4px;
  overflow: hidden;
}
.oxygen-bar {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--color-teal-dark), var(--color-teal));
  transition: width 0.3s;
}

/* Checklist groups */
.group {
  margin: 0 12px 12px;
}
.group-title {
  font-size: 11px;
  font-weight: bold;
  color: var(--color-teal-dark);
  padding: 10px 2px 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.cl-item {
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid #F0E8E0;
  cursor: pointer;
  min-height: 44px;
}
.cl-item:active {
  background: #faf6f1;
}

/* Check icon */
.check-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--color-sand-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  font-size: 12px;
  color: #fff;
  flex-shrink: 0;
}
.check-icon.checked {
  background: linear-gradient(135deg, var(--color-teal-dark), var(--color-teal));
  border-color: var(--color-teal);
  box-shadow: 0 0 8px rgba(78,205,196,0.3);
}

.item-name {
  font-size: 14px;
  color: var(--color-text);
}
.item-done {
  color: var(--color-text-muted);
  text-decoration: line-through;
}

/* Reset button */
.reset-btn {
  margin: 16px 12px;
  text-align: center;
  padding: 14px;
  background: rgba(255,107,90,0.06);
  border: 1px solid rgba(255,107,90,0.2);
  border-radius: 16px;
  color: var(--color-coral);
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.reset-btn:active {
  background: rgba(255,107,90,0.12);
}

/* ====== Tab Bar ====== */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-card);
  border-top: 1px solid #F0E8E0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 200;
}
.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 56px;
  color: var(--color-text-secondary);
  cursor: pointer;
  user-select: none;
  text-decoration: none;
}
.tab-item.active {
  color: var(--color-teal-dark);
}
.tab-icon {
  font-size: 22px;
  margin-bottom: 2px;
}
.tab-label {
  font-size: 10px;
  font-weight: bold;
}
