:root {
  color-scheme: light;
  /* Theme = brand chrome/text accent only (headings, buttons, links, nav, focus states).
     Background stays cream and the nutrient status semaphore (green/amber/red) stays fixed
     regardless of theme — see project memory on why those are kept separate from "branding". */
  --candy-50: #FFF5FA;
  --candy-100: #FFE3EF;
  --candy-200: #FFC7DF;
  --candy-300: #FFA0C7;
  --candy-400: #FF7FB3;
  --candy-500: #FF5FA0;
  --candy-600: #E8478B;
  --candy-700: #C93872;
  --candy-50-rgb: 255,245,250;
  --candy-100-rgb: 255,227,239;
  --candy-200-rgb: 255,199,223;
  --candy-300-rgb: 255,160,199;
  --candy-400-rgb: 255,127,179;
  --candy-500-rgb: 255,95,160;
  --candy-600-rgb: 232,71,139;
  --candy-700-rgb: 201,56,114;
}

:root[data-theme="black"] {
  --candy-50: #F2F2F2; --candy-100: #E0E0E0; --candy-200: #C6C6C6; --candy-300: #9E9E9E;
  --candy-400: #6E6E6E; --candy-500: #2E2E2E; --candy-600: #1A1A1A; --candy-700: #0D0D0D;
  --candy-50-rgb: 242,242,242; --candy-100-rgb: 224,224,224; --candy-200-rgb: 198,198,198;
  --candy-300-rgb: 158,158,158; --candy-400-rgb: 110,110,110; --candy-500-rgb: 46,46,46;
  --candy-600-rgb: 26,26,26; --candy-700-rgb: 13,13,13;
}
:root[data-theme="blue"] {
  --candy-50: #EFF6FF; --candy-100: #DBEAFE; --candy-200: #BFDBFE; --candy-300: #93C5FD;
  --candy-400: #60A5FA; --candy-500: #3B82F6; --candy-600: #2563EB; --candy-700: #1D4ED8;
  --candy-50-rgb: 239,246,255; --candy-100-rgb: 219,234,254; --candy-200-rgb: 191,219,254;
  --candy-300-rgb: 147,197,253; --candy-400-rgb: 96,165,250; --candy-500-rgb: 59,130,246;
  --candy-600-rgb: 37,99,235; --candy-700-rgb: 29,78,216;
}
:root[data-theme="gray"] {
  --candy-50: #F7F8F9; --candy-100: #ECEEF0; --candy-200: #DADFE3; --candy-300: #B7BFC7;
  --candy-400: #8A939D; --candy-500: #5C6570; --candy-600: #454D57; --candy-700: #333941;
  --candy-50-rgb: 247,248,249; --candy-100-rgb: 236,238,240; --candy-200-rgb: 218,223,227;
  --candy-300-rgb: 183,191,199; --candy-400-rgb: 138,147,157; --candy-500-rgb: 92,101,112;
  --candy-600-rgb: 69,77,87; --candy-700-rgb: 51,57,65;
}
:root[data-theme="red"] {
  --candy-50: #FEF2F2; --candy-100: #FEE2E2; --candy-200: #FECACA; --candy-300: #FCA5A5;
  --candy-400: #F87171; --candy-500: #EF4444; --candy-600: #DC2626; --candy-700: #B91C1C;
  --candy-50-rgb: 254,242,242; --candy-100-rgb: 254,226,226; --candy-200-rgb: 254,202,202;
  --candy-300-rgb: 252,165,165; --candy-400-rgb: 248,113,113; --candy-500-rgb: 239,68,68;
  --candy-600-rgb: 220,38,38; --candy-700-rgb: 185,28,28;
}

body {
  font-size: 16px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: #3A2E33;
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 0 0 0.5rem 0;
  z-index: 100;
}
.skip-link:focus {
  left: 0;
}

*:focus-visible {
  outline: 3px solid var(--candy-600);
  outline-offset: 2px;
  border-radius: 4px;
}

.nav-tab {
  font-family: 'Quicksand', system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.5rem 0.9rem;
  border-radius: 0.75rem 0.75rem 0 0;
  color: #a68a97;
  border-bottom: 3px solid transparent;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

/* On narrow screens the tab row scrolls horizontally instead of overflowing the page —
   a slim, unobtrusive scrollbar (or none at all on WebKit) hints that more tabs exist. */
.nav-scroll {
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.nav-scroll::-webkit-scrollbar {
  height: 4px;
}
.nav-scroll::-webkit-scrollbar-thumb {
  background: var(--candy-200, #f3d5e2);
  border-radius: 999px;
}
.nav-tab:hover {
  background: rgba(var(--candy-500-rgb),0.08);
  color: var(--candy-600);
}
.nav-tab[aria-selected="true"] {
  color: var(--candy-600);
  border-color: var(--candy-500);
}

.card {
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90' viewBox='0 0 90 90'%3E%3Cg fill='%23FF5FA0' fill-opacity='0.055'%3E%3Cellipse cx='45' cy='58' rx='13' ry='11'/%3E%3Cellipse cx='27' cy='38' rx='6.5' ry='8'/%3E%3Cellipse cx='45' cy='30' rx='6.5' ry='8'/%3E%3Cellipse cx='63' cy='38' rx='6.5' ry='8'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 90px 90px;
  border: 1px solid var(--candy-100);
  border-radius: 1.25rem;
  box-shadow: 0 1px 2px rgba(58,52,46,0.04), 0 8px 24px -12px rgba(var(--candy-500-rgb),0.18);
}

.card-hover {
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(58,52,46,0.08), 0 16px 32px -14px rgba(var(--candy-500-rgb),0.28);
  border-color: var(--candy-200);
}

.btn {
  font-family: 'Quicksand', system-ui, sans-serif;
  font-weight: 700;
  border-radius: 0.9rem;
  padding: 0.55rem 1.1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: transform .1s ease, background-color .15s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--candy-500); color: #fff; box-shadow: 0 6px 16px -6px rgba(var(--candy-500-rgb),0.6); }
.btn-primary:hover { background: var(--candy-600); }
.btn-secondary { background: var(--candy-100); color: var(--candy-600); border: 1px solid var(--candy-200); }
.btn-secondary:hover { background: var(--candy-200); }
.btn-ghost { background: transparent; color: #3A2E33; border: 1px solid var(--candy-100); }
.btn-ghost:hover { background: #F2F7F3; }
.btn-danger { background: #FCEDEC; color: #C2413D; border: 1px solid #F8D6D4; }
.btn-danger:hover { background: #F8D6D4; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.chip {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.toggle {
  position: relative;
  width: 3rem;
  height: 1.65rem;
  border-radius: 999px;
  background: #ECE4D6;
  transition: background-color .15s ease;
  flex-shrink: 0;
  cursor: pointer;
  border: none;
}
.toggle[aria-checked="true"] { background: var(--candy-500); }
.toggle .knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 1.35rem; height: 1.35rem;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform .15s ease;
}
.toggle[aria-checked="true"] .knob { transform: translateX(1.35rem); }

.bar-track {
  height: 0.85rem;
  border-radius: 999px;
  background: #EFEAE0;
  overflow: hidden;
  position: relative;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width .5s cubic-bezier(.22,1,.36,1);
}
.bar-fill.status-ok { background: linear-gradient(90deg,#79AD87,#5B8C6E); }
.bar-fill.status-deficient { background: linear-gradient(90deg,#EFC26B,#E8A93C); }
.bar-fill.status-critical_deficient { background: linear-gradient(90deg,#E36B6B,#D9534F); }
.bar-fill.status-excess { background: linear-gradient(90deg,#F0B584,#E8905C); }
.bar-fill.status-critical_excess { background: repeating-linear-gradient(45deg,#D9534F,#D9534F 8px,#C2413D 8px,#C2413D 16px); }

/* Omega-3 "Zakres Optymalny" — therapeutic-but-safe reads calm/positive (blue), never as an
   alarm; only omega3_excess (true overdose past the Max Safe Upper Limit) is ever red. */
.bar-fill.status-omega3_deficient { background: linear-gradient(90deg,#EFC26B,#E8A93C); }
.bar-fill.status-omega3_optimal { background: linear-gradient(90deg,#79AD87,#5B8C6E); }
.bar-fill.status-omega3_therapeutic { background: linear-gradient(90deg,#7DBEE0,#4A94BF); }
.bar-fill.status-omega3_excess { background: repeating-linear-gradient(45deg,#D9534F,#D9534F 8px,#C2413D 8px,#C2413D 16px); }

@media (prefers-reduced-motion: reduce) {
  .bar-fill, .card-hover, .toggle .knob { transition: none !important; }
  .animate-pulse-soft, .hero-badge, .hero-badge::after, .hero-paw { animation: none !important; }
}

.hero-badge {
  width: 8.75rem;
  height: 8.75rem;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 30%, #ffffff, var(--candy-100) 72%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  animation: glow-pulse 3s ease-in-out infinite;
}
.hero-badge::after {
  content: '';
  position: absolute;
  top: -60%;
  left: -60%;
  width: 55%;
  height: 220%;
  background: linear-gradient(115deg, transparent, rgba(255,255,255,0.85), transparent);
  animation: shine-sweep 3.2s ease-in-out infinite;
}
.hero-paw {
  animation: slow-spin 16s linear infinite;
  filter: drop-shadow(0 2px 4px rgba(107,66,38,0.25));
}

@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--candy-500-rgb),0.35), 0 10px 30px -10px rgba(var(--candy-500-rgb),0.45); }
  50% { box-shadow: 0 0 0 16px rgba(var(--candy-500-rgb),0), 0 10px 38px -8px rgba(var(--candy-500-rgb),0.7); }
}
@keyframes shine-sweep {
  0%, 15% { transform: translateX(-40%) rotate(20deg); }
  55%, 100% { transform: translateX(220%) rotate(20deg); }
}
@keyframes slow-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulse-soft {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217,83,79,0.35); }
  50% { box-shadow: 0 0 0 6px rgba(217,83,79,0); }
}
.animate-pulse-soft { animation: pulse-soft 2s ease-in-out infinite; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fade-in .25s ease; }

.drag-over {
  outline: 3px dashed var(--candy-500);
  outline-offset: 4px;
  background: var(--candy-50);
}

input[type="text"], input[type="number"], input[type="date"], input[type="email"], input[type="password"], select, textarea {
  border: 1px solid var(--candy-100);
  border-radius: 0.75rem;
  padding: 0.55rem 0.8rem;
  background: #fff;
  width: 100%;
  font-family: inherit;
}
input[type="text"]:focus, input[type="number"]:focus, input[type="date"]:focus, input[type="email"]:focus, input[type="password"]:focus, select:focus, textarea:focus {
  border-color: var(--candy-500);
}

.ing-card[draggable="true"] { cursor: grab; }
.ing-card[draggable="true"]:active { cursor: grabbing; }

.water-gauge {
  width: 100%;
  height: 2.75rem;
  border-radius: 0.9rem;
  background: #EFEAE0;
  position: relative;
  overflow: hidden;
  border: 1px solid #ECE4D6;
}
.water-gauge .fill {
  position: absolute;
  left: 0; bottom: 0; width: 100%;
  background: linear-gradient(180deg, #9EC4A8, #5B8C6E);
  transition: height .5s cubic-bezier(.22,1,.36,1);
}
.water-gauge .target-line {
  position: absolute;
  left: 0; right: 0;
  border-top: 2px dashed #CC7644;
}

.theme-swatch {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 2px solid rgba(58,52,46,0.12);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  padding: 0;
}
.theme-swatch:hover { transform: scale(1.12); }
.theme-swatch-active {
  box-shadow: 0 0 0 3px #FFF8F3, 0 0 0 5px var(--candy-500);
}
.theme-swatch-mini {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(58,52,46,0.15);
}
