:root {
  --paper: #f6f1e7;
  --card: #fffdf8;
  --ink: #23304a;
  --sub: #6b7385;
  --line: #e7dccb;
  --sky: #3d7ab8;
  --sky-soft: #e3eef7;
  --sunset: #e2683c;
  --sunset-soft: #fbe7dc;
  --sun: #f2b544;
  --ok: #3c8c6e;
  --on-accent: #fff;
  --shadow: 0 1px 0 rgba(35, 48, 74, .05), 0 6px 18px rgba(35, 48, 74, .07);
  --r: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #161b26; --card: #1f2634; --ink: #eef0f4; --sub: #a3abbb; --line: #313a4b;
    --sky: #7fb2e3; --sky-soft: #22344a; --sunset: #f08a5d; --sunset-soft: #3d2a24; --sun: #f2c266; --ok: #6cc29f; --on-accent: #1b1f2a;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #161b26; --card: #1f2634; --ink: #eef0f4; --sub: #a3abbb; --line: #313a4b;
  --sky: #7fb2e3; --sky-soft: #22344a; --sunset: #f08a5d; --sunset-soft: #3d2a24; --sun: #f2c266; --ok: #6cc29f; --on-accent: #1b1f2a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: 'Zen Maru Gothic', system-ui, -apple-system, 'Hiragino Maru Gothic ProN', sans-serif;
  font-weight: 500; line-height: 1.6; padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
button, input { font: inherit; color: inherit; }
svg.ic { width: 20px; height: 20px; flex: none; }
.num { font-variant-numeric: tabular-nums; letter-spacing: .01em; }

/* 上部 */
.top { position: relative; padding: calc(18px + env(safe-area-inset-top)) 16px 10px; overflow: hidden; max-width: 560px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.logo { width: 44px; height: 44px; }
.brand h1 { margin: 0; font-size: 22px; font-weight: 900; letter-spacing: .04em; }
.brand p { margin: 0; font-size: 13px; color: var(--sub); }
.skyline { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 60px; color: var(--line); }
.plane { position: absolute; width: 22px; height: 22px; color: var(--sky); offset-path: path('M-10 52 C 90 50, 170 10, 370 8'); offset-rotate: auto; animation: fly 7s ease-in-out 0.4s both; }
@keyframes fly { from { offset-distance: 0%; opacity: 0; } 8% { opacity: 1; } 92% { opacity: 1; } to { offset-distance: 100%; opacity: 0; } }

main { max-width: 560px; margin: 0 auto; padding: 4px 16px; }
h2 { font-size: 15px; font-weight: 900; margin: 22px 2px 10px; display: flex; align-items: baseline; gap: 8px; }
h2 small { font-size: 12px; font-weight: 500; color: var(--sub); }

/* お知らせ帯 */
.notice { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-top: 10px; box-shadow: var(--shadow); }
.notice .ic { color: var(--sunset); width: 26px; height: 26px; }
.notice p { margin: 0; font-size: 13px; flex: 1; }
.notice b { display: block; font-size: 14px; }
.notice.demo { background: var(--sky-soft); border-color: transparent; box-shadow: none; }
.notice.demo .ic { color: var(--sky); }

/* ボタン（どれも同じ形） */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn.primary { background: var(--sunset); border-color: var(--sunset); color: var(--on-accent); }
.btn.sky { background: var(--sky); border-color: var(--sky); color: var(--on-accent); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .choice:focus-visible, input:focus-visible { outline: 2.5px solid var(--sky); outline-offset: 2px; }
.btn .ic { width: 18px; height: 18px; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn.wide { width: 100%; }

/* 激安カード（搭乗券ふう） */
.deal { position: relative; display: grid; grid-template-columns: 1fr auto; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden; }
.deal.hl { animation: glow 2.4s ease-out 1; }
@keyframes glow { 0% { box-shadow: 0 0 0 3px var(--sun), var(--shadow); } 100% { box-shadow: 0 0 0 0 transparent, var(--shadow); } }
.deal .main { padding: 14px 8px 12px 16px; min-width: 0; }
.deal .stub { width: 112px; padding: 14px 12px 12px 4px; display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.deal .links { grid-column: 1 / -1; position: relative; border-top: 2px dashed var(--line); padding: 12px 14px 14px; }
.deal .links::before, .deal .links::after { content: ''; position: absolute; top: -9px; width: 16px; height: 16px; border-radius: 50%; background: var(--paper); }
.deal .links::before { left: -8px; } .deal .links::after { right: -8px; }
.route { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--sub); font-weight: 700; letter-spacing: .06em; }
.route .ic { width: 14px; height: 14px; color: var(--sky); }
.dest { font-size: 22px; font-weight: 900; margin: 2px 0 0; line-height: 1.3; }
.dest small { font-size: 12px; font-weight: 500; color: var(--sub); margin-left: 6px; }
.facts { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--sub); margin: 6px 0 10px; }
.facts span { display: inline-flex; align-items: center; gap: 4px; }
.facts .ic { width: 15px; height: 15px; }
.price { font-size: 24px; font-weight: 900; color: var(--sunset); line-height: 1.1; }
.price small { font-size: 12px; font-weight: 700; }
.vs { font-size: 12px; color: var(--sub); margin-top: 2px; }
.stamp { margin-top: 10px; margin-right: 2px; width: 64px; height: 64px; border-radius: 50%; border: 2.5px solid var(--sunset); color: var(--sunset); display: grid; place-content: center; transform: rotate(-12deg); font-weight: 900; line-height: 1.05; }
.stamp b { font-size: 20px; } .stamp span { font-size: 10px; }
.deal.new .stamp { animation: stamp .5s cubic-bezier(.3, 1.6, .5, 1) .2s both; }
@keyframes stamp { from { transform: rotate(-30deg) scale(1.8); opacity: 0; } to { transform: rotate(-12deg) scale(1); opacity: 1; } }
.links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.links .btn { min-height: 42px; font-size: 13px; padding: 0 8px; }
.breakdown { font-size: 12px; color: var(--sub); margin: -4px 0 10px; }

/* 見張りカード */
.watch { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 10px; }
.watch.off { opacity: .6; }
.watch .head { display: flex; align-items: center; gap: 10px; }
.watch .title { font-weight: 900; font-size: 16px; flex: 1; min-width: 0; }
.radar { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); position: relative; flex: none; }
.radar::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--ok); animation: ping 2.4s ease-out infinite; }
.watch.off .radar { background: var(--sub); } .watch.off .radar::after { display: none; }
@keyframes ping { from { transform: scale(1); opacity: .8; } to { transform: scale(3); opacity: 0; } }
.watch .tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.tag { font-size: 12px; background: var(--paper); border-radius: 999px; padding: 3px 10px; display: inline-flex; align-items: center; gap: 4px; }
.tag .ic { width: 13px; height: 13px; }
.watch .acts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.empty { text-align: center; color: var(--sub); font-size: 14px; padding: 22px 16px; background: var(--card); border-radius: var(--r); border: 1.5px dashed var(--line); }
.empty svg { width: 46px; height: 46px; color: var(--line); display: block; margin: 0 auto 6px; }

.fab { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom)); width: min(528px, calc(100% - 32px)); min-height: 54px; font-size: 16px; border-radius: 16px; box-shadow: 0 8px 22px rgba(226, 104, 60, .35); z-index: 5; }
.fab:active { transform: translateX(-50%) translateY(1px); }

/* 条件の入力（下から出るシート） */
dialog.sheet { overflow-x: hidden; border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px; max-height: 92dvh; border-radius: 22px 22px 0 0; background: var(--paper); color: var(--ink); }
dialog.sheet::backdrop { background: rgba(20, 26, 38, .45); }
dialog.sheet[open] { animation: up .28s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-head { position: sticky; top: 0; z-index: 2; background: var(--paper); display: flex; align-items: center; padding: 14px 12px 8px 20px; }
.sheet-head h2 { margin: 0; flex: 1; font-size: 18px; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; display: grid; place-content: center; cursor: pointer; color: var(--sub); }
.sheet-body { padding: 0 20px 20px; }
.q { background: var(--card); border-radius: var(--r); padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.q > label, .q > .label { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 15px; margin-bottom: 10px; }
.q > .label .ic { color: var(--sky); }
.q .step { width: 22px; height: 22px; border-radius: 50%; background: var(--sky); color: var(--on-accent); font-size: 12px; display: grid; place-content: center; flex: none; }
.choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.choice { min-height: 46px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); font-weight: 700; font-size: 14px; cursor: pointer; padding: 6px 8px; }
.choice[aria-pressed="true"] { background: var(--sky); border-color: var(--sky); color: var(--on-accent); }
.hint { font-size: 12px; color: var(--sub); margin: 8px 2px 0; }
.dates { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.dates span { color: var(--sub); font-size: 13px; }
input[type="date"], input[type="search"] { width: 100%; min-height: 46px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); padding: 0 12px; font-size: 16px; }
input[type="date"] { font-size: 15px; min-width: 0; padding: 0 8px; -webkit-appearance: none; appearance: none; }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.stepper > span { font-size: 14px; color: var(--sub); }
.stepper .val { font-size: 18px; font-weight: 900; min-width: 3.4em; text-align: center; }
.stepper .pair { display: flex; align-items: center; gap: 6px; }
.stepper .btn { width: 44px; padding: 0; font-size: 20px; }
.picked { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 2px; background: var(--sky-soft); border-radius: 999px; padding: 4px 4px 4px 12px; font-size: 14px; font-weight: 700; }
.chip button { width: 28px; height: 28px; border: 0; background: transparent; cursor: pointer; display: grid; place-content: center; color: var(--sub); }
.chip button .ic { width: 14px; height: 14px; }
.results { list-style: none; margin: 6px 0 0; padding: 0; }
.results button { width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 6px; border-bottom: 1px solid var(--line); cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.results small { color: var(--sub); }
.rule { display: flex; gap: 10px; align-items: center; font-size: 13px; background: var(--sunset-soft); border-radius: var(--r); padding: 12px 14px; margin-bottom: 14px; }
.rule .ic { color: var(--sunset); }

#toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 20; max-width: calc(100% - 32px); }

.howto { font-size: 13px; margin: 8px 0 0; padding-left: 1.3em; }
.howto li { margin: 2px 0; }
.howto .ic { width: 15px; height: 15px; vertical-align: -2px; }
.foot { font-size: 12px; color: var(--sub); text-align: center; margin: 28px 0 0; }

@media (max-width: 360px) {
  .deal .stub { width: 100px; }
  .dest { font-size: 20px; }
  .price { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .plane { display: none; }
}
