:root {
  color-scheme: light;
  --ink: #1f1c19;
  --ink-soft: #3a332d;
  --paper: #f7f1e6;
  --paper-2: #fdf8f0;
  --accent: #d76d3f;
  --accent-2: #2f8f83;
  --accent-3: #f2c14e;
  --muted: #c9b79f;
  --line: #e6d9c6;
  --shadow: 0 20px 50px rgba(31, 28, 25, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Space Grotesk", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  line-height: 1.5;
}

.bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(215, 109, 63, 0.25), transparent 45%),
    radial-gradient(circle at 80% 15%, rgba(47, 143, 131, 0.22), transparent 40%),
    radial-gradient(circle at 70% 80%, rgba(242, 193, 78, 0.2), transparent 45%),
    linear-gradient(130deg, #fef7eb 0%, #f7efe0 45%, #f2e7d4 100%);
  z-index: -2;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.hero {
  display: grid;
  gap: 24px;
  grid-template-columns: 1.2fr 1fr;
  align-items: center;
  padding: 28px;
  background: var(--paper-2);
  border-radius: 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(215, 109, 63, 0.15);
}

.hero-text h1 {
  font-family: "Fraunces", serif;
  font-size: clamp(2.2rem, 3.2vw, 3.1rem);
  margin-bottom: 8px;
}

.hero-heading {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

.hero-logo {
  width: 120px;
  height: 120px;
  object-fit: contain;
}

.hero-copy {
  display: flex;
  flex-direction: column;
}

.kicker {
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-2);
  margin-bottom: 8px;
}

.sub {
  color: var(--ink-soft);
  max-width: 36ch;
}

.hero-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.summary-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 25px rgba(31, 28, 25, 0.08);
}

.summary-card .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 8px;
}

.summary-card .value {
  font-size: 1.1rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.panel {
  background: var(--paper-2);
  border-radius: 20px;
  padding: 20px;
  border: 1px solid rgba(47, 143, 131, 0.12);
  box-shadow: 0 12px 28px rgba(31, 28, 25, 0.08);
}

.panel-row {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-title h2 {
  font-family: "Fraunces", serif;
  font-size: 1.5rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-row {
  display: flex;
  gap: 10px;
}

label {
  font-size: 0.9rem;
  color: var(--ink-soft);
  font-weight: 500;
}

input,
select {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 0.95rem;
  color: var(--ink);
  outline: none;
}

input:disabled,
select:disabled {
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink-soft);
  cursor: not-allowed;
}

.readonly {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  min-height: 42px;
  display: flex;
  align-items: center;
  overflow-wrap: anywhere;
}

input:focus,
select:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(47, 143, 131, 0.18);
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  background: var(--accent-2);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(47, 143, 131, 0.25);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn.ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  box-shadow: none;
}

.btn.primary {
  background: var(--accent);
}

.segmented {
  display: flex;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.seg {
  flex: 1;
  padding: 10px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-soft);
}

.seg.active {
  background: var(--accent-3);
  color: var(--ink);
}

.task-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.progress {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
  border: 1px solid var(--line);
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.4s ease;
}

.progress-label {
  margin-top: 10px;
  font-weight: 600;
  color: var(--ink-soft);
}

.gear {
  display: grid;
  gap: 8px;
  padding-left: 18px;
  color: var(--ink-soft);
}

.tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-soft);
  min-height: 40px;
}

.tab.active {
  background: var(--accent-2);
  border-color: transparent;
  color: #fff;
}

.tab-panel {
  display: grid;
  gap: 14px;
}

.hidden {
  display: none !important;
}

.timeline {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.day-card,
.week-card,
.task-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.day-header,
.week-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.badge {
  background: var(--accent-3);
  color: var(--ink);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.task-list {
  display: grid;
  gap: 8px;
}

.task-item {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--paper);
  overflow-wrap: anywhere;
}

.task-item.done {
  opacity: 0.6;
  text-decoration: line-through;
}

.task-item button {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--accent);
}

.muted {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.empty {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px dashed var(--line);
  color: var(--ink-soft);
}

.fade-in {
  animation: fadeIn 0.5s ease;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 10;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 28, 25, 0.4);
  backdrop-filter: blur(2px);
}

.modal-card {
  position: relative;
  background: #fff;
  border-radius: 20px;
  width: min(560px, 90vw);
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(31, 28, 25, 0.2);
  border: 1px solid var(--line);
  animation: fadeIn 0.3s ease;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--line);
}

.modal-body {
  display: grid;
  gap: 14px;
  color: var(--ink-soft);
  padding: 16px 20px 20px;
  overflow: auto;
}

.modal-section h3 {
  font-family: "Fraunces", serif;
  font-size: 1.1rem;
  margin-bottom: 6px;
  color: var(--ink);
}

.modal-body ul {
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.icon-btn {
  border: none;
  background: var(--paper);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--ink-soft);
}

.glossary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.glossary-item {
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  display: grid;
  gap: 6px;
}

.term {
  font-weight: 700;
  color: var(--ink);
}

.definition {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.glossary-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  cursor: pointer;
}

.text-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  font-size: 0.9rem;
}

.tutorials {
  display: grid;
  gap: 16px;
}

.tutorial-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 16px;
  align-items: center;
}

.tutorial-card summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
  min-height: 44px;
}

.tutorial-card summary::-webkit-details-marker {
  display: none;
}

.summary-toggle {
  font-size: 0.85rem;
  color: var(--ink-soft);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.tutorial-card[open] .summary-toggle {
  color: #fff;
  background: var(--accent-2);
  border-color: transparent;
}

.tutorial-section {
  display: block;
}

.tutorial-section summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
  padding: 4px 2px;
  min-height: 44px;
}

.tutorial-section summary::-webkit-details-marker {
  display: none;
}

.tutorial-section[open] .summary-toggle {
  color: #fff;
  background: var(--accent);
  border-color: transparent;
}

.section-sub {
  margin: 10px 0 14px;
  color: var(--ink-soft);
}

.tutorial-content {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 320px);
  gap: 18px;
  margin-top: 14px;
}

.glossary-card .tutorial-content {
  grid-template-columns: 1fr;
}

.glossary-content {
  align-items: start;
}

.glossary-content p {
  margin: 0;
}

.glossary-content .btn {
  justify-self: start;
}

.tutorial-text h3 {
  font-family: "Fraunces", serif;
  font-size: 1.2rem;
  margin-bottom: 6px;
}

.tutorial-text {
  padding: 6px 8px 6px 4px;
}

.tutorial-text p,
.tutorial-text ul {
  margin-top: 8px;
}

.tutorial-text ul {
  padding-left: 18px;
}

.tutorial-media {
  background: #fff;
  border: 2px solid #000;
  border-radius: 12px;
  overflow: hidden;
}

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

.hydrometer {
  transform-origin: center;
  animation: bob 1.2s ease-in-out infinite;
}

.transfer-flow {
  stroke-dasharray: 6 8;
  animation: flow 1.2s linear infinite;
}


.must-step {
  opacity: 0;
  animation: mustStep 14s ease-in-out infinite;
}

.must-step1 { animation-delay: 0s; }
.must-step2 { animation-delay: 2s; }
.must-step3 { animation-delay: 4s; }
.must-step4 { animation-delay: 6s; }
.must-step5 { animation-delay: 8s; }
.must-step6 { animation-delay: 10s; }
.must-step7 { animation-delay: 12s; }

.must-stir {
  opacity: 0;
  transform-origin: 280px 160px;
  animation-name: mustStep, stir;
  animation-duration: 14s, 1.2s;
  animation-delay: 12s, 12s;
  animation-timing-function: ease-in-out, ease-in-out;
  animation-iteration-count: infinite, infinite;
  animation-fill-mode: both, both;
}

.must-water {
  opacity: 0;
  animation: waterHold 14s ease-in-out infinite;
  animation-delay: 2s;
  animation-fill-mode: both;
}


@keyframes bob {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
  100% { transform: translateY(0px); }
}

@keyframes flow {
  0% { stroke-dashoffset: 28; }
  100% { stroke-dashoffset: 0; }
}


@keyframes stir {
  0% { transform: rotate(-6deg); }
  50% { transform: rotate(6deg); }
  100% { transform: rotate(-6deg); }
}

@keyframes mustStep {
  0% { opacity: 0; }
  8% { opacity: 1; }
  16% { opacity: 1; }
  22% { opacity: 0; }
  100% { opacity: 0; }
}

@keyframes waterHold {
  0% { opacity: 0; }
  5% { opacity: 1; }
  100% { opacity: 1; }
}


@media (max-width: 720px) {
  .tutorial-content {
    grid-template-columns: 1fr;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-heading {
    align-items: center;
  }

  .hero-logo {
    width: 96px;
    height: 96px;
  }

  .sub {
    max-width: 48ch;
  }

  .hero-summary {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .app {
    padding: 24px 16px 64px;
    gap: 18px;
  }

  .hero {
    padding: 20px;
  }

  .hero-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-logo {
    width: 80px;
    height: 80px;
  }

  .hero-summary {
    grid-template-columns: 1fr;
  }

  .task-form {
    grid-template-columns: 1fr;
  }

  .field-row {
    flex-direction: column;
    align-items: stretch;
  }

  .field-row .btn {
    width: 100%;
  }

  .tabs {
    gap: 8px;
  }

  .tab {
    width: 100%;
    text-align: left;
    min-height: 44px;
  }

  .timeline {
    grid-template-columns: 1fr;
  }

  .day-header,
  .week-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .task-item {
    grid-template-columns: 20px 1fr;
  }

  .task-item button {
    grid-column: 2 / 3;
    justify-self: end;
  }

  .btn {
    min-height: 44px;
  }

  .modal-card {
    width: min(92vw, 560px);
    max-height: 86vh;
  }

  .panel-title {
    flex-direction: column;
    align-items: flex-start;
  }
}
