/* まとめない診断 — style.css
 * 家の作法（vanilla-pwa-house-style / ui-layout / visual-design）を入れてある。
 * - 色・余白・字の大きさ・角丸は :root のトークンから使う（直値を散らさない）
 * - [hidden] と .hidden は !important で確実に消す（display 指定に負けない）
 * 試作（Projects\matomenai-prototype\matomenai.html 版10）から移した。
 */
[hidden] { display: none !important; }
.hidden { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
body { margin: 0; }
img { max-width: 100%; }
.notice {
  position: relative; z-index: 2; margin: 0; padding: 12px 16px;
  background: #fff4e5; color: #1a1a1a; border-bottom: 1px solid #ffd8a8; font-size: 14px;
}
/* 方向性: やわらか・空・ただよう
   1列の細い柱（最大 560px）を左揃えで置く。空は60問で朝→昼→夕方→夜とめぐり、
   問いは雲のようなメッセージ窓に一文字ずつ出る */
@property --sky-top { syntax: "<color>"; inherits: true; initial-value: #e8eef7; }
@property --sky-bottom { syntax: "<color>"; inherits: true; initial-value: #f7f0e8; }
@property --c-haze { syntax: "<color>"; inherits: true; initial-value: #f1e4d6; }
@property --c-muted { syntax: "<color>"; inherits: true; initial-value: #56626f; }
@property --stars { syntax: "<number>"; inherits: true; initial-value: 0; }
:root {
  --sky-top: #e8eef7;       /* 空の上（JS が時刻に合わせて書きかえる） */
  --sky-bottom: #f7f0e8;    /* 空の下 */
  --c-haze: #f1e4d6;        /* ただようかすみ */
  --stars: 0;               /* 夜に近づくと見える星 */
  --c-bg: #eef3f8;          /* 空が描けない時の地 */
  --c-surface: #fbfcfe;     /* 選択肢・窓の面 */
  --c-ink: #2b3643;         /* やわらかい墨 */
  --c-muted: #56626f;       /* 脇の文字（空が暗くなると濃くなる） */
  --c-line: #c5d2e0;        /* 枠 */
  --c-accent: #44689c;      /* 藍：選んだ・進み具合・主なボタン・フォーカス */
  --c-accent-ink: #ffffff;  /* 藍の面の上の文字 */
  --c-accent-soft: #dae5f3; /* 選んだ選択肢の色・持ち帰る問いの窓 */
  --c-star: #ffffff;

  --font: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "BIZ UDPGothic", "Yu Gothic UI", "Meiryo UI", sans-serif;
  --fw-body: 400; --fw-q: 500; --fw-head: 700;
  --fs-small: 13px; --fs-body: 15px; --fs-option: 17px; --fs-q: 24px; --fs-take: 26px; --fs-display: 36px;

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-6: 24px; --sp-8: 32px; --sp-12: 48px; --sp-16: 64px;
  --radius: 24px; --radius-window: 32px; --radius-pill: 999px;
  --sky-ms: 1600ms;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sky-top: #1d2634; --sky-bottom: #262f3c; --c-haze: #2a3646;
    --c-bg: #161d27; --c-surface: #1f2834; --c-ink: #e4ebf3; --c-muted: #a9b5c3; --c-line: #3a4757;
    --c-accent: #93b3e0; --c-accent-ink: #13202f; --c-accent-soft: #2a3b53; --c-star: #e4ebf3;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --sky-top: #1d2634; --sky-bottom: #262f3c; --c-haze: #2a3646;
  --c-bg: #161d27; --c-surface: #1f2834; --c-ink: #e4ebf3; --c-muted: #a9b5c3; --c-line: #3a4757;
  --c-accent: #93b3e0; --c-accent-ink: #13202f; --c-accent-soft: #2a3b53; --c-star: #e4ebf3;
  color-scheme: dark;
}
:root {
  transition: --sky-top var(--sky-ms) ease, --sky-bottom var(--sky-ms) ease,
              --c-haze var(--sky-ms) ease, --c-muted var(--sky-ms) ease, --stars var(--sky-ms) ease;
}

html, body { min-height: 100%; }
body {
  background-color: var(--c-bg);
  background-image: linear-gradient(180deg, var(--sky-top), var(--sky-bottom));
  background-attachment: fixed;
  color: var(--c-ink);
  font-family: var(--font); font-weight: var(--fw-body); font-size: var(--fs-body);
  line-height: 1.8; letter-spacing: 0.02em;
  -webkit-font-smoothing: antialiased;
}
/* 日本語を文節で折り返す（対応しないブラウザではふつうの折り返し） */
.q, .take, .stuck .sq, h1, h2, .lead { word-break: auto-phrase; }

/* 空：かすみと星 */
.sky { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.sky span {
  position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%;
  background: var(--c-haze); filter: blur(60px); opacity: 0.75;
  top: -20vmax; right: -24vmax;
  animation: drift 28s ease-in-out infinite alternate;
}
.sky span + span { top: auto; right: auto; bottom: -28vmax; left: -26vmax; width: 52vmax; height: 52vmax; animation-duration: 34s; opacity: 0.55; }
@keyframes drift { from { transform: translate(0, 0); } to { transform: translate(-6vmax, 5vmax); } }
.sky i {
  position: absolute; width: 3px; height: 3px; border-radius: 50%; background: var(--c-star);
  opacity: calc(var(--stars) * var(--o, 0.8));
  animation: twinkle 5s ease-in-out infinite alternate; animation-delay: var(--d, 0s);
}
@keyframes twinkle { from { transform: scale(1); } to { transform: scale(0.5); } }

.wrap {
  position: relative; z-index: 1;
  max-width: 560px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: var(--sp-12) var(--sp-16);
  box-sizing: border-box;
}
.screen { display: flex; flex-direction: column; gap: var(--sp-6); }
.foot {
  position: relative; z-index: 1;
  max-width: 560px; margin: 0 auto; box-sizing: border-box;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 var(--sp-12);
  font-size: var(--fs-small); color: var(--c-muted);
}
.foot a { color: var(--c-muted); text-underline-offset: 3px; letter-spacing: 0.08em; }
.foot a:hover { color: var(--c-ink); }

/* 共通の部品 */
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 3px; }
.btn-main {
  align-self: flex-start;
  background: var(--c-accent); color: var(--c-accent-ink);
  border: 0; border-radius: var(--radius-pill);
  padding: var(--sp-3) var(--sp-8); font-weight: var(--fw-head); font-size: var(--fs-option);
}
.btn-main:hover { filter: brightness(1.06); }
.btn-text {
  background: none; border: 0; padding: var(--sp-2) 0;
  color: var(--c-muted); font-size: var(--fs-body);
  text-decoration: underline; text-decoration-color: var(--c-line); text-underline-offset: 4px;
}
.btn-text:hover { color: var(--c-ink); text-decoration-color: currentColor; }
.btn-line {
  background: var(--c-surface); color: var(--c-ink); border: 1.5px solid var(--c-accent); border-radius: var(--radius-pill);
  padding: var(--sp-3) var(--sp-6); font-weight: var(--fw-q); font-size: var(--fs-body); text-decoration: none;
}
.btn-line:hover { background: var(--c-accent-soft); }
h3 { font-size: var(--fs-small); font-weight: var(--fw-head); margin: 0; color: var(--c-muted); letter-spacing: 0.12em; }
.fine { font-size: var(--fs-small); color: var(--c-muted); margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* メッセージ窓：雲のような窓。下に、考えごとの吹き出しの小さな丸が2つ */
.window {
  position: relative;
  background: color-mix(in srgb, var(--c-surface) 82%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1.5px solid var(--c-line); border-radius: var(--radius-window);
  padding: var(--sp-6) var(--sp-6) var(--sp-8);
}
.window::before, .window::after {
  content: ""; position: absolute; border-radius: 50%;
  background: inherit; border: 1.5px solid var(--c-line);
}
.window::before { width: 18px; height: 18px; left: 36px; bottom: -26px; }
.window::after { width: 10px; height: 10px; left: 22px; bottom: -42px; }
.window.soft { background: color-mix(in srgb, var(--c-accent-soft) 88%, transparent); border-color: var(--c-accent-soft); }
.window.soft::before, .window.soft::after { border-color: var(--c-accent-soft); }

/* 一文字ずつ出る文 */
.caret {
  display: inline-block; width: 0.5em; height: 1em; margin-left: 2px; vertical-align: -0.12em;
  background: var(--c-accent); border-radius: 2px; animation: blink 0.9s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.typing { cursor: pointer; }

/* はじめの画面 */
.start { gap: var(--sp-8); padding-top: var(--sp-8); }
h1 { font-size: var(--fs-display); font-weight: var(--fw-head); line-height: 1.35; margin: 0; letter-spacing: 0.08em; min-height: 1.35em; }
.start-rest { display: flex; flex-direction: column; gap: var(--sp-8); }
.lead-block { display: flex; flex-direction: column; }
.lead { font-size: var(--fs-option); margin: 0; line-height: 1.9; }
/* タイトルのあと、文が1行ずつふわっと現れる */
.reveal { opacity: 0; }
.reveal:not(.shown) { pointer-events: none; }
.reveal.shown { animation: arrive 520ms cubic-bezier(.2,.7,.3,1) both; }
.notes { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--sp-1); color: var(--c-muted); }
.start-foot { display: flex; flex-direction: column; gap: var(--sp-3); align-items: flex-start; }

/* 問いの画面 */
.bar { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4); }
.count { font-size: var(--fs-small); color: var(--c-muted); font-variant-numeric: tabular-nums; letter-spacing: 0.1em; }
.track { height: 2px; background: color-mix(in srgb, var(--c-line) 70%, transparent); border-radius: 2px; overflow: hidden; }
.track i { display: block; height: 100%; background: var(--c-accent); width: 0; transition: width 600ms ease; }
.q-area { display: flex; flex-direction: column; gap: var(--sp-6); margin-top: var(--sp-8); }
.q { font-size: var(--fs-q); font-weight: var(--fw-q); line-height: 1.65; margin: 0; min-height: 3.3em; }
.options { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-12); }

/* 選んだあと：押した所から色がふわーっと溶けて広がる。広がりきったら次の問いへ */
@property --melt { syntax: "<percentage>"; inherits: false; initial-value: 0%; }
.opt {
  text-align: left; width: 100%;
  --x: 50%; --y: 50%; --melt: 0%;
  background-color: var(--c-surface);
  background-image: radial-gradient(circle at var(--x) var(--y),
    var(--c-accent-soft) calc(var(--melt) * 0.55), transparent var(--melt));
  border: 1.5px solid var(--c-line); border-radius: var(--radius-pill);
  padding: var(--sp-4) var(--sp-6); font-size: var(--fs-option); line-height: 1.5;
  transition: border-color 240ms ease, opacity 600ms ease;
}
.opt:hover { border-color: var(--c-accent); }
.opt[aria-pressed="true"] { border-color: var(--c-accent); animation: melt 1500ms cubic-bezier(.2,.6,.3,1) forwards, rise 1500ms cubic-bezier(.4,0,.3,1) forwards; }
.options.chosen .opt[aria-pressed="false"] { opacity: 0.45; }
@keyframes melt { from { --melt: 0%; } to { --melt: 260%; } }
.later-row { display: flex; }
/* 後で考える：問いの窓がふわっと浮かんで空へしまわれる。しまい終えたら次の問いへ */
.q-area.putaway .window { animation: putaway 1300ms cubic-bezier(.3,.1,.3,1) forwards; }
.q-area.putaway .options, .q-area.putaway .later-row { opacity: 0.3; transition: opacity 500ms ease; pointer-events: none; }

/* 問いの窓は、出る時にふわっと浮かんで現れる */
.window { animation: arrive 360ms cubic-bezier(.2,.7,.3,1) both; }
@keyframes arrive { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
/* 答えた時：色が溶けるあいだ窓はとどまり、後半でふわっと浮かんで空へ旅立つ。選んだ選択肢も少し浮く */
.q-area.answered .window { animation: driftoff 1500ms cubic-bezier(.4,0,.3,1) forwards; }
@keyframes driftoff {
  0%, 40% { opacity: 1; transform: none; filter: blur(0); }
  100% { opacity: 0; transform: translateY(-28px) scale(0.98); filter: blur(2px); }
}
@keyframes rise {
  0%, 55% { transform: none; opacity: 1; }
  100% { transform: translateY(-8px); opacity: 0.55; }
}
.q-area.answered .later-row { opacity: 0.3; transition: opacity 500ms ease; }
@keyframes putaway {
  from { transform: translateY(0) scale(1); opacity: 1; filter: blur(0); }
  to { transform: translateY(-40px) scale(0.96); opacity: 0; filter: blur(3px); }
}

/* 終わりの画面：主役は持ち帰る問い */
.end { gap: var(--sp-12); }
h2 { font-size: var(--fs-option); font-weight: var(--fw-head); margin: 0; line-height: 1.5; letter-spacing: 0.06em; }
.block { display: flex; flex-direction: column; gap: var(--sp-4); }
.take { margin: 0; font-size: var(--fs-take); font-weight: var(--fw-q); line-height: 1.65; min-height: 3.3em; }
.share { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-8); }
.share label { font-size: var(--fs-small); color: var(--c-muted); }
.share textarea {
  font: inherit; font-size: var(--fs-option); color: var(--c-ink); line-height: 1.6;
  background: var(--c-surface); border: 1.5px solid var(--c-line); border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4); resize: vertical; min-height: 3.6em; box-sizing: border-box; width: 100%;
}
.share textarea:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; border-color: var(--c-accent); }
.share .len { font-size: var(--fs-small); color: var(--c-muted); align-self: flex-end; font-variant-numeric: tabular-nums; }
.share img { width: 100%; max-width: 360px; height: auto; border-radius: var(--sp-3); border: 1px solid var(--c-line); }
.share-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-6); align-items: center; }
.share .msg { font-size: var(--fs-small); color: var(--c-ink); margin: 0; }
.stuck { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.stuck li { padding-block: var(--sp-3); border-top: 1px solid var(--c-line); display: flex; flex-direction: column; gap: 2px; }
.stuck li:last-child { border-bottom: 1px solid var(--c-line); }
.stuck .sq { font-size: var(--fs-body); font-weight: var(--fw-q); }
.stuck .sopts { color: var(--c-muted); font-size: var(--fs-small); }
.stuck .sopts b { color: var(--c-ink); font-weight: var(--fw-q); }
.stuck .facts { font-size: var(--fs-small); color: var(--c-muted); }
.empty { color: var(--c-muted); margin: 0; }
.end-actions { display: flex; flex-wrap: wrap; gap: var(--sp-6); align-items: center; }


@media (max-width: 480px) {
  :root { --fs-q: 21px; --fs-take: 22px; --fs-display: 30px; --fs-option: 16px; }
  .wrap { padding-block: var(--sp-8) var(--sp-12); }
  .window { padding: var(--sp-4) var(--sp-4) var(--sp-6); }
}
@media (prefers-reduced-motion: reduce) {
  :root { transition: none; }
  .sky span, .sky i, .caret { animation: none; }
  .opt, .track i { transition: none; }
  .opt[aria-pressed="true"] { animation: none; background-image: none; background-color: var(--c-accent-soft); }
  .window, .q-area.answered .window { animation: none; }
  .reveal, .reveal.shown { opacity: 1; animation: none; }
  .q-area.putaway .window { animation: none; opacity: 0.3; }
}
