/* でんしゃのごきげん — ゆるふわ。空色の地・まるいゴシック・表情で語る */
:root {
  --sky: #eaf5fb;
  --card: #ffffff;
  --ink: #2d3a4a;
  --ink-soft: #66768a;
  --line: #dbe7ef;
  --brand: #3a8fd0;
  --good: #49b37c;   --good-bg: #e6f6ed;
  --caution: #e9a21f; --caution-bg: #fdf3dd;
  --avoid: #ea6a55;  --avoid-bg: #fde9e5;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--sky); color: var(--ink);
  font-family: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", sans-serif;
  font-weight: 500; font-size: 15px; line-height: 1.7; font-feature-settings: "palt";
}
.wrap { position: relative; max-width: 560px; margin: 0 auto; padding: 0 16px 40px; }
a { color: var(--brand); }

/* 空と雲 */
.sky { position: absolute; inset: 0 0 auto 0; height: 340px; overflow: hidden; pointer-events: none;
  background: linear-gradient(#cfe9f8, var(--sky)); }
.cloud { position: absolute; background: #fff; border-radius: 40px; opacity: .9; }
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.c1 { width: 90px; height: 26px; top: 48px; left: 6%; }
.c1::before { width: 40px; height: 40px; top: -20px; left: 14px; } .c1::after { width: 30px; height: 30px; top: -14px; left: 44px; }
.c2 { width: 70px; height: 22px; top: 92px; right: 8%; }
.c2::before { width: 32px; height: 32px; top: -16px; left: 10px; } .c2::after { width: 24px; height: 24px; top: -10px; left: 34px; }
@media (prefers-reduced-motion: no-preference) {
  .c1 { animation: drift 28s ease-in-out infinite alternate; } .c2 { animation: drift 34s ease-in-out infinite alternate-reverse; }
  @keyframes drift { to { transform: translateX(30px); } }
  .train-face.mood-good { animation: bob 2.4s ease-in-out infinite; }
  .train-face.mood-avoid { animation: shake .9s ease-in-out infinite; }
  @keyframes bob { 50% { transform: translateY(-3px); } }
  @keyframes shake { 25% { transform: translateX(-1.5px); } 75% { transform: translateX(1.5px); } }
}

/* ヒーロー */
.hero { position: relative; text-align: center; padding-top: 22px; }
.hero-art { display: flex; justify-content: center; align-items: flex-end; gap: 4px; }
.logo { margin: 4px 0 0; font-size: 32px; font-weight: 900; letter-spacing: .02em; line-height: 1.2; }
.logo span { color: var(--brand); }
.lead { margin: 8px 0 0; font-size: 14.5px; color: var(--ink-soft); }

/* 検索カード */
.card { background: var(--card); border-radius: 22px; box-shadow: 0 6px 0 #d5e6f1; }
.search { position: relative; margin-top: 18px; padding: 16px; display: grid; gap: 10px; }
.stn { position: relative; display: grid; grid-template-columns: 4.6em 1fr; align-items: center; gap: 8px; }
.stn label { font-weight: 700; font-size: 14px; }
.stn input, .dep input {
  width: 100%; font: inherit; font-size: 17px; padding: 11px 14px; color: var(--ink);
  border: 2px solid var(--line); border-radius: 14px; background: #f7fbfd;
}
.stn input:focus, .dep input:focus { outline: none; border-color: var(--brand); background: #fff; }
.swap { justify-self: end; margin: -8px 6px -8px 0; width: 36px; height: 30px; border: 2px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--brand); font-size: 16px; cursor: pointer; }
.when { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.seg { display: inline-flex; background: #eef5fa; border-radius: 12px; padding: 3px; }
.seg button { font: inherit; font-weight: 700; font-size: 14px; border: 0; background: none; color: var(--ink-soft);
  padding: 8px 14px; border-radius: 10px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: #fff; color: var(--brand); box-shadow: 0 2px 0 #d5e6f1; }
.dep { display: flex; align-items: center; gap: 8px; flex: 1 1 12em; font-weight: 700; font-size: 14px; white-space: nowrap; }
.dep input { flex: 1; min-width: 7.5em; }

.suggest { position: absolute; grid-column: 2; left: 0; right: 0; top: calc(100% + 4px); z-index: 5; background: #fff;
  border-radius: 14px; box-shadow: 0 10px 28px rgba(45,58,74,.16); overflow: hidden; }
.suggest button { display: block; width: 100%; text-align: left; font: inherit; font-size: 16px; padding: 11px 14px;
  border: 0; border-bottom: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.suggest button:last-child { border-bottom: 0; }
.suggest button:hover, .suggest button:focus-visible { background: #eef6fc; outline: none; }

/* はじめての説明（3つの表情） */
.intro { margin-top: 22px; }
.moods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.moods .m { background: #fff; border-radius: 18px; padding: 10px 6px 12px; text-align: center; box-shadow: 0 4px 0 #d5e6f1; }
.moods b { display: block; font-size: 13.5px; margin-top: 2px; }
.moods span { display: block; font-size: 11.5px; color: var(--ink-soft); line-height: 1.5; margin-top: 2px; }
.try { font-size: 13px; color: var(--ink-soft); margin-top: 14px; text-align: center; line-height: 2.2; }
.try a { display: inline-block; background: #fff; border-radius: 999px; padding: 2px 12px; margin: 0 2px; text-decoration: none; font-weight: 700; }

/* 結果 */
#results { margin-top: 18px; }
.empty-msg { text-align: center; color: var(--ink-soft); background: #fff; border-radius: 18px; padding: 16px; }

.rc { background: #fff; border-radius: 24px; margin-top: 16px; padding: 16px; box-shadow: 0 6px 0 #d5e6f1; position: relative; }
.rc.best { box-shadow: 0 0 0 3px var(--good), 0 6px 0 #c2e5d1; }
.rc .ribbon { position: absolute; top: -12px; left: 16px; background: var(--good); color: #fff; font-weight: 900; font-size: 13px;
  border-radius: 999px; padding: 3px 12px; }
.rc-top { display: flex; gap: 12px; align-items: center; }
.rc-top .face { flex-shrink: 0; }
.rc-name { font-weight: 900; font-size: 17px; line-height: 1.4; }
.rc-time { font-size: 13px; color: var(--ink-soft); }
.rc-mood { display: inline-block; margin-top: 4px; font-weight: 900; font-size: 15px; border-radius: 999px; padding: 1px 12px; }
.rc-mood.good { background: var(--good-bg); color: #237a4f; }
.rc-mood.caution { background: var(--caution-bg); color: #9a6410; }
.rc-mood.avoid { background: var(--avoid-bg); color: #b33b27; }
.rc-mood.none { background: #eef1f4; color: var(--ink-soft); }

/* 吹き出し：ここが「このままだと…」 */
.bubble { position: relative; margin-top: 12px; padding: 12px 14px; border-radius: 18px; font-size: 15.5px; font-weight: 700; line-height: 1.6; }
.bubble::before { content: ""; position: absolute; top: -9px; left: 34px; border: 9px solid transparent; border-top: 0; border-bottom-color: inherit; }
.bubble.good { background: var(--good-bg); border-color: var(--good-bg); }
.bubble.caution { background: var(--caution-bg); border-color: var(--caution-bg); }
.bubble.avoid { background: var(--avoid-bg); border-color: var(--avoid-bg); }
.bubble.none { background: #eef1f4; border-color: #eef1f4; }
.bubble .big { font-size: 20px; font-weight: 900; }
.bubble .note { display: block; font-size: 11.5px; font-weight: 500; color: var(--ink-soft); margin-top: 2px; }

/* 乗る電車（区間）の並び */
.legs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: #f5f9fc; border-radius: 999px; padding: 2px 10px 2px 2px; font-size: 13px; font-weight: 700; }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; margin-left: 6px; }
.chip svg { display: block; }
.legs .arrow { color: #a8b6c4; font-size: 12px; }

/* ずらすと… */
.shift { margin-top: 12px; display: flex; align-items: center; gap: 8px; background: linear-gradient(90deg, #fff4f1, #eaf8f0);
  border-radius: 18px; padding: 10px 12px; }
.shift .t { font-size: 12px; text-align: center; color: var(--ink-soft); line-height: 1.3; }
.shift .t b { display: block; font-size: 15px; color: var(--ink); }
.shift .go { font-size: 22px; color: #9bb1c4; }
.shift .msg { flex: 1; font-size: 14px; font-weight: 700; line-height: 1.55; }
.shift .msg em { font-style: normal; color: #237a4f; font-size: 17px; font-weight: 900; }

/* くわしく（根拠はここに） */
details.more-info { margin-top: 12px; border-top: 2px dashed var(--line); padding-top: 8px; }
details.more-info summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--brand); list-style: none; }
details.more-info summary::before { content: "▸ "; }
details.more-info[open] summary::before { content: "▾ "; }
.leg { border-left: 6px solid #b9c4cf; padding: 4px 0 4px 10px; margin-top: 10px; font-size: 13px; }
.leg .nm { font-weight: 900; font-size: 14px; }
.leg .sp { color: var(--ink-soft); }
.leg .why { color: var(--ink-soft); font-size: 12.5px; }
.leg .tag { display: inline-block; font-size: 10.5px; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; margin-right: 4px; }
.leg .tail { color: #b33b27; font-size: 12.5px; }
.xfer { font-size: 12px; color: var(--ink-soft); margin: 6px 0 0 16px; }
.links { margin-top: 10px; font-size: 13px; display: flex; gap: 14px; flex-wrap: wrap; }

/* ほかの機能 */
.more { margin-top: 30px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.more a { background: #fff; border-radius: 18px; padding: 12px; text-decoration: none; color: var(--ink); font-weight: 900; font-size: 14px;
  box-shadow: 0 4px 0 #d5e6f1; line-height: 1.4; }
.more .mi { display: block; font-size: 22px; }
.more small { display: block; font-weight: 500; font-size: 11.5px; color: var(--ink-soft); margin-top: 3px; }

.foot { margin-top: 30px; font-size: 11.5px; color: var(--ink-soft); line-height: 1.85; }
.foot strong { color: var(--ink); }

:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
