/* incho-post 共通スタイル。テーマ色は CSS 変数で切替（既定=スタッフ版ピンク / .theme-incho=院長版ブルー） */
:root {
  --grad-top: #fdf2f8;
  --grad-bottom: #f1ecff;
  --ink: #4c3644;
  --h1: #b23a6b;
  --sub: #8f6c84;
  --label: #8a3f64;
  --req: #e34b78;
  --field-border: #ecc9d9;
  --field-bg: #fffdfe;
  --field-ink: #3a2a34;
  --placeholder: #bd97ac;
  --focus: #f083ab;
  --focus-ring: rgba(240,131,171,.22);
  --btn-g1: #f97fa6;
  --btn-g2: #e85084;
  --btn-shadow: rgba(232,80,132,.30);
  --btn-text-shadow: rgba(122,40,72,.30);
  --btn-disabled: #f0c4d5;
  --sec-ink: #b23a6b;
  --sec-border: #efbdd0;
  --card-border: #ffdbe9;
  --card-shadow: rgba(232,120,165,.16);
  --msg-ok-bg: #fdeef5;
  --msg-ok-ink: #b23a6b;
  --msg-ok-border: #ffcfe2;
  --msg-err-bg: #fff0f1;
  --msg-err-ink: #cf3f5d;
  --msg-err-border: #ffccd5;
  --img-border: #ecc9d9;
  --link-ink: #cf3f5d;
}

.theme-incho {
  --grad-top: #eef4ff;
  --grad-bottom: #e7edff;
  --ink: #2b3850;
  --h1: #2f6fed;
  --sub: #6b7a94;
  --label: #345089;
  --req: #e05555;
  --field-border: #c9d7ec;
  --field-bg: #fdfeff;
  --field-ink: #26313d;
  --placeholder: #9bb0cd;
  --focus: #5b8def;
  --focus-ring: rgba(91,141,239,.22);
  --btn-g1: #5b8def;
  --btn-g2: #2f6fed;
  --btn-shadow: rgba(47,111,237,.30);
  --btn-text-shadow: rgba(28,64,140,.30);
  --btn-disabled: #bcd0ef;
  --sec-ink: #2f6fed;
  --sec-border: #bcd0ef;
  --card-border: #d7e6f5;
  --card-shadow: rgba(80,130,190,.16);
  --msg-ok-bg: #eef3fb;
  --msg-ok-ink: #2f6db0;
  --msg-ok-border: #cfe0f4;
  --msg-err-bg: #fdeeee;
  --msg-err-ink: #c94141;
  --msg-err-border: #f6cccc;
  --img-border: #c9d7ec;
  --link-ink: #c94141;
}

* { box-sizing: border-box; -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  padding: 20px 16px 40px;
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN",
               -apple-system, BlinkMacSystemFont, "Segoe UI", "Meiryo", sans-serif;
  background: linear-gradient(180deg, var(--grad-top) 0%, var(--grad-bottom) 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 560px; margin: 0 auto; }
h1 { font-size: 20px; margin: 0 0 4px; color: var(--h1); letter-spacing: .02em; }
.sub { font-size: 12px; color: var(--sub); margin: 0 0 16px; }

label {
  display: block; font-size: 13.5px; color: var(--label);
  margin: 16px 0 5px; font-weight: 700;
}
label .req { color: var(--req); font-weight: 700; margin-left: 4px; }

textarea, input[type="text"], input[type="date"], input[type="datetime-local"], select {
  width: 100%;
  padding: 13px 14px;
  font-size: 16px;               /* iOSの自動ズーム防止に16px以上 */
  border: 1.5px solid var(--field-border);
  border-radius: 14px;
  background: var(--field-bg);
  color: var(--field-ink);
  font-family: inherit;
  line-height: 1.5;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea::placeholder { color: var(--placeholder); }
textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
  background: #fff;
}
textarea { resize: vertical; }
#raw { min-height: 130px; }
#f_content { min-height: 84px; }

button {
  -webkit-appearance: none; appearance: none;
  width: 100%;
  padding: 15px;
  font-size: 17px;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  color: #fff;
  text-shadow: 0 1px 2px var(--btn-text-shadow);
  background: linear-gradient(135deg, var(--btn-g1) 0%, var(--btn-g2) 100%);
  margin-top: 16px;
  cursor: pointer;
  box-shadow: 0 8px 18px var(--btn-shadow);
  transition: transform .05s ease, box-shadow .15s ease, opacity .15s ease;
}
button:active { transform: translateY(1px); }
button:disabled {
  background: var(--btn-disabled); color: #fff; text-shadow: none;
  box-shadow: none; cursor: default;
}
button.secondary {
  background: #fff; color: var(--sec-ink); text-shadow: none;
  border: 1.5px solid var(--sec-border); box-shadow: none;
  margin-top: 10px;
}

.card {
  background: #fff;
  border: 1.5px solid var(--card-border);
  border-radius: 22px;
  padding: 18px 18px 22px;
  margin-top: 16px;
  box-shadow: 0 10px 28px var(--card-shadow);
}
.hidden { display: none !important; }

.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 3px solid rgba(255,255,255,.55); border-top-color: #fff;
  border-radius: 50%; animation: spin .8s linear infinite;
  vertical-align: -2px; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.msg { margin-top: 14px; padding: 12px 14px; border-radius: 14px; font-size: 14px; font-weight: 600; }
.msg.ok  { background: var(--msg-ok-bg); color: var(--msg-ok-ink); border: 1.5px solid var(--msg-ok-border); }
.msg.err { background: var(--msg-err-bg); color: var(--msg-err-ink); border: 1.5px solid var(--msg-err-border); }
.empty { min-height: 0; }

.hint { font-size: 12.5px; color: var(--sub); margin-top: 12px; line-height: 1.55; }

/* 写真: labelをボタン風に（iOSでファイル選択を確実に開くため） */
label.btnlike {
  display: block; width: 100%; text-align: center;
  padding: 15px; font-size: 17px; font-weight: 700;
  border-radius: 999px; cursor: pointer;
  background: #fff; color: var(--sec-ink);
  border: 1.5px solid var(--sec-border);
  margin: 6px 0 0; box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}
label.btnlike:active { transform: translateY(1px); }
/* 入力自体は見えないが display:none にしない（iOS対策） */
.vh {
  position: absolute; width: 1px; height: 1px;
  opacity: 0; overflow: hidden; clip: rect(0 0 0 0);
}
#photoPreview { margin-top: 12px; text-align: center; }
#photoImg {
  max-width: 100%; max-height: 240px; border-radius: 14px;
  border: 1.5px solid var(--img-border); display: block; margin: 0 auto 8px;
}
button.linklike {
  -webkit-appearance: none; appearance: none;
  width: auto; margin: 0 auto; padding: 6px 14px;
  background: none; color: var(--link-ink); text-shadow: none;
  box-shadow: none; border: none; border-radius: 999px;
  font-size: 13.5px; font-weight: 700; cursor: pointer;
}

/* ===== AI振り分けの待ち演出（確認画面の上部＋スケルトン＋順次流し込み） ===== */
/* 段階メッセージ（スピナー＋ローテーション文言） */
.ai-progress {
  display: flex; align-items: center; gap: 9px;
  margin: 2px 0 8px; font-size: 14.5px; font-weight: 700; color: var(--h1);
}
.ai-progress .spinner {
  border-color: rgba(0,0,0,.12); border-top-color: var(--h1);
  margin: 0; vertical-align: middle;
}
/* 10秒超の混雑メッセージ（ローテーションの上に重ねて表示） */
.ai-busy { font-size: 12.5px; color: var(--sub); margin: 0 0 12px; min-height: 0; }

/* フィールド行：既定は通常表示。pending でスケルトン、確定でフェードイン */
.frow .skel { display: none; }
.frow.pending .ctl { display: none; }
.frow.pending .skel { display: block; }
.frow.revealing .ctl { animation: fadeIn .22s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

/* スケルトン（グレーのシマー） */
.skel {
  height: 47px; margin-top: 0; border-radius: 14px;
  background: linear-gradient(100deg, #e9e9ee 30%, #f4f4f7 50%, #e9e9ee 70%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}
.skel.tall { height: 84px; }   /* 内容テキストエリア相当 */

@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* 流し込み中は編集不可（編集と演出の衝突防止）。ボタンは JS で disabled にする */
.card.streaming .ctl { pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; }
  .ai-progress .spinner { animation: none; }
  .frow.revealing .ctl { animation: none; }
}
