* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
}

body { 
  background-color: #e0e0e0; 
  display: flex; 
  justify-content: center; 
  align-items: center; 
  height: 100vh; 
}

/* Phone Container */
.screen {
  display: none; 
  width: 100%; 
  max-width: 400px; 
  height: 850px;
  background-color: #fff; 
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  overflow: hidden; 
  flex-direction: column;
  position: relative;
}
.screen.active { display: flex; }

/* --- Login / Signup Styles --- */
#login-screen { 
  background-image: url('https://images.unsplash.com/photo-1504674900247-0877df9cc836?q=80&w=1000&auto=format&fit=crop');
  background-size: cover;
  background-position: center;
  justify-content: center; 
  align-items: center; 
}

#login-screen::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1;
}

.login-box { 
  background: rgba(255, 255, 255, 0.95); 
  padding: 30px; 
  border-radius: 12px; 
  width: 85%; 
  text-align: center; 
  z-index: 2; 
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.login-box h2 { margin-bottom: 20px; color: #333; }
.login-box input { width: 100%; padding: 15px; margin-bottom: 15px; border: 1px solid #ccc; border-radius: 8px; font-size: 16px; outline: none;}
.login-box input:focus { border-color: #4A55A2; }
.login-box button { width: 100%; padding: 15px; background-color: #4A55A2; color: white; border: none; border-radius: 8px; font-size: 18px; cursor: pointer; font-weight: bold;}
.login-box button:hover { background-color: #3b4482; }

.error { color: red; margin-top: 10px; font-weight: bold; font-size: 14px; min-height: 20px;}
.success { color: green; margin-top: 10px; font-weight: bold; font-size: 14px; min-height: 20px;}
.switch-text { color: #4A55A2; margin-top: 15px; font-size: 14px; cursor: pointer; text-decoration: underline; font-weight: bold; }

/* --- Header --- */
.header { 
  background-color: #4A55A2; 
  color: white; 
  padding: 15px 20px; 
  padding-top: 30px; 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  font-size: 20px; 
  font-weight: bold; 
}
.text-btn { background: none; border: none; color: white; cursor: pointer; text-decoration: underline; font-size: 14px;}

/* --- Home Screen --- */
.image-preview { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; color: #999; }
.image-preview .icon { font-size: 60px; }
.hint { text-align: center; color: #333; margin-bottom: 15px; font-size: 14px; }
.button-row { display: flex; gap: 10px; padding: 0 10px 20px 10px; }
.action-btn { flex: 1; height: 80px; border: none; border-radius: 8px; color: white; font-weight: bold; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center;}

/* --- Result Screen --- */
#result-screen .content { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
#result-screen h2 { margin-bottom: 5px; }
#result-screen p { color: #333; margin-bottom: 15px; }
#result-screen .action-btn { flex: none; height: 50px; justify-content: flex-start; padding-left: 20px; }

.premium-banner { background-color: #fcf8e3; border: 1px solid #faebcc; color: #8a6d3b; padding: 15px; border-radius: 4px; font-weight: bold; font-size: 14px; margin-top: 15px; cursor: pointer; transition: background 0.2s;}
.premium-banner:hover { background-color: #fcf0c7; }

/* --- Detail Screen (editable macros) --- */
#detail-screen .content { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
#detail-screen h2 { margin-bottom: 10px; }
#detail-screen .action-btn { flex: none; height: 50px; justify-content: center; padding-left: 0; }

.macro-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.macro-row label {
  font-size: 15px;
  color: #333;
  font-weight: 500;
}
.macro-row input {
  width: 90px;
  padding: 10px;
  font-size: 16px;
  text-align: center;
  border: 1px solid #ccc;
  border-radius: 8px;
  outline: none;
}
.macro-row input:focus { border-color: #4A55A2; }

/* --- Profile select --- */
.macro-row select {
  padding: 10px;
  font-size: 15px;
  border: 1px solid #ccc;
  border-radius: 8px;
  outline: none;
  background: #fff;
  min-width: 120px;
}
.macro-row select:focus { border-color: #4A55A2; }

/* --- Profile screen --- */
#profile-screen .content { padding: 20px; display: flex; flex-direction: column; gap: 6px; }
#profile-screen h2 { margin-bottom: 10px; }
#profile-screen .action-btn { flex: none; height: 50px; justify-content: center; padding-left: 0; }

/* --- Premium Screen --- */
#premium-screen .content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

#premium-screen h2 {
  font-size: 22px;
  margin-bottom: 10px;
}

.features-list {
  margin-bottom: 15px;
  line-height: 1.8;
  font-size: 16px;
  color: #333;
}

#premium-screen .action-btn {
  flex: none;
  height: 50px;
  justify-content: center;
  padding-left: 0;
}

/* --- History List --- */
.list-container { padding: 20px; overflow-y: auto; flex: 1; background: #f9f9f9;}
.history-item { background: #fff; padding: 15px; border-radius: 8px; margin-bottom: 12px; display: flex; justify-content: space-between; border-left: 5px solid #4A55A2; box-shadow: 0 2px 5px rgba(0,0,0,0.05);}
.history-item .food-name { font-weight: bold; color: #333; margin-bottom: 4px;}
.history-item .date { font-size: 12px; color: #888; }

/* --- History Footer --- */
.history-footer { padding: 10px 20px 20px 20px; background: #f9f9f9; }

/* --- Colors --- */
.green { background-color: #5cb85c; }
.dark { background-color: #555; }
.red { background-color: #cc0000; }
.blue { background-color: #5bc0de; }

/* --- Beta Toast --- */
.beta-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #4A55A2;
  color: #fff;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 9999;
  max-width: 320px;
}
.beta-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Focus for label-buttons --- */
.action-btn:focus-visible {
  outline: 3px solid #fff;
  outline-offset: -3px;
}