body {
  font-family: sans-serif;
  margin: 0;
  background-color: #fffaf0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: 100vw;
  -webkit-text-size-adjust: 100%;
  touch-action: none;
  position: fixed;
  /* 画面を固定してスクロールを物理的に防ぐ */
}

html {
  overflow: hidden;
  height: -webkit-fill-available;
}

/* 16px以上にすることで、ブラウザによる自動ズームを回避 */
input[type="text"],
input[type="number"],
select,
textarea {
  font-size: 16px !important;
}

/* --- ヘッダー ---*/
header {
  background-color: #FFA75B00;
  /* みかん色に合う薄い黄色 */
  padding: 10px 15px;
  /*border-bottom: 2px solid #ffb300;*/
  position: sticky;
  top: 0;
  z-index: 100;
  position: relative;
  padding: 20px;
  color: white;
  overflow: hidden;
  /* 擬似要素のはみ出し防止 */
}

/* ボカシ専用の背景レイヤー */
.controls::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  /* コンテンツの後ろに配置 */

  /* ボカシの設定 */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  /* マスクの設定（これで背景だけを削る） */
  mask-image: linear-gradient(to bottom, black, black 80% transparent);
  -webkit-mask-image: linear-gradient(to bottom, black, black 80%, transparent);

  /* 必要に応じて背景色も追加 */
  background: rgba(255, 255, 255, 0.1);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: #fc7f04;
}

.controls #title {
  white-space: nowrap;
  display: flex;
  justify-content: center;
  align-items: center;
}

#search-area {
  display: flex;
  flex-direction: row;
  align-items: center;
}

.material-symbols-outlined {
  font-variation-settings:
    'FILL' 0,
    'wght' 400,
    'GRAD' 0,
    'opsz' 30;
  padding: 3px;
}


/* 検索窓を使いやすく */
#mikanSearch {
  flex-grow: 1;
  /* 空きスペースに合わせて伸びる */
  min-width: 200px;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 100px;
  text-align: center;
}

/* 世代数入力とラベル */
#title label {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.controls button {
  background: none;
  border: none;
  color: #ff8c00;
}

@media (max-width: 600px) {

  .controls {
    align-items: center;
  }

  .controls strong {
    display: none;
  }

  #mikanSearch {
    width: 80%;
    margin: auto;
    border-radius: 100px
  }
}

/* --- フィルターのドロワー --- */
#filter-drawer {
  position: fixed;
  top: 0;
  left: max(-300px, -100vw);
  width: min(300px, 100vw);
  height: 100%;
  background: white;
  z-index: 1000;
  transition: transform 0.3s ease-in-out;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
  padding: 20px;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
  color: #fc7f04;
}

#filter-drawer.active {
  transform: translateX(300px);
}

#drawer-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

#drawer-overlay.active {
  display: block;
}

#filter-list-button {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 30px;
  height: 30px;
  z-index: 10;
  background-color: white;
  border: none;
  border-radius: 50%;
  padding: 20px;
  margin-left: 30px;
  color: #ff9800;
  box-shadow: #0003 1px 2px 5px 0px;
  appearance: none;
}

#filter-drawer h3 {
  display: inline-block;
  margin: 0px;
  padding: none;
  padding-left: 20px;
}

.drawer-header {
  width: 100%;
}

#close-drawer {
  background: none;
  padding: none;
  aspect-ratio: 1;
  border: none;
  appearance: none;
  color: #ff9800;
  font-size: clamp(35px, 10vw, 4rem);
  position: absolute;
  right: 0px;
  top: 0px;
  border-radius: 100px;
  -webkit-tap-highlight-color: transparent;
}

.drawer-header {
  margin-top: 30px;
  margin-bottom: 30px;
  margin-left: 20px;
  color: #e65200;
  border-left: 5px solid #e65200;
}

.drawer-content ul {
  padding-left: 15px;
}

.drawer-content ul li {
  list-style-type: none;
  font-weight: 600;
  padding: 5px;
}

.drawer-content input#hops {
  appearance: none;
  border-radius: 100px;
  border: 1px solid #ff9800;
  text-align: center;
}

/* スイッチ本体の枠組み */
.mikan-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

/* デフォルトのチェックボックスを隠す */
.mikan-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* スライダーの背景 */
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 34px;
}

/* スライダー内の丸（みかんイメージ） */
.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* ONの時の背景色（みかんオレンジ） */
input:checked + .slider {
  background-color: #ff9800;
}

/* ONの時の丸の移動 */
input:checked + .slider:before {
  transform: translateX(20px);
  background-color: #fff; /* 白、または濃いオレンジでもOK */
}

/* ホバー時の微調整 */
.mikan-switch:hover .slider {
  box-shadow: 0 0 1px #ff9800;
}


.drawer-content button {
  appearance: none;
  background-color: #ff9800;
  color: white;
  padding: 10px;
  border-radius: 5px;
  border: none;
  margin-left: 10px;
}

.drawer-content #how-to-use {
  color: #333;
  font-weight: 400;
  font-size: 0.8rem;
  display: block;
  width: 90%;
  border: 1px solid #ff9800;
  border-radius: 10px;
  padding: 10px;
  background-color: #fff7e6;
}

.drawer-content #how-to-use li::before {
  content: '-';
}

.drawer-content a {
  appearance: none;
  color: #fc7f04;
}

.drawer-content #reference li::before {
  content: '-';
}


#copyright {
  font-size: 0.5rem;
}

.preset-container {
  display: flex;
  flex-wrap: wrap; /* これで重ならずに折り返される */
  gap: 8px;        /* ボタン同士の隙間 */
  padding: 5px;
}

/* ボタン単体のスタイル */
.drawer-content #filters .preset-container .preset-btn {
  background-color: #fffaf0; /* 薄いオレンジ背景 */
  border: 2px solid #ff9800; /* オレンジの枠線 */
  color: #ff9800;
  border-radius: 20px;       /* 角を丸くしてカプセル型に */
  padding: 6px 16px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;       /* ボタン内で改行させない */
}

.preset-btn:active {
  transform: scale(0.95);    /* 押した感を出す */
}
/* --- Cytoscapeの表示範囲 --- */
#cy {
  position: absolute;
  /* headerの下に潜り込ませる場合はabsolute */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  /* グラフ操作以外のブラウザ挙動をカット */
  touch-action: none;
}


/* --- みかんの詳細表示ウィンドウ ---*/
.info-panel {
  position: fixed;
  bottom: 20px;
  left: 20px;
  max-width: 35vw;
  background: rgba(255, 255, 255, 0.9);
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #ff8c00;
  pointer-events: none;
}

@media screen and (max-width: 850px) {
  .info-panel {
    max-width: 60vw;
  }
}

@media screen and (max-width: 480px) {
  .info-panel {
    max-width: 80vw;
  }
}

.info-panel h3 {
  display: inline;
  font-size: 1.1rem;
  margin-top: 0;
  margin-bottom: 0;
}

.info-panel .origin {
  color: grey;
}

.info-panel .other-names {
  font-size: 0.6rem;
  color: grey
}

.info-panel .note {
  font-size: 0.8rem;
}
