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

:root {
  --bg: #FFF8F0;
  --text: #2D2D2D;
  --primary: #FF6B6B;
  --secondary: #4ECDC4;
  --accent: #FFE66D;
  --green: #4CAF50;
  --red: #FF5252;
  --card-bg: #FFFFFF;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --radius: 16px;
  --radius-sm: 12px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans TC', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

#app {
  width: 100%;
  max-width: 420px;
  padding: 20px 16px;
  position: relative;
}

/* === Screens === */
.screen {
  display: none;
  animation: fadeSlideIn 0.4s ease-out;
}
.screen.active { display: block; }

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

/* === Landing === */
.landing-content {
  text-align: center;
  padding-top: 10vh;
}

.landing-hero {
  width: 180px;
  height: auto;
  animation: bounce 2s ease-in-out infinite;
}

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

h1 {
  font-size: 2rem;
  line-height: 1.3;
  margin: 16px 0 8px;
  background: linear-gradient(135deg, var(--primary), #FF8E53);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: #888;
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.price-banner {
  background: linear-gradient(135deg, #2D2D2D, #444);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.price-banner strong { color: var(--accent); font-size: 1.1rem; }

/* === Price Change Badge === */
.price-change {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
}
.price-change.up { background: rgba(255,82,82,0.2); color: var(--red); }
.price-change.down { background: rgba(76,175,80,0.2); color: var(--green); }

.result-change {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.result-change.up { color: var(--red); }
.result-change.down { color: var(--green); }

/* === Buttons === */
.btn-primary {
  width: 100%;
  padding: 16px;
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary), #FF8E53);
  color: white;
  cursor: pointer;
  transition: var(--transition);
}
.btn-primary:hover { transform: scale(1.02); box-shadow: 0 6px 24px rgba(255,107,107,0.3); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  font-weight: 600;
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  transition: var(--transition);
}
.btn-secondary:hover { background: var(--primary); color: white; }

/* === Step Screen === */
.step-header { margin-bottom: 24px; }

.progress-bar {
  width: 100%;
  height: 6px;
  background: #E8E8E8;
  border-radius: 3px;
  margin-bottom: 20px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--secondary), var(--primary));
  border-radius: 3px;
  transition: width 0.4s ease;
}

.step-header h2 {
  font-size: 1.5rem;
  text-align: center;
}

/* === Options Grid === */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.option-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 12px;
  background: var(--card-bg);
  border: 2px solid #E8E8E8;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.95rem;
  text-align: center;
  min-height: 90px;
  box-shadow: var(--shadow);
}
.option-btn:hover { border-color: var(--primary); transform: translateY(-2px); }
.option-btn:active { transform: scale(0.97); }
.option-btn.selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, #FFF0F0, #FFE8E8);
}
.option-btn .option-label { font-size: 1.2rem; margin-bottom: 4px; }
.option-btn .option-amount { color: #888; font-size: 0.85rem; }

.option-btn.custom-trigger { border-style: dashed; }

/* === Custom Input === */
.custom-input-area {
  margin-top: 16px;
  padding: 16px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.custom-input-area.hidden { display: none; }
.custom-input-area label { font-size: 0.85rem; color: #888; display: block; margin-bottom: 8px; }
.custom-input-area input {
  width: 100%;
  padding: 12px;
  font-size: 1.2rem;
  border: 2px solid #E8E8E8;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}
.custom-input-area input:focus { border-color: var(--primary); }
.custom-input-area input.input-error { border-color: var(--primary); background: #FFF0F0; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* === Result Screen === */
.result-card {
  background: var(--card-bg);
  border-radius: 24px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

.result-character {
  width: 280px;
  height: auto;
  margin: 0 auto 16px;
  display: block;
}

.result-title {
  font-size: 1.4rem;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.result-liters { margin-bottom: 16px; }
.result-number {
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), #FF8E53);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.result-unit { display: block; font-size: 0.9rem; color: #888; margin-top: 4px; }

.result-quote {
  font-size: 1rem;
  color: #666;
  margin-bottom: 16px;
  padding: 0 8px;
  line-height: 1.5;
}

.result-context {
  font-size: 0.82rem;
  color: #888;
  line-height: 1.6;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: #F8F8F8;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
  text-align: left;
}

.result-meta {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 0.75rem;
  color: #AAA;
  margin-bottom: 8px;
}

.result-cta {
  font-size: 0.8rem;
  color: #FF6B35;
  font-weight: 600;
  margin-top: 8px;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* === Stale data indicator === */
.stale-notice {
  text-align: center;
  font-size: 0.75rem;
  color: #CC8800;
  margin-top: 8px;
}
