/* Styles */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Yu Gothic", "Noto Sans JP", Arial, sans-serif;
  margin: 0;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  line-height: 1.6;
  background: #fff;
}
header { padding: 24px 16px 8px; text-align: center; }
h1 { margin: 0; font-size: 28px; }
.tagline { color: #555; margin-top: 6px; }
main { padding: 16px; max-width: 820px; margin: 0 auto; }
.card {
  background: #fff; border: 1px solid #eee; border-radius: 14px; padding: 16px; margin-bottom: 16px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.05);
}
label { display: block; margin: 10px 0 14px; }
input[type="text"], input[type="date"], select {
  width: 100%; padding: 12px; border-radius: 10px; border: 1px solid #ddd;
}
input[type="range"] { width: 100%; }
.primary { margin-top: 8px; width: 100%; padding: 12px 18px; border: none; border-radius: 12px; }
button {
  cursor: pointer; padding: 10px 14px; border: 1px solid #ddd; border-radius: 12px; background: #fffbf8;
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items:center }
.result h2 { text-align:center; font-size: 22px; margin-top: 0; }
.hero {
  display:flex; align-items:center; justify-content:center;
  background: radial-gradient(60% 60% at 50% 40%, #fff3eb 0%, #ffffff 100%);
  border-radius: 16px; padding: 20px; margin-bottom: 12px;
  border: 1px dashed #ffd1b3;
}
.lucky-name { font-size: 26px; font-weight: 800; letter-spacing: 1px; }
.badge {
  display:inline-block; margin-top: 6px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid #ffd1b3; background: #ffefe6; font-size: 12px;
}
.pairing, .why, .tips { margin: 10px 0; }
.cta {
  display:inline-block; text-decoration:none; background:#ffefe6; border:1px solid #ffd1b3;
  padding: 10px 14px; border-radius: 12px;
}
.alt ul { margin: 6px 0 0 18px; }
.more summary { cursor: pointer; }
footer { color: #777; text-align: center; font-size: 12px; padding: 20px 0; }


/* iPhone Safari 占うボタン視認性改善 */
button#uranaiBtn {
  background-color: #e60012;
  color: #fff !important;
  font-size: 1.5rem;
  font-weight: bold;
  text-align: center;
  line-height: 1.2;
  padding: 0.8em 1.2em;
  border-radius: 8px;
  -webkit-text-stroke: 0.5px rgba(0,0,0,0.2);
}


/* ==== Result UI Polish ==== */
:root{
  --kimchi-red:#e60012;
  --card-bg:#fff;
  --ink:#222;
  --muted:#666;
  --line:#eee;
  --radius:16px;
  --shadow:0 8px 24px rgba(0,0,0,.06);
}
.result-heading{ font-weight:800; letter-spacing:.01em; margin:0 0 .8rem; font-size: clamp(13px, 3.6vw, 22px); text-align:center; white-space:nowrap; word-break:keep-all; }
.result-card{
  max-width: 920px;
  margin: 0 auto;
  background: var(--card-bg);
  border:1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: clamp(12px,2vw,20px);
}
.result-visual{
  position: relative;
  margin: 10px auto 16px;
  max-width: 860px;
}
.result-visual img{
  width: 100%;
  height: auto;
  display: block;
  border-radius: 20px;
}
.side-name{
  position: absolute;
  right: -6px;
  top: 8px;
  bottom: 8px;
  writing-mode: vertical-rl;
  text-orientation: upright;
  background: #fff;
  border:1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 12px;
  padding: 10px 6px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: .2em;
  display: none; /* shown when image visible */
}
.meta-line{
  color: var(--ink);
  font-size: clamp(14px,1.9vw,16px);
  line-height: 1.7;
  margin: .4rem 0;
}
.meta-line .label{
  font-weight:700;
  color: var(--muted);
}
.meta-line.pairing::before{ content: "🍽️ "; }
.meta-line.reason::before{ content: "🧠 "; }
.meta-line.tips::before{ content: "💡 "; }
.actions{
  display:flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 4px;
}
.actions .btn, .actions button, .actions a{
  background:#fff;
  border:1px solid var(--line);
  border-radius: 999px;
  padding: .6em 1em;
  font-weight:700;
  box-shadow: 0 2px 6px rgba(0,0,0,.04);
}
.actions .btn.primary, .actions button.primary, .actions a.primary{
  background: var(--kimchi-red);
  color:#fff;
  border-color:#b0000e;
}
.sublist{
  border-top:1px dashed var(--line);
  margin-top: 12px;
  padding-top: 8px;
  color: var(--muted);
}
/* Mobile tweaks */
@media (max-width: 560px){
  .side-name{ display:none !important; }
  .result-card{ padding: 12px; }
}


/* === iPhone 占うボタン視認性・最優先 === */
button#uranaiBtn,
button[type="submit"],
.primary {
  background-color: #e60012 !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important; /* iOSで色が抜ける対策 */
  font-weight: 800 !important;
  font-size: 17px !important; /* iOS自動ズームを避ける */
  line-height: 1.2 !important;
  padding: 0.9em 1.2em !important;
  border: 1px solid #b0000e !important;
  border-radius: 12px !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  text-align: center !important;
  text-shadow: 0 1px 0 rgba(0,0,0,.15);
}

/* disabledでも必ず可読（操作不可はカーソルと透過で示す） */
button#uranaiBtn:disabled,
button[type="submit"]:disabled,
.primary:disabled {
  background-color: #e60012 !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  opacity: .7 !important; /* ほんの少しだけ弱める */
  cursor: not-allowed !important;
  filter: none !important;
}

/* ダークモード固定 */
@media (prefers-color-scheme: dark) {
  button#uranaiBtn, button[type="submit"], .primary {
    background-color: #e60012 !important;
    color: #fff !important;
  }
}


/* --- keep result heading on a single line --- */
.result-heading{
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow: visible;
  text-overflow: clip;
  letter-spacing: .01em;
  font-size: clamp(13px, 3.6vw, 22px) !important;
}
@media (max-width: 360px){
  .result-heading{ font-size: 13px !important; }
}


/* --- configurable labels/emojis support --- */
.meta-line.pairing::before, .meta-line.reason::before, .meta-line.tips::before { content: "" !important; }
.meta-wrap .meta-line { display:block; }
.lead-emoji{ margin-right:.25em; }
.meta-line .label{ font-weight:700; color: var(--muted); margin-right:.2em; }


/* === Viewer Counter (top-right, black) === */
#viewCounter{
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 9999;
  font-size: 12px;
  font-weight: 700;
  color: #000 !important;
  background: transparent;
  padding: 4px 8px;
  border-radius: 999px;
  pointer-events: none;
  text-shadow: none;
  letter-spacing: .02em;
}
