/* ============================================
   BrewDaily - 咖啡冲煮工具箱
   Global Styles
   ============================================ */

/* CSS Variables */
:root {
  --color-primary: #6F4E37;
  --color-primary-dark: #5A3D2B;
  --color-primary-light: #8B6F5C;
  --color-accent: #E87A3D;
  --color-bg: #F7FAF0;
  --color-page-bg: #F9FBF4;
  --color-surface: #FFFFFF;
  --color-text: #2D2D2D;
  --color-text-secondary: #6B6B6B;
  --color-text-muted: #9E9E9E;
  --color-border: #E8E4E0;
  --color-success: #4CAF50;
  --color-info: #3B82F6;
  --color-warm: #E87A3D;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

  --nav-height: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
               'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--color-page-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background 0.8s ease;
}

/* App Container */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--color-bg);
  position: relative;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 8px);
}

/* Page Sections */
.page {
  display: none;
  animation: fadeIn 0.25s ease;
}
.page.active {
  display: block;
}

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

/* Page Header */
.page-header {
  padding: 16px 20px 12px;
  text-align: center;
}
.page-header h1 {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  letter-spacing: 1px;
}

/* ============================================
   Timer Page
   ============================================ */

/* Recipe Cards */
.recipe-section {
  padding: 0 16px 16px;
}
.recipe-section-title {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
  padding-left: 4px;
}

.recipe-cards {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.recipe-cards::-webkit-scrollbar {
  display: none;
}

.recipe-card {
  flex: 0 0 auto;
  width: 130px;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}
.recipe-card:hover {
  border-color: var(--color-primary-light);
  transform: translateY(-1px);
}
.recipe-card.active {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}
.recipe-card .recipe-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
}
.recipe-card .recipe-desc {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}
.recipe-card .recipe-time {
  font-size: 13px;
  color: var(--color-primary);
  font-weight: 500;
}

/* Timer Core */
.timer-core {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 20px 20px;
}

/* Progress Ring */
.progress-ring-container {
  position: relative;
  width: 220px;
  height: 220px;
  margin-bottom: 16px;
}

.progress-ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.progress-ring-bg {
  fill: none;
  stroke: var(--color-border);
  stroke-width: 8;
}

.progress-ring-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s linear, stroke 0.4s ease;
}

.progress-ring-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.timer-seconds {
  font-size: 56px;
  font-weight: 700;
  line-height: 1;
  color: var(--color-text);
  transition: color 0.6s ease, opacity 0.3s ease, transform 0.3s ease;
  font-variant-numeric: tabular-nums;
}

.timer-stage-name {
  font-size: 16px;
  color: var(--color-text-secondary);
  margin-top: 8px;
  font-weight: 500;
  transition: color 0.6s ease, opacity 0.3s ease, transform 0.3s ease;
}

/* Stage transition animations */
.timer-stage-fade-out {
  opacity: 0 !important;
  transform: translateY(-8px) !important;
}
.timer-stage-fade-in {
  animation: stageFadeIn 0.4s ease forwards;
}
@keyframes stageFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Stage index badge transition */
.timer-info-value {
  transition: color 0.4s ease;
}

/* Timer Info */
.timer-info {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.timer-info-item {
  text-align: center;
}
.timer-info-label {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}
.timer-info-value {
  font-size: 14px;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.timer-info-divider {
  width: 1px;
  height: 28px;
  background: var(--color-border);
}

/* Total Progress Bar */
.total-progress-wrap {
  width: 100%;
  max-width: 280px;
  margin-bottom: 20px;
}
.total-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}
.total-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
}
.total-progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Timer Controls */
.timer-controls {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 280px;
}

.btn {
  flex: 1;
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  font-family: inherit;
  text-align: center;
}
.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--color-primary-dark);
}

.btn-outline {
  background: transparent;
  color: var(--color-text);
  border: 2px solid var(--color-border);
}
.btn-outline:hover {
  border-color: var(--color-text-secondary);
}

.btn-start {
  background: var(--color-primary);
  color: #fff;
  font-size: 18px;
  padding: 16px 40px;
  border-radius: var(--radius-xl);
  margin-top: 8px;
}

/* Stage Toast */
.stage-toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--color-text);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-xl);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 100;
  white-space: nowrap;
}
.stage-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Complete Overlay */
.complete-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.3s ease;
}
.complete-overlay.show {
  display: flex;
}

.complete-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: 32px 28px;
  text-align: center;
  max-width: 300px;
  width: 85%;
  animation: scaleIn 0.3s ease;
}

.complete-icon {
  width: 64px;
  height: 64px;
  background: var(--color-success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.complete-icon svg {
  width: 32px;
  height: 32px;
  color: #fff;
}

.complete-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}
.complete-desc {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: 20px;
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ============================================
   Calculator Page
   ============================================ */

.calc-container {
  padding: 8px 20px 20px;
}

/* Input Section */
.calc-input-section {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  margin-bottom: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.calc-label {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.calc-input-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.calc-btn-step {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 20px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
}
.calc-btn-step:hover {
  border-color: var(--color-primary-light);
}
.calc-btn-step:active {
  background: var(--color-bg);
  transform: scale(0.92);
}

.calc-input {
  width: 100px;
  font-size: 36px;
  font-weight: 700;
  text-align: center;
  border: none;
  border-bottom: 2px solid var(--color-border);
  background: transparent;
  color: var(--color-text);
  padding: 4px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.calc-input:focus {
  border-color: var(--color-primary);
}

.calc-unit {
  font-size: 16px;
  color: var(--color-text-muted);
  margin-left: 4px;
}

/* Ratio Section */
.calc-ratio-section {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.calc-ratio-title {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.ratio-buttons {
  display: flex;
  gap: 8px;
}

.ratio-btn {
  flex: 1;
  padding: 12px 8px;
  border-radius: var(--radius-md);
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}
.ratio-btn:hover {
  border-color: var(--color-primary-light);
}
.ratio-btn.active {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
}

/* Custom Ratio */
.custom-ratio-wrap {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}
.custom-ratio-wrap.show {
  display: flex;
}
.custom-ratio-wrap span {
  font-size: 15px;
  color: var(--color-text-secondary);
}
.custom-ratio-input {
  width: 60px;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px;
  font-family: inherit;
  outline: none;
}
.custom-ratio-input:focus {
  border-color: var(--color-primary);
}

/* Unit Toggle */
.unit-toggle-wrap {
  display: flex;
  justify-content: flex-end;
  gap: 0;
  margin: 0 4px 12px;
}
.unit-toggle-btn {
  padding: 4px 12px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}
.unit-toggle-btn:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  border-right: none;
}
.unit-toggle-btn:last-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.unit-toggle-btn.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* Result Section */
.calc-result-section {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.result-label {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.result-value {
  font-size: 48px;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.result-unit {
  font-size: 16px;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

.result-sub {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-top: 8px;
}

/* ============================================
   Profile / My Page
   ============================================ */

.profile-container {
  padding: 0 16px 20px;
}

/* -- Stats Card -- */
.profile-stats-card {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  text-align: center;
  color: #fff;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.profile-stats-card::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  position: relative;
  z-index: 1;
  overflow: hidden;
}
.profile-avatar svg {
  width: 40px;
  height: 40px;
  color: #fff;
}
.avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 18px;
  object-fit: cover;
}

.profile-greeting {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}

.profile-stats-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}
.profile-stat {
  text-align: center;
  padding: 0 12px;
}
.profile-stat-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}
.profile-stat-label {
  font-size: 11px;
  opacity: 0.75;
  margin-top: 2px;
  white-space: nowrap;
}
.profile-stat-divider {
  width: 1px;
  height: 32px;
  background: rgba(255,255,255,0.25);
}

/* -- Brew History Section -- */
.profile-history-section {
  margin-bottom: 16px;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-left: 4px;
}
.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}
.section-hint {
  font-size: 12px;
  color: var(--color-text-muted);
}

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

.history-item {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  animation: historySlideIn 0.3s ease both;
  position: relative;
  transition: transform 0.15s ease;
}
.history-item:active {
  transform: scale(0.98);
}

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

.history-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.history-item-recipe {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}
.history-item-time {
  font-size: 12px;
  color: var(--color-text-muted);
}
.history-item-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.history-item-meta span {
  font-size: 12px;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}
.history-item-meta span svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--color-text-muted);
}
.history-item-note {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-top: 4px;
  border-left: 3px solid var(--color-primary);
  font-style: italic;
}
.history-item-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.history-item:hover .history-item-delete,
.history-item-delete:focus {
  opacity: 1;
}
.history-item-delete:hover {
  color: #E53935;
}

/* -- Empty State -- */
.history-empty {
  text-align: center;
  padding: 36px 20px;
  display: none;
}
.history-empty.show {
  display: block;
}
.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.empty-icon svg {
  width: 36px;
  height: 36px;
  color: var(--color-text-muted);
}
.history-empty p {
  font-size: 15px;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}
.empty-sub {
  font-size: 13px !important;
  color: var(--color-text-muted) !important;
}

/* -- Easter Egg Hint Card -- */
.profile-easter-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  cursor: pointer;
  transition: transform 0.2s var(--ease-bounce), box-shadow 0.2s;
  border: 1px solid transparent;
}
.profile-easter-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: rgba(111, 78, 55, 0.15);
}
.easter-icon {
  font-size: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.easter-icon svg {
  width: 28px;
  height: 28px;
  color: var(--color-accent);
}
.easter-info {
  flex: 1;
}
.easter-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}
.easter-desc {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
}
.easter-arrow {
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* -- Collapsible About Section -- */
.profile-about-section {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.about-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text);
  transition: background 0.15s;
}
.about-summary::-webkit-details-marker {
  display: none;
}
.about-summary:hover {
  background: var(--color-bg);
}
.about-sum-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.about-sum-left svg {
  color: var(--color-text-secondary);
}
.about-chevron {
  color: var(--color-text-muted);
  transition: transform 0.25s ease;
}
.profile-about-section[open] .about-chevron {
  transform: rotate(180deg);
}
.about-details {
  padding: 0 18px 18px;
  border-top: 1px solid var(--color-border);
}
.about-version-tag {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 14px;
  margin-bottom: 8px;
}
.about-bio {
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.7;
}
.about-links-nav {
  margin-top: 14px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

/* About link items inside collapsible section */
.profile-about-section .about-link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  color: inherit;
}
.profile-about-section .about-link-item:last-child {
  border-bottom: none;
}
.profile-about-section .about-link-item:hover {
  background: var(--color-bg);
}
.profile-about-section .about-link-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.profile-about-section .about-link-icon {
  width: 32px;
  height: 32px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.profile-about-section .about-link-icon svg {
  width: 18px;
  height: 18px;
  color: var(--color-text-secondary);
}
.profile-about-section .about-link-item span:not(.about-link-arrow svg):not(.about-link-icon span) {
  font-size: 15px;
  color: var(--color-text);
}
.profile-about-section .about-link-arrow {
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* ============================================
   Save Record Prompt (未登录引导弹窗)
   ============================================ */

.save-prompt-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 190;
  animation: fadeIn 0.25s ease;
  padding: 20px;
}
.save-prompt-overlay.show {
  display: flex;
}
.save-prompt-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: 32px 24px 24px;
  width: 100%;
  max-width: 320px;
  text-align: center;
  animation: slideUp 0.3s ease;
  box-shadow: var(--shadow-lg);
}
.save-prompt-icon {
  font-size: 48px;
  margin-bottom: 12px;
  animation: breathe 2s ease-in-out infinite;
}
.save-prompt-icon svg {
  width: 48px;
  height: 48px;
  color: var(--color-primary);
}
.save-prompt-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
}
.save-prompt-desc {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}
.save-prompt-brew-info {
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.save-prompt-actions {
  display: flex;
  gap: 10px;
}
.save-prompt-skip-btn,
.save-prompt-login-btn {
  flex: 1;
  padding: 11px 0;
  font-size: 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-weight: 600;
}
.save-prompt-skip-btn {
  background: transparent;
  color: var(--color-text-secondary);
  border: 1.5px solid var(--color-border);
}
.save-prompt-skip-btn:active {
  background: var(--color-bg);
}
.save-prompt-login-btn {
  background: var(--color-primary);
  color: #fff;
}
.save-prompt-login-btn:active {
  background: var(--color-primary-dark);
}

/* ============================================
   Recipe Editor Dialog (自定义方案)
   ============================================ */

/* 添加按钮 - 方案列表右上角 */
.recipe-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.btn-icon svg { width: 18px; height: 18px; }
.btn-icon:active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* 编辑弹窗 */
.recipe-editor-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 210;
  animation: fadeIn 0.25s ease;
  padding: 16px;
}
.recipe-editor-overlay.show { display: flex; }
.recipe-editor-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: 24px 20px 20px;
  width: 100%;
  max-width: 380px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}
.recipe-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.recipe-editor-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
}
.recipe-editor-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.15s;
}
.recipe-editor-close:active { background: var(--color-bg); color: var(--color-text); }
.recipe-editor-close svg { width: 18px; height: 18px; }

/* 表单字段 */
.re-field { margin-bottom: 14px; }
.re-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 5px;
}
.re-required { color: #E53935; }
.re-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  -webkit-appearance: none;
}
.re-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(111,78,55,0.12);
}
.re-input::placeholder { color: var(--color-text-muted); }

/* 阶段区域 */
.re-stages-section {
  margin-bottom: 18px;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 14px;
}
.re-stages-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.re-stages-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
}
.re-stage-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-primary);
  background: transparent;
  border: 1.5px solid var(--color-primary);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
}
.re-stage-add-btn svg { width: 12px; height: 12px; }
.re-stage-add-btn:active {
  background: var(--color-primary);
  color: #fff;
}

/* 阶段行 */
.re-stage-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  animation: fadeIn 0.2s ease;
}
.re-stage-row:last-child { margin-bottom: 0; }
.re-stage-index {
  width: 22px; height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--color-primary);
  border-radius: 50%;
  flex-shrink: 0;
}
.re-stage-name-wrap { flex: 1; min-width: 0; }
.re-stage-name-wrap input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--color-text);
  outline: none;
  background: transparent;
  transition: border-color 0.15s;
}
.re-stage-name-wrap input:focus { border-color: var(--color-primary); }
.re-stage-dur-wrap { width: 72px; flex-shrink: 0; }
.re-stage-dur-wrap input {
  width: 100%;
  padding: 7px 6px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
  color: var(--color-text);
  outline: none;
  background: transparent;
  transition: border-color 0.15s;
}
.re-stage-dur-wrap input:focus { border-color: var(--color-accent); }
.re-stage-unit { font-size: 11px; color: var(--color-text-muted); width: 20px; flex-shrink: 0; text-align: center; }
.re-stage-del {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.re-stage-del:active { background: #FFEBEE; color: #E53935; }
.re-stage-del svg { width: 14px; height: 14px; }

.re-hint {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 8px;
  line-height: 1.4;
}

/* 操作按钮 */
.re-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.re-actions .btn { flex: 1; padding: 11px 0; }

/* ============================================
   Import Page (批量导入)
   ============================================ */

#page-import.page.active ~ .bottom-nav .nav-item[data-page="import"] {
  color: var(--color-primary);
}
#page-import.page.active ~ .bottom-nav .nav-item[data-page="import"]::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%; right: 20%;
  height: 3px;
  background: var(--color-primary);
  border-radius: 2px;
}

.import-container {
  padding: 16px 16px calc(var(--safe-bottom) + 80px);
  max-width: 520px;
  margin: 0 auto;
}

.import-hero {
  text-align: center;
  padding: 28px 16px 24px;
}
.import-hero-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.import-hero-icon svg {
  width: 48px;
  height: 48px;
  color: var(--color-primary);
}
.import-hero h2 {
  font-size: 19px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 6px;
}
.import-hero p {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.import-section {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.import-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.import-section-title svg {
  width: 18px; height: 18px;
  color: var(--color-primary);
}

/* 模板下载区 */
.template-download-area {
  display: flex;
  align-items: stretch;
  gap: 10px;
}
.template-info {
  flex: 1;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.template-filename {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 3px;
}
.template-desc {
  font-size: 11px;
  color: var(--color-text-muted);
  line-height: 1.4;
}
.btn-download-template {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--color-primary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
.btn-download-template:active { background: var(--color-primary-dark); }
.btn-download-template svg { width: 16px; height: 16px; }

/* 上传区 */
.upload-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--color-primary);
  background: rgba(111,78,55,0.03);
}
.upload-zone.has-file {
  border-style: solid;
  border-color: var(--color-success);
  background: rgba(76,175,80,0.04);
}
.upload-zone-icon {
  font-size: 36px;
  margin-bottom: 10px;
}
.upload-zone-icon svg {
  width: 36px;
  height: 36px;
  color: var(--color-text-secondary);
}
.upload-zone-text {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}
.upload-zone-hint {
  font-size: 11px;
  color: var(--color-text-muted);
}
.upload-file-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-success);
  margin-top: 8px;
  word-break: break-all;
}
#file-import-input { display: none; }

/* 预览表格 */
.import-preview {
  display: none;
  margin-top: 16px;
}
.import-preview.show { display: block; }
.preview-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}
.preview-table {
  width: 100%;
  min-width: 400px;
  border-collapse: collapse;
  font-size: 12px;
}
.preview-table th,
.preview-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.preview-table th {
  background: var(--color-bg);
  font-weight: 600;
  color: var(--color-text-secondary);
  font-size: 11px;
  position: sticky;
  top: 0;
}
.preview-table td {
  color: var(--color-text);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-table tr:last-child td { border-bottom: none; }
.preview-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px 0;
  font-size: 13px;
}
.preview-count { color: var(--color-text-secondary); }
.preview-count strong { color: var(--color-primary); }
.preview-error { color: #E53935; font-size: 12px; }

/* 导入操作栏 */
.import-actions {
  display: none;
  gap: 10px;
  margin-top: 16px;
}
.import-actions.show { display: flex; }
.import-actions .btn { flex: 1; padding: 12px 0; font-size: 14px; }

/* 导入结果 */
.import-result {
  display: none;
  text-align: center;
  padding: 24px 16px;
  animation: fadeIn 0.3s ease;
}
.import-result.show { display: block; }
.import-result-icon { font-size: 48px; margin-bottom: 12px; }
.import-result-icon svg { width: 48px; height: 48px; color: var(--color-success); }
.import-result-title { font-size: 17px; font-weight: 700; color: var(--color-text); margin-bottom: 6px; }
.import-result-desc { font-size: 13px; color: var(--color-text-secondary); line-height: 1.5; }

/* ============================================
   Note Dialog (Post-Brew Notes)
   ============================================ */

.note-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.25s ease;
  padding: 20px;
}
.note-overlay.show {
  display: flex;
}

.note-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  max-width: 340px;
  width: 100%;
  animation: noteSlideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes noteSlideUp {
  from { transform: translateY(24px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.note-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.note-emoji {
  font-size: 22px;
  display: inline-flex;
  align-items: center;
}
.note-emoji svg {
  width: 20px;
  height: 20px;
  color: var(--color-primary);
}
.note-title {
  font-size: 19px;
  font-weight: 700;
}
.note-subtitle {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 14px;
}

.note-input {
  width: 100%;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  box-sizing: border-box;
}
.note-input:focus {
  border-color: var(--color-primary);
}
.note-input::placeholder {
  color: var(--color-text-muted);
}

.note-char-count {
  text-align: right;
  font-size: 11px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.note-brew-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--color-text-secondary);
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 18px;
}

.note-actions {
  display: flex;
  gap: 10px;
}
.note-skip-btn {
  flex: 1 !important;
  padding: 12px !important;
  font-size: 15px !important;
}
.note-save-btn {
  flex: 1.5 !important;
  padding: 12px !important;
  font-size: 15px !important;
}

/* ============================================
   Bottom Navigation
   ============================================ */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--nav-height) + var(--safe-bottom));
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
  padding-bottom: var(--safe-bottom);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: var(--nav-height);
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  color: var(--color-text-muted);
  transition: color 0.2s;
}
.nav-item.active {
  color: var(--color-primary);
}
.nav-item svg {
  width: 22px;
  height: 22px;
}
.nav-item span {
  font-size: 11px;
  font-weight: 500;
}

/* PWA Install Banner — 已移除 */

/* ============================================
   Utilities
   ============================================ */

.hidden {
  display: none !important;
}

/* Responsive */
@media (min-width: 768px) {
  .app {
    box-shadow: var(--shadow-lg);
  }
}

/* ============================================
   🌟 DELIGHT ENHANCEMENTS
   BrewDaily Personality Layer
   ============================================ */

/* -- Delight CSS Variables -- */
:root {
  --color-morning-start: #F3F6EA;
  --color-morning-end: #F7FAF0;
  --color-evening-start: #EDF0E0;
  --color-evening-end: #E6EAD6;
  --color-confetti-1: #E87A3D;
  --color-confetti-2: #D4A574;
  --color-confetti-3: #6F4E37;
  --color-confetti-4: #F5DEB3;
  --color-confetti-5: #FFD700;
  --color-steam: rgba(255, 255, 255, 0.6);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-spring: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ============================================
   A. Welcome / Onboarding
   ============================================ */

.welcome-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.welcome-overlay.show {
  opacity: 1;
  pointer-events: auto;
}
.welcome-overlay.dismiss {
  opacity: 0;
  pointer-events: none;
}

.welcome-card {
  text-align: center;
  padding: 32px 28px;
  max-width: 320px;
  width: 85%;
}

.welcome-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  animation: welcomeFloat 3s ease-in-out infinite;
}

@keyframes welcomeFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.welcome-greeting {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
  animation: fadeSlideUp 0.6s ease both;
  animation-delay: 0.1s;
}

.welcome-subtitle {
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-bottom: 28px;
  animation: fadeSlideUp 0.6s ease both;
  animation-delay: 0.25s;
}

.welcome-btn {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  border: none;
  padding: 14px 40px;
  border-radius: var(--radius-xl);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  animation: fadeSlideUp 0.6s ease both;
  animation-delay: 0.4s;
  transition: transform 0.2s var(--ease-bounce), box-shadow 0.2s ease;
}
.welcome-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 6px 20px rgba(111, 78, 55, 0.3);
}
.welcome-btn:active {
  transform: scale(0.96);
}

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

/* -- First-time hint animation for recipe section -- */
.recipe-section.hint-glow .recipe-section-title::after {
  content: ' 👆';
  display: inline-block;
  animation: hintBounce 1.2s ease-in-out infinite;
}

@keyframes hintBounce {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(-4px); opacity: 1; }
}

/* ============================================
   B. Timer Page Delight
   ============================================ */

/* -- Enhanced Recipe Card Selection -- */
.recipe-card {
  position: relative;
  overflow: hidden;
}

/* Ripple on selection */
.recipe-card .card-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(111, 78, 55, 0.15);
  transform: scale(0);
  animation: cardRipple 0.6s ease-out forwards;
  pointer-events: none;
}

@keyframes cardRipple {
  to { transform: scale(4); opacity: 0; }
}

/* Active card shimmer */
.recipe-card.active {
  position: relative;
}
.recipe-card.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: cardShimmer 2s ease-in-out infinite;
}

@keyframes cardShimmer {
  0% { left: -100%; }
  100% { left: 200%; }
}

/* Selected card pulse dot */
.recipe-card.active .recipe-name::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
  margin-right: 6px;
  vertical-align: middle;
  animation: pulseDot 1.5s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.3); }
}

/* -- Start Button Anticipation -- */
.btn-start {
  position: relative;
  transition: transform 0.2s var(--ease-bounce), box-shadow 0.3s ease;
}
.btn-start:hover {
  box-shadow: 0 6px 24px rgba(111, 78, 55, 0.35);
  transform: scale(1.03);
}
.btn-start:active {
  transform: scale(0.95);
}
.btn-start::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: calc(var(--radius-xl) + 4px);
  border: 2px solid transparent;
  transition: all 0.4s ease;
}
.btn-start.pulse-ready::after {
  border-color: rgba(111, 78, 55, 0.3);
  animation: startPulse 2s ease-in-out infinite;
}

@keyframes startPulse {
  0%, 100% { inset: -4px; opacity: 0.3; }
  50% { inset: -10px; opacity: 0; }
}

/* -- Progress Ring Breathing -- */
.progress-ring-fill.breathing {
  animation: ringBreathe 2s ease-in-out infinite;
}

@keyframes ringBreathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

/* -- Phase Transition Glow -- */
.phase-transition-flash {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 90;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.phase-transition-flash.fire {
  opacity: 1;
  background: radial-gradient(circle at 50% 40%, var(--flash-color, rgba(232,122,61,0.12)) 0%, transparent 60%);
  animation: flashPulse 0.8s ease-out forwards;
}

@keyframes flashPulse {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* -- Timer Number Pop on Second Change -- */
.timer-seconds.pop {
  animation: numberPop 0.15s ease-out;
}

@keyframes numberPop {
  0% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* ============================================
   C. Completion Celebration — THE Moment
   ============================================ */

/* -- Celebration Canvas (confetti) -- */
#celebration-canvas {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 210;
  pointer-events: none;
}

/* -- Steam Wisps -- */
.steam-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 205;
}

.steam-wisp {
  position: absolute;
  width: 30px;
  height: 40px;
  background: var(--color-steam);
  border-radius: 50%;
  filter: blur(12px);
  opacity: 0;
  animation: steamRise 3s ease-out forwards;
}

.steam-wisp:nth-child(1) { left: 0; animation-delay: 0s; }
.steam-wisp:nth-child(2) { left: 20px; animation-delay: 0.4s; }
.steam-wisp:nth-child(3) { left: -20px; animation-delay: 0.8s; }
.steam-wisp:nth-child(4) { left: 10px; animation-delay: 1.1s; }
.steam-wisp:nth-child(5) { left: -10px; animation-delay: 1.5s; }

@keyframes steamRise {
  0% { transform: translateY(0) scale(0.5); opacity: 0; }
  20% { opacity: 0.5; }
  80% { opacity: 0.15; }
  100% { transform: translateY(-120px) scale(2.5); opacity: 0; }
}

/* -- Satisfaction Ripple on Checkmark -- */
.complete-icon.satisfaction {
  position: relative;
}
.complete-icon.satisfaction::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 3px solid var(--color-success);
  animation: satisfactionRipple 1s ease-out forwards;
}

@keyframes satisfactionRipple {
  0% { inset: -4px; opacity: 0.8; }
  100% { inset: -30px; opacity: 0; }
}

/* -- Enhanced Complete Card -- */
.complete-card.enhanced {
  position: relative;
  overflow: visible;
}
.complete-card.enhanced .complete-brew-stats {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 12px 0 20px;
  flex-wrap: wrap;
}
.complete-card.enhanced .brew-stat-item {
  text-align: center;
  min-width: 60px;
}
.complete-card.enhanced .brew-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-primary);
}
.complete-card.enhanced .brew-stat-label {
  font-size: 11px;
  color: var(--color-text-muted);
}
.complete-card.enhanced .complete-rating {
  font-size: 28px;
  letter-spacing: 2px;
  margin-bottom: 4px;
  animation: starsAppear 0.4s ease both;
  animation-delay: 0.6s;
  display: flex;
  justify-content: center;
  gap: 4px;
}
.complete-card.enhanced .complete-rating svg {
  width: 20px;
  height: 20px;
  color: #FFD700;
  fill: #FFD700;
}

@keyframes starsAppear {
  from { opacity: 0; transform: scale(0.3) rotate(-10deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

/* -- Brew complete badge glow -- */
.complete-icon.glow {
  animation: completeGlow 2s ease-in-out infinite;
}

@keyframes completeGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.4); }
  50% { box-shadow: 0 0 0 16px rgba(76, 175, 80, 0); }
}

/* ============================================
   D. Enhanced Toast Notifications
   ============================================ */

.stage-toast.enhanced {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: rgba(45, 45, 45, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stage-toast .toast-icon {
  font-size: 16px;
  flex-shrink: 0;
  animation: toastIconPop 0.4s var(--ease-spring);
  display: inline-flex;
  align-items: center;
}
.stage-toast .toast-icon svg {
  width: 18px;
  height: 18px;
  color: #fff;
}

@keyframes toastIconPop {
  0% { transform: scale(0); }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Update toast (non-intrusive top slide) */
.update-toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-120%);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 250;
  white-space: nowrap;
  transition: transform 0.4s var(--ease-bounce);
  display: flex;
  align-items: center;
  gap: 8px;
}
.update-toast.show {
  transform: translateX(-50%) translateY(0);
}
.update-toast .toast-icon {
  display: inline-flex;
  align-items: center;
}
.update-toast .toast-icon svg {
  width: 16px;
  height: 16px;
  color: var(--color-primary);
}

/* ============================================
   E. Calculator Page Personality
   ============================================ */

/* -- Step Button Tactile Pop -- */
.calc-btn-step.pop {
  animation: stepPop 0.25s var(--ease-spring);
}

@keyframes stepPop {
  0% { transform: scale(1); }
  40% { transform: scale(0.85); }
  100% { transform: scale(1); }
}

/* -- Ratio Button Selection Spark -- */
.ratio-btn {
  position: relative;
  overflow: hidden;
}
.ratio-btn .ratio-spark {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  pointer-events: none;
  animation: sparkBurst 0.5s ease-out forwards;
}

@keyframes sparkBurst {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--sx), var(--sy)) scale(0); opacity: 0; }
}

/* -- Result Number Counting Animation -- */
.result-value.counting {
  transition: none;
  animation: none;
}
.result-value.revealed {
  animation: resultReveal 0.5s var(--ease-bounce);
}

@keyframes resultReveal {
  0% { transform: scale(1.15); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Result section subtle celebration */
.calc-result-section.celebrate {
  animation: calcCelebrate 0.6s ease;
}

@keyframes calcCelebrate {
  0% { box-shadow: var(--shadow-sm); }
  50% { box-shadow: 0 0 0 4px rgba(111, 78, 55, 0.1), var(--shadow-md); }
  100% { box-shadow: var(--shadow-sm); }
}

/* -- Calculator input focus glow -- */
.calc-input:focus {
  animation: inputGlow 0.3s ease;
}

@keyframes inputGlow {
  0% { border-color: var(--color-border); }
  100% { border-color: var(--color-primary); }
}

/* ============================================
   F. Navigation & Tab Transitions
   ============================================ */

/* Tab icon bounce on activation */
.nav-item .nav-icon-bounce {
  display: inline-block;
  animation: navBounce 0.45s var(--ease-spring);
}

@keyframes navBounce {
  0% { transform: scale(1); }
  30% { transform: scale(1.3) translateY(-3px); }
  60% { transform: scale(0.9); }
  100% { transform: scale(1) translateY(0); }
}

/* Active tab glow indicator */
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--color-primary);
  border-radius: 0 0 3px 3px;
  animation: navIndicatorSlide 0.35s var(--ease-bounce);
}

@keyframes navIndicatorSlide {
  from { width: 0; opacity: 0; }
  to { width: 24px; opacity: 1; }
}

/* Page transition — warm slide */
.page {
  animation: pageEnter 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

/* ============================================
   G. Profile Page Personality
   ============================================ */

/* Avatar hover tilt */
.profile-avatar {
  transition: transform 0.3s ease, opacity 0.3s ease;
  cursor: default;
}
.profile-avatar:hover {
  transform: scale(1.05);
  opacity: 0.9;
}
.profile-avatar.secret-wiggle {
  animation: logoWiggle 0.5s ease;
}

@keyframes logoWiggle {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-8deg) scale(1.1); }
  40% { transform: rotate(6deg) scale(1.05); }
  60% { transform: rotate(-4deg); }
  80% { transform: rotate(2deg); }
}

/* Version spark on update check */
.about-version.spark {
  animation: versionSpark 0.6s var(--ease-spring);
}

@keyframes versionSpark {
  0%, 100% { color: var(--color-text-muted); }
  50% { color: var(--color-accent); transform: scale(1.1); }
}

/* ============================================
   H. Time-of-Day Theme Hints
   ============================================ */

/* Morning warm tones */
body.theme-morning {
  --color-bg-dynamic: linear-gradient(180deg, var(--color-morning-start) 0%, var(--color-bg) 60%);
}
body.theme-afternoon {
  --color-bg-dynamic: linear-gradient(180deg, var(--color-morning-end) 0%, var(--color-bg) 60%);
}
body.theme-evening {
  --color-bg-dynamic: linear-gradient(180deg, var(--color-evening-start) 0%, var(--color-evening-end) 60%);
}

body.theme-morning .app,
body.theme-afternoon .app,
body.theme-evening .app {
  background: var(--color-bg-dynamic, var(--color-bg));
}

/* ============================================
   I. Easter Eggs Visual Effects
   ============================================ */

/* Rainbow mode (Konami code) */
body.rainbow-mode {
  animation: rainbowBg 5s linear infinite;
}

@keyframes rainbowBg {
  0% { background-color: #FFE0E0; }
  16% { background-color: #FFF5E0; }
  32% { background-color: #E8FFE0; }
  48% { background-color: #E0F5FF; }
  64% { background-color: #E8E0FF; }
  80% { background-color: #FFE0F5; }
  100% { background-color: #FFE0E0; }
}

body.rainbow-mode .app {
  background: transparent;
}

/* Floating emoji (triple-tap logo) */
.floating-emoji {
  position: fixed;
  font-size: 24px;
  pointer-events: none;
  z-index: 500;
  animation: floatUp 2.5s ease-out forwards;
}
.floating-emoji svg {
  width: 24px;
  height: 24px;
  color: var(--color-primary);
}

@keyframes floatUp {
  0% { transform: translateY(0) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translateY(-200px) scale(0.5) rotate(20deg); opacity: 0; }
}

/* Brew counter badge */
.brew-streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--color-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  animation: badgeAppear 0.5s var(--ease-spring);
}

@keyframes badgeAppear {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Secret stats reveal animation */
.stats-reveal {
  animation: statsSlideDown 0.5s var(--ease-bounce);
}

@keyframes statsSlideDown {
  from { max-height: 0; opacity: 0; transform: translateY(-10px); }
  to { max-height: 200px; opacity: 1; transform: translateY(0); }
}

/* ============================================
   J. Accessibility & Reduced Motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .welcome-overlay {
    transition: opacity 0.01ms;
  }

  .welcome-overlay.show {
    opacity: 1;
  }

  .update-toast {
    transition: transform 0.01ms;
  }

  .recipe-card.active::after {
    animation: none;
    display: none;
  }

  .btn-start.pulse-ready::after {
    animation: none;
  }

  #celebration-canvas {
    display: none;
  }

  .steam-container {
    display: none;
  }

  body.rainbow-mode {
    animation: none;
    background-color: #F4F7EC;
  }
}

/* ============================================
   K. Login Dialog (SSM Auth Integration)
   ============================================ */

/* -- Global Loading Overlay -- */
.global-loading {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 400;
  backdrop-filter: blur(2px);
}
.global-loading.show {
  display: flex;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* -- Login Overlay -- */
.login-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
  animation: fadeIn 0.25s ease;
}
.login-overlay.show {
  display: flex;
}

/* -- Login Card -- */
.login-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: 32px 28px;
  max-width: 340px;
  width: 100%;
  animation: loginSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes loginSlideUp {
  from { transform: translateY(24px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* -- Login Header -- */
.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  overflow: hidden;
}

.login-logo svg {
  width: 28px;
  height: 28px;
  color: #fff;
}
.login-logo-img {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-lg);
  object-fit: cover;
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--color-text);
}

.login-subtitle {
  font-size: 13px;
  color: var(--color-text-muted);
}

/* -- Login Form Fields -- */
.login-field {
  margin-bottom: 16px;
}

.login-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}

.login-input {
  width: 100%;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: var(--color-bg);
  color: var(--color-text);
  box-sizing: border-box;
}

.login-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(111, 78, 55, 0.12);
}

.login-input::placeholder {
  color: var(--color-text-muted);
}

/* -- Login Error Message -- */
.login-error {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #FDECEA;
  border: 1px solid #F5C6CB;
  color: #C53030;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  animation: shakeError 0.4s ease;
}

.login-error svg {
  flex-shrink: 0;
  color: #C53030;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-5px); }
  30% { transform: translateX(5px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
  90% { transform: translateX(2px); }
}
@keyframes fadeOutUp {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-12px); }
}

/* -- Login Submit Button -- */
.login-submit-btn {
  width: 100%;
  padding: 13px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  border-radius: var(--radius-md) !important;
  position: relative;
  transition: all 0.2s ease;
}

.login-submit-btn .btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* -- Login Hint Text -- */
.login-hint {
  text-align: center;
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 16px;
  margin-bottom: 0;
}

/* -- Logged-in state on profile header -- */
.profile-stats-card.logged-in .profile-greeting::after {
  content: ' ✓';
  color: var(--color-accent);
  font-weight: 700;
  font-size: 14px;
  vertical-align: super;
}

/* Login trigger button (on profile stats card when not logged in) */
.profile-login-hint {
  text-align: center;
  margin-top: 12px;
  font-size: 13px;
  color: var(--color-primary);
  cursor: pointer;
  font-weight: 500;
  display: none;
}
.profile-stats-card:not(.logged-in) .profile-login-hint {
  display: block;
}
.profile-login-hint:hover {
  text-decoration: underline;
}

/* Avatar picker option hover */
.av-opt:hover {
  background: var(--color-bg);
}
#ap-logout:hover {
  text-decoration: underline;
}

/* API error toast for network issues */
.api-error-toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-text);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  z-index: 260;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
  max-width: 90vw;
}
.api-error-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Logout section - only visible when logged in */
.profile-logout-section {
  text-align: center;
  margin-top: 24px;
  margin-bottom: 16px;
  display: none;
}
.profile-stats-card.logged-in ~ .profile-logout-section {
  display: block;
}
.profile-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.profile-logout-btn:hover {
  border-color: var(--color-danger, #e74c3c);
  color: var(--color-danger, #e74c3c);
  background: var(--color-bg-secondary);
}
.profile-logout-btn svg {
  stroke: currentColor;
}
