/* Hydra — daily water tracker
 * Palette: ice-blue + cyan glacier
 * © אופיר ברנס (Ofir Baranes) 2026
 */

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

:root {
  --bg-1: #082f49;
  --bg-2: #0c4a6e;
  --bg-3: #0e7490;
  --ice-100: #f0f9ff;
  --ice-200: #e0f2fe;
  --ice-300: #bae6fd;
  --cyan-400: #22d3ee;
  --cyan-500: #06b6d4;
  --sky-500: #0ea5e9;
  --sky-700: #0369a1;
  --text-primary: #ecfeff;
  --text-secondary: rgba(236,254,255,0.7);
  --text-muted: rgba(236,254,255,0.45);
  --surface: rgba(255,255,255,0.06);
  --surface-strong: rgba(255,255,255,0.10);
  --border: rgba(186,230,253,0.18);
  --border-strong: rgba(186,230,253,0.32);
  --shadow-glass: 0 30px 60px -20px rgba(8,47,73,0.6);
  --bezier: cubic-bezier(.34,1.56,.64,1);
  --bezier-soft: cubic-bezier(.4,0,.2,1);
}

html, body {
  background: var(--bg-1);
  color: var(--text-primary);
  font-family: 'Heebo', system-ui, sans-serif;
  font-weight: 400;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(ellipse 600px 800px at 80% -10%, rgba(34,211,238,0.18), transparent 60%),
    radial-gradient(ellipse 500px 600px at -10% 60%, rgba(125,211,252,0.12), transparent 65%),
    radial-gradient(ellipse 700px 900px at 50% 110%, rgba(14,116,144,0.25), transparent 70%),
    linear-gradient(180deg, #082f49 0%, #0c4a6e 70%, #0e7490 110%);
  background-attachment: fixed;
  position: relative;
  padding-bottom: 60px;
}

/* Ambient orbs */
.ambient-bg {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.orb-blur {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
}
.orb-blur.o1 { width: 380px; height: 380px; top: -100px; left: -100px; background: radial-gradient(circle, #22d3ee 0%, transparent 70%); animation: drift1 22s ease-in-out infinite; }
.orb-blur.o2 { width: 320px; height: 320px; bottom: 5%; right: -120px; background: radial-gradient(circle, #7dd3fc 0%, transparent 70%); animation: drift2 28s ease-in-out infinite; }
.orb-blur.o3 { width: 260px; height: 260px; top: 35%; left: 30%; background: radial-gradient(circle, #0ea5e9 0%, transparent 70%); opacity: 0.32; animation: drift3 35s ease-in-out infinite; }
@keyframes drift1 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(30px,40px) scale(1.1); } }
@keyframes drift2 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-40px,-25px) scale(1.08); } }
@keyframes drift3 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(25px,-35px) scale(1.12); } }

/* ===== Topbar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  padding-top: max(14px, env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(8,47,73,0.85) 0%, rgba(8,47,73,0.6) 100%);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--ice-100);
  letter-spacing: -0.01em;
}
.mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--cyan-400), var(--sky-700));
  color: var(--ice-100);
  box-shadow: 0 0 14px rgba(34,211,238,0.35);
}
.mark svg { width: 18px; height: 18px; }

.header-actions {
  display: flex;
  gap: 8px;
}
.icon-btn, .install-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  border-radius: 12px;
  padding: 7px 12px;
  cursor: pointer;
  transition: all 0.2s var(--bezier-soft);
  backdrop-filter: blur(10px);
}
.icon-btn { padding: 7px 9px; font-size: 16px; }
.icon-btn:hover, .install-btn:hover {
  background: var(--surface-strong);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.install-btn {
  background: linear-gradient(135deg, var(--cyan-400), var(--sky-500));
  border: none;
  color: #0c4a6e;
  font-weight: 600;
}

main {
  position: relative;
  z-index: 1;
  padding: 18px;
  max-width: 720px;
  margin: 0 auto;
}
.panel { animation: fade-in 0.5s var(--bezier-soft); }
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.hidden { display: none !important; }

/* ===== Hero ===== */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 8px;
  margin-bottom: 28px;
}
.glass-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}
.glass-svg {
  width: 220px;
  height: 290px;
  filter: drop-shadow(0 18px 30px rgba(8,47,73,0.5)) drop-shadow(0 0 30px rgba(34,211,238,0.12));
}

#waterGroup {
  transition: transform 1s var(--bezier);
}

@keyframes wavefloat1 {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-12px); }
}
@keyframes wavefloat2 {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(10px); }
}
#wave1 { animation: wavefloat1 4s ease-in-out infinite; transform-origin: center; }
#wave2 { animation: wavefloat2 5s ease-in-out infinite; transform-origin: center; }

@keyframes bubble-up {
  0% { transform: translateY(0); opacity: 0; }
  20% { opacity: 0.9; }
  100% { transform: translateY(-260px); opacity: 0; }
}
.bubble { transform-origin: center; }
.bubble.b1 { animation: bubble-up 4s ease-in 0s infinite; }
.bubble.b2 { animation: bubble-up 5s ease-in 1s infinite; }
.bubble.b3 { animation: bubble-up 4.5s ease-in 2s infinite; }
.bubble.b4 { animation: bubble-up 5.5s ease-in 0.5s infinite; }

.hero-stat {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  text-shadow: 0 2px 12px rgba(8,47,73,0.7);
}
.hero-current {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 44px;
  font-weight: 600;
  color: var(--ice-100);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.hero-current .unit {
  font-size: 16px;
  font-weight: 500;
  color: var(--ice-200);
  opacity: 0.8;
}
.hero-goal {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--ice-200);
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* Quick stats */
.quick-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 420px;
}
.qs {
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 10px;
  text-align: center;
  transition: all 0.3s var(--bezier-soft);
}
.qs:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.qs-num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 22px;
  font-weight: 600;
  color: var(--ice-100);
  font-variant-numeric: tabular-nums;
  margin-bottom: 2px;
}
.qs-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ===== Add section ===== */
.add-section {
  margin-bottom: 28px;
}
.add-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
  padding-right: 4px;
}
.add-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
@media (max-width: 480px) {
  .add-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
}
.add-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 6px;
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--ice-200);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.25s var(--bezier);
  position: relative;
  overflow: hidden;
}
.add-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(34,211,238,0.15), rgba(14,165,233,0.05));
  opacity: 0;
  transition: opacity 0.3s var(--bezier-soft);
}
.add-btn:hover {
  transform: translateY(-3px);
  border-color: var(--cyan-400);
  box-shadow: 0 12px 24px rgba(8,47,73,0.45), 0 0 20px rgba(34,211,238,0.25);
}
.add-btn:hover::before { opacity: 1; }
.add-btn:active {
  transform: translateY(-1px) scale(0.97);
}
.add-btn.tap {
  animation: tap-pulse 0.5s var(--bezier);
}
@keyframes tap-pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(34,211,238,0); }
  40% { transform: scale(0.95); box-shadow: 0 0 30px rgba(34,211,238,0.6); }
  100% { transform: scale(1); box-shadow: 0 0 0 rgba(34,211,238,0); }
}
.cup-svg { width: 32px; height: 38px; color: var(--cyan-400); position: relative; z-index: 1; }
.add-ml {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--ice-100);
  font-variant-numeric: tabular-nums;
  position: relative; z-index: 1;
}
.add-unit {
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  position: relative; z-index: 1;
}
.add-btn-custom .cup-svg { color: var(--ice-300); opacity: 0.7; }
.add-btn-custom { border-style: dashed; border-color: var(--border-strong); }

/* ===== Log ===== */
.log-section {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow-glass);
}
.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.log-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ice-100);
}
.log-clear {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.2s;
}
.log-clear:hover { color: #fda4af; background: rgba(253,164,175,0.08); }

.log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}
.log-list::-webkit-scrollbar { width: 4px; }
.log-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

.log-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: all 0.2s var(--bezier-soft);
  animation: log-in 0.4s var(--bezier);
}
@keyframes log-in {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}
.log-item:hover {
  background: rgba(255,255,255,0.07);
  border-color: var(--border-strong);
}
.log-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--cyan-400), var(--sky-500));
  border-radius: 10px;
  color: white;
  flex-shrink: 0;
}
.log-icon svg { width: 18px; height: 22px; }
.log-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.log-amount {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--ice-100);
  font-variant-numeric: tabular-nums;
}
.log-time {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}
.log-del {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  font-size: 16px;
  transition: all 0.2s;
}
.log-del:hover { color: #fda4af; background: rgba(253,164,175,0.08); }

.empty {
  text-align: center;
  padding: 28px 12px;
  color: var(--text-muted);
}
.empty-icon {
  font-size: 36px;
  margin-bottom: 8px;
  opacity: 0.5;
}
.empty-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.empty-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== Modals (bottom sheets) ===== */
.modal {
  position: fixed; inset: 0;
  background: rgba(8,30,49,0.6);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: modal-fade 0.25s var(--bezier-soft);
}
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  width: 100%;
  max-width: 520px;
  background: linear-gradient(180deg, #0e3a5f 0%, #082f49 100%);
  border: 1px solid var(--border-strong);
  border-bottom: none;
  border-radius: 28px 28px 0 0;
  padding: 20px 22px 30px;
  padding-bottom: max(30px, env(safe-area-inset-bottom));
  animation: modal-slide 0.4s var(--bezier);
  max-height: 88vh;
  overflow-y: auto;
}
@keyframes modal-slide {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.handle {
  width: 38px; height: 4px;
  background: var(--border-strong);
  border-radius: 4px;
  margin: 0 auto 14px;
}
.modal-card h3 {
  color: var(--ice-100);
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 6px;
  text-align: right;
}
.modal-card p {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 14px;
}
.mark-big {
  width: 64px; height: 64px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--cyan-400), var(--sky-700));
  border-radius: 18px;
  color: var(--ice-100);
  margin: 4px auto 12px;
  box-shadow: 0 0 30px rgba(34,211,238,0.35);
}
.mark-big svg { width: 32px; height: 32px; }

.modal-input {
  width: 100%;
  padding: 13px 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--ice-100);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 12px;
  transition: all 0.2s;
  text-align: right;
  direction: rtl;
}
.modal-input:focus {
  outline: none;
  border-color: var(--cyan-400);
  background: rgba(255,255,255,0.10);
}
.modal-input::placeholder { color: var(--text-muted); }

.quick-amounts {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.qa {
  padding: 10px 4px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--ice-200);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.qa:hover { background: rgba(34,211,238,0.15); border-color: var(--cyan-400); color: var(--ice-100); }

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.btn-mini, .btn-primary, .btn-secondary {
  flex: 1;
  padding: 13px 16px;
  border-radius: 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s var(--bezier);
  border: none;
}
.btn-mini {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  flex: 0 1 auto;
  padding: 13px 18px;
}
.btn-mini:hover { background: rgba(255,255,255,0.10); color: var(--ice-100); }
.btn-primary {
  background: linear-gradient(135deg, var(--cyan-400), var(--sky-500));
  color: #0c4a6e;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(34,211,238,0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(34,211,238,0.45); }
.btn-secondary {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  color: var(--ice-100);
}
.btn-secondary:hover { background: rgba(255,255,255,0.14); }

/* History */
.hist-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.hs-item {
  text-align: center;
  padding: 12px 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.hs-num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 18px;
  font-weight: 600;
  color: var(--cyan-400);
  font-variant-numeric: tabular-nums;
}
.hs-label {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  height: 180px;
  padding: 8px 0 24px;
  border-bottom: 1px dashed var(--border);
  position: relative;
}
.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  position: relative;
}
.bar-fill {
  width: 100%;
  background: linear-gradient(180deg, var(--cyan-400), var(--sky-700));
  border-radius: 6px 6px 2px 2px;
  min-height: 4px;
  transition: height 0.6s var(--bezier);
  position: relative;
}
.bar-fill.hit { background: linear-gradient(180deg, #86efac, #16a34a); box-shadow: 0 0 14px rgba(134,239,172,0.4); }
.bar-fill.today { box-shadow: 0 0 14px rgba(34,211,238,0.5); }
.bar-day {
  position: absolute;
  bottom: -22px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.bar-val {
  position: absolute;
  top: -16px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Settings */
.setting-group {
  margin-bottom: 16px;
}
.setting-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.setting-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}
.goal-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.goal-row .modal-input { flex: 1; }
.goal-row .btn-mini { flex-shrink: 0; }

.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.toggle {
  width: 48px;
  height: 28px;
  border-radius: 14px;
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  padding: 0;
  transition: all 0.3s var(--bezier);
}
.toggle-knob {
  position: absolute;
  width: 22px; height: 22px;
  background: var(--ice-200);
  border-radius: 50%;
  top: 2px;
  right: 2px;
  transition: all 0.3s var(--bezier);
}
.toggle[aria-checked="true"] {
  background: linear-gradient(135deg, var(--cyan-400), var(--sky-500));
  border-color: transparent;
}
.toggle[aria-checked="true"] .toggle-knob {
  right: calc(100% - 24px);
  background: white;
}
.toggle-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Splash */
.splash {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(34,211,238,0.4), rgba(8,47,73,0.95));
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  animation: splash-in 0.4s var(--bezier);
}
@keyframes splash-in {
  from { opacity: 0; backdrop-filter: blur(0px); }
  to { opacity: 1; backdrop-filter: blur(8px); }
}
.splash.fade { animation: splash-out 0.4s var(--bezier-soft) forwards; }
@keyframes splash-out { to { opacity: 0; } }
.splash-icon {
  font-size: 96px;
  animation: splash-pop 0.6s var(--bezier);
}
@keyframes splash-pop {
  0% { transform: scale(0) rotate(-30deg); opacity: 0; }
  60% { transform: scale(1.15) rotate(8deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.splash-msg {
  color: var(--ice-100);
  font-size: 22px;
  font-weight: 700;
  text-shadow: 0 4px 16px rgba(8,47,73,0.6);
}
