/* index-page.css — ページ固有スタイル */

/* index-page.css — 食事記録ページ固有スタイル
   Extracted from index.html inline <style> */

/* ページ固有のアニメーション */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.main-title {
  animation: fadeIn 0.5s ease-in;
}

.subtitle {
  animation: fadeIn 0.5s ease-in 0.1s both;
}

.card {
  animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ページ固有スタイル */

.upload-box {
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  background: var(--pill);
  cursor: pointer;
  transition: all 0.3s;
  margin-bottom: 20px;
}

.upload-box:hover,
.upload-box.dragover {
  border-color: var(--acc);
  background: rgba(34, 211, 238, 0.05);
  transform: scale(1.02);
}

.upload-icon {
  font-size: clamp(120px, 22vw, 180px);
  line-height: 1;
  color: var(--acc);
  animation: bounce 2s infinite;
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

.upload-text {
  font-size: 16px;
  font-weight: 500;
  margin-top: 12px;
}

/* ========== 日時編集 ========== */

.datetime-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.3s;
}

.datetime-row:hover {
  border-color: rgba(105, 177, 255, 0.25);
  background: rgba(255, 255, 255, 0.06);
}

.datetime-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.datetime-display {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.datetime-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.datetime-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
}

.datetime-edit-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 16px;
  color: var(--muted);
  transition: all 0.25s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.datetime-edit-btn:hover {
  border-color: var(--acc);
  color: var(--acc);
  background: rgba(105, 177, 255, 0.08);
  transform: scale(1.05);
}

.datetime-edit-btn:active {
  transform: scale(0.97);
}

.datetime-input-wrapper {
  display: none;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(105, 177, 255, 0.3);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 16px;
  animation: fadeIn 0.25s ease;
}

.datetime-input-wrapper.active {
  display: block;
}

.datetime-input-wrapper input[type="datetime-local"] {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.2);
  color: var(--fg);
  font-size: 16px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s;
}

.datetime-input-wrapper input[type="datetime-local"]:focus {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px rgba(105, 177, 255, 0.15);
}

.datetime-input-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: flex-end;
}

.datetime-input-actions button {
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.datetime-confirm-btn {
  background: var(--acc);
  color: #081321;
}

.datetime-confirm-btn:hover {
  opacity: 0.85;
}

.datetime-cancel-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

.datetime-cancel-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ライトテーマ */

[data-theme="light"] .datetime-row {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .datetime-row:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(59, 130, 246, 0.25);
}

[data-theme="light"] .datetime-edit-btn {
  border-color: rgba(0, 0, 0, 0.12);
  color: #6b7280;
}

[data-theme="light"] .datetime-edit-btn:hover {
  border-color: #3b82f6;
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
}

[data-theme="light"] .datetime-input-wrapper {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(59, 130, 246, 0.3);
}

[data-theme="light"] .datetime-input-wrapper input[type="datetime-local"] {
  background: white;
  color: #1f2937;
  border-color: rgba(0, 0, 0, 0.15);
}

.upload-hint {
  font-size: 14px;
  color: var(--muted);
  margin-top: 8px;
}

#fileInput,
#cameraInput {
  display: none;
}

.camera-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.btn-camera {
  background: linear-gradient(135deg, var(--acc), #06b6d4);
  color: #0f172a;
  border: none;
  border-radius: 8px;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-camera:hover {
  background: linear-gradient(135deg, #06b6d4, var(--acc));
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(34, 211, 238, 0.3);
}

.btn-secondary {
  background: var(--pill);
  color: var(--fg);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-secondary:hover {
  background: #374151;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-cancel-record {
  background: transparent !important;
  color: #f59e0b !important;
  border: 1.5px solid #f59e0b !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  padding: 6px 14px !important;
  margin-top: 24px;
  border-radius: 6px !important;
  box-shadow: none !important;
  transform: none !important;
  align-self: flex-start;
}

.btn-cancel-record:hover {
  color: #fff !important;
  background: #f59e0b !important;
  border-color: #f59e0b !important;
  box-shadow: none !important;
  transform: none !important;
}

[data-theme="light"] .btn-cancel-record {
  background: transparent !important;
  color: #e67700 !important;
  border: 1.5px solid #e67700 !important;
}

[data-theme="light"] .btn-cancel-record:hover {
  color: #fff !important;
  background: #e67700 !important;
}

/* 進行表示 */

.analyzing-container {
  display: none;
  text-align: center;
  padding: 40px 20px;
}

.analyzing-container.active {
  display: block;
  animation: fadeIn 0.3s ease-in;
}

.cancel-analysis-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  padding: 10px 28px;
  background: transparent;
  color: var(--red, #ef4444);
  border: 1.5px solid var(--red, #ef4444);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.cancel-analysis-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  transform: translateY(-1px);
}

.circular-progress {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-ring {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.progress-ring-circle {
  stroke: var(--pill);
  fill: transparent;
  stroke-width: 8;
}

.progress-ring-fill {
  stroke: var(--acc);
  fill: transparent;
  stroke-width: 8;
  stroke-dasharray: 565.48;
  stroke-dashoffset: 565.48;
  transition: stroke-dashoffset 0.5s ease;
  stroke-linecap: round;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
  font-weight: 700;
  color: var(--acc);
  width: 100%;
  text-align: center;
  margin: 0;
  padding: 0;
  line-height: 1;
}

.analyzing-stages {
  margin-top: 30px;
  text-align: left;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.stage-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 8px;
  background: var(--pill);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.3s;
}

.stage-item.active {
  border-color: var(--acc);
  background: rgba(34, 211, 238, 0.1);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.8;
  }
}

.stage-item.completed {
  border-color: var(--green);
  background: rgba(34, 197, 94, 0.1);
}

.stage-icon {
  font-size: 24px;
  opacity: 0.5;
  transition: all 0.3s;
}

.stage-item.active .stage-icon,
.stage-item.completed .stage-icon {
  opacity: 1;
}

.stage-text {
  flex: 1;
  font-size: 14px;
}

.stage-check {
  font-size: 20px;
  opacity: 0;
  transition: all 0.3s;
  color: var(--green);
}

.stage-item.completed .stage-check {
  opacity: 1;
  animation: scaleIn 0.3s ease-out;
}

/* ========== 新機能: アコーディオンセクション ========== */

/* 食事区分 */

.meal-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
}

.meal-type-btn {
  background: var(--pill);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 6px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  font-size: 12px;
  color: var(--fg);
  user-select: none;
}

.meal-type-btn:hover {
  border-color: rgba(34, 211, 238, 0.3);
  transform: translateY(-2px);
}

.meal-type-btn.active {
  border-color: var(--acc);
  background: rgba(34, 211, 238, 0.1);
  color: var(--acc);
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.2);
}

/* 食べた割合スライダー */

/* ドリンクリスト */

.sugar-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sugar-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.sugar-types {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.sugar-type-input {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sugar-type-label {
  font-size: 10px;
  color: var(--muted);
}

.sugar-type-field {
  display: flex;
  gap: 3px;
  align-items: center;
}

.sugar-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 5px 6px;
  color: var(--fg);
  font-size: 12px;
  text-align: center;
}

.sugar-input:focus {
  outline: none;
  border-color: var(--acc);
}

.sugar-unit {
  font-size: 10px;
  color: var(--muted);
}

/* ジュースサブタイプボタン */

/* 砂糖 +/- ボタン */

/* 乳製品アンケート */

.plant-based-choice {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.plant-based-choice button {
  flex: 1;
  min-width: 80px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--fg);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.plant-based-choice button.selected {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}

.plant-based-choice button:hover {
  border-color: rgba(34, 197, 94, 0.3);
}

.usage-reasons-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

/* 料理名（重なり解消・レスポンシブ） */

.dishes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  align-items: stretch;
}

.dish-input {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: var(--fg);
  font-size: 14px;
}

.dish-input:focus {
  outline: none;
  border-color: var(--acc);
  background: rgba(34, 211, 238, 0.06);
}

/* ======= 料理階層（ドリルダウン）表示 ======= */

.dish-hierarchy {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.dish-section {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.2s;
}

.dish-section:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

/* ========== 写真タップ → 料理修正UI ========== */

.result-photo-container {
  position: relative;
  display: inline-block;
  cursor: pointer;
  margin-bottom: 8px;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s;
}

/* サブ画像サムネイル一覧 */

.sub-images-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 12px;
  margin-bottom: 8px;
}

.sub-images-strip:empty {
  display: none;
}

.sub-image-thumb {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sub-image-thumb:hover {
  border-color: var(--acc);
  transform: scale(1.05);
}

.sub-image-thumb-wrap {
  position: relative;
  flex-shrink: 0;
}

.sub-image-thumb-wrap .thumb-hint {
  position: absolute;
  bottom: 2px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.8);
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.result-photo-container:hover {
  transform: scale(1.01);
}

.result-photo-container:active {
  transform: scale(0.99);
}

.photo-tap-hint {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* 料理修正オーバーレイ */

.dish-correct-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeInOverlay 0.25s ease;
}

@keyframes fadeInOverlay {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.dish-correct-content {
  background: var(--card);
  border-radius: 20px;
  max-width: 480px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.6);
}

.dish-correct-header {
  padding: 20px 20px 10px;
  text-align: center;
}

.dish-correct-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 2px;
}

.dish-correct-subtitle {
  font-size: 11px;
  color: var(--muted);
}

/* 写真エリア（ラベルオーバーレイ対応） */

.dish-correct-photo {
  padding: 8px 16px;
  position: relative;
}

.dish-correct-photo img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: block;
}

/* 写真上の料理名ラベル */

.photo-labels-overlay {
  position: absolute;
  border-radius: 12px;
  pointer-events: none;
}

/* モード: bbox有り → 各ラベルをabsoluteで配置 */

/* モード: bbox無し → 下部にバー形式 */

.photo-labels-overlay.mode-bar {
  left: 16px;
  right: 16px;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7) 30%);
  border-radius: 0 0 12px 12px;
}

.photo-label {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 6px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.6);
  color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  white-space: nowrap;
  z-index: 2;
}

/* bboxモード時のみabsolute + transform */

.mode-bbox .photo-label {
  position: absolute;
  transform: translate(-50%, -50%);
}

.mode-bbox .photo-label:hover {
  transform: translate(-50%, -50%) scale(1.05);
}

.photo-label:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: rgba(255, 255, 255, 0.5);
}

.photo-label .label-minus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: white;
  flex-shrink: 0;
}

.photo-label.marked-delete {
  background: rgba(239, 68, 68, 0.6);
  border-color: rgba(239, 68, 68, 0.8);
  text-decoration: line-through;
}

.photo-label.marked-delete .label-minus {
  background: rgba(255, 255, 255, 0.3);
  color: #fecaca;
}

/* 料理カードリスト */

.dish-card-list {
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dish-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  transition: all 0.2s;
}

.dish-card:hover {
  background: rgba(255, 255, 255, 0.07);
}

.dish-card.marked-delete {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  opacity: 0.6;
}

.dish-card.marked-delete .dish-card-name {
  text-decoration: line-through;
  color: var(--muted);
}

.dish-card-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.dish-card-info {
  flex: 1;
  min-width: 0;
}

.dish-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dish-card-meta {
  font-size: 10px;
  color: var(--muted);
  margin-top: 1px;
}

.dish-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.dish-action-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
}

.dish-action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.dish-action-btn.action-rename:hover {
  background: rgba(34, 211, 238, 0.15);
  color: #22d3ee;
}

.dish-action-btn.action-delete {
  color: #f87171;
}

.dish-action-btn.action-delete:hover {
  background: rgba(239, 68, 68, 0.15);
}

.dish-action-btn.action-delete.active {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.4);
}

.dish-action-btn.action-photo:hover {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

/* インライン料理名編集 */

.dish-card-edit-input {
  width: 100%;
  padding: 6px 8px;
  font-size: 14px;
  font-weight: 600;
  background: rgba(34, 211, 238, 0.06);
  border: 1.5px solid rgba(34, 211, 238, 0.4);
  border-radius: 6px;
  color: var(--fg);
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}

.dish-card-edit-input:focus {
  border-color: var(--acc);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.15);
}

/* 削除件数表示 */

.dish-correct-delete-info {
  text-align: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.08);
  margin: 4px 16px;
  border-radius: 8px;
}

/* 下部アクション */

.dish-correct-footer {
  display: flex;
  gap: 10px;
  padding: 12px 20px 20px;
}

.dish-correct-close-btn {
  flex: 1;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  background: transparent;
  color: var(--fg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.dish-correct-close-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.dish-correct-addphoto-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(34, 197, 94, 0.1));
  color: #4ade80;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.dish-correct-addphoto-btn:hover {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.3), rgba(34, 197, 94, 0.15));
  transform: translateY(-1px);
}

.dish-correct-delete-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.dish-correct-delete-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.dish-correct-delete-btn:not(:disabled):hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.dish-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.08), rgba(34, 211, 238, 0.03));
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.dish-section-header:hover {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.14), rgba(34, 211, 238, 0.06));
}

.dish-section-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.dish-section-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  min-width: 0;
}

.dish-section-name input {
  width: 100%;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: var(--fg);
  font-size: 14px;
  font-weight: 600;
}

.dish-section-name input:focus {
  outline: none;
  border-color: var(--acc);
  background: rgba(34, 211, 238, 0.06);
}

.dish-section-kcal {
  font-size: 13px;
  font-weight: 600;
  color: var(--acc);
  white-space: nowrap;
  padding: 2px 8px;
  background: rgba(34, 211, 238, 0.1);
  border-radius: 12px;
}

.dish-section-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.dish-delete-btn {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--red);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.dish-delete-btn:hover {
  background: rgba(239, 68, 68, 0.25);
}

.dish-toggle-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
  transition: transform 0.3s;
}

.dish-toggle-btn.collapsed {
  transform: rotate(-90deg);
}

.dish-section-body {
  padding: 0;
  max-height: 2000px;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s;
}

.dish-section-body.collapsed {
  max-height: 0;
  padding: 0;
}

.dish-section-body .ingredients-table {
  margin-top: 0;
}

/* ドリンク展開部分 */

.dish-section.drink-dish .dish-section-body {
  padding: 12px;
}

.dish-section.drink-dish .dish-section-body.collapsed {
  padding: 0;
}

.dish-add-item-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  background: rgba(34, 211, 238, 0.06);
  border: 1px dashed rgba(34, 211, 238, 0.25);
  border-radius: 6px;
  color: var(--acc);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
  margin: 8px 10px;
}

.dish-add-item-btn:hover {
  background: rgba(34, 211, 238, 0.12);
  border-color: var(--acc);
}

/* 全体合計バー */

.total-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.12), rgba(139, 92, 246, 0.08));
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: 10px;
  margin-top: 12px;
}

.total-summary-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--fg);
}

.total-summary-kcal {
  font-size: 18px;
  font-weight: 700;
  color: var(--acc);
}

/* 料理追加ボタン */

.add-dish-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(6, 182, 212, 0.04));
  border: 1px dashed rgba(6, 182, 212, 0.3);
  border-radius: 10px;
  color: var(--acc);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.add-dish-btn:hover {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.18), rgba(6, 182, 212, 0.08));
  border-color: var(--acc);
}

/* 結果テーブル */

.ingredients-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.ingredients-table th,
.ingredients-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: middle;
}

.ingredients-table th {
  background: var(--pill);
  font-weight: 600;
  color: var(--acc);
}

.ingredients-table input,
.ingredients-table textarea {
  width: 100%;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  color: var(--fg);
  font-size: 15px;
  min-height: 40px;
  transition: all 0.2s;
  box-sizing: border-box;
  font-family: inherit;
}

.ing-name-textarea {
  resize: none;
  overflow: hidden;
  line-height: 1.4;
  word-break: break-all;
}

.ing-name-display {
  font-size: 13px;
  line-height: 1.4;
  color: var(--fg);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.15s;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.ing-name-display:hover,
.ing-name-display:active {
  background: rgba(34, 211, 238, 0.08);
}

.ing-name-display::after {
  content: ' \270f\fe0f';
  font-size: 10px;
  opacity: 0.5;
}

@media (max-width: 768px) {
  .ing-name-display {
    font-size: 12px;
  }
}

.ingredients-table input:focus,
.ingredients-table textarea:focus {
  outline: none;
  border-color: var(--acc);
  background: rgba(34, 211, 238, 0.05);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.1);
}

.delete-btn {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.delete-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  transform: scale(1.05);
}

/* ======= 食材追加モーダル ======= */

.add-ingredient-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.add-ingredient-modal {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.add-ingredient-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.add-ingredient-header h3 {
  margin: 0;
  color: var(--acc);
  font-size: 18px;
}

.add-ingredient-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.add-ingredient-close:hover {
  color: var(--fg);
}

.add-ingredient-body {
  padding: 24px;
}

.add-ingredient-field {
  margin-bottom: 20px;
}

.add-ingredient-field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
}

.add-ingredient-field input[type="text"],
.add-ingredient-field input[type="number"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: var(--fg);
  box-sizing: border-box;
  transition: all 0.2s;
}

.add-ingredient-field input:focus {
  outline: none;
  border-color: var(--acc);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}

.grams-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.grams-presets button {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.grams-presets button:hover {
  background: rgba(34, 211, 238, 0.15);
  border-color: var(--acc);
  color: var(--acc);
}

/* ===== グラム数ステッパーUI ===== */

.grams-stepper {
  display: flex;
  align-items: center;
  gap: 1px;
  justify-content: center;
}

.grams-stepper-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.grams-stepper-btn:active {
  transform: scale(0.9);
  background: rgba(34, 211, 238, 0.2);
}

.grams-stepper-value {
  min-width: 36px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  cursor: pointer;
  padding: 4px 1px;
  border-radius: 6px;
  transition: background 0.15s;
  line-height: 1.2;
}

.grams-stepper-value:hover {
  background: rgba(34, 211, 238, 0.1);
  color: var(--acc);
}

@media (max-width: 768px) {
  .grams-stepper-btn {
    width: 28px;
    height: 28px;
    font-size: 15px;
  }

  .grams-stepper-value {
    min-width: 38px;
    font-size: 13px;
    padding: 4px 1px;
  }
}

/* ===== グラム数編集モーダル ===== */

.grams-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 10100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: gramsModalFadeIn 0.2s ease-out;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

@keyframes gramsModalFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.grams-modal-sheet {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 480px;
  padding: 0 0 env(safe-area-inset-bottom, 16px) 0;
  animation: gramsSheetSlideUp 0.25s ease-out;
  max-height: 85vh;
  overflow-y: auto;
}

@keyframes gramsSheetSlideUp {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

.grams-modal-handle {
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  margin: 10px auto 6px;
}

.grams-modal-header {
  padding: 8px 20px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.grams-modal-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.grams-modal-sub {
  font-size: 12px;
  color: var(--muted);
}

.grams-modal-body {
  padding: 16px 20px 20px;
}

/* 大きなステッパー */

.grams-modal-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.grams-modal-stepper-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.grams-modal-stepper-btn:active {
  transform: scale(0.92);
  background: rgba(34, 211, 238, 0.25);
  border-color: var(--acc);
}

.grams-modal-stepper-display {
  text-align: center;
  min-width: 100px;
}

.grams-modal-stepper-display .grams-big {
  font-size: 40px;
  font-weight: 800;
  color: var(--acc);
  line-height: 1;
}

.grams-modal-stepper-display .grams-unit {
  font-size: 18px;
  font-weight: 400;
  color: var(--muted);
  margin-left: 2px;
}

.grams-modal-stepper-display .grams-kcal {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* ステップ量切替 */

.grams-step-selector {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.grams-step-btn {
  padding: 5px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.grams-step-btn.active {
  background: rgba(34, 211, 238, 0.15);
  border-color: var(--acc);
  color: var(--acc);
}

/* プリセットグリッド */

.grams-presets-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.grams-preset-chip {
  padding: 10px 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: var(--fg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.grams-preset-chip:hover,
.grams-preset-chip:active {
  border-color: var(--acc);
  background: rgba(34, 211, 238, 0.1);
  color: var(--acc);
}

.grams-preset-chip.selected {
  border-color: var(--acc);
  background: rgba(34, 211, 238, 0.15);
  color: var(--acc);
}

/* 直接入力 */

.grams-direct-input {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.grams-direct-input input {
  flex: 1;
  padding: 12px 14px;
  font-size: 20px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: var(--fg);
  text-align: center;
  box-sizing: border-box;
}

.grams-direct-input input:focus {
  outline: none;
  border-color: var(--acc);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
}

.grams-direct-input .grams-input-unit {
  font-size: 16px;
  color: var(--muted);
  font-weight: 600;
  flex-shrink: 0;
}

/* 確定ボタン */

.grams-modal-confirm {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--acc), #06b6d4);
  color: #0f172a;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.grams-modal-confirm:active {
  transform: scale(0.98);
}

/* ライトモード */

[data-theme="light"] .grams-stepper-btn {
  border-color: rgba(0, 0, 0, 0.15);
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .grams-stepper-btn:active {
  background: rgba(255, 136, 0, 0.15);
}

[data-theme="light"] .grams-stepper-value:hover {
  background: rgba(255, 136, 0, 0.08);
  color: #ff8800;
}

[data-theme="light"] .grams-modal-sheet {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .grams-modal-stepper-btn {
  border-color: rgba(0, 0, 0, 0.15);
  background: #f8f9fa;
}

[data-theme="light"] .grams-modal-stepper-btn:active {
  background: rgba(255, 136, 0, 0.15);
  border-color: #ff8800;
}

[data-theme="light"] .grams-step-btn.active {
  background: rgba(255, 136, 0, 0.1);
  border-color: #ff8800;
  color: #ff8800;
}

[data-theme="light"] .grams-preset-chip:hover,
[data-theme="light"] .grams-preset-chip.selected {
  border-color: #ff8800;
  background: rgba(255, 136, 0, 0.08);
  color: #ff8800;
}

[data-theme="light"] .grams-modal-confirm {
  background: linear-gradient(135deg, #ff8800, #ff6600);
  color: #fff;
}

.add-ingredient-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.add-ingredient-cancel {
  flex: 1;
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--muted) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.add-ingredient-submit {
  flex: 2;
  background: linear-gradient(135deg, #06b6d4, #22d3ee) !important;
  color: #0f172a !important;
}

.hidden {
  display: none !important;
}

.btn {
  background: var(--acc);
  color: #0f172a;
  border: none;
  border-radius: 8px;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-block;
}

.btn:hover {
  background: #06b6d4;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(34, 211, 238, 0.3);
}

.btn:disabled {
  background: var(--muted);
  cursor: not-allowed;
  transform: none;
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}

.alert-success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
  white-space: pre-line;
}

/* 栄養情報テーブル */

.nutrition-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.nutrition-table th,
.nutrition-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.nutrition-table th {
  background: var(--pill);
  font-weight: 600;
  color: var(--acc);
}

.nutrition-table td {
  font-size: 16px;
}

.nutrition-table .nowrap {
  white-space: nowrap;
  color: var(--muted);
  font-size: 14px;
}

/* アドバイス */

.advice-box {
  background: rgba(34, 211, 238, 0.05);
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
}

.advice-box h4 {
  color: var(--acc);
  margin: 0 0 12px 0;
  font-size: 16px;
}

.advice-box ul {
  margin: 0;
  padding-left: 20px;
}

.advice-box li {
  margin-bottom: 8px;
  line-height: 1.6;
}

/* 食材内訳（詳細ビュー） */

.ingredient-breakdown {
  margin-top: 16px;
}

.ingredient-item {
  background: var(--pill);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}

.ingredient-item strong {
  color: var(--acc);
  font-size: 15px;
}

.ingredient-item .nutri-detail {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

/* テーブル内のバッジ＋入力の並び */

.ing-name-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 6px;
}

.badges-inline {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 詳細栄養（折りたたみ + チップ） */

.details-block details {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 12px;
}

.details-block summary {
  cursor: pointer;
  color: var(--muted);
  outline: none;
}

.micros-table td,
.micros-table th {
  font-size: 14px;
}

.microchips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.nutri-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--fg);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
}

/* レスポンシブ */

@media (max-width: 768px) {
  .container {
    padding: 4px 12px;
  }

  .main-title {
    margin-top: 0;
    margin-bottom: 4px;
  }

  .subtitle {
    margin-bottom: 10px;
    font-size: 14px;
  }

  .card {
    margin-bottom: 16px;
  }

  .upload-box {
    padding: 30px 20px;
  }

  .camera-buttons {
    grid-template-columns: 1fr;
  }

  .analyzing-container {
    padding: 20px 16px;
  }

  .circular-progress {
    width: 160px;
    height: 160px;
  }

  .progress-text {
    font-size: 28px;
  }

  .dishes-grid {
    grid-template-columns: 1fr;
  }

  .ingredients-table th,
  .ingredients-table td {
    padding: 8px;
    font-size: 13px;
  }

  .btn {
    width: 100%;
  }

  .meal-type-grid {
    grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
  }

  .meal-type-btn {
    padding: 8px 4px;
    font-size: 11px;
  }

  .drink-types-grid {
    grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  }

  .drink-emoji {
    font-size: 18px;
  }

  .drink-name {
    font-size: 8px;
  }

  .dairy-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
  }

  .accordion-section {
    margin-bottom: 12px;
  }

  .accordion-header {
    padding: 12px 14px;
  }

  .accordion-body.open {
    padding: 14px;
  }

  /* 砂糖入力をモバイルで縦並びに */
  .sugar-types {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  .sugar-type-input {
    width: 100% !important;
  }

  .sugar-btn {
    width: 28px;
    height: 28px;
    font-size: 16px;
  }

  .sugar-value {
    min-width: 35px;
    font-size: 13px;
  }
}

/* ===== 栄養値編集モーダル フィールド ===== */

.nutr-group-label {
  margin-top: 12px;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nutr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.nutr-field {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nutr-label {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.nutr-unit {
  font-size: 9px;
  color: var(--muted);
  opacity: 0.7;
}

.nutr-input {
  width: 100%;
  padding: 6px 8px;
  font-size: 14px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--fg);
  box-sizing: border-box;
}

.nutr-input:focus {
  outline: none;
  border-color: var(--acc);
  background: rgba(34, 211, 238, 0.06);
}

@media (max-width: 420px) {
  .nutr-grid {
    grid-template-columns: 1fr 1fr;
    gap: 4px;
  }

  .nutr-input {
    padding: 5px 6px;
    font-size: 13px;
  }

  .nutr-label {
    font-size: 10px;
  }

  .nutr-group-label {
    font-size: 10px;
    margin-top: 8px;
    margin-bottom: 4px;
  }

  .grams-modal-body {
    padding: 10px 10px 14px;
  }
}

@media (max-width: 340px) {
  .nutr-grid {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* ===== 料理名表示（タップで編集） ===== */

.dish-name-text {
  display: inline-block;
  max-width: 100%;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.15s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dish-name-text:hover,
.dish-name-text:active {
  background: rgba(34, 211, 238, 0.08);
}

/* ===== iPhone SE / 小画面 (375px) 用コンパクトモード ===== */

@media (max-width: 420px) {
  .container {
    padding: 2px 4px !important;
  }

  .dish-section-header {
    padding: 8px 8px;
    gap: 4px;
  }

  .dish-section-header .dish-section-name {
    font-size: 13px;
  }

  .ingredients-table th,
  .ingredients-table td {
    padding: 4px 3px;
    font-size: 12px;
  }

  .ingredients-table th {
    font-size: 11px;
  }

  /* バッジをコンパクトに */
  .badge {
    padding: 1px 4px;
    font-size: 9px;
    margin-right: 2px;
  }

  .badges-inline {
    flex-shrink: 0;
  }

  /* ステッパーをさらにコンパクトに */
  .grams-stepper {
    gap: 0;
  }

  .grams-stepper-btn {
    width: 24px;
    height: 24px;
    font-size: 13px;
  }

  .grams-stepper-value {
    min-width: 30px;
    font-size: 12px;
    padding: 2px 0;
  }

  /* 食材名表示を最適化 */
  .ing-name-display {
    font-size: 11px;
    padding: 2px 3px;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }

  .ing-name-display::after {
    content: '';
    /* 小画面ではペンアイコンを削除してスペース節約 */
  }

  /* 削除ボタンをコンパクトに */
  .delete-btn {
    padding: 4px 6px;
    font-size: 11px;
  }

  /* 名前列にさらにスペースを */
  .ing-name-wrap {
    display: flex;
    align-items: center;
    gap: 2px;
  }
}

/* ==================================================
   ライトモード包括的オーバーライド
   シアン(34,211,238) → オレンジ(255,136,0)に統一
   緑テキスト → オレンジテキストに統一
================================================== */

/* アコーディオン - 全て同じライムグリーンで統一 */

[data-theme="light"] .edit-table th {
  background: linear-gradient(135deg, rgba(159, 255, 0, 0.2), rgba(184, 255, 66, 0.12)) !important;
  border-bottom-color: rgba(159, 255, 0, 0.4) !important;
  color: var(--fg) !important;
}

[data-theme="light"] .edit-field {
  background: rgba(255, 136, 0, 0.06);
  border-color: rgba(255, 136, 0, 0.2);
}

[data-theme="light"] .survey-header {
  border-color: rgba(255, 136, 0, 0.3);
  background: rgba(255, 136, 0, 0.08);
}

[data-theme="light"] .nutrition-summary {
  background: rgba(255, 136, 0, 0.04);
  border: 1px solid rgba(255, 136, 0, 0.15);
}

[data-theme="light"] .ingredient-item {
  background: rgba(255, 136, 0, 0.04) !important;
}

[data-theme="light"] .dish-section {
  border-color: rgba(0, 0, 0, 0.1);
  background: rgba(255, 136, 0, 0.02);
}

[data-theme="light"] .dish-section-header {
  background: linear-gradient(135deg, rgba(255, 136, 0, 0.08), rgba(255, 136, 0, 0.03));
}

[data-theme="light"] .dish-section-header:hover {
  background: linear-gradient(135deg, rgba(255, 136, 0, 0.14), rgba(255, 136, 0, 0.06));
}

[data-theme="light"] .dish-section-kcal {
  background: rgba(255, 136, 0, 0.1);
  color: #e07000;
}

[data-theme="light"] .dish-add-item-btn {
  background: rgba(255, 136, 0, 0.04);
  border-color: rgba(255, 136, 0, 0.2);
  color: #e07000;
}

[data-theme="light"] .total-summary-bar {
  background: linear-gradient(135deg, rgba(255, 136, 0, 0.1), rgba(139, 92, 246, 0.06));
  border-color: rgba(255, 136, 0, 0.2);
}

[data-theme="light"] .photo-tap-hint {
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
  color: white;
}

[data-theme="light"] .dish-correct-overlay {
  background: rgba(0, 0, 0, 0.6);
}

[data-theme="light"] .dish-card {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .dish-card:hover {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .dish-card.marked-delete {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="light"] .dish-action-btn {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .dish-action-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .dish-correct-delete-info {
  color: #dc2626;
  background: rgba(239, 68, 68, 0.06);
}

[data-theme="light"] .total-summary-kcal {
  color: #e07000;
}

[data-theme="light"] .add-dish-btn {
  background: linear-gradient(135deg, rgba(255, 136, 0, 0.08), rgba(255, 136, 0, 0.03));
  border-color: rgba(255, 136, 0, 0.3);
  color: #e07000;
}

[data-theme="light"] .upload-box:hover,
[data-theme="light"] .upload-box.dragover {
  box-shadow: 0 6px 20px rgba(255, 136, 0, 0.2);
}

[data-theme="light"] .btn-camera:hover {
  box-shadow: 0 6px 20px rgba(255, 136, 0, 0.3);
}

[data-theme="light"] .btn-save:hover {
  box-shadow: 0 6px 20px rgba(255, 136, 0, 0.3);
}

/* #6 食材名拡大入力オーバーレイ */

.ing-edit-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 10000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ing-edit-overlay.active {
  display: flex;
}

.ing-edit-card {
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ing-edit-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--acc);
}

.ing-edit-card .ing-edit-hint {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
}

.ing-edit-card textarea {
  width: 100%;
  min-height: 80px;
  padding: 14px;
  font-size: 18px;
  line-height: 1.5;
  background: var(--pill);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: var(--fg);
  resize: vertical;
  box-sizing: border-box;
  font-family: inherit;
}

.ing-edit-card textarea:focus {
  outline: none;
  border-color: var(--acc);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}

.ing-edit-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.ing-edit-actions button {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.ing-edit-actions .ing-edit-cancel {
  background: var(--pill);
  color: var(--fg);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.ing-edit-actions .ing-edit-confirm {
  background: var(--acc);
  color: #0f172a;
}

/* ======== 体重記録セクション ======== */

.weight-section {
  margin-top: 12px;
}

.weight-section .card-title {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.weight-section .card-title .toggle-arrow {
  transition: transform 0.25s;
  font-size: 0.85em;
  opacity: 0.6;
}

.weight-section .card-title .toggle-arrow.open {
  transform: rotate(180deg);
}

.weight-body {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  max-height: 0;
  opacity: 0;
}

.weight-body.open {
  max-height: 300px;
  opacity: 1;
}

.weight-prev {
  font-size: 0.82em;
  color: var(--sub);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.weight-prev .weight-trend {
  font-size: 0.9em;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
}

.weight-prev .weight-trend.down {
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
}

.weight-prev .weight-trend.up {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
}

.weight-prev .weight-trend.same {
  color: #6b7280;
  background: rgba(107, 114, 128, 0.12);
}

.weight-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.weight-input-row input[type="number"] {
  width: 100px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
  font-size: 1.15em;
  font-weight: 600;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

.weight-input-row input[type="number"]:focus {
  border-color: var(--acc);
}

.weight-input-row .unit {
  font-size: 0.95em;
  color: var(--sub);
  font-weight: 500;
}

.weight-input-row .btn-weight-save {
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #22d3ee, #06b6d4);
  color: #0f172a;
  font-weight: 600;
  font-size: 0.9em;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.weight-input-row .btn-weight-save:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(34, 211, 238, 0.3);
}

.weight-input-row .btn-weight-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.weight-today-done {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #10b981;
  font-size: 0.85em;
  font-weight: 500;
  margin-top: 6px;
}

[data-theme="light"] .weight-input-row input[type="number"] {
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: rgba(0, 0, 0, 0.04);
}

/* PWA インストールバナー */

.pwa-install-banner {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border-top: 1px solid rgba(34, 211, 238, 0.3);
  padding: 14px 16px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.pwa-install-inner {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.pwa-install-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.pwa-install-text {
  flex: 1;
  min-width: 0;
}

.pwa-install-text strong {
  display: block;
  font-size: 14px;
  color: #e5e7eb;
  margin-bottom: 2px;
}

.pwa-install-text span {
  font-size: 12px;
  color: #9ca3af;
}

.pwa-install-btn {
  background: linear-gradient(135deg, #22d3ee, #3b82f6);
  color: #0f172a;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  flex-shrink: 0;
}

.pwa-install-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(34, 211, 238, 0.4);
}

.pwa-install-close {
  background: none;
  border: none;
  color: #6b7280;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.2s;
}

.pwa-install-close:hover {
  color: #e5e7eb;
}

[data-theme="light"] .pwa-install-banner {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-top: 1px solid rgba(255, 136, 0, 0.3);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .pwa-install-text strong {
  color: #1a1a1a;
}

[data-theme="light"] .pwa-install-text span {
  color: #6b7280;
}

[data-theme="light"] .pwa-install-btn {
  background: linear-gradient(135deg, #ff8800, #ff6600);
  color: #ffffff;
}

[data-theme="light"] .pwa-install-close {
  color: #9ca3af;
}