/* ============ Shellfish Hunter — Beach Girls Theme ============ */
:root {
  --pink-50: #fff0f7;
  --pink-100: #ffd6ea;
  --pink-200: #ffaed4;
  --pink-300: #ff7fb6;
  --pink-500: #e94e8a;
  --purple-200: #e0c3ff;
  --purple-300: #c79cff;
  --purple-500: #8b5cf6;
  --purple-700: #6b3fc0;
  --teal-200: #b8f0ec;
  --teal-300: #6ee0d8;
  --sand: #fff4d6;
  --coral: #ffb59e;
  --text: #4a1d52;
  --text-soft: #7a4187;
  --good: #38d39f;
  --okay: #ffd24a;
  --poor: #b9b9c8;
  --great: #ff4d8a;
  --shadow: 0 6px 18px rgba(150, 60, 130, 0.18);
  --radius: 22px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: 'Mali', 'Fredoka', 'Bubblegum Sans', system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, #ffe7f3 0%, transparent 55%),
    radial-gradient(circle at 95% 5%, #e6d6ff 0%, transparent 50%),
    radial-gradient(circle at 50% 100%, #b8f0ec 0%, transparent 60%),
    linear-gradient(180deg, #fff7fb 0%, #fce6f6 40%, #d9f3f0 100%);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}

/* Decorative shells (subtle) */
.bg-shells {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.bg-shells .shell {
  position: absolute;
  font-size: 42px;
  opacity: 0.18;
  filter: saturate(1.2);
  animation: float 9s ease-in-out infinite;
}
.bg-shells .s1 { top: 5%; left: 5%; animation-delay: 0s; }
.bg-shells .s2 { top: 12%; right: 8%; font-size: 28px; animation-delay: 1.2s; }
.bg-shells .s3 { top: 30%; left: 88%; animation-delay: 2.4s; }
.bg-shells .s4 { top: 45%; left: 3%; font-size: 30px; animation-delay: 0.8s; }
.bg-shells .s5 { top: 60%; right: 6%; animation-delay: 3s; }
.bg-shells .s6 { top: 70%; left: 10%; font-size: 32px; animation-delay: 1.5s; }
.bg-shells .s7 { top: 80%; right: 18%; animation-delay: 2s; }
.bg-shells .s8 { top: 25%; left: 45%; font-size: 26px; animation-delay: 4s; }
.bg-shells .s9 { top: 92%; left: 50%; animation-delay: 2.7s; }
.bg-shells .s10 { top: 50%; left: 55%; font-size: 24px; animation-delay: 3.5s; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(8deg); }
}

.container {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 14px 90px;
}

/* ============ Header ============ */
.page-header {
  text-align: center;
  margin-bottom: 8px;
}
.title {
  font-family: 'Bubblegum Sans', 'Fredoka', cursive;
  font-size: clamp(22px, 6vw, 32px);
  line-height: 1.15;
  margin: 6px 0 8px;
  color: var(--pink-500);
  text-shadow:
    2px 2px 0 #fff,
    3px 3px 0 var(--purple-300);
  letter-spacing: 0.5px;
}
.location-display {
  display: inline-block;
  background: rgba(255, 255, 255, 0.75);
  border: 2px dashed var(--pink-300);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 14px;
  color: var(--text-soft);
  font-weight: 600;
  white-space: nowrap;
}
.pin { font-size: 16px; }

/* ============ Header row (lang flag + location + share) ============ */
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 6px 2px 10px;
}
.header-row .location-display {
  flex: 1 1 auto;
  text-align: center;
  font-size: 13px;
  padding: 5px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.share-btn {
  background: linear-gradient(135deg, var(--pink-500) 0%, var(--purple-500) 100%);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 8px 12px;
  font-family: 'Mali', sans-serif;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(233, 78, 138, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
  flex: 0 0 auto;
}
.share-btn:active {
  transform: scale(0.94);
  box-shadow: 0 2px 8px rgba(233, 78, 138, 0.5);
}
.share-btn:disabled { opacity: 0.6; cursor: wait; }

.lang-btn {
  background: rgba(255, 255, 255, 0.85);
  border: 2px solid var(--purple-300);
  border-radius: 10px;
  padding: 3px 4px 1px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(123, 65, 135, 0.18);
  transition: transform 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.lang-btn:active { transform: scale(0.92); }
.lang-btn .flag-wrap img {
  display: block;
  width: 32px;
  height: 20px;
  border-radius: 3px;
}

/* ============ 4-Day Strip ============ */
.days-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 14px 0 8px;
}
.day-box {
  position: relative;
  background: linear-gradient(160deg, #fff 0%, var(--pink-50) 100%);
  border-radius: var(--radius);
  border: 3px solid var(--pink-200);
  box-shadow: var(--shadow);
  min-height: 150px;
  padding: 8px 6px 6px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.2s ease;
}
.day-box.loading {
  background: repeating-linear-gradient(45deg, #ffe9f3, #ffe9f3 10px, #fff 10px, #fff 20px);
}
.day-box:active { transform: scale(0.97); }
.day-box.today {
  border-color: var(--pink-500);
  border-width: 4px;
  box-shadow: 0 8px 24px rgba(233, 78, 138, 0.4);
  background: linear-gradient(160deg, #fff 0%, #fff0f7 60%, #ffd6ea 100%);
}
.day-box.today .day-label { color: var(--pink-500); font-weight: 700; }

.day-label-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 4px;
  font-size: 11px;
}
.day-date {
  font-size: 12px;
  font-weight: 700;
  color: var(--purple-700);
  background: rgba(255,255,255,0.7);
  border-radius: 8px;
  padding: 2px 5px;
  line-height: 1;
}
.day-weather {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-weight: 700;
  font-size: 11px;
  color: var(--text-soft);
  text-align: right;
}
.day-weather .weather-icon { font-size: 22px; line-height: 1; }
.day-weather .weather-temp { font-size: 11px; margin-top: 2px; white-space: nowrap; }

.day-name {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--purple-500);
  margin-top: 6px;
}
.day-box.today .day-name { color: var(--pink-500); font-size: 14px; }

.shellfish-pile {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 1px;
  min-height: 22px;
  padding-top: 4px;
}
.shell-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: flex-end;
  gap: 1px;
  line-height: 0;
}
.shellfish-pile img {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}
.shellfish-pile.big img { width: 16px; height: 16px; }

.tide-mini {
  font-size: 10px;
  color: var(--text-soft);
  text-align: center;
  margin-top: 3px;
  font-weight: 600;
}

/* ============ Legend ============ */
.legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 8px 0 14px;
  font-size: 12px;
  color: var(--text-soft);
  font-weight: 600;
}
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  display: inline-block;
}
.dot.great { background: var(--great); }
.dot.good { background: var(--good); }
.dot.okay { background: var(--okay); }
.dot.poor { background: var(--poor); }

/* ============ Calendar ============ */
.calendar-section {
  margin: 18px 0;
  background: rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  padding: 14px 10px 12px;
  border: 2px solid var(--purple-200);
  box-shadow: var(--shadow);
}
.calendar-section.dim {
  opacity: 0.72;
  background: rgba(255, 255, 255, 0.55);
  border-style: dashed;
}
.month-title {
  margin: 0 0 10px;
  font-family: 'Bubblegum Sans', cursive;
  text-align: center;
  font-size: 22px;
  color: var(--purple-700);
  letter-spacing: 0.5px;
}
.weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  color: var(--pink-500);
  text-align: center;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-cell {
  position: relative;
  aspect-ratio: 1 / 1.15;
  background: #fff;
  border: 2px solid #f5d6e8;
  border-radius: 12px;
  padding: 3px;
  display: flex;
  flex-direction: column;
  font-size: 10px;
  color: var(--text);
  overflow: hidden;
  min-height: 60px;
}
.cal-cell.empty {
  background: transparent;
  border: none;
}
.cal-cell.today {
  border-color: var(--pink-500);
  border-width: 3px;
  background: #fff0f7;
}
.cal-cell.great { background: linear-gradient(160deg, #ffe1ef, #ffcce0); border-color: var(--pink-500); }
.cal-cell.good { background: linear-gradient(160deg, #e8fff5, #c9f5e2); border-color: var(--good); }
.cal-cell.okay { background: linear-gradient(160deg, #fff8d9, #ffefb0); border-color: var(--okay); }
.cal-cell-date {
  font-weight: 700;
  font-size: 12px;
  color: var(--purple-700);
  line-height: 1;
}
.cal-cell.today .cal-cell-date { color: var(--pink-500); }
.cal-cell-moon {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 10px;
  opacity: 0.85;
}
.cal-cell-tides {
  font-size: 8px;
  line-height: 1.15;
  color: var(--text-soft);
  margin-top: 2px;
  font-weight: 600;
}
.cal-cell-tides .low { color: var(--pink-500); font-weight: 700; }
.cal-cell-shells {
  margin-top: auto;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 1px;
  line-height: 0;
  overflow: hidden;
}
.cal-cell-shells img { width: 8px; height: 8px; flex: 0 0 auto; }

/* ============ Tide legend ============ */
.tide-legend {
  background: rgba(255, 255, 255, 0.75);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 18px 0;
  border: 2px solid var(--teal-300);
  font-size: 13px;
  color: var(--text-soft);
  text-align: center;
  line-height: 1.5;
}
.tide-legend h4 {
  margin: 0 0 6px;
  color: var(--purple-700);
  font-family: 'Bubblegum Sans', cursive;
  font-size: 18px;
}
.inline-shell { width: 14px; height: 14px; vertical-align: middle; }

/* ============ Location input (inconspicuous) ============ */
.location-input-wrap {
  position: fixed;
  bottom: 10px;
  right: 10px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(123, 65, 135, 0.25);
  border-radius: 14px;
  padding: 5px 8px;
  font-size: 11px;
  color: var(--text-soft);
  opacity: 0.7;
  transition: all 0.25s ease;
  max-width: 80vw;
  backdrop-filter: blur(6px);
}
.location-input-wrap:hover,
.location-input-wrap:focus-within {
  opacity: 1;
  background: rgba(255, 255, 255, 0.95);
}
.location-input-wrap label {
  font-size: 11px;
  font-weight: 600;
}
.location-input-wrap input {
  width: 90px;
  border: 1px solid rgba(123, 65, 135, 0.3);
  border-radius: 8px;
  padding: 3px 6px;
  font-size: 12px;
  font-family: inherit;
  background: rgba(255,255,255,0.8);
  color: var(--text);
  outline: none;
}
.location-input-wrap input:focus {
  border-color: var(--pink-300);
}
.location-input-wrap button {
  border: none;
  background: var(--purple-300);
  color: #fff;
  border-radius: 8px;
  padding: 3px 8px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.location-input-wrap button:active { transform: scale(0.95); }

/* Changed (bright) state */
.location-input-wrap.changed {
  opacity: 1;
  background: linear-gradient(135deg, #fff0a8, #ffcce6);
  border: 2px solid var(--pink-500);
  box-shadow: 0 4px 14px rgba(233, 78, 138, 0.45);
  padding: 6px 8px;
}
.location-input-wrap.changed label,
.location-input-wrap.changed input {
  font-weight: 800;
  color: var(--pink-500);
  font-size: 13px;
}
.location-input-wrap.changed input {
  background: #fff;
  border-color: var(--pink-500);
}
.location-input-wrap.changed button {
  background: var(--pink-500);
  font-size: 13px;
}

/* ============ Footer ============ */
.page-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 20px;
  margin-bottom: 50px;
  opacity: 0.7;
  padding: 0 90px 0 8px;
}

/* ============ Add to Home Screen banner ============ */
.a2hs-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #fff6c2 0%, #ffd6ea 100%);
  border: 2px solid var(--pink-300);
  border-radius: 18px;
  padding: 10px 12px;
  margin: 4px 0 10px;
  box-shadow: 0 4px 14px rgba(233, 78, 138, 0.2);
  animation: slideDown 0.35s ease;
  position: relative;
}
.a2hs-banner.hidden { display: none; }
@keyframes slideDown { from { transform: translateY(-12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.a2hs-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  flex: 0 0 auto;
}
.a2hs-text {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  font-size: 12px;
  line-height: 1.25;
  color: var(--text);
  min-width: 0;
}
.a2hs-text strong {
  color: var(--purple-700);
  font-family: 'Bubblegum Sans', cursive;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.3px;
}
.a2hs-install {
  background: linear-gradient(135deg, var(--pink-500), var(--purple-500));
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 7px 14px;
  font-family: 'Mali', sans-serif;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  flex: 0 0 auto;
  box-shadow: 0 3px 10px rgba(233, 78, 138, 0.35);
}
.a2hs-install:active { transform: scale(0.95); }
.a2hs-dismiss {
  background: rgba(255,255,255,0.7);
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 11px;
  color: var(--purple-700);
  cursor: pointer;
  flex: 0 0 auto;
  font-weight: 700;
}

/* iOS instruction sheet for A2HS */
.a2hs-ios-instructions {
  position: fixed;
  inset: 0;
  background: rgba(74, 29, 82, 0.6);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}
.a2hs-ios-instructions.hidden { display: none; }
.a2hs-ios-card {
  background: linear-gradient(160deg, #fff, #fff0f7);
  border-radius: 22px;
  padding: 18px 18px 14px;
  max-width: 380px;
  width: 100%;
  border: 3px solid var(--pink-300);
  position: relative;
  animation: slideUp 0.25s ease;
}
.a2hs-ios-card h4 {
  margin: 0 0 10px;
  font-family: 'Bubblegum Sans', cursive;
  color: var(--purple-700);
  text-align: center;
  font-size: 20px;
}
.a2hs-ios-card ol {
  margin: 0;
  padding-left: 22px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
}
.a2hs-ios-card .ios-share-icon {
  display: inline-block;
  background: var(--purple-200);
  border-radius: 6px;
  padding: 1px 5px;
  font-weight: 700;
  color: var(--purple-700);
}

/* ============ Share Modal ============ */
.share-modal {
  position: fixed;
  inset: 0;
  background: rgba(74, 29, 82, 0.55);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}
.share-modal.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.share-modal-card {
  background: linear-gradient(160deg, #fff 0%, #fff0f7 100%);
  border-radius: 22px;
  padding: 18px 16px 16px;
  width: 100%;
  max-width: 380px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(74, 29, 82, 0.35);
  border: 3px solid var(--pink-300);
  position: relative;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.share-modal-card h3 {
  margin: 0 0 12px;
  text-align: center;
  font-family: 'Bubblegum Sans', cursive;
  font-size: 22px;
  color: var(--purple-700);
}
.share-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: rgba(255, 255, 255, 0.7);
  border: 2px solid var(--pink-200);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 14px;
  color: var(--purple-700);
  cursor: pointer;
  font-weight: 700;
}
.share-close:active { transform: scale(0.9); }
.share-preview {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 14px;
  padding: 8px;
  margin-bottom: 12px;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--purple-200);
}
.share-preview img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(150, 60, 130, 0.18);
}
.share-preview .loader {
  font-family: 'Mali', sans-serif;
  color: var(--text-soft);
  font-size: 13px;
}
.share-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.share-action {
  background: #fff;
  border: 2px solid var(--purple-200);
  border-radius: 14px;
  padding: 10px 6px;
  font-family: 'Mali', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--purple-700);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  min-height: 64px;
  justify-content: center;
}
.share-action:hover { background: var(--pink-50); border-color: var(--pink-300); }
.share-action:active { transform: scale(0.95); }
.share-action .ico { font-size: 22px; line-height: 1; }
.share-action.done {
  background: linear-gradient(135deg, var(--good), #2ec88a);
  color: #fff;
  border-color: var(--good);
}
.share-hint {
  font-size: 11px;
  color: var(--text-soft);
  text-align: center;
  margin: 6px 4px 0;
  line-height: 1.4;
}

/* ============ Responsive tweaks ============ */
@media (max-width: 400px) {
  .container { padding: 12px 8px 90px; }
  .day-box { min-height: 130px; padding: 6px 4px 4px; }
  .day-name { font-size: 11px; }
  .day-weather .weather-icon { font-size: 18px; }
  .shellfish-pile img { width: 11px; height: 11px; }
  .shellfish-pile.big img { width: 14px; height: 14px; }
  .cal-cell { min-height: 50px; font-size: 9px; }
  .cal-cell-date { font-size: 11px; }
  .cal-cell-tides { font-size: 7px; }
  .cal-cell-shells img { width: 6px; height: 6px; }
}

@media (min-width: 720px) {
  .day-box { min-height: 180px; }
  .shellfish-pile.big img { width: 24px; height: 24px; }
  .cal-cell { min-height: 80px; font-size: 11px; }
  .cal-cell-shells img { width: 11px; height: 11px; }
}
