:root {
  --bg: #0A2E36;
  --surface: #123B44;
  --surface-2: #17505C;
  --accent: #3DDCB8;
  --accent-deep: #22A8B0;
  --alert: #FFB454;
  --alert-deep: #E0923A;
  --foam: #EAF6F4;
  --muted: #7FA8A3;
  --muted-2: #4E7A78;

  --font-display: ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-body: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Roboto Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: radial-gradient(120% 140% at 50% -10%, #113E47 0%, var(--bg) 55%, #071E24 100%);
  color: var(--foam);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  justify-content: center;
  padding: 32px 18px 48px;
}

.app {
  width: 100%;
  max-width: 480px;
}

/* ---------- Header ---------- */
.app-header {
  text-align: center;
  margin-bottom: 28px;
}

.app-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.app-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.5rem, 6vw, 2rem);
  margin: 6px 0 0;
  color: var(--foam);
}

.app-title .owner {
  color: var(--accent);
}

/* ---------- Status card ---------- */
.status-card {
  background: linear-gradient(165deg, var(--surface) 0%, #0E323A 100%);
  border: 1px solid rgba(61, 220, 184, 0.14);
  border-radius: 20px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 20px 40px -24px rgba(0, 0, 0, 0.6);
}

.status-card.due {
  border-color: rgba(255, 180, 84, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 180, 84, 0.25), 0 20px 40px -20px rgba(255, 180, 84, 0.25);
  animation: pulseGlow 1.8s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255, 180, 84, 0.25), 0 20px 40px -20px rgba(255, 180, 84, 0.25); }
  50% { box-shadow: 0 0 0 3px rgba(255, 180, 84, 0.4), 0 20px 48px -16px rgba(255, 180, 84, 0.4); }
}

.status-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.status-headline {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 7vw, 2.1rem);
  font-weight: 600;
  margin: 10px 0 4px;
  color: var(--foam);
}

.status-card.due .status-headline { color: var(--alert); }

.status-sub {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
}

.status-sub .count {
  font-family: var(--font-mono);
  color: var(--accent);
}

/* ---------- Tide line (signature element) ---------- */
.tideline-wrap {
  margin: 30px 0 8px;
}

.tideline-caption {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted-2);
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.tideline-svg { width: 100%; height: auto; display: block; }

.tide-dot-ring { fill: none; stroke: var(--muted-2); stroke-width: 2; }
.tide-dot-fill { fill: var(--bg); }
.tide-dot.passed .tide-dot-ring { stroke: var(--accent-deep); }
.tide-dot.passed .tide-dot-fill { fill: var(--accent); }
.tide-dot.due .tide-dot-ring { stroke: var(--alert); }
.tide-dot.due .tide-dot-fill { fill: var(--alert); }
.tide-dot.due { animation: dueDotPulse 1.2s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }

@keyframes dueDotPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.35); }
}

.tide-hour-label {
  font-family: var(--font-mono);
  font-size: 8.5px;
  fill: var(--muted-2);
}
.tide-dot.passed ~ .tide-hour-label,
.tide-dot.due ~ .tide-hour-label { fill: var(--muted); }

/* ---------- Actions ---------- */
.actions {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

button {
  font-family: var(--font-body);
  font-size: 0.96rem;
  font-weight: 600;
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

button:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #05201F;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:disabled {
  background: var(--surface-2);
  color: var(--muted);
  cursor: default;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--foam);
}
.btn-secondary:hover { filter: brightness(1.12); }

.btn-row { display: flex; gap: 10px; }
.btn-row button { flex: 1; }

/* ---------- Permission / setup notice ---------- */
.setup-note {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 180, 84, 0.08);
  border: 1px solid rgba(255, 180, 84, 0.25);
  color: #FFD9A6;
  font-size: 0.85rem;
  line-height: 1.5;
}

.setup-note.hidden { display: none; }

/* ---------- Footer ---------- */
.app-footer {
  margin-top: 30px;
  text-align: center;
  color: var(--muted-2);
  font-size: 0.76rem;
  line-height: 1.6;
}

.app-footer strong { color: var(--muted); font-weight: 600; }

/* Toggle row */
.toggle-row {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid rgba(61, 220, 184, 0.12);
  border-radius: 14px;
  padding: 12px 16px;
}

.toggle-row span { font-size: 0.88rem; color: var(--foam); }

.switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0;
  background: var(--surface-2);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.slider::before {
  content: "";
  position: absolute;
  height: 20px; width: 20px;
  left: 3px; top: 3px;
  background: var(--foam);
  border-radius: 50%;
  transition: transform 0.2s ease;
}
input:checked + .slider { background: var(--accent-deep); }
input:checked + .slider::before { transform: translateX(18px); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .status-card.due, .tide-dot.due { animation: none; }
}

@media (max-width: 380px) {
  .status-card { padding: 22px 16px; }
}
