:root {
  --bg: #f3f6fa; --card: #fff; --ink: #14202e; --sub: #5b6b7d; --line: #dbe3ec;
  --accent: #0b3d6b; --accent2: #1d6fb8; --danger: #b3261e;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e141b; --card: #17202b; --ink: #e8eef5; --sub: #9aa9ba; --line: #263444; --accent: #2b6cb0; --accent2: #5aa2e6; --danger: #f2877f; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 13px/1.5 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  padding-bottom: calc(90px + env(safe-area-inset-bottom));
}
.top {
  background: var(--accent); color: #fff; padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.top h1 { margin: 0; font-size: 15.5px; }
.stats { font-size: 11px; opacity: .92; }
.stats b { font-size: 13px; }

.bar { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 10px 12px 8px; border-bottom: 1px solid var(--line); }
.bar input, .bar select, dialog input, dialog textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.filters { display: flex; gap: 6px; margin-top: 6px; }
.filters select { flex: 1; min-width: 0; padding: 8px 6px; font-size: 11px; }

.grid {
  display: grid; gap: 10px; padding: 12px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
@media (min-width: 700px) { .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); } }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  text-align: left; padding: 0; cursor: pointer; color: inherit; font: inherit;
}
.card:active { transform: scale(.98); }
.card .ph { aspect-ratio: 4 / 3; background: #0001; display: block; width: 100%; object-fit: cover; }
.card .ph.none { display: grid; place-items: center; color: var(--sub); font-size: 25px; }
.card .meta { padding: 8px 10px 10px; }
.card .reg { font-weight: 700; font-size: 13.5px; letter-spacing: .02em; }
.card .reg small { font-weight: 600; color: var(--accent2); margin-left: 4px; }
.card .sub { color: var(--sub); font-size: 10px; margin-top: 2px; }
.empty { text-align: center; color: var(--sub); padding: 40px 16px; }

.foot { display: flex; justify-content: center; gap: 16px; padding: 8px; }
.link { background: none; border: 0; color: var(--sub); font: inherit; font-size: 10px; text-decoration: underline; padding: 8px; }


dialog {
  width: min(560px, calc(100vw - 12px)); max-height: calc(100dvh - 20px); overflow: auto;
  border: 0; border-radius: 16px; padding: 16px; background: var(--card); color: var(--ink);
}
dialog::backdrop { background: #000a; }
dialog h2 { margin: 0 0 10px; font-size: 14.5px; }
dialog label { display: block; font-size: 10px; color: var(--sub); margin-top: 10px; }
dialog label input, dialog label textarea { margin-top: 3px; font-size: 16px; } /* 16px: iOSの自動ズーム防止 */
dialog .two { display: grid; grid-template-columns: 1fr; gap: 0; }
@media (min-width: 700px) { dialog .two { grid-template-columns: 1fr 1fr; gap: 8px; } }
dialog input[type=date] { min-width: 0; text-align: left; }
#plate { font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.photo {
  display: grid; place-items: center; min-height: 140px; border: 2px dashed var(--line); border-radius: 12px;
  overflow: hidden; cursor: pointer; color: var(--sub); margin-top: 0 !important;
}
.photo img { width: 100%; max-height: 300px; object-fit: contain; background: #0002; display: block; }
.btns { display: flex; gap: 8px; margin-top: 14px; }
.btns button { flex: 1; font: inherit; font-weight: 600; border-radius: 10px; padding: 12px; border: 1px solid transparent; cursor: pointer; }
.primary { background: var(--accent2); color: #fff; }
.ghost { background: transparent; border-color: var(--line) !important; color: var(--ink); }
.danger { background: transparent; border-color: var(--danger) !important; color: var(--danger); }
button:disabled { opacity: .5; }
.msg { min-height: 1.4em; margin: 8px 0 0; font-size: 11px; color: var(--sub); }
.msg.err { color: var(--danger); }

#viewBody img { width: 100%; border-radius: 10px; display: block; background: #0002; }
#viewBody h2 { font-size: 18.5px; margin: 10px 0 2px; }
#viewBody dl { display: grid; grid-template-columns: 5.5em 1fr; gap: 4px 8px; margin: 8px 0 0; font-size: 12px; }
#viewBody dt { color: var(--sub); }
#viewBody dd { margin: 0; word-break: break-word; }
#viewBody .others { margin-top: 10px; font-size: 11px; color: var(--sub); }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: #000d; color: #fff; padding: 8px 16px; border-radius: 20px; font-size: 11px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.regrow { display: flex; gap: 8px; align-items: stretch; margin-top: 4px; }
.regrow input { flex: 1; min-width: 0; margin-top: 0; }
.regrow button { font: inherit; font-size: 11px; font-weight: 600; border-radius: 10px; padding: 0 12px; border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; white-space: nowrap; }
#viewBody .links { margin-top: 10px; font-size: 11px; }
#viewBody .links a { color: var(--accent, #2a6df4); }
.strip { display: flex; gap: 8px; overflow-x: auto; padding: 6px 0 2px; }
.strip button { flex: 0 0 auto; width: 84px; padding: 0; border: 2px solid transparent; border-radius: 10px; background: transparent; font: inherit; color: var(--sub); cursor: pointer; text-align: center; }
.strip button.on { border-color: var(--accent, #2a6df4); }
.strip img, .strip span { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; display: block; background: #0002; }
.strip span { display: grid; place-items: center; }
.strip small { display: block; font-size: 9.5px; padding: 2px 0; }
.combo { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; max-height: 200px; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 18px #0003; margin-top: 2px; }
.combo .opt { padding: 11px 12px; font-size: 16px; color: var(--ink); border-bottom: 1px solid var(--line); cursor: pointer; }
.combo .opt:last-child { border-bottom: 0; }
.combo .opt:active { background: #0001; }

input, textarea { font-size: 16px; } /* iOSで文字入力時に拡大されないように */

/* ---- 下部ナビ ---- */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; display: grid; grid-template-columns: 1fr 1fr 74px 1fr 1fr; align-items: center;
  background: var(--card); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
.nav button[data-v] { background: none; border: 0; font: inherit; font-size: 9.5px; color: var(--sub); display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 0; cursor: pointer; }
.nav button[data-v] span { font-size: 17px; line-height: 1.2; filter: grayscale(1); opacity: .7; }
.nav button[data-v].on { color: var(--accent2); font-weight: 700; }
.nav button[data-v].on span { filter: none; opacity: 1; }
.nav .addbtn { width: 58px; height: 58px; margin: -26px auto 0; border-radius: 50%; border: 4px solid var(--bg); background: var(--accent); color: #fff; font-size: 27px; line-height: 1; box-shadow: 0 4px 14px #0005; cursor: pointer; }
.view[hidden] { display: none; }

/* ---- ホーム ---- */
.cards4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 4px; }
.cards4 > div { text-align: center; border-left: 1px solid var(--line); }
.cards4 > div:first-child { border-left: 0; }
.cards4 .ic { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; margin: 0 auto 4px; font-size: 13.5px; }
.cards4 small { display: block; font-size: 9.5px; color: var(--sub); }
.cards4 b { display: block; font-size: 23.5px; line-height: 1.2; }
.sec { display: flex; align-items: baseline; justify-content: space-between; padding: 8px 16px 0; }
.sec h2 { margin: 0; font-size: 15.5px; }
.link2 { background: none; border: 0; color: var(--accent2); font: inherit; font-size: 11px; cursor: pointer; padding: 6px 0; }
.rail { display: flex; gap: 10px; overflow-x: auto; padding: 8px 16px 12px; scroll-snap-type: x proximity; scroll-padding-left: 16px; }
.tile { flex: 0 0 72%; max-width: 300px; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; position: relative; border: 0; padding: 0; color: #fff; text-align: left; font: inherit; cursor: pointer; background: #1b2a3b; scroll-snap-align: start; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 35%, #000b); }
.tile .tx { position: absolute; left: 12px; right: 12px; bottom: 10px; z-index: 1; }
.tile .r { font-size: 18.5px; font-weight: 800; text-shadow: 0 1px 4px #0008; }
.tile .pills { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.pill { border: 1.5px solid #fff; border-radius: 999px; padding: 0 9px; font-size: 10px; font-weight: 600; line-height: 1.6; }
.tile .pl { font-size: 10px; margin-top: 4px; opacity: .95; }

#homeHero { padding: 12px 12px 0; }
.hero2 { display: block; width: 100%; aspect-ratio: 16 / 10; border-radius: 18px; overflow: hidden; position: relative; border: 0; padding: 0; color: #fff; text-align: left; font: inherit; cursor: pointer; background: linear-gradient(135deg, #0b3d6b, #1d6fb8); }
.hero2 img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero2::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 40%, #000c); }
.hero2 .tx { position: absolute; left: 14px; right: 14px; bottom: 12px; z-index: 1; }
.hero2 small { font-size: 9.5px; opacity: .85; letter-spacing: .05em; }
.hero2 .r { font-size: 27px; font-weight: 800; line-height: 1.15; text-shadow: 0 1px 4px #0008; }
.hero2 .pills { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.hero2 .pl { font-size: 10px; margin-top: 4px; }
.period { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 12px 4px; }
.period > div { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px 14px; }
.period small { display: block; font-size: 10px; color: var(--sub); }
.period b { font-size: 27px; line-height: 1.2; }
.period b i { font-size: 12px; font-style: normal; margin-left: 2px; }
.period em { font-style: normal; font-size: 11px; color: var(--sub); margin-left: 8px; }
.hbars { margin: 6px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 4px 12px; }
.hbar { display: grid; grid-template-columns: 12px minmax(0, 7em) 1fr 2.2em; align-items: center; gap: 8px; width: 100%; background: none; border: 0; border-top: 1px solid var(--line); color: var(--ink); font: inherit; padding: 10px 0; text-align: left; cursor: pointer; }
.hbar:first-child { border-top: 0; }
.hbar .stc { width: 12px; height: 12px; border-radius: 50%; }
.hbar .nm { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .bar2 { display: block; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.hbar .bar2 i { display: block; height: 100%; border-radius: 4px; }
.hbar b { text-align: right; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 16px 6px; }
.chip { background: var(--card); border: 1px solid var(--line); color: var(--ink); border-radius: 999px; font: inherit; font-size: 12px; padding: 6px 12px; cursor: pointer; }
.chip b { margin-left: 6px; color: var(--accent2); }
#homeTop { padding-bottom: 24px; }

/* ---- 統計 ---- */
.tabs { display: flex; overflow-x: auto; background: var(--accent); }
.tabs button { flex: 1 0 auto; background: none; border: 0; color: #fffa; font: inherit; padding: 12px 14px; cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.on { color: #fff; font-weight: 700; border-bottom-color: #fff; }
.stbar { display: flex; gap: 8px; padding: 12px; align-items: center; }
.stbar select { flex: 1; min-width: 0; font: inherit; font-size: 16px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 9px 10px; }
.seg { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { background: none; border: 0; font: inherit; font-size: 11px; padding: 9px 12px; color: var(--sub); cursor: pointer; }
.seg button.on { background: var(--accent); color: #fff; font-weight: 700; }
.stbody { margin: 0 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.stbody h3 { margin: 0 0 2px; font-size: 13.5px; }
.stbody .subt { color: var(--sub); font-size: 10px; margin-bottom: 8px; }
.donut { display: block; width: min(300px, 80%); margin: 6px auto 10px; }
.donut text { fill: var(--ink); text-anchor: middle; }
.legend { list-style: none; margin: 0; padding: 0; }
.legend li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 12px; }
.legend i { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.legend .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend .ct { color: var(--sub); font-size: 11px; white-space: nowrap; }
.bars li { display: block; }
.bars .row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.bars .bar2 { height: 8px; background: var(--line); border-radius: 99px; margin-top: 5px; overflow: hidden; }
.bars .bar2 i { display: block; height: 100%; background: var(--accent2); border-radius: 99px; }
.ocr { width: 100%; margin-top: 8px; font: inherit; font-weight: 600; font-size: 12px; border-radius: 10px; padding: 10px; border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; }
.ocr:disabled { opacity: .6; }
.stcard { display: flex; gap: 12px; width: 100%; text-align: left; font: inherit; color: inherit; background: none; border: 0; border-top: 1px solid var(--line); padding: 12px 0; cursor: pointer; align-items: stretch; }
.stcard:first-child { border-top: 0; }
.stc { width: 8px; border-radius: 99px; flex: 0 0 auto; }
.stm { flex: 1; min-width: 0; display: block; }
.stm b { display: block; font-size: 13.5px; }
.stm small { display: block; color: var(--sub); font-size: 11px; margin: 1px 0 6px; }
.stm .bar2 { display: block; height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.stm .bar2 i { display: block; height: 100%; border-radius: 99px; }
#stTop[hidden] { display: none; }

/* ---- 詳細（Log Details 風） ---- */
.hero { position: relative; border-radius: 16px; overflow: hidden; aspect-ratio: 4 / 3; background: #1b2a3b; }
#viewBody .hero img, #vcHero .hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 40%, #000c); pointer-events: none; }
.hero .zoom { position: absolute; top: 10px; right: 10px; z-index: 2; width: 40px; height: 40px; border-radius: 12px; background: #0008; display: grid; place-items: center; text-decoration: none; font-size: 15.5px; }
.hero .htx { position: absolute; left: 12px; right: 130px; bottom: 12px; z-index: 2; display: flex; gap: 10px; color: #fff; align-items: stretch; }
.hero .hbar { width: 4px; border-radius: 99px; background: var(--c, #2b6cb0); flex: 0 0 auto; }
.hero .ht { font-size: 10px; opacity: .9; }
.hero .hr { font-size: 25px; font-weight: 800; line-height: 1.15; text-shadow: 0 1px 4px #0008; }
.hero .ha { font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; border-top: 1px solid #fff9; margin-top: 3px; padding-top: 3px; }
.hero .hlinks { position: absolute; right: 10px; bottom: 12px; z-index: 2; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.hero .hlinks a { color: #fff; text-decoration: none; font-size: 10px; font-weight: 700; border-radius: 10px; padding: 6px 10px; white-space: nowrap; }
.hero .fr24 { background: #0a85c9; }
.hero .ps { background: #f28c00; }
.dcard { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; margin-top: 10px; }
.dcard h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; font-size: 13px; }
.dic { width: 32px; height: 32px; border-radius: 10px; background: var(--bg); display: grid; place-items: center; font-size: 13.5px; }
.kv { padding: 8px 0; border-top: 1px solid var(--line); }
.kv:first-of-type { border-top: 0; }
.kv small { display: block; font-size: 10px; color: var(--sub); }
.kv div { font-size: 13.5px; word-break: break-word; white-space: pre-wrap; }

.morelist { padding: 14px 12px; }
.morelist h2 { margin: 0 4px 10px; font-size: 15.5px; }
.morebtn { display: grid; grid-template-columns: 34px 1fr; column-gap: 10px; width: 100%; text-align: left; font: inherit; font-weight: 600; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; cursor: pointer; align-items: center; }
.morebtn span { grid-row: 1 / 3; font-size: 18.5px; }
.morebtn small { color: var(--sub); font-weight: 400; font-size: 10px; }

.chk { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--sub); }
.chk input { width: 20px; height: 20px; flex: none; margin: 0; }
input[type=date]:disabled { opacity: .45; }

/* ---- 空港ページ ---- */
.aphead { display: flex; align-items: center; gap: 8px; padding: 10px 12px 0; }
.aphead h2 { margin: 0; font-size: 15.5px; }
.apback { background: none; border: 0; color: var(--accent2); font: inherit; font-size: 13px; padding: 6px 4px; cursor: pointer; }
.apbox { margin: 8px 12px; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; text-align: center; }
.apcode { font-size: 30.5px; font-weight: 800; letter-spacing: .04em; }
.apname { color: var(--sub); font-size: 12px; margin-top: 2px; }
.apcnt { margin-top: 8px; font-size: 12px; color: var(--sub); }
.apcnt b { font-size: 18.5px; color: var(--ink); }
.apadd { margin-top: 12px; width: 100%; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font: inherit; font-weight: 700; padding: 13px; cursor: pointer; }
.aplist { padding: 4px 12px 24px; }
.aprow { display: grid; grid-template-columns: 8.5em 1fr auto; gap: 8px; align-items: center; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--ink); font: inherit; padding: 12px 2px; cursor: pointer; }
.aprow b { font-size: 13px; letter-spacing: .02em; }
.aprow span { color: var(--sub); font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aprow em { font-style: normal; font-size: 11px; color: var(--accent2); font-weight: 700; }
.aprow.none b { color: var(--sub); font-weight: 600; }
.plink { background: none; border: 0; padding: 0; font: inherit; color: var(--accent2); cursor: pointer; text-align: left; }
.legend li[data-p] { cursor: pointer; }

/* ---- 機体ページ ---- */
#vcHero { padding: 8px 12px 0; }
#vcHero .hero { cursor: pointer; }
.hero .fl { font-size: 12px; letter-spacing: 0; vertical-align: -1px; margin-left: 4px; }
.acph { position: relative; }
.acph .aclinks { position: absolute; right: 10px; bottom: 10px; z-index: 2; }
.aclinks { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.achead { margin: 12px 14px 0; font-size: 13px; color: var(--sub); font-weight: 700; }
.achead b { color: var(--ink); font-size: 15px; }
.aclinks a { text-decoration: none; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 4px 10px; box-shadow: 0 1px 4px #0006; color: #fff; background: #1d6fb8; }
.aclinks a.ps { background: #f08a00; }
.card .sub.dt { color: var(--ink); font-weight: 700; font-size: 12px; margin-top: 0; }

.acnote { text-align: left; }
.acnh { display: flex; justify-content: space-between; align-items: center; }
.acnt { white-space: pre-wrap; word-break: break-word; font-size: 13px; margin-top: 6px; color: var(--ink); }
.acnt.none { color: var(--sub); }
#vcNoteInput { width: 100%; margin-top: 8px; font: inherit; font-size: 13.5px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); resize: vertical; }
.acnb { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.sec2 { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 12px; font: inherit; padding: 12px; cursor: pointer; }

.migmsg { margin: -4px 6px 10px; font-size: 11px; color: var(--sub); }

/* ---- 写真ビューア ---- */
.zoomdlg { position: fixed; inset: 0; width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: #000; overflow: hidden; }
.zoomdlg img { width: 100%; height: 100%; object-fit: contain; touch-action: none; user-select: none; -webkit-user-drag: none; transform-origin: center; }
.zoomdlg button { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; width: 40px; height: 40px; border-radius: 12px; border: 0; background: #fff2; color: #fff; font-size: 16px; cursor: pointer; }
.hero button.zoom { border: 0; color: #fff; cursor: pointer; }

/* =====================================================================
   iPad / 広い画面：左サイドバー + 余白を活かした2段組
   ===================================================================== */
@media (min-width: 700px) {
  body { padding-left: calc(92px + env(safe-area-inset-left)); padding-bottom: 28px; font-size: 14px; }
  /* 下部ナビ → 左サイドバー */
  .nav { top: 0; bottom: 0; right: auto; left: 0; width: calc(92px + env(safe-area-inset-left)); display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; gap: 6px;
    border-top: 0; border-right: 1px solid var(--line); padding: calc(18px + env(safe-area-inset-top)) 6px 18px calc(6px + env(safe-area-inset-left)); }
  .nav .addbtn { order: -1; width: 56px; height: 56px; margin: 0 auto 14px; border: 0; }
  .nav button[data-v] { font-size: 11px; padding: 10px 0; border-radius: 12px; }
  .nav button[data-v] span { font-size: 22px; }
  .nav button[data-v].on { background: color-mix(in srgb, var(--accent2) 12%, transparent); }
  /* 中身は広がりすぎないように */
  .view { max-width: 1180px; margin: 0 auto; }
  .top { padding-left: 20px; padding-right: 20px; }
  .top h1 { font-size: 17px; }
  .stats { font-size: 12px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; padding: 16px; }
  dialog { width: min(680px, calc(100vw - 120px)); }
  dialog .two { grid-template-columns: 1fr 1fr; gap: 12px; }

  /* ホーム：写真は横長に（縦に伸びすぎない） */
  #homeHero { padding: 16px 16px 0; }
  .hero2 { aspect-ratio: 2 / 1; border-radius: 22px; }
  .hero2 .r { font-size: 34px; }
  .hero2 .tx { left: 22px; bottom: 18px; }
  .cards4 { margin: 16px; padding: 16px 8px; }
  .period { margin: 0 16px 4px; gap: 14px; }
  .period > div { padding: 14px 18px; }
  .hbars { margin: 8px 16px; }
  .chips { padding: 8px 20px 6px; }
  .sec { padding: 12px 20px 0; }
  /* 最近の記録：横スクロールではなく並べて見せる */
  .rail { flex-wrap: wrap; overflow: visible; padding: 10px 16px 14px; gap: 14px; }
  .tile { flex: 0 0 calc((100% - 28px) / 3); max-width: none; }
  .tile .r { font-size: 20px; }

  /* 機体・空港ページ：写真を大きくしすぎない */
  .hero { aspect-ratio: 2 / 1; }
  #vcHero, #viewVehicle .aphead, #viewPlace .aphead, #viewPlaces .aphead { padding-left: 16px; padding-right: 16px; }
  .apbox { margin-left: 16px; margin-right: 16px; }
  .achead { margin-left: 18px; }
  .stbody { padding-left: 8px; padding-right: 8px; }
}

/* 横向きiPad・PC：ホームを2段組に */
@media (min-width: 1000px) {
  #viewHome { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); column-gap: 8px; align-items: start;
    grid-template-areas: "hero cards" "hero period" "sec top" "rail top" "empty empty"; }
  #homeHero { grid-area: hero; }
  #homeCards { grid-area: cards; margin-bottom: 0; }
  #homePeriod { grid-area: period; margin-top: 0; grid-template-columns: 1fr; }
  #viewHome > .sec { grid-area: sec; }
  #homeRail { grid-area: rail; }
  #homeTop { grid-area: top; padding-top: 10px; }
  #homeEmpty { grid-area: empty; }
  .hero2 { aspect-ratio: 16 / 10; }
  .cards4 { grid-template-columns: 1fr 1fr; row-gap: 14px; }
  .cards4 > div { border-left: 0; }
  .tile { flex-basis: calc((100% - 14px) / 2); }
  .hero { aspect-ratio: 16 / 7; }
}
#viewHome[hidden] { display: none !important; }

/* ---- バス版の追加 ---- */
.hero .htx { right: 12px; } /* 外部リンクのボタンが無いので、文字を右まで使える */
.hero .ha { text-transform: none; letter-spacing: .02em; }

/* ログイン */
.login { display: grid; place-items: start center; padding: 28px 14px; }
.login[hidden] { display: none; }
.loginbox { width: min(420px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px 18px 16px; }
.loginbox h2 { margin: 0 0 4px; font-size: 17px; }
.loginbox .sub { color: var(--sub); font-size: 11.5px; margin: 4px 0 10px; line-height: 1.6; }
.loginbox label { display: block; font-size: 10.5px; color: var(--sub); margin-top: 10px; }
.loginbox input { width: 100%; margin-top: 4px; font: inherit; font-size: 16px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; }
#loginCode { letter-spacing: .3em; font-size: 20px; text-align: center; font-weight: 700; }
button.wide { width: 100%; margin-top: 12px; font: inherit; font-weight: 600; border-radius: 10px; padding: 12px; border: 1px solid transparent; cursor: pointer; }
button.wide.ghost { border-color: var(--line); }

/* その他・メンバー管理 */
.meline { margin: 0 0 8px; padding: 0 2px; color: var(--sub); font-size: 11px; word-break: break-all; }
#dlgMembers .sub { color: var(--sub); font-size: 11px; margin: 0 0 8px; line-height: 1.6; }
.memlist { display: grid; gap: 6px; margin-bottom: 10px; }
.memrow { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.memrow .mem { font-size: 12px; word-break: break-all; }
.memrow select, .memadd select { font: inherit; font-size: 13px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 7px 6px; }
.memdel { background: none; border: 1px solid var(--line); border-radius: 8px; color: var(--danger); width: 34px; height: 34px; cursor: pointer; font: inherit; }
.memdel:disabled { opacity: .3; cursor: default; }
.memadd { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; align-items: center; }
.memadd input { margin: 0 !important; font-size: 14px !important; padding: 9px 10px !important; }
.memadd button { font: inherit; font-weight: 600; border-radius: 10px; padding: 9px 12px; border: 0; cursor: pointer; }
.nav[hidden], .morebtn[hidden], .view[hidden], dialog .ocr[hidden], #vEdit[hidden], #vDel[hidden] { display: none !important; }
a.wlink { color: var(--accent2); font-weight: 600; text-decoration: none; }
