/* ===== リセット & 基本設定 ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --col-do:   #4A90D9;   /* したい = 青 */
  --col-recv: #E2556B;   /* されたい = 赤 */
  --col-both-l: #4A90D9;
  --col-both-r: #E2556B;
  --col-ng:   #A8A4A1;
  --col-ink:  #FFF5E8;
  --col-muted: rgba(247,238,232,0.72);
  --col-bg:   #0f0c10;
  --col-bg-top: #28141d;
  --col-card: rgba(247,238,232,0.075);
  --col-card-strong: rgba(247,238,232,0.11);
  --col-gold: #F6D46B;
  --col-glass: #E7C6A0;
  --col-chip-active-bg: rgba(246,212,107,0.15);
  --col-chip-active-fg: #F6D46B;
  --col-chip-border: rgba(246,212,107,0.38);
  --radius-pill: 999px;
  --shadow-card: 0 14px 36px rgba(0,0,0,0.28);
  --font: "Zen Maru Gothic", sans-serif;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-weight: 500;
  background:
    radial-gradient(circle at 50% -120px, rgba(128,36,66,0.72), transparent 430px),
    linear-gradient(180deg, var(--col-bg-top) 0%, var(--col-bg) 52%, #09070a 100%);
  color: var(--col-ink);
  min-height: 100vh;
  padding: 0 0 env(safe-area-inset-bottom, 0) 0;
}

/* ===== レイアウト ===== */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
}

main {
  padding-bottom: 120px;
}

/* ===== ヘッダー ===== */
.site-header {
  background: transparent;
  box-shadow: none;
  padding: 22px 16px 12px;
  text-align: center;
}

.site-header h1 {
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1.18;
  margin-bottom: 12px;
  text-shadow: 0 2px 0 rgba(0,0,0,0.35);
}

.legend {
  background: var(--col-card);
  border: 1px solid rgba(246,212,107,0.22);
  border-radius: 12px;
  padding: 10px 12px;
  text-align: left;
  font-size: 0.76rem;
  line-height: 1.75;
  margin-bottom: 8px;
  color: var(--col-muted);
}

.legend-do   { color: var(--col-do);   font-weight: 700; }
.legend-recv { color: var(--col-recv); font-weight: 700; }

.legend-both-text {
  display: inline-block;
  background: linear-gradient(to right, var(--col-do) 50%, var(--col-recv) 50%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

.age-notice {
  font-size: 0.72rem;
  color: rgba(247,238,232,0.52);
  margin-top: 6px;
}

/* ===== セクション共通 ===== */
.section {
  background: var(--col-card);
  border: 1px solid rgba(247,238,232,0.12);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  padding: 16px;
  margin-top: 16px;
  backdrop-filter: blur(10px);
}

.section-title {
  font-size: 1rem;
  font-weight: 900;
  margin-bottom: 12px;
  padding-bottom: 8px;
  color: var(--col-gold);
  border-bottom: 1px solid rgba(246,212,107,0.24);
}

/* ===== チップグループ ===== */
.chip-group {
  margin-bottom: 12px;
}

.chip-group-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--col-muted);
  margin-bottom: 6px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--col-chip-border);
  background: rgba(15,12,16,0.38);
  color: var(--col-ink);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  min-height: 34px;
  line-height: 1;
  user-select: none;
}

.chip:hover {
  border-color: var(--col-gold);
}

.chip.active {
  background: var(--col-chip-active-bg);
  color: var(--col-chip-active-fg);
  border-color: var(--col-gold);
  font-weight: 700;
}

/* ===== 瓶グリッド ===== */
.jar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 13px 7px;
}

.jar-help {
  font-size: 0.78rem;
  color: var(--col-muted);
  margin-bottom: 12px;
}

.jar-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 2px 0 0;
  border-radius: 10px;
  border: 0;
  transition: filter 0.15s, transform 0.15s;
  min-height: 92px;
  background: none;
  font-family: var(--font);
}

.jar-cell:hover {
  transform: translateY(-1px);
  filter: brightness(1.12);
}

.jar-cell.selected {
  background: radial-gradient(circle at 50% 44%, rgba(246,212,107,0.18), transparent 60%);
  filter: drop-shadow(0 0 8px rgba(246,212,107,0.35));
}

.jar-cell svg {
  width: 100%;
  max-width: 58px;
  height: auto;
  display: block;
  aspect-ratio: 100 / 120;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,0.34));
}

.jar-label {
  font-size: 0.76rem;
  font-weight: 900;
  text-align: center;
  margin-top: 4px;
  line-height: 1.12;
  word-break: keep-all;
  color: #FFF5E8;
  text-shadow: 0 1px 0 rgba(0,0,0,0.62);
}

/* ===== 生成セクション ===== */
.generate-section {
  background: var(--col-card);
  border: 1px solid rgba(247,238,232,0.12);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  padding: 20px 16px;
  margin-top: 16px;
  text-align: center;
}

.btn-generate {
  display: inline-block;
  padding: 14px 32px;
  background: var(--col-gold);
  color: #171014;
  border: none;
  border-radius: var(--radius-pill);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  transition: opacity 0.15s;
  min-height: 48px;
}

.btn-generate:hover { opacity: 0.85; }

.preview-area {
  display: none;
  margin-top: 20px;
}

.preview-area.visible { display: block; }

#preview-img {
  width: 100%;
  border-radius: 10px;
  box-shadow: var(--shadow-card);
  display: block;
}

.share-buttons {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-share {
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  border: none;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
  transition: opacity 0.15s;
}
.btn-share:hover { opacity: 0.85; }

.btn-x {
  background: #000;
  color: #fff;
}

.btn-save {
  background: rgba(247,238,232,0.9);
  color: #171014;
}

.share-hint {
  display: none;
  font-size: 0.75rem;
  color: var(--col-muted);
  margin-top: 8px;
  line-height: 1.5;
}

.share-hint.visible { display: block; }

.share-note {
  margin-top: 10px;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--col-gold);
}

/* ===== フッター ===== */
.site-footer {
  text-align: center;
  padding: 24px 16px;
  font-size: 0.75rem;
  color: rgba(247,238,232,0.52);
  line-height: 1.8;
}

.site-footer a {
  color: var(--col-gold);
  text-decoration: none;
}

/* ===== ボトムシート ===== */
.bottom-sheet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.58);
  z-index: 100;
}

.bottom-sheet-overlay.visible { display: block; }

/* シート本体：通常は非表示、overlay.visible のときだけ表示 */
.bottom-sheet {
  display: none;
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: #151014;
  color: var(--col-ink);
  border: 1px solid rgba(247,238,232,0.16);
  border-radius: 18px 18px 0 0;
  padding: 0 16px calc(env(safe-area-inset-bottom, 0px) + 20px);
  z-index: 101;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.38);
}

.bottom-sheet-overlay.visible ~ .bottom-sheet {
  display: block;
}

.bottom-sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: rgba(247,238,232,0.28);
  margin: 12px auto 16px;
}

.bottom-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.bottom-sheet-title {
  font-size: 1rem;
  font-weight: 900;
}

.sheet-description {
  margin: 2px 0 20px;
  padding: 12px 14px;
  border: 1px solid rgba(231, 198, 160, 0.26);
  border-radius: 8px;
  background: rgba(247, 238, 232, 0.055);
  color: rgba(255, 245, 232, 0.84);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.75;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  color: rgba(247,238,232,0.72);
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.1s;
}
.btn-close:hover { background: rgba(247,238,232,0.08); }

.sheet-section-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--col-muted);
  margin-bottom: 8px;
}

/* 種別ボタン */
.type-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.btn-type {
  flex: 1;
  min-width: 0;
  padding: 10px 3px;
  border-radius: 10px;
  border: 1.5px solid rgba(247,238,232,0.18);
  background: rgba(247,238,232,0.06);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  min-height: 44px;
  color: var(--col-ink);
}

.btn-type:hover { border-color: rgba(246,212,107,0.65); }

.btn-type.active-do   { border-color: var(--col-do);   background: rgba(74,144,217,0.18); }
.btn-type.active-recv { border-color: var(--col-recv);  background: rgba(226,85,107,0.18); }
.btn-type.active-both { border-color: var(--col-gold); background: rgba(246,212,107,0.12); color: var(--col-gold); }
.btn-type.active-ng   { border-color: var(--col-ng);    background: rgba(136,136,136,0.12); }
.btn-type.active-clear { border-color: rgba(247,238,232,0.34); background: rgba(247,238,232,0.1); }

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-do   { background: var(--col-do); }
.dot-recv { background: var(--col-recv); }
.dot-ng   { background: var(--col-ng); }

.dot-both {
  background: linear-gradient(to right, var(--col-do) 50%, var(--col-recv) 50%);
}

/* 強さボタン */
.level-panel {
  display: none;
}

.level-panel.visible {
  display: block;
}

.level-title-do {
  color: #8FC7FF;
}

.level-title-recv {
  color: #FF9AAD;
}

.level-buttons {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.btn-level {
  flex: 1;
  padding: 10px 4px;
  border-radius: 10px;
  border: 1.5px solid rgba(247,238,232,0.18);
  background: rgba(247,238,232,0.06);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  min-height: 44px;
  color: var(--col-ink);
}

.btn-level:hover { border-color: rgba(246,212,107,0.65); }

.btn-level.active-do {
  border-color: var(--col-do);
  background: rgba(74,144,217,0.22);
  color: #8FC7FF;
}

.btn-level.active-recv {
  border-color: var(--col-recv);
  background: rgba(226,85,107,0.22);
  color: #FF9AAD;
}

.btn-level.disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* ===== スクロールバー細め ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: #DDD; border-radius: 2px; }
