html {
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  padding: 0;
  background-color: #fefefe;
  color: #333;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  font-family: Noto Sans JP;
}

/* Header */
.site-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-bottom: 1px solid #bbb;

  /* ▼ 追記：スクロール追従用 */
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #fff;
  transition: padding 0.25s ease,
              box-shadow 0.25s ease,
              flex-direction 0.25s ease;
}

.header-top {
  text-align: center;
  margin-bottom: 0px;

  /* ▼ 追記：アニメーション */
  transition: all 0.25s ease;
}

.site-logo {
  max-width: 500px;
  height: auto;

  /* ▼ 追記：縮小アニメーション用 */
  transition: transform 0.25s ease;
}

.site-title {
  display: inline-block;
}

.site-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;

  /* ▼ 追記：レイアウトのアニメーション */
  transition: justify-content 0.25s ease;
}

.site-nav a {
  margin-left: 0px;
  color: #666;
  text-decoration: none;
  font-size: 0.95em;
}

.site-nav a:hover {
  color: #000;
}

.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown > a {
  padding: 10px 15px 0px 15px;
  text-decoration: none;
  color: #444;
}

.nav-menu {
  position: relative;
  display: inline-block;
}

.nav-menu a {
  padding: 10px 15px 0px 15px;
  text-decoration: none;
  color: #444;
}

.nav-menu a:hover {
  border-bottom: 3px solid #90E1E4;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  background-color: white;
  min-width: 200px;
  border: 0px solid #ccc;
  z-index: 10;
  font-size: 14px;
  padding: 0px 0px 0px 5px;
  
}

.dropdown-menu a {
  display: block;
  padding: 10px;
  color: #333;
  text-decoration: none;
}

.dropdown-menu a:hover {
  background-color: #f5f5f5;
}

.nav-dropdown:hover .dropdown-menu {
  display: block;
}

/* --- ▼ 2階層目（サブメニュー）対応 --- */

.nested-dropdown {
  position: relative;
}

.nested-dropdown > a {
  display: block;
  padding: 10px;
  color: #333;
  text-decoration: none;
  white-space: nowrap;
}

.nested-dropdown > a::after {
  content: ">";
  position: absolute;
  right: 0.5em;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  font-size: 0.9em;
}

.nested-menu {
  display: none;
  position: absolute;
  top: 0;
  left: 100%;
  background-color: white;
  min-width: 200px;
  border: 0px solid #ccc;
  z-index: 11;
  font-size: 14px;
  padding-left: 5px;
}

.nested-dropdown:hover .nested-menu {
  display: block;
}

.nested-menu a {
  padding: 10px;
  color: #333;
  text-decoration: none;
}

.nested-menu a:hover {
  background-color: #f5f5f5;
}

/* Main */
.site-main {
  max-width: 960px;
  margin: 20px auto;
  padding: 0 20px;
}

.hero h1{
  font-size: 32px;
  text-align: center;
  margin: 10px 0 10px 0;
  font-family: "Zen Kaku Gothic New", sans-serif;
  font-weight: 900;
  font-style: normal;
  line-height: 1.1;
  letter-spacing: 4px;
}

.hira {
  font-size: 0.98em;
  position: relative;
  top: 0.02em;   /* ここをちょっといじると「好きな香水を」みたいなバランスになる */
}

.hero p{
  font-size: 14.4px;
  text-align: center;
  margin: 0 0 2.5em 0;
  color: #666;
}

.tab-buttons-row {
  display: flex;
  border-bottom: 2px solid #90E1E4;
  margin-bottom: 20px;
  gap: 5px;
  padding: 0 20px;
}

.tab-btn {
  flex: 1;
  padding: 12px 16px;
  font-size: 0.90em;
  background: #fff;
  border: none;
  border-top: 2px solid #ccc;
  border-right: 2px solid #ccc;  
  border-left: 2px solid #ccc;
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
  cursor: pointer;
  transition: background 0.2s ease, border-bottom 0.2s ease;
}

.tab-btn:hover {
  background: #eee;
}

.tab-btn.active {
  background: #fff;
  border-top: 2px solid #90E1E4;
  border-right: 2px solid #90E1E4;
  border-left: 2px solid #90E1E4;  
  border-bottom: 2px solid #fff;
  font-weight: bold;
  z-index: 2;
  margin-bottom: -2px;
}

/* タブアイコン */
.tab-icon {
  width: 40px;
  height: 40px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Footer */
.site-footer {
  background-color: #fafafa;
  border-top: 1px solid #e0e0e0;
  padding: 20px;
  text-align: center;
  font-size: 0.85em;
  color: #888;
}

.footer-note {
  margin-top: 4px;
  font-size: 0.8em;
  color: #aaa;
}

.footer-links {
  margin-top: 1.5em;
  font-size: 0.85em;
  text-align: center;
}

.footer-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  display: inline-block;
  margin: 0 10px;
}

.footer-links a {
  color: #666;
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}


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;
}

/* 選択ノートの外枠 */
#selected-notes-container {
  margin: 1em 0;
  min-height: 40px;
  position: relative;
  border:1px solid #ccc;
  border-radius: 7px;
}

/* ノートが無い時に表示するプレースホルダ */
#note-placeholder {
  color: #aaa;
  font-size: 14px;
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* 選択済みノートの見た目 */
.note-tag {
  display: inline-block;
  background: #d9ebff;
  border-radius: 16px;
  padding: 5px 10px;
  margin: 3px;
  font-size: 14px;
}

.note-tag .remove {
  margin-left: 5px;
  cursor: pointer;
  font-weight: bold;
  color: #555;
}

/* ボタングループを中央寄せ */
.button-group {
  text-align: center;
  margin: 1em 0;
}

/* ボタンスタイル */
.button-group button {
  color: white;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 15px;
  margin: 0 5px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.search-button {
  background-color: #90E2E4;
}

.reset-button {
  background-color: #555;
}

button {
  font-size: 1em;
  cursor: pointer;
}

.note-button {
  background-color: #f9f9f9;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 3px 12px;
  margin: 4px;
  font-size: 0.9em
}

.note-button.selected {
  background-color: #a2d2ff;
}

/* トグルタイトル */
.note-toggle {
  background-color: #eee;
  padding: 4px 10px;
  font-size: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  border-left: 4px solid #90E2E4;
}

.toggle-icon {
  font-weight: bold;
  font-size: 1.1em;
}

/* セクション折りたたみ対応 */
.note-section {
  display: none;
  margin-bottom: 15px;
}

.note-section.open {
  display: flex;
}

/* 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;
  font-size: 16px;
  margin: 0px 2px;
}

.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;
}

.selected-perfume-preview {
  flex-direction: row;
  align-items: flex-start;
  margin: 20px 0px;
}

/* 検索結果表示 */
#loading {
  display: none;
  font-style: italic;
  color: #666;
  margin-top: 20px;
}

#search-result-area {
  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: 0px;
  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 {
  max-width: 150px;
  max-height: 150px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

/* 横長画像だけトリミング */
img.perfume-img.horizontal {
  width: 150px;
  height: 150px;
  object-fit: cover;
  object-position: center;
}

/* 縦長（明示したい場合） */
img.perfume-img.vertical {
  /* 何もしなくてOKだが、意図を明確にするなら */
  object-fit: contain;
}

.result-text {
  flex: 1;
  padding-left: 20px;
  display: block;
}

.brand-en {
  font-size: 14px;
  margin-bottom: 4px;
}

.brand-en a {
  color: #777;
}

.perfume-ja {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 4px;
  color: #000;
}

.notes {
  font-size: 14px;
  color: #444;
  display: block;
}

.notes-toggle {
  display: none;
}

.price-size {
  font-size: 14px;
  color: #444;
  padding: 0px 0px;
}

.note-line {
  font-size: 14px;
}

.similarity-stars {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  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;
}

/* ドロワーアイコン */
.drawer-toggle {
  background: none;
  border: none;
  font-size: 26px;
  cursor: pointer;
  display: none; /* モバイルでのみ表示 */
}

.brand-section,.group-section,
.perfume-button-container {
  display: none;
}

.brand-section.open,.group-section.open,
.perfume-button-container.open {
  display: block;
}

.brand-buttons-pc {
  margin-bottom: 10px;
}

.brand-button,
.perfume-button,
.group-button,
.character-button {
  background-color: #f9f9f9;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 3px 12px;
  margin: 4px 2px;
  font-size: 0.9em
}

.brand-button.selected,
.perfume-button.selected,
.group-button.selected,
.character-button.selected {
  background-color: #D9EBFF;
  border-color: #4169e1;
  color: #000;
}

.placeholder-message {
  font-size: 14px;
}

.selected-info {
  font-size: 14px;
  margin: 12px 0;
  color: #444;
}

.tab-lead {
  font-size: 14.4px;
  color: #666;
}

.how-to-use h2{
  font-size: 16px;
  margin: 30px 0 15px 0;
  border-left: solid 4px #ccc;
  padding: 0.25em 0.5em;
}

.how-to-use ol{
  font-size: 14px;
  padding-left: 20px;
}

/* 入口ボタン2つ */
.ec-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.ec-main-btn {
  flex: 1;
  padding: 8px 6px;
  font-size: 13px;
  border-radius: 4px;
  border: none;
  background: #ff8a3c; /* ECボタン色 */
  color: #fff;
  cursor: pointer;
}

.ec-main-btn.ec-main-btn--decant {
  background: #00a0c6; /* 計り売りボタン色 */
}

/* ポップアップ共通 */
.ec-popup {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1001;
}
.ec-popup.show {
  display: flex;
}

.ec-popup-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: none;
  z-index: 1000;
}
.ec-popup-backdrop.show {
  display: block;
}

.ec-popup-inner {
  background: #fff;
  border-radius: 8px;
  padding: 14px 16px 12px;
  width: min(320px, 90vw);
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

.ec-popup-title {
  font-size: 14px;
  margin: 0 0 8px;
}

.ec-popup-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ec-link {
  display: block;
  text-align: center;
  padding: 7px 6px;
  border-radius: 4px;
  color: #fff;
  text-decoration: none;
  font-size: 13px;
}

/* 色は既存のボタンに合わせて */
.ec-amazon  { background:#ff8a3c; }
.ec-rakuten { background:#e60012; }
.ec-yahoo   { background:#4090ff; }
.ec-gakuen  { background:#00a080; }

.ec-ease    { background:#6c4bd3; }
.ec-celes   { background:#00b8b8; }

.result-h1 {
  font-size: 18px;
  font-weight: 600;
  margin: 0.4em 0 0.4em 0;
}


/* スマホ時表示切替 */
@media (max-width: 768px) {
  .site-logo {
  max-width: 70%;
  height: auto;
  }

  .site-main {
    margin: 0 0 20px 0;
    padding: 0 20px;
  }

  .site-footer {
  padding: 0 20px 20px 20px;
  }

  .drawer-toggle {
    display: block;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1001;
    color: inherit;
    text-decoration: none;
    -webkit-appearance: none; /* iOSボタンの初期装飾を無効化 */
  }

  .drawer-toggle img {
    width: 40px;
    height: auto;
  }

  .drawer-toggle a {
    text-decoration: none;
  }  

  .site-nav {
    display: none;
    position: absolute;
    top: 70px;
    left: 0;
    width: 100%;
    background: #fff;
    flex-direction: column;
    z-index: 1000;
    padding: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  }

  .site-nav.open {
    display: flex;
    gap: 5px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .nav-menu {
    display: block;
    border-bottom: 1px solid #ccc;
    margin-top: 5px;
    position: relative; /* 追記：＋／－表示用 */
    padding-right: 1.5em; /* 追記：右に余白確保 */
  }

  .nav-menu a:hover {
  border-bottom: none;
  }

  .site-nav .nav-dropdown .nav-menu > a {
    display: block;
    width: 100%;
    padding: 5px 0;
  }

  .site-nav .dropdown-menu {
    display: none; /* ← 初期状態は閉じる */
    padding-left: 7px;
    font-size: 14px;
    transition: all 0.3s ease;
    position: static;
  }

  .dropdown-menu a {
    padding: 7px;
    border-bottom: 1px solid #ccc;
    position: relative; /* 追記：▶用 */
    padding-left: 1.5em; /* 追記：▶ぶん余白 */
  }

  /* ▶を左に表示 */
  .dropdown-menu a::before {
    content: '▶';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6em;
    color: #666;
  }

  .nav-dropdown .dropdown-menu .nested-menu {
    display: none;
  }

  .nested-menu {
    position :static;
    padding-left: 15px;
  }

  .nav-dropdown:hover .dropdown-menu {
    display: none;
  }

  .site-nav .nav-dropdown.open .dropdown-menu {
    display: block; /* ← `.open` クラスが付いたら展開 */
  }

  .nav-dropdown.open > .dropdown-menu {
    display: block;
  }

  .nested-dropdown.open > .nested-menu {
    display: block;
  }

  /* ＋／－トグル表示 */
  .nav-menu::after {
    content: '＋';
    position: absolute;
    right: 1em;
    top: 50%;
    transform: translateY(-50%);
    font-weight: bold;
    font-size: 0.8em;
  }

  .nav-dropdown.open .nav-menu::after {
    content: '－';
  }

  .tab-buttons-row {
    padding: 0px;
  }

  .tab-btn {
    flex: 1;
    padding: 3px 3px;
    font-size: 15px;
    color: inherit;
    text-decoration: none;
    -webkit-appearance: none; /* iOSボタンの初期装飾を無効化 */
  }

  .note-section.open {
  display: block;
  }

  .gyo-button {
    display: block;
    width: 100%;
    text-align: left;
    background-color: #eee;
    border: none;
    border-radius: 5px;
    padding: 6px;
    margin-bottom: 5px;
    font-size: 15px;
  }
  

  .dan-button {
    display: block;
    width: 100%;
    text-align: left;
    background-color: #d6ebff;
    border: none;
    border-radius: 4px;
    padding: 6px;
    margin-bottom: 5px;
    font-size: 15px;
  }

  .note-toggle {
    padding: 7px;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
  }

  .gyo-button,
  .dan-button,
  .kana-button,
  .note-button,
  .brand-button,
  .perfume-button,
  .group-button,
  .character-button {
    color: inherit;
    text-decoration: none;
    -webkit-appearance: none; /* iOSボタンの初期装飾を無効化 */
  }

  .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: 14px;
    background-color: #f9f9f9;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 5px 4px;
    margin: 2px 1px;
  }

  .selected-info {
    font-size: 0.85em;
    background-color: #eee;
    padding: 5px 0px;
    margin: 0 calc(50% - 50vw);
	  width: 100vw;
  }

  .brand-button,
  .perfume-button,
  .group-button,
  .character-button {
    font-size: 14px;
    background-color: #f9f9f9;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 5px 4px;
    margin: 2px 1px;
  }

  .character-button,
  .perfume-button {
    margin-right: 4px;
  }

  .kana-button {
  padding: 5px 8px;
  font-size: 15px;
  }  

  .result-item {
    font-size: 0.9em;
    flex-wrap: wrap;
  }

  .selected-perfume-preview {
    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;
  }

  img.perfume-img {
    max-width: 110px;
    max-height: 110px;
    width: auto;
    height: auto;
    object-position: center;
  }

  .image-credit {
    font-size: 0.7em;
    text-align: center;
    margin-top: 4px;
    color: #666;
  }

  .notes-toggle {
    display: block;
    font-size: 13px;
    color: #0077aa;
    cursor: pointer;
    margin-top: 6px;
  }

  .notes-toggle.open {
    margin-bottom: 4px;
  }

  .notes {
    display: none;      /* 初期は非表示 */
  }

  .notes.open {
    display: block;     /* 開いたときに表示 */
  }

  .note-line {
  font-size: 13px;
  }

  .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: 13px;
    min-width: auto;
    padding: 6px 0;
    box-sizing: border-box;
    text-align: center;
  }

  #overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5); /* 半透明の黒 */
  z-index: 99; /* メニューより下、背景より上に */
  }

  /* メニューが開いてるときに表示 */
  body.drawer-open #overlay {
    display: block;
  }
  
  .hero h1{
  font-size: 25px;
  }

  .ec-actions {
    margin-left:-120px ;
  }
}

/* ここから追加部分：スクロール後の見た目 */
/* PC想定：横並びにしたいので min-width:769px だけ切り替える */
@media (min-width: 1025px) {

  /* body に .is-scrolled が付いたときの状態 */
  body.is-scrolled .site-header {
    flex-direction: row;             /* ロゴ＋ナビを横並びに */
    align-items: center;
    justify-content: center;
    padding-top: 8px;                /* 上の余白を少し減らしてコンパクトに */
    padding-bottom: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  }

  body.is-scrolled .header-top {
    margin-bottom: 0;
    text-align: left;                /* ロゴを左寄せ */
  }

  body.is-scrolled .site-logo {
    max-width: 300px;           /* ロゴを小さく */
  }

  body.is-scrolled .site-nav {
    justify-content: flex-end;       /* メニューを右側に寄せる */
  }
}