body {
  font-family: sans-serif;
  line-height: 1.6;
  padding: 20px;
  max-width: 890px;
  margin: auto;
  background-color: #fff;
  color: #333;
}

h1,
h2,
h3 {
  font-weight: bold;
  margin: 1em 0 0.5em;
}

h5 {
  font-weight: bold;
  font-size: 1.0em;
  margin: 1em 0 0.5em;
  border-bottom: 1px solid #ddd;
  padding-bottom: 16px;
}

textarea#note-input {
  width: 100%;
  height: 6em;
  padding: 10px;
  font-size: 1em;
  margin-bottom: 10px;
  box-sizing: border-box;
}

button {
  font-size: 1em;
  cursor: pointer;
}

.note-button {
  background-color: #f9f9f9;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 8px 12px;
  margin: 4px;
}

.note-button.selected {
  background-color: #a2d2ff;
}

/* トグルタイトル */
.note-toggle {
  background-color: #f2f2f2;
  padding: 10px;
  border-radius: 5px;
  font-size: 1.1em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.toggle-icon {
  font-weight: bold;
  font-size: 1.1em;
}

/* セクション折りたたみ対応 */
.note-section {
  display: none;
  margin-bottom: 15px;
}

.note-section.open {
  display: block;
}

/* PC用カナボタン一覧 */
.note-buttons-pc .row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.kana-button {
  background-color: #eee;
  border: none;
  border-radius: 4px;
  padding: 8px 12px;
}

.note-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.note-list-container {
  margin-top: 10px;
}

/* モバイル：アカサタナボタン */
.note-buttons-mobile {
  display: none;
  margin-top: 10px;
  font-size: 0.9em;
}

.gyo-button {
  display: block;
  width: 100%;
  text-align: left;
  background-color: #eee;
  border: none;
  border-radius: 5px;
  padding: 10px;
  margin-bottom: 5px;
}

/* モバイル：段ボタン（インデント） */
.dan-container {
  display: none;
  padding-left: 15px;
}

.dan-button {
  display: block;
  width: 100%;
  text-align: left;
  background-color: #d6ebff;
  border: none;
  border-radius: 4px;
  padding: 10px;
  margin-bottom: 5px;
  font-size: 0.9em;
}

/* モバイル：ノートリスト */
.note-list-mobile {
  display: none;
  flex-wrap: wrap;
  gap: 4px 2px;
  padding: 2px 5px 10px 10px;
  background-color: #fdfdfd;
}

/* 検索結果表示 */
#loading {
  display: none;
  font-style: italic;
  color: #666;
  margin-top: 20px;
}

#search-result-area {
  display: none;
  margin-top: 30px;
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}

.result-item {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  margin-bottom: 20px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 16px;
}

/* ✅ 画像＆引用を含むコンテナ */
.result-image {
  width: 150px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

img.perfume-img {
  height: 150px;
  width: auto;
  object-fit: contain;
  display: block;
}

/* 横長画像用 - トリミング */
img.perfume-img.horizontal {
  width: 150px;
  height: 150px;
  object-fit: cover;
  object-position: center;
}

.result-text {
  flex: 1;
  padding-left: 20px;
  display: block;
}

.brand-en {
  font-size: 1em;
  color: #a9a9a9;
  margin-bottom: 4px;
}

.perfume-ja {
  font-size: 1.1em;
  font-weight: bold;
  margin-bottom: 8px;
  color: #000;
}

.notes {
  font-size: 0.95em;
  color: #000;
}

.note-line {
  font-size: 0.9em;
}

.similarity-stars {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95em;
  margin-top: 4px;
}

.similarity-label {
  font-weight: bold;
  color: #444;
  margin-right: 4px;
}

.stars-outer {
  position: relative;
  display: inline-block;
  font-family: Arial, sans-serif;
  font-size: 1.2em;
  color: #ccc;
  /* 背景の星 */
  letter-spacing: 2px;
}

.stars-outer::before {
  content: "★★★★★";
}

.stars-inner {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  white-space: nowrap;
  color: #ffc107;
  /* 塗りつぶしの色 */
  letter-spacing: 2px;
}

.stars-inner::before {
  content: "★★★★★";
}

.similarity-score {
  font-size: 0.85em;
  color: #555;
}


.image-credit {
  font-size: 0.7em;
  color: #777;
  margin-top: 6px;
  line-height: 1.2;
  max-width: 150px;
  word-break: break-word;
}

.image-credit a {
  color: #777;
  text-decoration: none;
}

.image-credit a:hover {
  text-decoration: underline;
}

.ec-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  margin-left: 0;
  justify-content: flex-start;
}

.ec-button {
  padding: 6px 12px;
  font-size: 0.85em;
  font-weight: bold;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  width: 140px;
  text-align: center;
}

/* 各サービスの色指定 */
.ec-button.amazon {
  background-color: #F79256;
}

.ec-button.rakuten {
  background-color: #F76956;
}

.ec-button.yahoo {
  background-color: #66A7FF;
}

.ec-button.celes {
  background-color: #21D4C8;
}

/* hover（任意） */
.ec-button:hover {
  opacity: 0.85;
}


/* スマホ時表示切替 */
@media (max-width: 768px) {

  .gyo-button {
    display: block;
    width: 100%;
    text-align: left;
    background-color: #eee;
    border: none;
    border-radius: 5px;
    padding: 6px;
    margin-bottom: 5px;
    font-size: 0.9em;
  }
  

  .dan-button {
    display: block;
    width: 100%;
    text-align: left;
    background-color: #d6ebff;
    border: none;
    border-radius: 4px;
    padding: 6px;
    margin-bottom: 5px;
    font-size: 0.9em;
  }

  .note-toggle {
    background-color: #f2f2f2;
    padding: 7px;
    border-radius: 5px;
    font-size: 0.9em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
  }

  .toggle-icon {
    font-weight: bold;
    font-size: 0.9em;
  }

  h5 {
    font-weight: bold;
    font-size: 0.9em;
    margin: 1em 0 0.5em;
    border-bottom: 1px solid #ddd;
    padding-bottom: 12px;
  }

  .note-buttons-pc {
    display: none;
  }

  .note-buttons-mobile {
    display: block;
  }

  .note-section {
    margin-bottom: 20px;
  }

  .note-button {
    font-size: 12px;
    background-color: #f9f9f9;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 5px 4px;
    margin: 2px 1px;
  }

  .result-item {
    font-size: 0.9em;
    flex-wrap: wrap;
  }

  .result-image {
    width: 110px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .perfume-img {
    max-width: 110px;
    max-height: 110px;
    width: auto;
    height: auto;
    object-fit: cover;
    object-position: center;
    display: block;
  }

  .image-credit {
    font-size: 0.7em;
    text-align: center;
    margin-top: 4px;
    color: #666;
  }

  .result-text {
    flex: 1;
    font-size: 0.9em;
    padding-left: 10px;
  }

  .ec-buttons {
    flex-wrap: wrap;
    width: calc(100% + 110px); /* 画像部分を含める */
    gap: 6px;
    margin-top: 10px;
    margin-left: -110px;
    padding-left: 0px;
  }

  .ec-button {
    flex: 0 0 calc(50% - 12px);
    font-size: 0.9em;
    min-width: auto;
    padding: 6px 0;
    box-sizing: border-box;
    text-align: center;
  }
}