:root {
  --primary: #FF6B6B;
  --primary-glow: rgba(255, 107, 107, 0.4);
  --bg-dark: #121212;
  --bg-darker: #000000;
  --panel-bg: rgba(255, 255, 255, 0.05);
  --panel-border: rgba(255, 255, 255, 0.1);
  --text-main: #FFFFFF;
  --text-muted: #A0A0B0;
  --success: #4ECDC4;
  --warning: #FCA311;
  --border-radius-lg: 24px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-darker);
  color: var(--text-main);
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

/* App Shell */
#app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg-dark);
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Global Glass Background element */
.ambient-bg {
  position: fixed;
  top: -20%;
  right: -20%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  filter: blur(80px);
  z-index: 0;
  pointer-events: none;
}

/* Screens */
.screen {
  display: none;
  flex: 1;
  padding: 20px 20px 100px;
  z-index: 10;
  animation: fadeIn 0.4s ease forwards;
}

.screen.active {
  display: block;
}

.screen.flex-active {
  display: flex !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Welcome Screen */
.welcome-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('https://images.unsplash.com/photo-1556910103-1c02745a872f?w=800&q=80') center/cover;
  z-index: 0;
}

.welcome-bg::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* Create a dark gradient overlay so text is readable */
  background: linear-gradient(to top, rgba(0, 0, 0, 1) 15%, rgba(0, 0, 0, 0.5) 50%, rgba(0, 0, 0, 0.3) 100%);
}

.welcome-content {
  position: relative;
  z-index: 10;
  padding: 40px 30px 80px;
  text-align: center;
}

.welcome-title {
  font-size: 42px;
  font-weight: 800;
  margin: 0 0 10px;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
  letter-spacing: 1px;
}

.welcome-subtitle {
  font-size: 18px;
  color: #fff;
  margin: 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.features-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.feature-item {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 15px;
  display: flex;
  align-items: flex-start;
  gap: 15px;
  backdrop-filter: blur(10px);
}

.feature-icon {
  font-size: 24px;
  background: rgba(255, 107, 107, 0.2);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

.feature-text h4 {
  margin: 0 0 5px 0;
  font-size: 16px;
  color: var(--primary);
}

.feature-text p {
  margin: 0;
  font-size: 13px;
  color: #ccc;
  line-height: 1.5;
}

/* Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  background: rgba(18, 18, 18, 0.85);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-around;
  padding: 15px 0 25px;
  z-index: 50;
}

.nav-item {
  color: var(--text-muted);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.nav-item.active {
  color: var(--primary);
  font-weight: 600;
}

.nav-item svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* Home Screen: Recipe Grid */
.header h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 5px;
}

.header p {
  color: var(--text-muted);
  margin-top: 0;
}

.recipe-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-top: 20px;
}

.recipe-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s;
}

.recipe-card:active {
  transform: scale(0.96);
}

.recipe-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
}

.recipe-info {
  padding: 12px;
}

.recipe-info h3 {
  margin: 0 0 5px 0;
  font-size: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recipe-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

/* Detail Screen */
.detail-header {
  margin: -20px -20px 20px -20px;
  height: 250px;
  position: relative;
}

.detail-header img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to top, var(--bg-dark), transparent);
}

.back-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 40px;
  height: 40px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
  cursor: pointer;
}

.detail-title {
  margin-top: -40px;
  position: relative;
  z-index: 2;
}

.detail-title h1 {
  font-size: 32px;
  margin: 0 0 10px;
}

.detail-tags {
  display: flex;
  gap: 10px;
  margin-bottom: 25px;
}

.detail-tags span {
  padding: 4px 10px;
  background: var(--panel-bg);
  border-radius: 10px;
  font-size: 13px;
  color: var(--warning);
}

.section-title {
  font-size: 20px;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 10px;
}

.ingredient-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Timeline Overview */
.timeline {
  margin: 15px 0 25px 0;
  position: relative;
  padding-left: 20px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: var(--panel-border);
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-darker);
  border: 2px solid var(--primary);
  z-index: 2;
}

.timeline-time {
  font-size: 13px;
  color: var(--warning);
  font-weight: 600;
  margin-bottom: 4px;
}

.timeline-title {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 6px;
}

.timeline-desc {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.5;
}

.timeline-parallel {
  margin-top: 8px;
  font-size: 13px;
  color: #ddd;
  background: rgba(252, 163, 17, 0.1);
  padding: 8px 12px;
  border-radius: 8px;
  border-left: 3px solid var(--warning);
}


.btn {
  width: 100%;
  padding: 18px;
  border-radius: 16px;
  border: none;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 15px;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 8px 20px var(--primary-glow);
}

.btn-secondary {
  background: var(--panel-bg);
  color: var(--text-main);
  border: 1px solid var(--panel-border);
}

/* Shopping List Screen */
.cart-item {
  background: var(--panel-bg);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.cart-item.checked {
  opacity: 0.5;
}

.cart-item.checked .cart-text {
  text-decoration: line-through;
}

.checkbox {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid var(--text-muted);
  display: flex;
  justify-content: center;
  align-items: center;
}

.cart-item.checked .checkbox {
  background: var(--success);
  border-color: var(--success);
}

.cart-item.checked .checkbox::after {
  content: "✓";
  color: #000;
  font-weight: bold;
}

/* Cooking Navigator Fullscreen UX (from prototype) */
#nav-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: 100;
  background: var(--bg-darker);
  display: none;
  flex-direction: column;
}

#nav-screen.active {
  display: flex;
}

.nav-top {
  padding: 40px 20px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-progress-bar {
  display: flex;
  gap: 4px;
  padding: 0 20px 15px;
}

.nav-progress-step {
  height: 4px;
  flex: 1;
  background: var(--panel-border);
  border-radius: 2px;
  transition: all 0.3s;
}

.nav-progress-step.completed {
  background: var(--success);
}

.nav-progress-step.active {
  background: var(--warning);
  box-shadow: 0 0 10px var(--warning);
}

.nav-close {
  width: 40px;
  height: 40px;
  border-radius: 20px;
  background: var(--panel-bg);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
}

.step-card {
  margin: 10px 20px 20px;
  padding: 30px;
  background: var(--panel-bg);
  border-radius: 32px;
  border: 1px solid var(--panel-border);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.nav-step-icon {
  width: 90px;
  height: 90px;
  border-radius: 45px;
  margin: 0 auto 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 45px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--panel-border);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

@keyframes animCut {

  0%,
  100% {
    transform: translateY(0) rotate(0);
  }

  25% {
    transform: translateY(-10px) rotate(-5deg);
  }

  50% {
    transform: translateY(5px) rotate(5deg);
  }
}

.anim-cut {
  animation: animCut 0.4s ease-in-out infinite;
}

@keyframes animFry {

  0%,
  100% {
    transform: translate(0, 0);
  }

  25% {
    transform: translate(-3px, -3px);
  }

  50% {
    transform: translate(3px, 3px);
  }

  75% {
    transform: translate(-2px, 2px);
  }
}

.anim-fry {
  animation: animFry 0.2s infinite;
}

@keyframes animBoil {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.05);
    opacity: 0.9;
  }
}

.anim-boil {
  animation: animBoil 1.5s ease-in-out infinite;
}

.step-num {
  color: var(--primary);
  font-weight: 800;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.step-action {
  font-size: 38px;
  font-weight: 800;
  margin: 10px 0;
}

.step-desc {
  font-size: 18px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Timer */
.timer-container {
  display: flex;
  justify-content: center;
  margin: 30px 0;
}

.timer-circle {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: conic-gradient(var(--warning) 100%, #222 0);
  display: flex;
  justify-content: center;
  align-items: center;
}

.timer-inner {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: var(--bg-darker);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.timer-time {
  font-size: 56px;
  font-weight: 800;
  color: var(--warning);
  font-variant-numeric: tabular-nums;
}

.timer-label {
  font-size: 14px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.parallel-task {
  background: rgba(252, 163, 17, 0.1);
  border-left: 4px solid var(--warning);
  padding: 15px;
  border-radius: 12px;
  margin-top: 20px;
}

.parallel-task span {
  color: var(--warning);
  font-weight: bold;
  font-size: 14px;
}

.parallel-task p {
  margin: 5px 0 0;
  color: #ddd;
  font-size: 15px;
}

.nav-bottom {
  margin-top: auto;
  padding: 20px;
}

.nav-next-btn {
  width: 100%;
  padding: 25px;
  border-radius: 28px;
  background: var(--primary);
  color: white;
  font-size: 24px;
  font-weight: 800;
  border: none;
  box-shadow: 0 10px 30px var(--primary-glow);
}

.lang-toggle-btn {
  position: absolute;
  top: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid var(--panel-border);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  z-index: 10;
}

.search-container {
  position: relative;
  margin: 15px 0;
}

#recipe-search {
  width: 100%;
  padding: 15px 20px 15px 45px;
  border-radius: 16px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-color);
  font-size: 16px;
  transition: border-color 0.3s;
}

#recipe-search:focus {
  outline: none;
  border-color: var(--primary);
}

.search-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 5px;
}

.category-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  white-space: nowrap;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s ease;
}

.chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}