/* =========================================================
   プリクラ風 顔補正アプリ  スタイルシート
   - スマホ優先（モバイルファースト）デザイン
   - 初心者でも色を変えやすいよう CSS変数を使用
   ========================================================= */

/* ----- 全体で使う色やサイズの設定（ここを変えると雰囲気が変わります） ----- */
:root {
  --pink:        #ff5fa2;   /* メインのピンク */
  --pink-light:  #ffd3e6;   /* 薄いピンク */
  --purple:      #b15cff;   /* アクセントの紫 */
  --bg:          #fff5fa;   /* 背景色 */
  --card:        #ffffff;   /* カードの背景 */
  --text:        #3a2b33;   /* 文字色 */
  --shadow:      0 6px 20px rgba(255, 95, 162, 0.25);
  --radius:      18px;      /* 角丸 */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  background: linear-gradient(160deg, var(--bg), var(--pink-light));
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 40px;
  -webkit-text-size-adjust: 100%;
}

/* ---------- ヘッダー ---------- */
.app-header {
  text-align: center;
  padding: 20px 16px 14px;
}
.app-title {
  font-size: 1.4rem;
  letter-spacing: 1px;
  color: var(--pink);
  text-shadow: 1px 1px 0 #fff, 2px 2px 0 var(--pink-light);
}
.privacy-note {
  margin-top: 8px;
  font-size: 0.72rem;
  background: #fff;
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  color: var(--purple);
  box-shadow: var(--shadow);
}

/* ---------- レイアウト ---------- */
.app-main {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 14px;
}

/* ---------- 写真選択ボタン ---------- */
.upload-section { text-align: center; margin: 10px 0 16px; }
.file-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff;
  font-weight: bold;
  padding: 14px 28px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}
.file-label:active { transform: scale(0.96); }
.file-icon { font-size: 1.3rem; }

/* ---------- プレビュー ---------- */
.preview-section { margin-bottom: 16px; }
.canvas-wrap {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-canvas {
  max-width: 100%;
  height: auto;
  display: block;
}
.placeholder {
  padding: 60px 20px;
  text-align: center;
  color: #c79bb0;
  font-size: 0.9rem;
}

/* 読み込み中のスピナー */
.loading {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 5;
}
.spinner {
  width: 44px; height: 44px;
  border: 5px solid var(--pink-light);
  border-top-color: var(--pink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* 補正前/後トグル */
.compare-toggle {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}
.toggle-btn {
  border: 2px solid var(--pink);
  background: #fff;
  color: var(--pink);
  padding: 6px 22px;
  border-radius: 999px;
  font-weight: bold;
  cursor: pointer;
}
.toggle-btn.active {
  background: var(--pink);
  color: #fff;
}

/* ---------- スライダー ---------- */
.controls {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.controls-title {
  font-size: 1rem;
  color: var(--purple);
  margin-bottom: 12px;
  text-align: center;
}
.slider-row { margin-bottom: 14px; }
.slider-row label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 6px;
}
.slider-row span { color: var(--pink); font-weight: bold; }

/* スライダー本体のデザイン（iOS/Android対応） */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--pink-light);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--pink);
  border: 3px solid #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--pink);
  border: 3px solid #fff;
  cursor: pointer;
}

/* ---------- アクションボタン ---------- */
.actions {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}
.action-btn {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: var(--radius);
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}
.action-btn:active { transform: scale(0.96); }
.action-btn.reset { background: #fff; color: var(--purple); border: 2px solid var(--purple); }
.action-btn.save  { background: linear-gradient(135deg, var(--pink), var(--purple)); color: #fff; }

/* 顔検出ステータス表示 */
.face-status {
  text-align: center;
  font-size: 0.8rem;
  color: var(--purple);
  min-height: 1.2em;
}

/* ---------- フッター ---------- */
.app-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.7rem;
  color: #c79bb0;
}

/* ---------- PC向け微調整 ---------- */
@media (min-width: 600px) {
  .app-title { font-size: 1.8rem; }
}


/* 追加情報・戻るリンク */
.gallery-link {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--purple);
  font-size: 0.8rem;
  text-decoration: underline;
}
.info-section {
  width: calc(100% - 28px);
  max-width: 520px;
  margin: 0 auto 22px;
  padding: 18px 16px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.info-section h2 { color: var(--purple); font-size: 1rem; margin-bottom: 8px; }
.info-section p, .info-section li { font-size: 0.86rem; line-height: 1.8; }
.info-section ul { margin-left: 1.2em; margin-top: 8px; }

@media (max-width: 420px) {
  .info-section {
    width: calc(100% - 24px);
    padding: 16px 14px;
  }
}
