/* ===== Beauty Atelier — 上品なベージュ×ゴールドの雑誌風デザイン ===== */
:root {
  --bg: #f6f1e8;
  --bg-deep: #efe7d8;
  --ink: #4a3f33;
  --ink-light: #7a6d5c;
  --gold: #a8853c;
  --gold-soft: #c9b483;
  --brown: #8a7357;
  --tier-best: #9a824f;
  --card: #fffdf8;
  --line: #ddd2bd;
  --accent-rose: #c98d7e;
  font-size: 15px;
}

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

body {
  font-family: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "BIZ UDMincho", serif;
  background: linear-gradient(180deg, #faf6ee 0%, var(--bg) 40%, #f1e9da 100%);
  color: var(--ink);
  line-height: 1.75;
  letter-spacing: 0.04em;
  min-height: 100vh;
}

main { max-width: 1000px; margin: 0 auto; padding: 0 20px 60px; }

/* ---- header ---- */
.site-header { text-align: center; padding: 46px 16px 30px; }
.header-sub { letter-spacing: 0.5em; color: var(--ink-light); font-size: 0.85rem; }
.header-title {
  font-size: 2rem; font-weight: 600; letter-spacing: 0.28em;
  color: var(--ink); margin: 8px 0 10px; position: relative; display: inline-block;
  padding: 0 30px;
}
.header-title::before, .header-title::after {
  content: "❦"; color: var(--gold-soft); font-size: 1.1rem;
  position: absolute; top: 50%; transform: translateY(-50%);
}
.header-title::before { left: 0; }
.header-title::after { right: 0; }
.header-lead { color: var(--ink-light); font-size: 0.9rem; }

/* ---- cards ---- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 2px 14px rgba(120, 100, 60, 0.08);
  padding: 26px 28px;
  margin-bottom: 26px;
}
.card-title {
  font-size: 1.05rem; letter-spacing: 0.2em; color: var(--gold);
  border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 18px;
  font-weight: 600;
}
.mini-title {
  font-size: 0.98rem; letter-spacing: 0.14em; color: var(--gold);
  margin-bottom: 12px; font-weight: 600;
}

/* ---- form ---- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 0.85rem; color: var(--ink-light); }
input, select, textarea {
  font-family: inherit; font-size: 0.95rem; color: var(--ink);
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 4px;
  background: #fffefb;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold-soft); }
.free-label { margin-top: 14px; }

/* ---- 体型 / 骨格 切り替え ---- */
.body-field { margin-top: 16px; display: flex; flex-direction: column; gap: 9px; }
.field-label { font-size: 0.85rem; color: var(--ink-light); }
.body-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; width: fit-content; }
.body-mode-btn {
  font-family: inherit; font-size: 0.85rem; padding: 9px 20px; cursor: pointer;
  background: var(--bg-deep); color: var(--ink-light); border: none;
}
.body-mode-btn + .body-mode-btn { border-left: 1px solid var(--line); }
.body-mode-btn.active { background: var(--brown); color: #fff; }
.body-select { max-width: 460px; }
.body-hint { font-size: 0.78rem; color: var(--ink-light); }

/* ---- method tabs ---- */
.method-tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.method-tab {
  flex: 1; min-width: 140px; padding: 10px 8px; cursor: pointer;
  font-family: inherit; font-size: 0.9rem; letter-spacing: 0.05em;
  background: var(--bg-deep); color: var(--ink-light);
  border: 1px solid var(--line); border-radius: 4px;
}
.method-tab.active { background: var(--brown); color: #fff; border-color: var(--brown); }

/* ---- photo ---- */
.photo-drop {
  border: 2px dashed var(--gold-soft); border-radius: 8px;
  min-height: 180px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; text-align: center; color: var(--ink-light);
  margin-bottom: 14px; overflow: hidden; background: #fbf8f1;
}
.photo-drop:hover { background: #f6f0e2; }
.drop-icon { font-size: 2rem; }
#photo-preview { max-width: 100%; max-height: 320px; display: block; }

.api-box { margin: 6px 0 16px; font-size: 0.85rem; color: var(--ink-light); }
.api-box summary { cursor: pointer; color: var(--gold); }
.api-box input { width: 60%; margin: 8px 8px 0 0; }
.hint { font-size: 0.82rem; color: var(--ink-light); margin: 8px 0 12px; }
#key-status { margin-left: 8px; font-size: 0.82rem; }
.error-msg { color: #a33; margin-top: 12px; font-size: 0.88rem; white-space: pre-wrap; }

/* ---- buttons ---- */
.btn {
  font-family: inherit; letter-spacing: 0.12em; cursor: pointer;
  padding: 12px 28px; font-size: 0.95rem; border-radius: 4px;
  border: 1px solid var(--brown); background: #fff; color: var(--brown);
  transition: 0.2s;
}
.btn:hover { opacity: 0.85; }
.btn.primary { background: var(--brown); color: #fff; }
.btn.small { padding: 7px 16px; font-size: 0.82rem; }
.btn.ghost { border-color: var(--line); color: var(--ink-light); background: transparent; }
.nav-row { display: flex; gap: 12px; justify-content: center; margin-top: 8px; }

/* ---- direct type grid ---- */
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.type-btn {
  padding: 12px 10px; text-align: center; cursor: pointer;
  border: 1px solid var(--line); border-radius: 4px; background: #fffefb;
  font-family: inherit; font-size: 0.92rem; color: var(--ink);
}
.type-btn small { display: block; color: var(--ink-light); font-size: 0.75rem; margin-top: 3px; }
.type-btn:hover { border-color: var(--gold); background: #fbf6ea; }

/* ---- quiz ---- */
.quiz-progress { color: var(--gold); letter-spacing: 0.2em; font-size: 0.85rem; margin-bottom: 10px; }
.quiz-question { font-size: 1.15rem; margin-bottom: 22px; font-weight: 600; }
.quiz-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.quiz-opt {
  text-align: left; padding: 13px 18px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 4px; background: #fffefb;
  font-family: inherit; font-size: 0.95rem; color: var(--ink);
}
.quiz-opt:hover { border-color: var(--gold); background: #fbf6ea; }

/* ---- loading ---- */
.loading-card { text-align: center; padding: 60px 20px; }
.spinner {
  width: 44px; height: 44px; margin: 0 auto 20px;
  border: 3px solid var(--line); border-top-color: var(--gold);
  border-radius: 50%; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- result: face type card ---- */
.facetype-card { display: flex; gap: 30px; flex-wrap: wrap; align-items: center; }
.facetype-left { flex: 1; min-width: 240px; text-align: center; border-right: 1px solid var(--line); padding-right: 20px; }
.facetype-label {
  display: inline-block; font-size: 0.8rem; letter-spacing: 0.25em; color: var(--ink-light);
  border: 1px solid var(--line); padding: 3px 16px; border-radius: 999px; margin-bottom: 12px;
}
.facetype-name { font-size: 1.9rem; letter-spacing: 0.14em; color: var(--ink); font-weight: 600; }
.facetype-axis-note { color: var(--ink-light); font-size: 0.88rem; margin-top: 6px; }
.facetype-desc { font-size: 0.86rem; margin-top: 12px; text-align: left; color: var(--ink-light); }
.facetype-right { flex: 1.2; min-width: 280px; display: flex; flex-direction: column; gap: 16px; }

.axis-row { display: grid; grid-template-columns: 5.5em 1fr 5.5em; align-items: center; gap: 10px; font-size: 0.85rem; }
.axis-row .axis-l { text-align: right; }
.axis-track { position: relative; height: 3px; background: var(--line); border-radius: 2px; }
.axis-dot {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 13px; height: 13px; background: var(--gold); border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(168, 133, 60, 0.2);
}

/* ---- section title ---- */
.section-title {
  text-align: center; margin: 34px 0 22px; font-size: 1.2rem; letter-spacing: 0.3em;
  display: flex; align-items: center; gap: 18px; color: var(--ink); font-weight: 600;
}
.section-title::before, .section-title::after { content: ""; flex: 1; height: 1px; background: var(--gold-soft); }

/* ---- hair tiers ---- */
.tier-block {
  display: flex; gap: 0; margin-bottom: 22px; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--line); background: var(--card); box-shadow: 0 2px 14px rgba(120,100,60,0.08);
}
.tier-side {
  width: 172px; flex-shrink: 0; padding: 22px 16px; color: #fff;
  display: flex; flex-direction: column; justify-content: center; text-align: center;
}
.tier-best-side { background: linear-gradient(160deg, #a08650, #8a7357); }
.tier-mid-side { background: linear-gradient(160deg, #b3a284, #a09070); }
.tier-low-side { background: linear-gradient(160deg, #b9ad9b, #a89d8d); }
.tier-crown { font-size: 1.5rem; }
.tier-name { font-size: 1.05rem; letter-spacing: 0.15em; margin: 6px 0 10px; font-weight: 600; }
.tier-note { font-size: 0.78rem; opacity: 0.92; }
.tier-styles { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; padding: 20px; }
.hairstyle { text-align: center; }
.hairstyle svg { width: 100%; max-width: 130px; height: auto; background: #f4ede0; border-radius: 6px; }
.hairstyle .hs-name { font-size: 0.9rem; margin-top: 8px; font-weight: 600; }
.hairstyle .hs-sub { font-size: 0.76rem; color: var(--ink-light); }
.hairstyle .hs-comment { font-size: 0.74rem; color: var(--ink-light); margin-top: 4px; line-height: 1.5; }

/* ---- result bottom ---- */
.result-bottom { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 20px; }
.makeup-list dt { color: var(--gold); font-size: 0.88rem; font-weight: 600; margin-top: 10px; }
.makeup-list dt:first-child { margin-top: 0; }
.makeup-list dd { font-size: 0.84rem; color: var(--ink-light); margin-left: 0; }

.palette-name { font-size: 0.84rem; color: var(--ink-light); margin: 10px 0 5px; }
.swatch-row { display: flex; gap: 10px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.08); }

.check-list { list-style: none; margin-top: 10px; }
.check-list li { font-size: 0.85rem; margin-bottom: 8px; padding-left: 1.6em; position: relative; }
.check-list li::before { content: "✔"; color: var(--gold); position: absolute; left: 0; }
#res-impression { font-size: 0.9rem; }

/* ---- share ---- */
.share-row { text-align: center; margin: 8px 0 26px; }
.share-row .btn { padding: 14px 34px; font-size: 1rem; }
.share-hint { font-size: 0.8rem; color: var(--ink-light); margin-top: 8px; }

/* ---- aim selection ---- */
.aim-card { margin-top: 26px; }
.aim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.aim-btn {
  padding: 16px 10px; cursor: pointer; text-align: center;
  border: 1px solid var(--line); border-radius: 6px; background: #fffefb;
  font-family: inherit; color: var(--ink);
}
.aim-btn .aim-icon { font-size: 1.5rem; display: block; margin-bottom: 6px; }
.aim-btn .aim-name { font-size: 0.92rem; font-weight: 600; }
.aim-btn small { display: block; font-size: 0.72rem; color: var(--ink-light); margin-top: 4px; }
.aim-btn:hover, .aim-btn.selected { border-color: var(--gold); background: #fbf4e4; box-shadow: 0 0 0 1px var(--gold); }

/* ---- advice ---- */
.advice-head { text-align: center; }
.advice-sub { color: var(--ink-light); font-size: 0.85rem; letter-spacing: 0.2em; }
.advice-title { font-size: 1.5rem; letter-spacing: 0.15em; color: var(--gold); margin: 6px 0 12px; font-weight: 600; }
.advice-message { font-size: 0.92rem; max-width: 640px; margin: 0 auto; }
.advice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.advice-block h4 { font-size: 0.88rem; color: var(--brown); margin: 14px 0 4px; font-weight: 600; }
.advice-block h4:first-child { margin-top: 0; }
.advice-block p, .advice-block li { font-size: 0.86rem; color: var(--ink); }
.advice-block ul { padding-left: 1.3em; }
.order-quote {
  background: #f8f2e4; border-left: 3px solid var(--gold);
  padding: 12px 16px; font-size: 0.88rem; margin: 8px 0; border-radius: 0 4px 4px 0;
}

/* ---- footer ---- */
.site-footer { text-align: center; padding: 30px 16px 44px; color: var(--ink-light); font-size: 0.85rem; letter-spacing: 0.1em; }

.footer-note { font-size: 0.72rem; color: var(--ink-light); margin-top: 6px; letter-spacing: 0.02em; }

/* ---- ヘアスタイル写真生成 ---- */
.hs-visual { position: relative; }
.hs-visual .hs-photo {
  width: 100%; aspect-ratio: 5 / 6; object-fit: cover;
  border-radius: 10px; display: block; background: #f4ede0;
}
.hs-visual.generating::after {
  content: "📷 生成中…";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(250, 246, 238, 0.82);
  border-radius: 10px;
  font-size: 0.8rem; color: var(--ink-light);
  animation: hs-pulse 1.2s ease-in-out infinite;
}
@keyframes hs-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.hs-mock {
  position: absolute; top: 6px; left: 6px;
  background: rgba(74, 63, 51, 0.75); color: #fff;
  font-size: 0.62rem; padding: 1px 7px; border-radius: 999px;
}
.hs-photo-btn {
  margin-top: 6px; width: 100%;
  background: #fff; border: 1px solid var(--gold-soft); border-radius: 999px;
  color: var(--ink-light); font-size: 0.72rem; padding: 5px 8px; cursor: pointer;
  transition: all 0.15s;
}
.hs-photo-btn:hover:not(:disabled) { border-color: var(--gold); color: var(--ink); }
.hs-photo-btn:disabled { opacity: 0.6; cursor: default; }

@media (max-width: 640px) {
  .facetype-left { border-right: none; padding-right: 0; }
  .tier-block { flex-direction: column; }
  .tier-side { width: 100%; }
  /* タイトルが不自然な位置で折り返さないように */
  .header-title { font-size: 1.35rem; letter-spacing: 0.12em; padding: 0 24px; }
}
