/* =========================================================
   日和 (hiyori) — design system
   KOKUYO に着想：あたたかい紙の白 × 明るい多色アクセント × 丸みのある親しみやすさ
   ========================================================= */

:root {
  --paper: #FBF7EF;
  --paper-2: #F4EEE1;
  --card: #FFFFFF;
  --ink: #2B2A28;
  --ink-soft: #726E66;
  --ink-faint: #A49E93;
  --line: #ECE5D6;

  --sky: #57ACE0;      --sky-soft: #DEEFFA;
  --leaf: #5FB98A;     --leaf-soft: #DEF0E5;
  --sun: #F3BE45;      --sun-soft: #FBEEC7;
  --coral: #F27A5E;    --coral-soft: #FBE1D8;
  --berry: #EC6F91;    --berry-soft: #FBE1E9;
  --grape: #9B7BD4;    --grape-soft: #EAE1F8;

  --r-xl: 32px;
  --r-lg: 26px;
  --r-md: 18px;
  --r-sm: 12px;
  --pill: 999px;

  --shadow-sm: 0 4px 14px rgba(94, 78, 45, .07);
  --shadow: 0 12px 30px rgba(94, 78, 45, .10);
  --shadow-lg: 0 22px 55px rgba(94, 78, 45, .14);

  --font-round: "Zen Maru Gothic", system-ui, sans-serif;
  --font-body: "Zen Kaku Gothic New", system-ui, sans-serif;
  --maxw: 760px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: .01em;
}
h1, h2, h3, .round { font-family: var(--font-round); font-weight: 700; letter-spacing: .02em; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; }

/* soft floating background blobs */
body::before, body::after {
  content: ""; position: fixed; z-index: 0; border-radius: 50%;
  filter: blur(40px); opacity: .5; pointer-events: none;
}
body::before { width: 340px; height: 340px; top: -120px; right: -80px;
  background: radial-gradient(circle, var(--sun-soft), transparent 70%); }
body::after { width: 380px; height: 380px; bottom: -140px; left: -120px;
  background: radial-gradient(circle, var(--sky-soft), transparent 70%); }

.wrap { position: relative; z-index: 1; max-width: var(--maxw); margin: 0 auto; padding: 0 20px 72px; }

/* ---------- top bar ---------- */
.topbar {
  position: relative; z-index: 2;
  max-width: var(--maxw); margin: 0 auto; padding: 20px 20px 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo {
  width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--sun), var(--coral));
  box-shadow: var(--shadow-sm); font-size: 22px;
}
.brand .name { font-family: var(--font-round); font-size: 21px; font-weight: 700; }
.brand .name small { display: block; font-family: var(--font-body); font-size: 10.5px; color: var(--ink-soft); font-weight: 500; letter-spacing: .14em; margin-top: -3px; }
.icon-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink-soft);
  border-radius: var(--pill); padding: 9px 15px; font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 6px; box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease;
}
.icon-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden; margin-top: 8px;
  border-radius: var(--r-xl); padding: 26px 24px 24px; color: var(--ink);
  background: linear-gradient(160deg, var(--sky-soft), #fff 78%);
  box-shadow: var(--shadow);
}
.hero.tone-sunny  { background: linear-gradient(160deg, #FFF0C9, #FFF9EC 80%); }
.hero.tone-cloudy { background: linear-gradient(160deg, #E9EEF3, #FBFAF6 80%); }
.hero.tone-rainy  { background: linear-gradient(160deg, #D9E9F5, #F3F8FB 80%); }
.hero.tone-snowy  { background: linear-gradient(160deg, #E7F0F7, #FBFCFE 80%); }
.hero .place { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink-soft); background: rgba(255,255,255,.7); padding: 5px 12px; border-radius: var(--pill); box-shadow: var(--shadow-sm); }
.hero .date { font-size: 12.5px; color: var(--ink-soft); margin-left: 8px; }
.hero-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-top: 16px; }
.hero h1 { font-size: 27px; line-height: 1.35; margin: 0 0 8px; }
.hero .summary { font-size: 14.5px; color: var(--ink-soft); margin: 0; max-width: 60ch; }
.hero-weather { text-align: center; flex-shrink: 0; }
.hero-weather .big-temp { font-family: var(--font-round); font-size: 34px; font-weight: 700; line-height: 1; }
.hero-weather .big-temp span { font-size: 16px; color: var(--ink-soft); }
.hero-weather .cond { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.hero-weather .wi { width: 66px; height: 66px; margin: 0 auto 2px; }
.hero .lowhigh { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.hero .lowhigh b { color: var(--coral); } .hero .lowhigh i { color: var(--sky); font-style: normal; }

/* ---------- section ---------- */
.section { margin-top: 26px; }
.section-title { display: flex; align-items: center; gap: 8px; font-family: var(--font-round); font-size: 15px; font-weight: 700; margin: 0 0 12px; padding-left: 4px; }
.section-title .dot { width: 9px; height: 9px; border-radius: 50%; }
.card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 20px; }

/* ---------- timeline ---------- */
.timeline { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 6px; }
.seg { text-align: center; border-radius: var(--r-md); padding: 12px 6px; background: var(--paper); }
.seg .lab { font-family: var(--font-round); font-size: 14px; font-weight: 700; }
.seg .rng { font-size: 10.5px; color: var(--ink-faint); }
.seg .wi { width: 40px; height: 40px; margin: 6px auto 4px; }
.seg .tp { font-family: var(--font-round); font-size: 18px; font-weight: 700; }
.seg .pop { font-size: 10.5px; color: var(--sky); font-weight: 700; }
.seg .pop.dry { visibility: hidden; }

.tempchart { margin-top: 8px; }
.tempchart svg { width: 100%; height: auto; display: block; }

.swing-badge { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 12.5px; font-weight: 700; color: #B4632F; background: var(--sun-soft); padding: 6px 13px; border-radius: var(--pill); }

/* ---------- outfit ---------- */
.outfit-card { position: relative; overflow: hidden; }
.persona-row { display: flex; align-items: center; gap: 13px; margin-bottom: 4px; }
.persona-emoji { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 27px; box-shadow: var(--shadow-sm); flex-shrink: 0; }
.persona-row .p-label { font-family: var(--font-round); font-size: 17px; font-weight: 700; }
.persona-row .p-sub { font-size: 12px; color: var(--ink-soft); }
.kw-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.kw { font-size: 11.5px; font-weight: 700; color: var(--ink-soft); background: var(--paper-2); padding: 4px 11px; border-radius: var(--pill); }

.items { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; }
.item { display: flex; align-items: center; gap: 13px; padding: 12px 6px; border-bottom: 1px dashed var(--line); }
.item:last-child { border-bottom: 0; }
.item .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.item .ci { width: 22px; height: 22px; }
.item .body .cat { font-family: var(--font-round); font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.item .body .txt { font-size: 14.5px; font-weight: 500; }
.item.muted .body .txt { color: var(--ink-faint); }
.item .tag { margin-left: auto; font-size: 10.5px; font-weight: 700; color: #fff; background: var(--coral); padding: 3px 9px; border-radius: var(--pill); flex-shrink: 0; }

/* ---------- lucky + fortune ---------- */
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mini { border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); }
.mini.lucky { background: linear-gradient(165deg, #fff, var(--paper)); }
.mini h3 { font-size: 13px; margin: 0 0 12px; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; }
.swatch-row { display: flex; align-items: center; gap: 14px; }
.swatch { width: 62px; height: 62px; border-radius: 18px; box-shadow: var(--shadow-sm), inset 0 0 0 1px rgba(0,0,0,.05); flex-shrink: 0; }
.swatch-row .cname { font-family: var(--font-round); font-size: 18px; font-weight: 700; }
.swatch-row .chex { font-size: 11px; color: var(--ink-faint); letter-spacing: .05em; }
.lucky .howto { font-size: 12.5px; color: var(--ink-soft); margin-top: 12px; }

.mini.fortune { background: linear-gradient(165deg, #fff, var(--grape-soft)); }
.fortune .tier { font-family: var(--font-round); font-size: 21px; font-weight: 700; }
.fortune .score { font-size: 12px; color: var(--ink-soft); }
.meter { height: 10px; border-radius: var(--pill); background: #EFE9F8; overflow: hidden; margin: 10px 0; }
.meter i { display: block; height: 100%; border-radius: var(--pill); background: linear-gradient(90deg, var(--grape), var(--berry)); transition: width 1s cubic-bezier(.2,.8,.2,1); }
.fortune .msg { font-size: 12.5px; color: var(--ink-soft); }
.fortune .action { font-size: 12px; color: var(--grape); font-weight: 700; margin-top: 8px; }

/* ---------- tips ---------- */
.tips { display: flex; flex-direction: column; gap: 9px; }
.tip { display: flex; align-items: center; gap: 11px; background: var(--card); border-radius: var(--r-md); padding: 12px 15px; box-shadow: var(--shadow-sm); font-size: 13.5px; }
.tip .ci { width: 24px; height: 24px; flex-shrink: 0; }

/* ---------- onboarding / modal ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(43,42,40,.42); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 18px; }
.overlay[hidden] { display: none; }
.modal { background: var(--paper); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: var(--r-xl); box-shadow: var(--shadow-lg); padding: 26px 22px 22px; }
.modal h2 { font-size: 21px; margin: 0 0 4px; }
.modal .lead { font-size: 13.5px; color: var(--ink-soft); margin: 0 0 18px; }
.step-label { font-family: var(--font-round); font-size: 14px; font-weight: 700; margin: 20px 0 10px; display: flex; align-items: center; gap: 8px; }
.step-num { width: 22px; height: 22px; border-radius: 50%; background: var(--sun); color: #fff; display: grid; place-items: center; font-size: 12px; }
.hint { font-size: 11.5px; color: var(--ink-faint); font-weight: 500; margin-left: 2px; }

.animal-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.a-pick { border: 2px solid transparent; background: var(--card); border-radius: var(--r-md); padding: 10px 4px; text-align: center; transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease; box-shadow: var(--shadow-sm); }
.a-pick:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.a-pick.sel { border-color: var(--coral); box-shadow: 0 0 0 3px var(--coral-soft); }
.a-pick .em { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; margin: 0 auto 5px; }
.a-pick .nm { font-family: var(--font-round); font-size: 12px; font-weight: 700; }

.mbti-groups { display: flex; flex-direction: column; gap: 10px; }
.mbti-group .gl { font-size: 11.5px; font-weight: 700; color: var(--ink-soft); margin-bottom: 5px; }
.mbti-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.m-pick { border: 2px solid transparent; background: var(--card); border-radius: var(--r-sm); padding: 8px 2px; text-align: center; font-family: var(--font-round); font-weight: 700; font-size: 13px; box-shadow: var(--shadow-sm); transition: transform .12s ease, border-color .12s; }
.m-pick:hover { transform: translateY(-1px); }
.m-pick.sel { color: #fff; }

.field { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.field input {
  font-family: inherit; font-size: 15px; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 11px 14px; background: var(--card);
}
.field input:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px var(--sky-soft); }
.field .row { display: flex; gap: 8px; }
.field .row input { flex: 1; }

.btn {
  width: 100%; border: none; border-radius: var(--pill); padding: 15px; margin-top: 22px;
  font-family: var(--font-round); font-weight: 700; font-size: 16px; color: #fff;
  background: linear-gradient(135deg, var(--coral), var(--berry)); box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn:disabled { opacity: .5; transform: none; cursor: not-allowed; }
.btn.ghost { background: var(--card); color: var(--ink-soft); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }

/* ---------- states ---------- */
.loading { text-align: center; padding: 60px 20px; color: var(--ink-soft); }
.spinner { width: 44px; height: 44px; margin: 0 auto 16px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--coral); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.err { text-align: center; padding: 40px 20px; color: var(--ink-soft); }

.footer { text-align: center; font-size: 11.5px; color: var(--ink-faint); margin-top: 40px; line-height: 1.9; }
.footer a { color: var(--ink-soft); }

/* reveal animation */
.reveal { opacity: 0; transform: translateY(14px); animation: rise .6s cubic-bezier(.2,.8,.2,1) forwards; }
.reveal.d1 { animation-delay: .05s; } .reveal.d2 { animation-delay: .12s; }
.reveal.d3 { animation-delay: .19s; } .reveal.d4 { animation-delay: .26s; }
@keyframes rise { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .reveal { animation: none; opacity: 1; transform: none; } .meter i { transition: none; } }

/* sparkles */
.sparkle { position: absolute; pointer-events: none; opacity: .8; animation: twinkle 3s ease-in-out infinite; }
@keyframes twinkle { 0%,100% { opacity: .3; transform: scale(.8); } 50% { opacity: .9; transform: scale(1.1); } }

/* ---------- icons ---------- */
.ani { width: 100%; height: 100%; display: block; }
.ci { width: 22px; height: 22px; flex-shrink: 0; }
.logo .logo-svg { width: 30px; height: 30px; }
.pin-ic { width: 14px; height: 14px; vertical-align: -2px; }
.h-ic { width: 16px; height: 16px; flex-shrink: 0; vertical-align: -3px; }
.btn-ic { width: 18px; height: 18px; vertical-align: -3px; }
.btn-ic-sm { width: 15px; height: 15px; vertical-align: -3px; }
.ext-ic { width: 13px; height: 13px; vertical-align: -2px; }
.err-ic { width: 46px; height: 46px; color: var(--ink-faint); margin: 0 auto 14px; display: block; }
.di { width: 11px; height: 11px; vertical-align: -1px; margin-right: 1px; }
.swing-badge .ci { width: 16px; height: 16px; vertical-align: -3px; }
.action .h-ic { vertical-align: -3px; }

/* ---------- modal hero + brand meaning ---------- */
.modal-hero { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.modal-hero .logo-svg { width: 46px; height: 46px; padding: 8px; background: linear-gradient(135deg, var(--sun), var(--coral)); border-radius: 15px; box-shadow: var(--shadow-sm); flex-shrink: 0; }
.mh-title { font-family: var(--font-round); font-size: 22px; font-weight: 700; }
.mh-title span { font-size: 13px; color: var(--ink-soft); font-weight: 500; margin-left: 5px; }
.mh-sub { font-size: 11.5px; color: var(--ink-faint); margin-top: -2px; }

/* ---------- diagnosis result ---------- */
.diag-result { display: flex; align-items: center; gap: 14px; background: linear-gradient(120deg, var(--sun-soft), #fff); border: 1.5px solid var(--sun); border-radius: var(--r-md); padding: 12px 14px; margin: 12px 0 4px; }
.diag-result[hidden] { display: none; }
.dr-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; flex-shrink: 0; }
.dr-lead { font-size: 11px; color: var(--ink-soft); }
.dr-name { font-family: var(--font-round); font-size: 20px; font-weight: 700; line-height: 1.2; }
.dr-reading { font-size: 12px; color: var(--ink-soft); font-weight: 500; }
.dr-catch { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

.sub-hint { font-size: 11.5px; color: var(--ink-faint); margin: 9px 2px 10px; line-height: 1.75; }
.ext-link { color: var(--sky); font-weight: 700; text-decoration: none; border-bottom: 1.5px solid var(--sky-soft); white-space: nowrap; }
.ext-link:hover { border-bottom-color: var(--sky); }

/* ---------- MBTI cards (2-line) + description ---------- */
.m-pick { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 2px; line-height: 1.25; }
.m-pick .mc { font-family: var(--font-round); font-weight: 700; font-size: 12.5px; letter-spacing: .04em; }
.m-pick .mj { font-size: 9.5px; color: var(--ink-soft); }
.m-pick.sel .mj { color: rgba(255, 255, 255, .88); }
.mbti-desc { display: flex; flex-direction: column; gap: 3px; background: var(--card); border-radius: var(--r-md); padding: 12px 14px; margin-top: 12px; box-shadow: var(--shadow-sm); }
.mbti-desc[hidden] { display: none; }
.mbti-desc b { font-family: var(--font-round); font-size: 13.5px; }
.mbti-desc span { font-size: 12.5px; color: var(--ink-soft); line-height: 1.7; }

/* ---------- responsive ---------- */
@media (max-width: 560px) {
  .hero h1 { font-size: 23px; }
  .hero-head { flex-direction: column; }
  .hero-weather { align-self: flex-start; display: flex; align-items: center; gap: 12px; text-align: left; }
  .hero-weather .wi { margin: 0; }
  .duo { grid-template-columns: 1fr; }
  .animal-grid { grid-template-columns: repeat(3, 1fr); }
  .brand .name { font-size: 19px; }
}
