/* 基本スタイル */
body { font-family: 'Noto Sans JP', sans-serif; text-align: center; margin: 0; padding: 0; background-color: #f0f2f5; color: #333; display: flex; justify-content: center; align-items: center; min-height: 100vh; overflow-y: hidden; }
/* 画面コンテナ */
.screen-container { background-color: #fff; border-radius: 12px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); padding: 40px; max-width: 1200px; width: 95%; box-sizing: border-box; opacity: 0; transition: opacity 0.5s ease-in-out; max-height: 95vh; display: flex; flex-direction: column; overflow-y: auto; }
.screen-container.active { opacity: 1; }
/* スクリーン共通 */
.screen { display: none; flex-direction: column; align-items: center; width: 100%; box-sizing: border-box; }
.screen.active { display: flex; flex-grow: 1; }
#screen1.active, #screen2.active, #screen4.active, #screen5.active { justify-content: center; }
#screen3.active { justify-content: flex-start; }
h1, h2 { color: #0056b3; margin-top: 0; margin-bottom: 20px; flex-shrink: 0; }
p { line-height: 1.6; margin-bottom: 20px; text-align: left; }
#screen1 p.info-text, #screen4 p.info-text, #screen5 p.info-text { text-align: center; }
#screen2 ul { text-align: left; padding-left: 20px; }
#screen2 ul li { margin-bottom: 10px; }
/* 入力フォーム */
input[type="text"], input[type="number"], input[type="email"], textarea { width: calc(100% - 20px); max-width: 500px; padding: 10px; margin-bottom: 15px; border: 1px solid #ddd; border-radius: 6px; font-size: 16px; box-sizing: border-box; font-family: 'Noto Sans JP', sans-serif; }
textarea { resize: vertical; min-height: 80px; }
input:focus, textarea:focus { border-color: #007bff; outline: none; box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25); }
/* ボタン共通 */
button { background-color: #007bff; color: white; padding: 12px 25px; border: none; border-radius: 8px; font-size: 18px; cursor: pointer; transition: background-color 0.3s ease, transform 0.2s ease; margin: 10px 5px; }
button:hover { background-color: #0056b3; transform: translateY(-2px); }
button:active { transform: translateY(0); }
button:disabled { background-color: #cccccc; cursor: not-allowed; transform: none; }
.back-button { background-color: #6c757d; }
.back-button:hover { background-color: #5a6268; }
#screen2 .back-button, #screen4 .back-button, #screen5 .back-button { margin-top: 20px; }
.button-controls .back-button { margin-right: auto; }
/* screen3 レイアウト */
#screen3 > h1 { flex-shrink: 0; }
.experiment-layout-container { display: flex; width: 100%; gap: 20px;  height: 600px; }
.canvas-area { flex: 2; display: flex; flex-direction: column; min-width: 0; }
#canvas-container { position: relative; width: 100%; height: 100%; min-height: 400px; border: 2px solid #e0e0e0; border-radius: 8px; background-color: #f9f9f9; overflow: hidden; box-shadow: inset 0 0 8px rgba(0,0,0,0.05); }
.details-area { flex: 1; border: 1px solid #e0e0e0; border-radius: 8px; padding: 15px; overflow-y: auto; display: flex; flex-direction: column; }
.button-controls { flex-shrink: 0; padding-top: 10px; padding-bottom: 10px; width: 100%; text-align: center; display: flex; justify-content: center; flex-wrap: wrap; }
/* 食品コンテナ */
.food-container { width: 80px; height: 110px; position: absolute; user-select: none; z-index: 10; transition: transform 0.2s ease-out, outline 0.2s ease-out, box-shadow 0.2s ease-out; background-color: #fff; border-radius: 8px; box-shadow: 2px 2px 8px rgba(0,0,0,0.1); display: flex; flex-direction: column; overflow: hidden; }
.food-container.dragging { z-index: 11; box-shadow: 4px 4px 12px rgba(0,0,0,0.2); transform: scale(1.20); }
.food-image { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.drag-handle { width: 100%; height: 30px; background-color: rgba(0, 123, 255, 0.7); border-top-left-radius: 8px; border-top-right-radius: 8px; cursor: grab; display: flex; justify-content: flex-end; align-items: center; box-sizing: border-box; padding-right: 5px; position: relative; order: -1; flex-shrink: 0; }
.drag-handle:hover { background-color: rgba(0, 123, 255, 0.9); }
.drag-handle:active { cursor: grabbing; }
.info-button { width: 20px; height: 20px; background-color: white; border-radius: 50%; border: 1px solid #0056b3; color: #0056b3; font-size: 12px; font-weight: bold; display: flex; justify-content: center; align-items: center; cursor: pointer; line-height: 1; box-shadow: 0 1px 3px rgba(0,0,0,0.2); flex-shrink: 0; }
.info-button:hover { background-color: #e0f0ff; }
.food-container.selected-food-item { outline: 3px solid #007bff; outline-offset: 1px; box-shadow: 0 0 12px rgba(0, 123, 255, 0.6); }
#clusterCanvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 20; pointer-events: none; }
#clusterCanvas.active-drawing { pointer-events: auto; cursor: crosshair; }
.info-text { font-size: 14px; color: #666; margin-top: 20px; flex-shrink: 0; }
#screen3 p#statusMessage.info-text { margin-top: 10px; min-height: 1.5em; }
.spinner { border: 4px solid rgba(0, 0, 0, 0.1); width: 36px; height: 36px; border-radius: 50%; border-left-color: #007bff; animation: spin 1s ease infinite; margin-top: 20px; display: none; flex-shrink: 0; }
.spinner.active { display: block; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
#dynamicDeleteClusterBtn { position: absolute; z-index: 25; background-color: rgba(220, 53, 69, 0.85); color: white; border: 1px solid darkred; padding: 3px 8px; font-size: 12px; border-radius: 4px; cursor: pointer; box-shadow: 1px 1px 3px rgba(0,0,0,0.4); transition: background-color 0.2s ease; }
#dynamicDeleteClusterBtn:hover { background-color: rgba(200, 40, 50, 1); }
/* 説明画面レイアウト */
.instructions-layout { display: flex; gap: 25px; width: 100%; margin-top: 20px; text-align: left; }
.instructions-text { flex: 2; }
.instructions-example { flex: 1; text-align: center; }
.instructions-example img { width: 100%; max-width: 300px; border: 1px solid #ccc; border-radius: 8px; }
/* フィードバック画面専用スタイル */
.cluster-list { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid #e0e0e0; }
.cluster-list-item { background-color: #f0f2f5; border: 1px solid #ddd; padding: 8px 12px; border-radius: 20px; cursor: pointer; transition: background-color 0.2s, color 0.2s, border-color 0.2s; }
.cluster-list-item.active, .cluster-list-item:hover { background-color: #007bff; color: white; border-color: #0056b3; }
.cluster-feedback-form label { display: block; margin-top: 15px; font-weight: bold; }
.cluster-feedback-form textarea { width: 100%; box-sizing: border-box; }
/* アンケートフォーム */
.survey-container { width: 100%; max-width: 800px; margin: 0 auto; text-align: left; }
.survey-section { border: 1px solid #e0e0e0; border-radius: 8px; padding: 20px; margin-bottom: 30px; }
.survey-section legend { font-size: 1.2em; font-weight: bold; color: #0056b3; padding: 0 10px; }
.survey-question { margin-bottom: 25px; }
.survey-question .question-text { font-weight: bold; margin-bottom: 10px; }
.likert-scale { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.likert-scale > span { font-size: 0.9em; color: #555; justify-self: center; }
.likert-options { display: flex; justify-content: space-around; gap: 5px; }
.likert-options label, #q9_cooking_freq label { display: flex; flex-direction: column; align-items: center; cursor: pointer; padding: 5px 10px; border-radius: 4px; transition: background-color 0.2s; }
.likert-options label:hover, #q9_cooking_freq label:hover { background-color: #f0f8ff; }
.likert-options input[type="radio"] { margin-bottom: 5px; }
.likert-scale > .likert-options { grid-column: 2 / 3; }
.likert-scale > span:first-child { justify-self: start; }
.likert-scale > span:last-child { justify-self: end; }
#q9_cooking_freq { display: flex; justify-content: space-around; align-items: center; gap: 10px; }
#q9_cooking_freq label { display: flex; flex-direction: column; align-items: center; cursor: pointer; padding: 5px 10px; border-radius: 4px; transition: background-color 0.2s; }
#q9_cooking_freq label:hover { background-color: #f0f8ff; }
.checkbox-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.checkbox-group label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
@media (max-width: 768px) { .instructions-layout, .experiment-layout-container { flex-direction: column; } }

/* フィードバック画面でレイアウトを固定するためのスタイル */
.feedback-mode-active .experiment-layout-container {
    height: 550px; /* レイアウトの高さを固定 */
    flex-grow: 0;
}

#details-food-image {
    width: 100%; /* 親要素の幅いっぱいに広がる */
    max-height: 250px; /* ここで最大の高さを指定 */
    object-fit: contain; /* 画像の縦横比を保ちつつ、指定したエリアに収める */
    margin-bottom: 15px; /* 下部との余白 */
    display: block; /* デフォルトでブロック要素として表示 */
    margin-left: auto; /* 中央寄せ用 */
    margin-right: auto; /* 中央寄せ用 */
    flex-shrink: 0;
}

#details-food-info {
    overflow-y: auto; /* ★追加 */
    flex-grow: 1; /* ★追加 */
    text-align: left; /* ★追加 */
}

.canvas-area {
    flex: 2;
    display: flex;
    position: relative; /* 子要素の配置基準にする */
}


/* ミートパイの上バー（drag-handle）だけ色変更 */
.drag-handle.is-meatpie {
  background: #F08B93;      /* 濃いめのしっかりした赤 */
  border-color: #E46F79;    /* それより少し暗めの境界線 */
  color: #fff;              /* 白文字（青いバーと同じ可読性を維持） */
}

.slider-labels{display:flex;justify-content:space-between;gap:8px;font-size:.9rem;color:#555;margin:6px 0 8px}
.recog-slider{width:100%;appearance:none;height:6px;background:#ddd;border-radius:5px;outline:none}
.recog-slider::-webkit-slider-thumb{appearance:none;width:18px;height:18px;background:#0078d7;border-radius:50%;cursor:pointer}
.recog-row{margin-bottom:18px}


/* 目盛りライン */
.slider-ticks {
  position: relative;
  height: 14px;
  margin-top: 6px;
}

.slider-ticks .tick {
  position: absolute;
  bottom: 0;
  width: 1px;
  height: 6px;         /* 短い目盛り（5%刻み） */
  background: #9aa0a6; /* グレー */
  opacity: 0.9;
}

.slider-ticks .tick.major {
  height: 10px;        /* 長い目盛り（10%刻み） */
  background: #5f6368; /* 少し濃い */
  opacity: 1;
}

/* （任意）0/50/100 に薄い数字を出したい場合 */
.slider-ticks .label {
  position: absolute;
  top: 0;
  font-size: 10px;
  color: #777;
  transform: translateX(-50%);
}
/* 各食品スライダーの外枠 */
.recog-row {
  background: #f9f9f9;              /* 優しいグレーの背景 */
  border: 1px solid #ddd;           /* 薄いグレーの枠線 */
  border-radius: 10px;              /* 角を丸く */
  padding: 12px 16px;               /* 内側の余白 */
  margin-bottom: 14px;              /* 下との間隔 */
  box-shadow: 0 1px 3px rgba(0,0,0,0.08); /* ほんのり影 */
  transition: background 0.2s ease;
}

/* ホバー時に少し明るく */
.recog-row:hover {
  background: #fefefe;
}

/* スライダーラベル部分を整える */
.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin: 4px 0 8px;
  color: #555;
}

/* スライダー */
.recog-slider {
  width: 100%;
  margin-top: 4px;
}

button[disabled],
button[aria-disabled="true"] {
  opacity: .6;
  cursor: not-allowed;
  pointer-events: none;
}
