*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-color: #f2f2f2;
  --text-color: #000000;
  --card-bg: #ffffff;
  --card-border: #e0e0e0;
  --input-bg: #ffffff;
  --input-border: #d0d0d0;
  --primary-color: #D400FF;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;  
  background: var(--bg-color);
  color: var(--text-color);
  overflow: hidden;
}

body {
  display: flex;
  justify-content: center;
  align-items: stretch;
  min-height: 100vh;
}

.app {
  width: 100%;
  height: 100%;
  max-width: 428px;
  background: var(--bg-color);
  border-radius: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: none;
  position: relative;
}

.app-header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-color) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,201,177,0.2);
  position: relative;
}

.app-header .logo-img {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  object-fit: contain;
  position: absolute;
  left: 16px;
}

.app-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  letter-spacing: 1px;
}

.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  padding: 8px 6px 75px;
  gap: 6px;
  height: 100%;
}

.screen.active {
  display: flex;
}

.card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 10px;
}

.data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
  color: var(--text-color);
}

.data-row .label {
  color: var(--text-color);
  font-weight: 500;
  opacity: 0.8;
}

.data-row .value {
  font-weight: 700;
  color: var(--primary-color);
}

.progress-container {
  margin: 8px 0;
}

.progress-label {
  font-size: 13px;
  color: var(--text-color);
  font-style: italic;
  margin-bottom: 3px;
  opacity: 0.8;
}

.progress-bar-bg {
  background: #e0e0e0;
  border-radius: 4px;
  height: 8px;
  width: 100%;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary-color);
  border-radius: 4px;
  width: 0%;
}

.imc-bar-container {
  margin-top: 12px;
  position: relative;
}

.imc-bar {
  display: flex;
  gap: 2px;
  height: 24px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  margin-bottom: 32px;
}

.imc-zone {
  flex: 1;
  border-radius: 8px;
}

.imc-underweight {
  background: #2196F3;
}

.imc-normal {
  background: #4CAF50;
}

.imc-overweight {
  background: #FF9800;
}

.imc-obese-moderate {
  background: #FF5722;
}

.imc-obese-severe {
  background: #f44336;
}

.imc-pointer {
  position: absolute;
  width: 3px;
  height: 28px;
  background: var(--text-color);
  border-radius: 2px;
  top: -2px;
  left: 0%;
  transform: translateX(-50%);
  transition: left 0.3s ease;
}

.imc-category-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
  gap: 2px;
  text-align: center;
}

.imc-category-labels span {
  flex: 1;
}

.imc-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  opacity: 0.7;
  gap: 2px;
}

.imc-range-labels span {
  flex: 1;
  text-align: center;
}

.score-big {
  font-size: 48px;
  font-weight: 700;
  color: var(--primary-color);
  text-align: center;
  line-height: 1.1;
  padding: 16px 0;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.score-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 6px;
}

.btn-teal {
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  text-align: center;
  letter-spacing: 0.3px;
  transition: filter 0.2s ease, transform 0.2s ease;
  flex-shrink: 0;
}

.btn-teal:hover {
  filter: brightness(0.85);
}

.btn-teal:active {
  transform: scale(0.98);
  filter: brightness(0.75);
}

.session-item {
  background: var(--input-bg);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--text-color);
  text-align: center;
  border: 1px solid var(--input-border);
}

.ia-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.ia-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 6px;
}

.ia-text {
  font-size: 13px;
  color: var(--text-color);
  line-height: 1.5;
  flex: 1;
  display: flex;
  align-items: center;
  opacity: 0.9;
}

.heatmap-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.heatmap-cell {
  width: 22px;
  height: 22px;
  border-radius: 4px;
}

.heatmap-cell.active { background: var(--primary-color); }
.heatmap-cell.active-mid { background: #D400FF; opacity: 0.75; }
.heatmap-cell.inactive { background: #d0d0d0; }

.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 0 6px;
  z-index: 10;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  flex: 1;
  padding: 2px 0;
}

.nav-icon {
  font-size: 22px;
  line-height: 1;
}

.nav-label {
  font-size: 10px;
  color: var(--text-color);
  opacity: 0.6;
}

.nav-item.active .nav-label {
  color: #D400FF;
  font-weight: 700;
}

.obj-percent {
  font-size: 48px;
  font-weight: 700;
  color: #D400FF;
  text-align: center;
  padding: 16px 0;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-params {
  background: #D400FF;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: center;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  justify-content: center;
  align-items: flex-end;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--card-bg);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 428px;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease-out;
}

.modal-form {
  border-radius: 16px;
  margin: 20px;
  max-height: none;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--card-border);
  gap: 10px;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-color);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: #000;
}

.modal-body {
  padding: 20px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  box-sizing: border-box;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--text-color);
}

.form-group input:focus {
  outline: none;
  border-color: #D400FF;
  box-shadow: 0 0 0 3px rgba(0, 201, 177, 0.2);
}

.radio-group {
  display: flex;
  gap: 12px;
  flex-direction: column;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-color);
}

.radio-label input[type="radio"] {
  width: auto;
  cursor: pointer;
  accent-color: #D400FF;
}

.radio-label span {
  font-weight: 500;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 250px;
  margin: 12px 0;
}

.data-item {
  background: rgba(212, 0, 255, 0.1);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  border: 1px solid rgba(212, 0, 255, 0.2);
}

.data-item .date {
  font-weight: 600;
  color: var(--text-color);
}

.data-item .value {
  color: #D400FF;
  font-weight: 700;
}

.average-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.avg-stat {
  background: rgba(212, 0, 255, 0.1);
  border-left: 4px solid #D400FF;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.avg-label {
  font-size: 12px;
  color: var(--text-color);
  font-weight: 500;
  opacity: 0.8;
}

.avg-value {
  font-size: 16px;
  font-weight: 700;
  color: #D400FF;
}

#settings-date-format {
  background: var(--input-bg);
  color: var(--text-color);
  border: 1px solid var(--input-border);
}

/* Utility classes for inline styles */
.nutrition-text {
  font-size: 12px;
  margin-top: 4px;
}

.empty-state {
  text-align: center;
  opacity: 0.6;
}

.foods-list-container {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 4px;
}

.session-history-container {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 4px;
}

.goal-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.goal-stat-value {
  font-size: 13px;
  font-weight: 600;
}

.goal-stat-label {
  margin-bottom: 0;
}

.form-group-spacing {
  margin-bottom: 12px;
}

.color-picker-grid {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.color-swatch {
  width: 35px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.color-swatch.color-teal {
  background: #00c9b1;
}

.color-swatch.color-blue {
  background: #2196F3;
}

.color-swatch.color-violet {
  background: #9C27B0;
}

.color-swatch.color-green {
  background: #4CAF50;
}

.color-swatch.color-orange {
  background: #FF9800;
}

.color-swatch.color-red {
  background: #f44336;
}

.color-swatch.color-pink {
  background: #E91E63;
}

.color-swatch.color-magenta {
  background: #d400ff;
}

.sleep-duration-container {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sleep-input-group {
  flex: 1;
}

.sleep-input-group input {
  width: 100%;
}

.sleep-input-label {
  font-size: 11px;
  opacity: 0.7;
}

.food-details-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-button-spacing {
  margin-bottom: 12px;
}

.search-results-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (max-width: 768px) {
  body {
    padding: 0;
  }

  .app {
    border-radius: 0;
  }

  .app-header {
    padding: 10px 14px;
    gap: 10px;
  }

  .app-header .logo-img {
    width: 20px;
    height: 20px;
  }

  .app-header h1 {
    font-size: 20px;
  }

  .screen {
    padding: 8px 6px 70px;
    gap: 6px;
  }

  .card {
    border-radius: 10px;
    padding: 10px 12px;
  }

  .card-title {
    font-size: 15px;
  }

  .data-row {
    font-size: 13px;
    padding: 4px 0;
  }

  .score-big {
    font-size: 38px;
  }

  .score-label {
    font-size: 14px;
  }

  .btn-teal {
    padding: 11px 16px;
    font-size: 14px;
    border-radius: 10px;
  }

  .nav-label {
    font-size: 9px;
  }

  .nav-icon {
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 0;
  }

  html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
  }

  .app {
    width: 100%;
    height: 100%;
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
  }

  .app-header {
    padding: 8px 10px;
  }

  .app-header h1 {
    font-size: 18px;
  }

  .screen {
    padding: 8px 6px 70px;
    gap: 6px;
    height: calc(100% - 60px);
  }

  .card {
    padding: 10px 12px;
    border-radius: 10px;
  }

  .card-title {
    font-size: 13px;
    margin-bottom: 6px;
  }

  .data-row {
    font-size: 12px;
    padding: 3px 0;
  }

  .score-big {
    font-size: 34px;
  }

  .progress-label {
    font-size: 11px;
  }

  .btn-teal {
    padding: 10px 14px;
    font-size: 13px;
  }

  .modal-content {
    border-radius: 16px 16px 0 0;
    max-height: 85vh;
  }

  .modal-header {
    padding: 12px 14px;
  }

  .modal-header h2 {
    font-size: 16px;
  }

  .modal-body {
    padding: 14px;
  }

  .form-group input {
    font-size: 13px;
    padding: 9px 11px;
  }

  .bottom-nav {
    padding: 6px 0 4px;
    height: 60px;
  }

  .nav-label {
    font-size: 8px;
  }

  .nav-icon {
    font-size: 18px;
  }

  canvas {
    max-height: 200px !important;
  }
}

