:root {
  --bg: #f6f1ea;
  --ink: #221b16;
  --muted: #6b5b4d;
  --accent: #d07b3a;
  --accent-2: #4a7f6b;
  --card: #fff9f2;
  --shadow: 0 20px 60px rgba(34, 27, 22, 0.18);
  --radius: 18px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-bounce: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Space Grotesk", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 700px at 80% -10%, #ffd9b7 0%, transparent 60%),
    radial-gradient(1000px 600px at 10% 0%, #b7e1d4 0%, transparent 55%),
    var(--bg);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: -1;
  filter: blur(40px);
}

body::before {
  width: 380px;
  height: 380px;
  top: -120px;
  right: -80px;
  background: radial-gradient(circle, rgba(208, 123, 58, 0.26) 0%, rgba(208, 123, 58, 0) 70%);
  animation: drift-one 14s ease-in-out infinite;
}

body::after {
  width: 420px;
  height: 420px;
  left: -140px;
  bottom: -180px;
  background: radial-gradient(circle, rgba(74, 127, 107, 0.24) 0%, rgba(74, 127, 107, 0) 70%);
  animation: drift-two 16s ease-in-out infinite;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='160' height='160' filter='url(%23n)' opacity='0.4'/></svg>");
  z-index: 1;
}

.spill-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.72;
  mix-blend-mode: multiply;
  filter: saturate(1.1) contrast(1.05);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 8vw 10px;
  animation: fade-up 0.75s var(--ease-out) both;
}

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.logo-title {
  font-size: clamp(0.38rem, 1vw + 0.34rem, 2rem);
  line-height: 1.22;
}

.logo-mark {
  width: 38px;
  height: 52px;
  flex: 0 0 38px;
  position: relative;
  transform: rotate(-16deg);
  filter: drop-shadow(0 8px 10px rgba(56, 30, 14, 0.34));
  animation: logo-glow 3.2s ease-in-out infinite;
}

.logo-mark::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 58% 42% 55% 45% / 52% 48% 58% 42%;
  background: linear-gradient(145deg, #7f4422 0%, #542c16 45%, #31190d 100%);
  box-shadow: inset -2px -3px 0 rgba(255, 213, 170, 0.15), inset 2px 3px 0 rgba(20, 10, 4, 0.26);
}

.logo-mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 8%;
  width: 3px;
  height: 82%;
  border-radius: 999px;
  transform: translateX(-50%) rotate(8deg);
  background: linear-gradient(180deg, rgba(240, 197, 149, 0.9) 0%, rgba(175, 117, 74, 0.78) 100%);
  box-shadow: 0 0 0 1px rgba(58, 31, 16, 0.2);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  grid-template-areas:
    "intro intro"
    "card aside";
  gap: 32px;
  padding: 12px 8vw 60px;
  align-items: start;
}

.hero-intro {
  grid-area: intro;
  max-width: 64ch;
  display: grid;
  gap: 14px;
  animation: fade-up 0.85s 0.08s var(--ease-out) both;
}

.hero-card {
  grid-area: card;
}

.hero-intro h1 {
  font-family: "Fraunces", serif;
  font-size: clamp(2.4rem, 2.6vw + 1.4rem, 4rem);
  line-height: 0.95;
  margin: 0;
  display: grid;
  gap: 6px;
  margin-top: 26px;
}

.hero-intro h1 span {
  display: block;
}

.hero-intro h1 span:first-child {
  white-space: nowrap;
}

.hero-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 45ch;
  margin-top: 15px;
}

.beginner-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.beginner-chip {
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(34, 27, 22, 0.1);
  color: #53463c;
  font-size: 0.86rem;
  box-shadow: 0 8px 18px rgba(34, 27, 22, 0.06);
}

.pill {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  background: #fff2e5;
  color: #8f4a21;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  animation: fade-up 0.9s 0.14s var(--ease-out) both;
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill-link {
  text-decoration: none;
  border: 1px solid rgba(34, 27, 22, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.auth-btn {
  font: inherit;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.01em;
  min-height: 42px;
  padding: 8px 20px;
  border-radius: 999px;
}

.mobile-header-toggle {
  display: none;
  min-width: 48px;
  justify-content: center;
  align-items: center;
  padding: 8px 12px;
}

.mobile-header-toggle-bar {
  position: relative;
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.mobile-header-toggle-bar::before,
.mobile-header-toggle-bar::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.mobile-header-toggle-bar::before {
  top: -6px;
}

.mobile-header-toggle-bar::after {
  top: 6px;
}

#authTrigger.auth-btn {
  color: #fff8f1;
  background: linear-gradient(135deg, #b7632a 0%, #df9455 100%);
  border-color: rgba(118, 62, 26, 0.58);
  text-shadow: 0 1px 0 rgba(35, 20, 10, 0.32);
  box-shadow: 0 10px 22px rgba(118, 62, 26, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

#authTrigger.auth-btn:hover {
  filter: brightness(1.05);
}

#logoutBtn.auth-btn {
  color: #1f4f3e;
  background: linear-gradient(135deg, #e1f1e9 0%, #c5e3d4 100%);
  border-color: rgba(74, 127, 107, 0.44);
  box-shadow: 0 10px 20px rgba(74, 127, 107, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

#logoutBtn.auth-btn:hover {
  filter: brightness(1.03);
}

.auth-btn:focus-visible {
  outline: 3px solid rgba(74, 127, 107, 0.28);
  outline-offset: 2px;
}

.pill-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(34, 27, 22, 0.12);
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(34, 27, 22, 0.08);
  position: relative;
  overflow: hidden;
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out);
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -35%;
  width: 30%;
  height: 100%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0));
  transform: skewX(-18deg);
  pointer-events: none;
  animation: card-sheen 8s linear infinite;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 64px rgba(34, 27, 22, 0.22);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.base-grid {
  margin-bottom: 12px;
}

.setup-hint {
  margin: 8px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px dashed rgba(34, 27, 22, 0.2);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
  font-size: 0.95rem;
}

.setup-hint.is-hidden {
  display: none;
}

.advanced-options {
  margin-top: 12px;
  animation: fade-up 0.45s var(--ease-out) both;
}

.advanced-options.is-hidden {
  display: none;
}

.advanced-grid {
  margin-bottom: 8px;
}

.action-row {
  margin-top: 18px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

.manual-toggle-btn {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-left: auto;
  margin-right: auto;
  border: 1px solid rgba(74, 127, 107, 0.24);
  background: rgba(74, 127, 107, 0.12);
  color: #2f5a49;
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.manual-toggle-btn:hover {
  background: rgba(74, 127, 107, 0.18);
}

.recipe-meta {
  margin-top: 16px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(34, 27, 22, 0.1);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.92) 0%, rgba(248, 241, 231, 0.9) 100%);
  display: grid;
  gap: 14px;
}

.manual-overrides {
  margin-top: 16px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(74, 127, 107, 0.15);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.94) 0%, rgba(242, 250, 246, 0.88) 100%);
  display: grid;
  gap: 12px;
  overflow: hidden;
  max-height: 520px;
  opacity: 1;
  transform: translateY(0);
  transition: max-height 0.38s var(--ease-out), opacity 0.24s ease, transform 0.38s var(--ease-out), padding 0.38s var(--ease-out), margin-top 0.38s var(--ease-out);
  will-change: max-height, opacity, transform;
}

.manual-overrides.is-collapsed {
  max-height: 0;
  opacity: 0;
  transform: translateY(-10px);
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  pointer-events: none;
}

.manual-overrides-head h3 {
  margin: 0;
  font-size: 1rem;
}

.manual-overrides-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.manual-overrides-grid {
  gap: 12px;
}

.manual-overrides-note {
  margin: 0;
  color: #5f4f43;
  font-size: 0.88rem;
  line-height: 1.45;
}

.ratio-warning {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(208, 123, 58, 0.22);
  background: rgba(255, 242, 229, 0.82);
  color: #87501f;
  font-size: 0.88rem;
  line-height: 1.45;
}

.ratio-warning.is-hidden {
  display: none;
}

.recipe-name-field input {
  font-size: 1.08rem;
}

.recipe-note-field textarea {
  width: 100%;
  min-height: 136px;
  resize: vertical;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(34, 27, 22, 0.15);
  background: #fff;
  font: inherit;
  line-height: 1.5;
}

.recipe-note-field textarea:focus {
  outline: none;
  border-color: rgba(74, 127, 107, 0.9);
  box-shadow: 0 0 0 4px rgba(74, 127, 107, 0.15);
}

.ratio-hint {
  margin: 0;
  color: #5f4f43;
  font-size: 0.88rem;
  line-height: 1.45;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(34, 27, 22, 0.18);
  background: rgba(255, 255, 255, 0.68);
}

.cup-fill-indicator {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid rgba(34, 27, 22, 0.14);
  background: rgba(255, 255, 255, 0.78);
}

.cup-fill-visual {
  width: 34px;
  height: 40px;
  border-radius: 0 0 11px 11px;
  border: 2px solid rgba(34, 27, 22, 0.46);
  border-top-width: 3px;
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.82);
}

.cup-fill-visual::after {
  content: "";
  position: absolute;
  right: -9px;
  top: 9px;
  width: 8px;
  height: 15px;
  border: 2px solid rgba(34, 27, 22, 0.38);
  border-left: none;
  border-radius: 0 8px 8px 0;
}

.cup-fill-liquid {
  position: absolute;
  inset: auto 0 0;
  height: 8%;
  background: linear-gradient(180deg, #c27944 0%, #8f4f2f 100%);
  transform-origin: bottom;
}

.cup-fill-text {
  font-size: 0.84rem;
  font-weight: 600;
  color: #6a584a;
}

.cup-fill-indicator.is-filling .cup-fill-liquid {
  animation: cup-fill-rise 0.9s var(--ease-out) both;
}

.cup-fill-indicator.is-filling .cup-fill-visual {
  animation: cup-bounce 0.9s var(--ease-bounce);
}

.cup-fill-indicator.is-ready .cup-fill-text {
  color: #2d5a4b;
}

#toolFields > div {
  opacity: 1;
}

#toolFields.is-switching > div {
  animation: field-in 0.45s var(--ease-out) both;
  animation-delay: calc(var(--field-index, 0) * 45ms);
}

.blend-controls {
  display: none;
  padding: 14px;
  border: 1px solid rgba(34, 27, 22, 0.15);
  border-radius: 14px;
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 246, 235, 0.82) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.36);
}

.blend-controls.active {
  display: block;
}

.blend-controls-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.blend-controls-head > label {
  margin: 0;
  font-weight: 600;
  color: #5f4d40;
}

.blend-lock {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(74, 127, 107, 0.3);
  background: rgba(74, 127, 107, 0.12);
  color: #345d4f;
  font-size: 0.77rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
}

.custom-controls {
  display: none;
}

.custom-controls.active {
  display: block;
}

.stat.hidden {
  display: none;
}

.blend-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.blend-field {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(34, 27, 22, 0.12);
  border-radius: 14px;
  padding: 10px;
}

.blend-field label {
  margin-bottom: 6px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(34, 27, 22, 0.68);
}

.blend-field input {
  text-align: center;
  font-size: 1.62rem;
  font-weight: 700;
  padding: 12px 14px;
  letter-spacing: 0.01em;
}

.blend-total-note {
  margin: 12px 0 0;
  color: #5d4e43;
  font-size: 0.84rem;
  line-height: 1.4;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px dashed rgba(34, 27, 22, 0.18);
  background: rgba(255, 255, 255, 0.66);
}

label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--muted);
}

select, input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(34, 27, 22, 0.15);
  background: #fff;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}

select:hover, input:hover {
  border-color: rgba(34, 27, 22, 0.28);
}

select:focus, input:focus {
  outline: none;
  border-color: rgba(74, 127, 107, 0.9);
  box-shadow: 0 0 0 4px rgba(74, 127, 107, 0.15);
  transform: translateY(-1px);
}

select {
  padding-right: 52px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 7l5 6 5-6' stroke='%23221b16' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  background-size: 14px;
}

select::-ms-expand {
  display: none;
}

.btn {
  background: linear-gradient(135deg, var(--accent), #ffb66c);
  color: #24160e;
  font-weight: 600;
  border: none;
  padding: 14px 20px;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  box-shadow: 0 12px 28px rgba(208, 123, 58, 0.35);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.btn-secondary {
  background: linear-gradient(135deg, #f0f5ec, #dce8de);
  color: #203429;
  box-shadow: 0 10px 22px rgba(74, 127, 107, 0.2);
}

.save-status {
  margin: 0;
  font-size: 0.84rem;
  color: #5f4f43;
  line-height: 1.35;
}

.save-status[data-tone="success"] {
  color: #2f6552;
}

.save-status[data-tone="warning"] {
  color: #8f5f1f;
}

.save-status[data-tone="error"] {
  color: #8e2a2a;
}

.btn::before {
  content: "";
  position: absolute;
  inset: -2px 120% -2px -18%;
  background: linear-gradient(105deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.44), rgba(255, 255, 255, 0));
  transform: skewX(-20deg);
  transition: transform 0.65s ease;
  pointer-events: none;
}

.btn:hover {
  transform: translateY(-2px);
  filter: saturate(1.06);
}

.btn:hover::before {
  transform: translateX(-220%) skewX(-20deg);
}

.btn.btn-pulse {
  animation: button-pulse 0.4s var(--ease-bounce);
}

.recipe {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  perspective: 800px;
}

.flavor-visual {
  margin-top: 16px;
  padding: 20px;
  border-radius: 14px;
  border: 1px solid rgba(34, 27, 22, 0.1);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.95) 0%, rgba(244, 255, 250, 0.88) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.flavor-visual.is-hidden {
  display: none;
}

.flavor-visual-head h3 {
  margin-left: 5px;
  margin-top: 10px;
  font-size: 1.44rem;
}

.flavor-visual-head p {
  margin-top: 0px;
  color: var(--muted);
  font-size: 1.16rem;
}

.flavor-visual-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.flavor-chart-card {
  border-radius: 12px;
  border: 1px solid rgba(34, 27, 22, 0.1);
  background: rgba(255, 255, 255, 0.82);
  padding: 10px;
  max-width: 550px;
  width: 100%;
  margin: 0 auto;
}

.flavor-chart-card h4 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.flavor-chart-card canvas {
  width: 100%;
  height: auto;
  display: block;
}

.flavor-metric-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.flavor-metric-item {
  border-radius: 10px;
  border: 1px solid rgba(34, 27, 22, 0.1);
  background: rgba(255, 255, 255, 0.86);
  padding: 8px;
}

.flavor-metric-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.82rem;
}

.flavor-metric-top strong {
  font-size: 0.88rem;
}

.flavor-metric-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(34, 27, 22, 0.1);
}

.flavor-metric-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 0.22s ease;
}

.tuning-assistant {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(34, 27, 22, 0.1);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 247, 235, 0.9) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.tuning-assistant.is-hidden {
  display: none;
}

.tuning-head h3 {
  margin: 0;
  font-size: 1.03rem;
}

.tuning-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.tuning-controls {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.tuning-btn {
  padding: 12px 14px;
  font-size: 0.86rem;
  white-space: nowrap;
}

.tuning-summary {
  margin-top: 11px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(34, 27, 22, 0.12);
  background: rgba(255, 255, 255, 0.82);
  color: #5e4f44;
  font-size: 0.87rem;
}

.tuning-list {
  margin: 10px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 7px;
}

.tuning-list li {
  color: #4f4237;
  font-size: 0.88rem;
  line-height: 1.4;
}

.brew-timer-panel {
  border-radius: 14px;
  border: 1px solid rgba(34, 27, 22, 0.12);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.96) 0%, rgba(245, 255, 251, 0.9) 100%);
  padding: 12px 13px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.52);
}

.brew-timer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.brew-timer-head h4 {
  margin: 0;
  font-size: 0.98rem;
}

.brew-timer-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.brew-timer-ring {
  --brew-progress: 0deg;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--accent-2) 0deg, var(--accent-2) var(--brew-progress), rgba(34, 27, 22, 0.12) var(--brew-progress), rgba(34, 27, 22, 0.12) 360deg);
  position: relative;
}

.brew-timer-ring::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 999px;
  background: #fff;
}

.brew-timer-ring span {
  position: relative;
  z-index: 1;
  font-size: 0.76rem;
  font-weight: 700;
  color: #34584b;
}

.brew-timer-bar {
  margin-top: 10px;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(34, 27, 22, 0.1);
}

.brew-timer-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d07b3a 0%, #4a7f6b 100%);
  transition: width 0.25s ease;
}

.brew-stage-toast {
  opacity: 0;
  transform: translateY(5px);
  pointer-events: none;
  justify-self: start;
  margin-top: -2px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(74, 127, 107, 0.32);
  background: rgba(74, 127, 107, 0.13);
  color: #2c5b4b;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.brew-stage-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.step {
  background: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(34, 27, 22, 0.08);
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px) scale(0.985);
  animation: step-in 0.55s var(--ease-bounce) both;
  animation-delay: calc(var(--step-index, 0) * 80ms);
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.step-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.step-head h4 {
  margin: 0;
}

.step-timer-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.step-duration,
.step-timer-display,
.step-timer-passive {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.step-duration {
  color: #5d4d40;
  background: rgba(34, 27, 22, 0.08);
}

.step-timer-display {
  color: #2f5f4f;
  background: rgba(74, 127, 107, 0.14);
}

.step-timer-passive {
  color: #6d5d50;
  background: rgba(34, 27, 22, 0.08);
}

.step-start-btn {
  border: 1px solid rgba(74, 127, 107, 0.32);
  background: rgba(74, 127, 107, 0.13);
  color: #2d5548;
  border-radius: 999px;
  padding: 4px 10px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, background-color 0.18s ease;
}

.step-start-btn:hover {
  transform: translateY(-1px);
  background: rgba(74, 127, 107, 0.2);
}

.step-start-btn[data-state="running"] {
  border-color: rgba(208, 123, 58, 0.4);
  background: rgba(208, 123, 58, 0.18);
  color: #7c461f;
}

.step-start-btn[data-state="done"] {
  border-color: rgba(34, 27, 22, 0.24);
  background: rgba(34, 27, 22, 0.09);
  color: #4f4238;
}

.step.is-active {
  border-color: rgba(74, 127, 107, 0.38);
  box-shadow: 0 12px 24px rgba(74, 127, 107, 0.16);
}

.step.is-complete {
  border-color: rgba(74, 127, 107, 0.24);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.98) 0%, rgba(241, 255, 249, 0.94) 100%);
}

.step.is-next {
  border-color: rgba(208, 123, 58, 0.25);
}

.step::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  transform: scaleY(0);
  transform-origin: top;
  animation: line-grow 0.42s var(--ease-out) both;
  animation-delay: calc(var(--step-index, 0) * 80ms + 120ms);
}

.step:hover {
  transform: translateY(-2px);
  border-color: rgba(34, 27, 22, 0.16);
  box-shadow: 0 10px 20px rgba(34, 27, 22, 0.08);
}

.step h4 {
  margin: 0;
  font-size: 1rem;
}

.step p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.aside {
  grid-area: aside;
  background: linear-gradient(160deg, #fff1e3 0%, #f3fff9 100%);
  border-radius: var(--radius);
  padding: 26px;
  border: 1px solid rgba(34, 27, 22, 0.08);
  box-shadow: var(--shadow);
  align-self: start;
  animation: fade-up 0.85s 0.2s var(--ease-out) both, aside-float 7s ease-in-out 1s infinite;
}

.aside-title {
  margin: 0;
  font-family: "Fraunces", serif;
}

.aside-tip {
  margin-top: 18px;
  color: var(--muted);
}

.aside p {
  margin-top: 28px;
}

.stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(34, 27, 22, 0.2);
  font-size: 0.95rem;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.stat.updated {
  border-bottom-color: rgba(208, 123, 58, 0.45);
}

.stat.updated .tag {
  animation: tag-pop 0.45s var(--ease-bounce);
}

.stat:last-child { border-bottom: none; }

.tag {
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 600;
}

body.modal-open {
  overflow: hidden;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 12% 12%, rgba(255, 232, 201, 0.18) 0%, rgba(255, 232, 201, 0) 42%),
    radial-gradient(circle at 88% 88%, rgba(74, 127, 107, 0.16) 0%, rgba(74, 127, 107, 0) 48%),
    rgba(19, 14, 11, 0.52);
  backdrop-filter: blur(4px);
  padding: clamp(16px, 4vw, 28px);
}

.auth-modal[hidden] {
  display: none !important;
}

.auth-modal-card {
  width: min(500px, 100%);
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 251, 245, 0.96) 100%);
  border: 1px solid rgba(34, 27, 22, 0.14);
  box-shadow: 0 30px 70px rgba(20, 14, 10, 0.34);
  padding: clamp(16px, 2.2vw, 24px);
  position: relative;
  overflow: hidden;
  animation: auth-modal-pop 0.24s var(--ease-bounce) both;
}

.auth-modal-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(90deg, #d07b3a 0%, #f0b06c 50%, #4a7f6b 100%);
}

.auth-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.auth-modal-head h3 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: clamp(1.5rem, 1.7vw + 0.95rem, 2.05rem);
  letter-spacing: 0.01em;
}

.auth-modal-close {
  border: 1px solid rgba(34, 27, 22, 0.14);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  width: 42px;
  height: 42px;
  font: inherit;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.auth-modal-close:hover {
  transform: translateY(-1px);
  background: #fff;
}

.auth-modal-subtitle {
  margin: 10px 0 16px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.45;
}

.auth-view-switch {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  padding: 6px;
  border-radius: 16px;
  background: rgba(34, 27, 22, 0.06);
  border: 1px solid rgba(34, 27, 22, 0.08);
}

.auth-switch-btn {
  flex: 1;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #5f4f43;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.auth-switch-btn.is-active {
  background: linear-gradient(135deg, #e98a43 0%, #f1a861 100%);
  color: #2d1a0d;
  box-shadow: 0 10px 20px rgba(183, 95, 35, 0.2);
}

.auth-view {
  display: grid;
  gap: 12px;
}

.auth-view.is-hidden {
  display: none;
}

.auth-form-grid {
  display: grid;
  gap: 12px;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 54px;
}

.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-5px);
  width: 34px;
  height: 34px;
  border: 1px solid rgba(34, 27, 22, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  color: #5f4f43;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.password-toggle:hover {
  background: #fff;
  border-color: rgba(74, 127, 107, 0.28);
  color: #2f6552;
  transform: translateY(0) scale(1.02);
}

.password-toggle:focus-visible {
  outline: 3px solid rgba(74, 127, 107, 0.22);
  outline-offset: 2px;
}

.password-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

.auth-form-grid label {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #6a584a;
}

.auth-form-grid input {
  border-radius: 14px;
  border: 1px solid rgba(34, 27, 22, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(251, 247, 242, 0.96) 100%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.7);
}

.auth-form-grid input::placeholder {
  color: #8f8173;
}

.auth-submit {
  width: 100%;
  margin-top: 12px;
  min-height: 54px;
  border-radius: 16px;
  font-size: 1.03rem;
}

.auth-submit.btn-secondary {
  background: linear-gradient(135deg, #ebf2ea 0%, #d6e6dc 100%);
  color: #1f3d32;
  box-shadow: 0 10px 22px rgba(74, 127, 107, 0.18);
}

.auth-message {
  margin: 12px 0 0;
  font-size: 0.9rem;
  color: #5f4f43;
  border-radius: 12px;
  border: 1px solid rgba(34, 27, 22, 0.12);
  background: rgba(255, 255, 255, 0.72);
  padding: 9px 11px;
}

.auth-message[data-tone="success"] {
  color: #2d5f4f;
  border-color: rgba(45, 95, 79, 0.3);
  background: rgba(214, 242, 229, 0.58);
}

.auth-message[data-tone="warning"] {
  color: #8d5a22;
  border-color: rgba(141, 90, 34, 0.28);
  background: rgba(255, 237, 205, 0.68);
}

.auth-message[data-tone="error"] {
  color: #8e2a2a;
  border-color: rgba(142, 42, 42, 0.28);
  background: rgba(255, 220, 220, 0.56);
}

.auth-view-hint {
  margin: 0;
  color: #5f4f43;
  font-size: 0.88rem;
  line-height: 1.4;
}

.auth-inline-link {
  border: none;
  background: transparent;
  color: #2f6552;
  font: inherit;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

footer {
  padding: 28px 8vw 50px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  max-width: 78ch;
  margin: 0 auto;
  animation: fade-up 0.85s 0.28s var(--ease-out) both;
}

@media (max-width: 720px) {
  .hero-intro h1 span:first-child {
    white-space: normal;
  }

  .beginner-guide {
    flex-direction: column;
  }
}

header,
.hero,
footer {
  position: relative;
  z-index: 2;
}

@keyframes drift-one {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-26px, 30px, 0) scale(1.08); }
}

@keyframes drift-two {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(26px, -22px, 0) scale(1.06); }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes logo-glow {
  0%, 100% { transform: rotate(-16deg) scale(1); filter: drop-shadow(0 8px 10px rgba(56, 30, 14, 0.34)) saturate(1); }
  50% { transform: rotate(-16deg) scale(1.06); filter: drop-shadow(0 12px 16px rgba(56, 30, 14, 0.42)) saturate(1.12); }
}

@keyframes card-sheen {
  0% { transform: translateX(0) skewX(-18deg); opacity: 0; }
  8% { opacity: 1; }
  24% { transform: translateX(430%) skewX(-18deg); opacity: 0; }
  100% { transform: translateX(430%) skewX(-18deg); opacity: 0; }
}

@keyframes field-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes step-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes line-grow {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

@keyframes aside-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes button-pulse {
  0% { transform: scale(1); }
  45% { transform: scale(0.97); }
  100% { transform: scale(1); }
}

@keyframes tag-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes cup-fill-rise {
  0% { height: 8%; }
  55% { height: 78%; }
  100% { height: 72%; }
}

@keyframes cup-bounce {
  0% { transform: translateY(0); }
  35% { transform: translateY(-2px); }
  100% { transform: translateY(0); }
}

@keyframes auth-modal-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .spill-canvas {
    opacity: 0.24;
    filter: none;
  }
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    grid-template-areas:
      "intro"
      "card"
      "aside";
  }

  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding-top: 20px;
    padding-bottom: 8px;
  }

  .logo {
    width: auto;
    justify-content: flex-start;
    text-align: left;
    gap: 10px;
  }

  .logo-title {
    max-width: 32ch;
    font-size: clamp(0.9rem, 1.1vw + 0.72rem, 1.34rem);
    line-height: 1.25;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    padding: 2px 0 6px;
  }

  .header-actions .pill-link,
  .header-actions .auth-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 40px;
    padding: 8px 14px;
  }

  .header-actions.has-mobile-menu .mobile-header-toggle {
    display: inline-flex;
    justify-content: center;
  }

  .header-actions.has-mobile-menu {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    width: min(100%, 560px);
    gap: 8px;
    padding: 4px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.28);
    border: 1px solid rgba(34, 27, 22, 0.12);
    backdrop-filter: blur(4px);
  }

  .header-actions.has-mobile-menu > :not(.mobile-header-toggle):not(#authTrigger):not(#logoutBtn) {
    display: none;
  }

  .header-actions.has-mobile-menu #authTrigger,
  .header-actions.has-mobile-menu #logoutBtn {
    margin-left: 0;
  }

  .header-actions.has-mobile-menu.is-mobile-open > :not(#authTrigger):not(#logoutBtn):not(.mobile-header-toggle) {
    display: inline-flex;
    width: 100%;
    justify-content: flex-start;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 12px;
    border-color: rgba(34, 27, 22, 0.14);
    background: rgba(255, 255, 255, 0.9);
  }
}

@media (max-width: 620px) {
  header {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    padding-left: 5vw;
    padding-right: 5vw;
    gap: 10px;
  }

  .logo-mark {
    width: 32px;
    height: 44px;
    flex-basis: 32px;
  }

  .logo {
    flex: 1 1 auto;
    min-width: 0;
    gap: 8px;
  }

  .logo-title {
    max-width: 18ch;
    font-size: clamp(0.72rem, 1.7vw + 0.42rem, 0.9rem);
    line-height: 1.2;
  }

  .header-actions {
    width: auto;
    margin-left: auto;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 8px;
    padding: 0;
  }

  .header-actions.has-mobile-menu {
    width: auto;
    max-width: none;
    border-radius: 14px;
    padding: 0;
    gap: 8px;
    background: transparent;
    border: none;
    backdrop-filter: none;
  }

  .header-actions .pill-link,
  .header-actions .auth-btn {
    min-height: 38px;
    padding: 7px 12px;
    font-size: 0.94rem;
  }

  .header-actions.has-mobile-menu.is-mobile-open > :not(#authTrigger):not(#logoutBtn):not(.mobile-header-toggle) {
    width: min(86vw, 320px);
  }

  .flavor-visual-grid,
  .flavor-metric-grid {
    grid-template-columns: 1fr;
  }

  .tuning-controls {
    grid-template-columns: 1fr;
  }

  .tuning-btn {
    width: 100%;
  }

  .brew-timer-head {
    align-items: flex-start;
  }

  .step-head {
    flex-direction: column;
  }

  .step-timer-controls {
    margin-left: 0;
    flex-wrap: wrap;
  }

  .blend-controls-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .blend-grid {
    grid-template-columns: 1fr;
  }

  .blend-field input {
    font-size: 1.42rem;
  }

  .auth-modal-card {
    border-radius: 20px;
    padding: 14px;
  }

  .password-field input {
    padding-right: 50px;
  }

  .password-toggle {
    width: 32px;
    height: 32px;
    right: 9px;
  }

  .auth-modal-head h3 {
    font-size: 1.42rem;
  }

  .auth-modal-subtitle {
    font-size: 0.95rem;
  }
}
