:root {
  --sky-1: #0E2347; --sky-2: #2D5D9A; --dusk: #E9B98F;
  --paper: #F4F1EA; --paper-2: #FBF9F4; --card: #FFFFFF;
  --ink: #18233A; --ink-2: #5A6577; --ink-3: #98A0AC;
  --line: #E6E1D6; --rule: #EFEBE2;
  --navy: #1E4C8F; --navy-soft: #E6EEF8;
  --shu: #C8442F; --shu-soft: #F8E7E3;
  --ok: #2E7D4F;
  --r: 18px; --tap: 46px;
  --mincho: "Hiragino Mincho ProN", "Yu Mincho", serif;
  --sans: -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", sans-serif;
  --latin: "Avenir Next", "Avenir", -apple-system, sans-serif;
  --shadow: 0 1px 2px rgba(24,35,58,.05), 0 10px 30px rgba(24,35,58,.08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12151B; --paper-2: #191D25; --card: #1E232C;
    --ink: #ECEAE4; --ink-2: #B0B4BC; --ink-3: #7A808B;
    --line: #2E3440; --rule: #272C36;
    --navy: #8DB4F0; --navy-soft: #233149;
    --shu: #EE7A64; --shu-soft: #3A2622;
    --ok: #6CC291;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* 画面は縦にだけ動かす。横にはずれないようにする（iPhoneで横にずれた。2026-10-06 CHIKA指摘） */
html, body { max-width: 100%; overflow-x: hidden; overscroll-behavior-x: none; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--sans); padding-bottom: 110px; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; width: 100%; }

/* 表紙: 夕暮れの空 */
.hero { color: #fff; padding: calc(16px + env(safe-area-inset-top)) 0 72px;
  background: linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 50%, #8FA3BF 72%, var(--dusk) 88%, var(--paper) 100%); }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { display: block; flex: none; filter: drop-shadow(0 2px 6px rgba(0,0,0,.25)); }
.logo.big { margin: 0 auto; filter: drop-shadow(0 4px 12px rgba(24,35,58,.18)); }
.seal { width: 40px; height: 40px; background: rgba(255,255,255,.92); border: 2.5px solid var(--shu); color: var(--shu);
  border-radius: 7px; display: grid; place-items: center; font: 700 22px/1 var(--mincho); transform: rotate(-4deg); flex: none; }
h1 { margin: 0; font: 600 21px/1.2 var(--mincho); letter-spacing: .1em; }
.sub { margin: 2px 0 0; font-size: 12px; opacity: .8; }
.proto { margin-left: 8px; padding: 0 6px; border: 1px solid rgba(255,255,255,.5); border-radius: 4px; font-size: 11px; }
.yearbar { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 22px 0 4px; font: 600 17px var(--latin); }
.yr { background: rgba(255,255,255,.14); border: 0; color: #fff; width: 34px; height: 34px; border-radius: 99px; font-size: 20px; line-height: 1; cursor: pointer; }
.hero-num { text-align: center; }
.hero-num .label { font-size: 13px; opacity: .85; }
.hero-num .big { font: 700 58px/1.05 var(--latin); letter-spacing: -.01em; font-variant-numeric: tabular-nums; text-shadow: 0 2px 16px rgba(0,0,0,.2); }
.hero-num .big small { font-size: 18px; margin-left: 4px; opacity: .85; }
.hero-num .planned { font-size: 13px; opacity: .85; }

button.ghost { background: none; border: 1px solid var(--line); border-radius: 12px; min-height: 38px; padding: 0 14px; cursor: pointer; }
button.ghost.small, button.primary.small { min-height: 34px; font-size: 14px; }
button.danger { color: var(--shu); border-color: var(--shu-soft); }
button.primary { background: var(--navy); color: #fff; border: 0; border-radius: 12px; padding: 0 16px; font-weight: 700; cursor: pointer; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) button.primary { color: #10131A; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; margin: 14px 0; }
.summary { margin-top: -52px; position: relative; }

/* 目標までの進み具合 */
.target-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 600; }
.target select { border: 1px solid var(--line); border-radius: 10px; background: var(--paper-2); padding: 4px 8px; }
.bar { margin-top: 12px; }
.bar-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); }
.bar-row b { color: var(--ink); font-variant-numeric: tabular-nums; font-family: var(--latin); }
.track { position: relative; height: 8px; background: var(--rule); border-radius: 99px; overflow: hidden; margin-top: 5px; }
.fill { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: linear-gradient(90deg, var(--sky-2), var(--navy)); }
.fill.plan { background: var(--navy-soft); }
.rest { margin-top: 14px; font-size: 15px; }
.rest b { color: var(--shu); font: 700 22px var(--latin); font-variant-numeric: tabular-nums; }
.reached { color: var(--ok); font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; text-align: center; }
.stats div { background: var(--paper-2); border-radius: 12px; padding: 10px 4px 8px; }
.stats b { display: block; font: 700 19px var(--latin); font-variant-numeric: tabular-nums; }
.stats span { font-size: 11px; color: var(--ink-2); }
.warn { margin-top: 10px; font-size: 13px; color: var(--shu); }

/* 搭乗の記録（月ごと） */
.log h2 { font: 600 14px var(--latin); color: var(--ink-2); margin: 24px 4px 8px; letter-spacing: .08em; }
.entry { display: grid; grid-template-columns: 78px 1fr auto; gap: 14px; align-items: center; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 10px 14px 10px 10px; margin-bottom: 10px; text-align: left; cursor: pointer; }
.entry.plan { opacity: .7; }
.thumb { position: relative; width: 78px; height: 96px; border-radius: 12px; overflow: hidden; color: #fff;
  background: linear-gradient(180deg, var(--sky-1), var(--sky-2) 60%, var(--dusk)); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .codes { position: absolute; left: 7px; top: 6px; font: 700 13px/1.15 var(--latin); text-shadow: 0 1px 6px rgba(0,0,0,.45); }
.thumb .codes i { font-style: normal; font-weight: 500; opacity: .85; }
.entry .what b { font: 700 17px var(--latin); }
.entry .what .date { font-size: 12px; color: var(--ink-2); font-family: var(--latin); }
.entry .what .route { display: block; font-size: 14px; margin-top: 1px; }
.entry .what .fare { display: block; font-size: 12px; color: var(--ink-2); }
.entry .pts { text-align: right; font: 700 18px var(--latin); font-variant-numeric: tabular-nums; }
.entry .pts small { display: block; font-size: 11px; font-weight: 500; color: var(--ink-3); }
.stamp { display: inline-block; vertical-align: 2px; margin-left: 4px; font: 600 11px var(--mincho); color: var(--shu); border: 1.5px solid var(--shu); border-radius: 4px; padding: 0 4px; transform: rotate(-3deg); }
.empty { text-align: center; color: var(--ink-2); padding: 28px 12px; }

.settings summary { cursor: pointer; font-weight: 600; }
.settings label { display: block; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.settings select { display: block; width: 100%; margin-top: 4px; min-height: 40px; }
.settings button { margin: 10px 8px 0 0; }
.note { font-size: 12px; color: var(--ink-2); margin: 8px 0 0; }
.foot { font-size: 11px; color: var(--ink-3); margin: 20px 4px; }

.fab { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: calc(18px + env(safe-area-inset-bottom));
  background: var(--shu); color: #fff; border: 0; border-radius: 99px; padding: 14px 22px; font-weight: 700; font-size: 16px;
  box-shadow: 0 8px 22px rgba(200,68,47,.38); cursor: pointer; }

/* 入力画面 */
.sheet { position: fixed; inset: 0; background: var(--paper); overflow-y: auto; overflow-x: hidden; overscroll-behavior-x: none; z-index: 10; }
.sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--card); border-bottom: 1px solid var(--line); }
.sheet-body { padding-top: 14px; padding-bottom: 40px; }
.memory canvas { display: block; width: 100%; max-width: 420px; aspect-ratio: 3 / 4; margin: 0 auto; border-radius: 16px; box-shadow: var(--shadow); background: var(--sky-1); }
.memory-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 12px 0 4px; }
.pill { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 8px 14px; font-size: 14px; cursor: pointer; }
.pill input { display: none; }
.pill.strong { background: var(--navy); color: #fff; border-color: var(--navy); font-weight: 700; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.strong { color: #10131A; } }
details.sect { border: 1px solid var(--line); border-radius: var(--r); background: var(--card); margin: 12px 0; padding: 0 14px; min-width: 0; }
details.sect[open] { padding-bottom: 14px; }
details.sect > summary { list-style: none; display: flex; justify-content: space-between; align-items: center; cursor: pointer;
  min-height: 56px; padding: 14px 0; font: 600 18px var(--mincho); letter-spacing: .1em; color: var(--navy); }
details.sect > summary::-webkit-details-marker { display: none; }
details.sect > summary::after { content: ""; width: 11px; height: 11px; border-right: 2.5px solid var(--ink-2); border-bottom: 2.5px solid var(--ink-2);
  transform: rotate(45deg); margin-right: 4px; transition: transform .2s; }
details.sect[open] > summary::after { transform: rotate(-135deg); }
details.sect > summary .filled { font: 14px var(--sans); color: var(--ink-3); letter-spacing: 0; margin-left: auto; margin-right: 12px; }
.sect label { display: block; font-size: 14px; color: var(--ink-2); margin-top: 10px; min-width: 0; }
.sect input:not([type=checkbox]):not([type=radio]), .sect select, .sect textarea {
  display: block; width: 100%; margin-top: 4px; min-height: var(--tap); padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2); color: var(--ink); }
.sect textarea { min-height: 80px; }
label.check { display: flex; gap: 8px; align-items: center; }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.row2 > * { min-width: 0; }
/* iPhoneの日付・時刻の欄は、そのままだと決めた幅より広がるので、見た目を自前にして幅に収める */
.sect input, .sect select, .sect textarea { min-width: 0; max-width: 100%; }
.sect input[type=date], .sect input[type=time] { -webkit-appearance: none; appearance: none; text-align: left; line-height: 1.6; }
.sect input[type=date]::-webkit-date-and-time-value, .sect input[type=time]::-webkit-date-and-time-value { text-align: left; }
.scan { display: block; border: 1.5px dashed var(--navy); border-radius: var(--r); padding: 12px; text-align: center; cursor: pointer; background: var(--navy-soft); margin-top: 14px; }
.scan input { display: none; }
.scan span { font-weight: 700; color: var(--navy); }
.scan small { display: block; font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.scanmsg { font-size: 13px; margin: 8px 4px 0; }
.pp { margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: var(--paper-2); font-size: 14px; }
.pp b { font: 700 20px var(--latin); font-variant-numeric: tabular-nums; }
.pp.ng { color: var(--shu); }
.faces { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 2px; }
.faces label { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 0; padding: 8px 0 6px;
  border-radius: 14px; border: 2px solid transparent; cursor: pointer; font-size: 12px; color: var(--ink-2); }
.faces input { position: absolute; opacity: 0; pointer-events: none; }
.faces svg { transition: transform .15s; }
.faces label:has(input:checked) { border-color: var(--navy); background: var(--navy-soft); color: var(--ink); font-weight: 700; }
.faces label:has(input:checked) svg { transform: scale(1.12); }
.sign-head { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; font-size: 13px; color: var(--ink-2); }
.sign-head .pill { padding: 4px 12px; font-size: 13px; }
.signpad { display: block; width: 100%; height: 170px; margin-top: 6px; border-radius: 12px; touch-action: none;
  border: 1px dashed var(--line); background:
  linear-gradient(transparent 128px, var(--line) 128px, var(--line) 129px, transparent 129px), #FFFEFB; }
.entry .face { display: inline-block; vertical-align: -5px; margin-left: 6px; }
.backup h3 { margin: 0; font: 600 16px var(--mincho); letter-spacing: .06em; }
.backup-btns { display: flex; gap: 10px; margin-top: 12px; }
.backup-btns .primary { min-height: 40px; }
.ghost-btn { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; min-height: 40px; padding: 0 16px; font-size: 14px; cursor: pointer; }
.ghost-btn input { display: none; }
.notice { display: flex; gap: 10px; align-items: center; justify-content: space-between; background: var(--navy-soft); border-radius: 14px; padding: 10px 14px; margin: 12px 0; font-size: 13px; }
.notice button { flex: none; }
.free-left { text-align: center; font-size: 12px; color: var(--ink-2); margin: 4px 0 0; }
.pay { padding-top: 20px; padding-bottom: 40px; }
.pay-hero { text-align: center; padding: 10px 0 6px; }
.pay-hero h2 { font: 600 24px/1.4 var(--mincho); margin: 14px 0 6px; }
.pay-hero p { color: var(--ink-2); margin: 0; }
.seal.big { width: 64px; height: 64px; font-size: 34px; margin: 0 auto; background: var(--card); }
.price { font: 700 52px/1 var(--latin); text-align: center; margin-top: 6px; }
.price small { font: 600 20px var(--sans); margin-left: 4px; }
.price-sub { text-align: center; color: var(--ink-2); font-size: 14px; margin: 6px 0 12px; }
.pay ul { margin: 0; padding-left: 20px; line-height: 2; }
.pay .ghost { margin-top: 12px; }
/* 上の白い枠（スワイプで切り替え） */
.carousel { padding: 0; overflow: hidden; transition: height .25s ease; }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; align-items: flex-start; overscroll-behavior-x: contain; }
.slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; padding: 18px; }
.dots { display: flex; justify-content: center; gap: 6px; padding: 0 0 12px; }
.dots span { width: 7px; height: 7px; border-radius: 99px; background: var(--line); transition: all .2s; }
.dots span.on { width: 18px; background: var(--navy); }
.swipe-hint { font-size: 12px; color: var(--ink-3); text-align: right; margin-top: 8px; }

/* 機材の図鑑 */
.fleet-head { display: flex; justify-content: space-between; align-items: baseline; }
.fleet-head h3 { margin: 0; font: 600 17px var(--mincho); letter-spacing: .06em; }
.fleet-head .cnt { font: 700 20px var(--latin); }
.fleet-head .cnt small { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.fleet-group { font-size: 12px; color: var(--ink-2); margin: 14px 0 6px; }
.fleet { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.plane { position: relative; border-radius: 12px; background: var(--paper-2); padding: 6px 4px 6px; text-align: center; color: #C3C8D0; }
.plane.got { color: var(--navy); background: var(--navy-soft); }
.plane .nm { display: block; font-size: 11px; line-height: 1.3; color: var(--ink-3); margin-top: 2px; }
.plane.got .nm { color: var(--ink); font-weight: 700; }
.plane .times { position: absolute; top: 4px; right: 6px; font: 700 11px var(--latin); color: var(--shu); }
.plane .got-stamp { position: absolute; top: 3px; left: 4px; font: 600 10px var(--mincho); color: var(--shu); border: 1.3px solid var(--shu); border-radius: 3px; padding: 0 3px; transform: rotate(-6deg); background: var(--card); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .plane { color: #3A414D; } }
/* 空の地図（3枚目） */
.seg { display: inline-flex; background: var(--paper-2); border: 1px solid var(--line); border-radius: 99px; padding: 2px; }
.seg button { border: 0; background: none; border-radius: 99px; padding: 5px 14px; font-size: 14px; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: var(--navy); color: #fff; font-weight: 700; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button.on { color: #10131A; } }
.mapbox { margin-top: 10px; border-radius: 14px; overflow: hidden; background: var(--sea); }
.mapbox svg { display: block; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.legend i { display: inline-block; vertical-align: -1px; margin-right: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chips span { background: var(--navy-soft); border-radius: 99px; padding: 3px 10px; font-size: 13px; }
.chips b { font-family: var(--latin); margin-left: 2px; }
:root { --sea: #EEF3F8; --map-jp: #AFC4DE; --map-land: #F6F4EF; --map-empty: #FFFFFF; --map-empty-line: #5D7395; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --sea: #141B27; --map-jp: #3B4F70; --map-land: #232A36; --map-empty: #141B27; --map-empty-line: #9FB3D1; } }
.buy { display: block; text-align: center; background: var(--shu); color: #fff; font-weight: 700; border-radius: 12px; padding: 14px; margin-top: 14px; text-decoration: none; }
.code-in { display: block; font-size: 14px; color: var(--ink-2); }
.code-in input { display: block; width: 100%; margin-top: 6px; min-height: 48px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2); font: 600 18px var(--latin); letter-spacing: .05em; }
button.primary.wide { display: block; width: 100%; min-height: 48px; margin-top: 10px; }
.paid-done { text-align: center; padding: 28px 18px; }
.paid-done .done-mark { width: 64px; height: 64px; margin: 0 auto; border-radius: 99px; background: var(--ok); color: #fff; font: 700 36px/64px var(--latin); }
.paid-done h2 { font: 600 22px var(--mincho); margin: 14px 0 6px; }
.paid-done p { margin: 4px 0; }
.proto.paid { border-color: rgba(255,255,255,.9); font-weight: 700; }
[hidden] { display: none !important; }
