:root {
  --bg: #fff2f6;
  --card: rgba(255, 255, 255, 0.82);
  --card-strong: #ffffff;
  --text: #2a1820;
  --muted: #8c6575;
  --pink: #ff8fb3;
  --pink-dark: #e75486;
  --rose: #ffd2df;
  --cream: #fff8e8;
  --gold: #f7b84b;
  --green: #6fcf97;
  --shadow: 0 20px 60px rgba(172, 73, 112, 0.18);
  --radius: 28px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  min-height: 100%;
  background: var(--bg);
  touch-action: manipulation;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, #ffd2df 0, transparent 34%),
    radial-gradient(circle at bottom right, #ffe9a8 0, transparent 30%),
    linear-gradient(160deg, #fff2f6 0%, #fff8e8 100%);
  overscroll-behavior: none;
}

button,
input,
select {
  font-family: inherit;
}

button {
  cursor: pointer;
  border: none;
}

.app-shell {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 18px;
  padding-bottom: 40px;
}

.hero-card,
.progress-card,
.buttons-card,
.reminder-card,
.protocol-card,
.log-card,
.trophy-card,
.reset-card {
  background: var(--card);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.hero-card {
  padding: 24px;
  overflow: hidden;
  position: relative;
}

.hero-card::after {
  content: "💧";
  position: absolute;
  right: 22px;
  bottom: -26px;
  font-size: 92px;
  opacity: 0.13;
  transform: rotate(-12deg);
}

.top-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--pink-dark);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 8vw, 3rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.daily-roast {
  position: relative;
  z-index: 1;
  margin-bottom: 0;
  max-width: 86%;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.45;
}

.mini-badge {
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  border-radius: 24px;
  background: linear-gradient(160deg, var(--pink), var(--pink-dark));
  color: white;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 26px rgba(231, 84, 134, 0.28);
}

.mini-badge span {
  display: block;
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1;
}

.mini-badge small {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.9;
}

.tab-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
  padding: 8px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
}

.tab-btn {
  padding: 12px 6px;
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 950;
}

.tab-btn.active {
  background: white;
  color: var(--pink-dark);
  box-shadow: 0 8px 18px rgba(172, 73, 112, 0.12);
}

.tab-section {
  display: none;
}

.tab-section.active {
  display: block;
}

.progress-card,
.buttons-card,
.reminder-card,
.protocol-card,
.log-card,
.trophy-card {
  padding: 22px;
}

.goal-header,
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.4;
  font-size: 0.92rem;
}

.label {
  margin-bottom: 4px;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 700;
}

.goal-header h2 {
  margin-bottom: 0;
  font-size: 2rem;
  letter-spacing: -0.04em;
}

.small-btn,
.save-btn {
  padding: 11px 14px;
  border-radius: 999px;
  background: var(--text);
  color: white;
  font-weight: 800;
  box-shadow: 0 10px 20px rgba(42, 24, 32, 0.16);
}

.wide {
  width: 100%;
  margin-top: 14px;
}

.progress-circle-wrap {
  display: flex;
  justify-content: center;
  padding: 26px 0 20px;
}

.progress-circle {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    conic-gradient(var(--pink) 0deg, var(--rose) 0deg);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.8),
    0 18px 40px rgba(255, 143, 179, 0.28);
}

.progress-inner {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: var(--card-strong);
  display: grid;
  place-items: center;
  align-content: center;
}

.progress-inner span {
  font-size: 2.3rem;
  font-weight: 950;
  letter-spacing: -0.06em;
}

.progress-inner small {
  color: var(--muted);
  font-weight: 700;
}

.stats-grid,
.protocol-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.stats-grid div,
.protocol-summary div {
  background: rgba(255, 210, 223, 0.42);
  border-radius: 22px;
  padding: 14px;
}

.stats-grid span,
.protocol-summary span {
  display: block;
  font-weight: 900;
  font-size: 1.2rem;
}

.stats-grid small,
.protocol-summary small {
  color: var(--muted);
  font-weight: 700;
}

.progress-bar {
  width: 100%;
  height: 14px;
  background: #ffe2eb;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink), var(--gold));
  transition: width 0.35s ease;
}

.status-text {
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.4;
}

.buttons-card h3,
.reminder-card h3,
.protocol-card h3,
.log-card h3,
.trophy-card h3 {
  margin-bottom: 14px;
  font-size: 1.3rem;
}

.drink-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.drink-btn {
  min-height: 88px;
  border-radius: 24px;
  padding: 16px;
  background: var(--card-strong);
  color: var(--text);
  font-size: 1.18rem;
  font-weight: 950;
  box-shadow: 0 12px 26px rgba(172, 73, 112, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.drink-btn:active,
.small-btn:active,
.ghost-btn:active,
.save-btn:active,
.danger-btn:active,
.tab-btn:active {
  transform: scale(0.96);
}

.drink-btn small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.drink-btn.special {
  background: linear-gradient(160deg, var(--pink), #ffc1d4);
  color: white;
}

.drink-btn.special small {
  color: rgba(255, 255, 255, 0.9);
}

.ghost-btn {
  width: 100%;
  margin-top: 14px;
  padding: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-weight: 900;
}

.no-margin {
  margin-top: 0;
}

.protocol-summary {
  margin-top: 16px;
}

.checkin-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.checkin-form label,
.reminder-settings label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
}

.full-width {
  grid-column: span 2;
}

.checkin-form input,
.reminder-settings input,
.reminder-settings select {
  width: 100%;
  padding: 14px;
  border: 2px solid #ffe1e8;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  font-size: 1rem;
  font-weight: 900;
  outline: none;
}

.checkin-form input:focus,
.reminder-settings input:focus,
.reminder-settings select:focus {
  border-color: var(--pink);
}

.protocol-note,
.reminder-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.checkin-list {
  display: grid;
  gap: 10px;
}

.checkin-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
}

.checkin-item strong {
  display: block;
  font-size: 1.05rem;
}

.checkin-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.35;
}

.delete-checkin {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: #ffe1e8;
  color: #b7365f;
  font-weight: 950;
}

.empty-state {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 210, 223, 0.42);
  color: var(--muted);
  font-weight: 800;
  line-height: 1.4;
}

.reminder-card .section-head {
  align-items: flex-start;
}

.switch {
  position: relative;
  width: 62px;
  height: 36px;
  flex: 0 0 auto;
}

.switch input {
  display: none;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #ead2dc;
  box-shadow: inset 0 2px 8px rgba(42, 24, 32, 0.12);
  transition: 0.25s ease;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 5px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 4px 12px rgba(42, 24, 32, 0.18);
  transition: 0.25s ease;
}

.switch input:checked + span {
  background: linear-gradient(160deg, var(--pink), var(--pink-dark));
}

.switch input:checked + span::after {
  transform: translateX(26px);
}

.reminder-status {
  margin-top: 16px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 210, 223, 0.42);
  color: var(--muted);
  font-weight: 800;
  line-height: 1.4;
}

.reminder-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.reminder-settings label:last-child {
  grid-column: span 2;
}

.reminder-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.section-head span {
  color: var(--pink-dark);
  font-weight: 950;
}

.trophy-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.trophy {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 4px 12px;
  align-items: center;
  padding: 13px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.trophy span {
  grid-row: span 2;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--cream);
  font-size: 1.45rem;
}

.trophy strong {
  font-size: 0.98rem;
}

.trophy small {
  color: var(--muted);
  font-weight: 650;
}

.trophy.locked {
  opacity: 0.42;
  filter: grayscale(1);
}

.trophy.unlocked {
  opacity: 1;
  filter: none;
  border-color: rgba(255, 143, 179, 0.55);
  background: linear-gradient(160deg, #ffffff, #fff4f8);
}

.reset-card {
  padding: 20px;
  text-align: center;
}

.danger-btn {
  width: 100%;
  padding: 14px;
  border-radius: 999px;
  background: #ffe1e8;
  color: #b7365f;
  font-weight: 950;
}

.reset-card p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(120px);
  width: calc(100% - 36px);
  max-width: 480px;
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(42, 24, 32, 0.94);
  color: white;
  text-align: center;
  font-weight: 850;
  box-shadow: 0 18px 40px rgba(42, 24, 32, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: 0.28s ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(42, 24, 32, 0.28);
  backdrop-filter: blur(10px);
  z-index: 30;
}

.modal.hidden {
  display: none;
}

.modal-box {
  width: min(100%, 420px);
  padding: 24px;
  border-radius: 28px;
  background: white;
  box-shadow: var(--shadow);
}

.modal-box h3 {
  margin-bottom: 8px;
  font-size: 1.55rem;
}

.modal-box p {
  color: var(--muted);
  line-height: 1.4;
}

.modal-box input {
  width: 100%;
  margin: 10px 0 16px;
  padding: 16px;
  border: 2px solid #ffe1e8;
  border-radius: 18px;
  font-size: 1.2rem;
  font-weight: 900;
  outline: none;
}

.modal-box input:focus {
  border-color: var(--pink);
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 380px) {
  .app-shell {
    padding: 12px;
  }

  .tab-nav {
    gap: 5px;
  }

  .tab-btn {
    font-size: 0.72rem;
    padding: 11px 4px;
  }

  .drink-buttons,
  .reminder-actions {
    grid-template-columns: 1fr;
  }

  .progress-circle {
    width: 168px;
    height: 168px;
  }

  .progress-inner {
    width: 116px;
    height: 116px;
  }

  .progress-inner span {
    font-size: 2rem;
  }
}