/* Layout: full-bleed night flight. Deliberately single dark look (glow needs a dark sky). HUD (Head-Up Display: 計器の重ね表示) pinned to corners. */
.mwf, .list, .reader, .ci, #rideModal, .fallback {
  --bg: #030805;          /* night sky */
  --ground: #11472a;      /* terrain grid, deep cyan */
  --forest: #7fe08a;      /* tree wire */
  --city: #3ddc84;        /* building wire */
  --window: #ffc14d;      /* sodium-lamp windows / accent */
  --bird: #e6ffe9;
  --rock: #3f7a52;
  --carline: #86d9a0;
  --cave: #a9e7b7;
  --metro: #c4f55a;     /* 地下鉄 */
  --tech: #3ddc84;        /* 記事カテゴリ: 技術 */
  --gear: #ffc14d;        /* 記事カテゴリ: 道具 */
  --life: #9be7ff;        /* 記事カテゴリ: 暮らし */
  --fg: #e4f5e6;
  --muted: #7fa68a;
  --panel: rgba(3,10,6,.66);
  --rule: rgba(160,255,180,.16);
  --f-display: "Zen Kaku Gothic New", "Hiragino Sans", "Noto Sans JP", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: dark;
}
/* 本番: ヘッダーは画面いっぱいの1セクション。下にスクロールするとテーマ本来の内容へ続く */
.mwf { position: relative; height: 100vh; height: 100svh; height: var(--mwf-h, 100svh); min-height: 560px; overflow: hidden; width: 100%; max-width: none; margin: 0; background: var(--bg); color: var(--fg); font-family: var(--f-display); isolation: isolate; }
.mwf button { font-family: var(--f-display); }
.mwf .mono { font-family: var(--f-mono); }
/* トップページではテーマ側のヒーロー/メインビジュアルを隠す(マークアップは残す) */
/* kichijitsu-terminal のヒーロー(サイト紹介ブロック)だけを隠す。注目記事などは残す */
body.mwf-active .khome-hero, body.mwf-active .wp-block-kichijitsu-terminal-hero { display: none !important; }
/* SANGO のヘッダー直下にできる余白を詰める */
body.mwf-active #miko-wire-flight + * { margin-top: 0; }
.mwf #stage { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.mwf .vignette { position: absolute; inset: 0; pointer-events: none; background-image: repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 1px, transparent 1px 3px);
  background: linear-gradient(180deg, rgba(4,6,12,.55), transparent 26%, transparent 62%, rgba(4,6,12,.6)), radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(0,0,0,.55) 100%); }

.mwf .hud {
  position: absolute; left: 0; right: 0; pointer-events: none;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.mwf .hud.top { top: 0; padding-top: calc(env(safe-area-inset-top, 0px) + 20px); align-items: flex-start; }
.mwf .hud.bottom { bottom: 0; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); align-items: flex-end; }

.mwf .masthead { display: grid; gap: 6px; min-width: 0; }
.mwf .masthead .eyebrow { font: 500 11px/1 var(--f-mono); letter-spacing: .2em; text-transform: uppercase; color: var(--window); }
.mwf .masthead h1 {
  margin: 0; font-weight: 900; font-size: clamp(30px, 7vw, 68px); line-height: 1.02; letter-spacing: .04em; text-wrap: balance;
  text-shadow: 0 0 24px rgba(61,220,132,.4);

}
.mwf .hud.pre > * { opacity: 0; }
.mwf .hud.rise > * { animation: rise 1.2s cubic-bezier(.2,.7,.2,1) both; }
.mwf .hud.rise > * + * { animation-delay: .15s; }
.mwf .masthead p { margin: 0; font-size: 14px; color: var(--muted); max-width: 32ch; }
@keyframes rise { from { opacity: .0; transform: translateY(14px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }

.mwf .topright { display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.mwf .zones { display: flex; gap: 6px; }
.mwf .ride { position: relative; pointer-events: auto; display: grid; justify-items: end; gap: 6px; }
.mwf .ride-chip { display: flex; align-items: baseline; gap: 8px; padding: 8px 12px; }
.mwf .ride-chip .rc-k { font: 500 10px/1 var(--f-mono); letter-spacing: .16em; color: var(--life); }
.mwf .ride-chip .rc-v { font: 500 13px/1 var(--f-mono); font-variant-numeric: tabular-nums; }
.mwf .ride-chip .rc-v b { font-size: 16px; font-weight: 500; }
.mwf .ride-chip .rc-s { font-size: 11px; color: var(--muted); }
.mwf .ride-chip .rc-c { font-size: 10px; color: var(--muted); transition: transform .25s; }
.mwf .ride-chip[aria-expanded="true"] .rc-c { transform: rotate(180deg); }
.mwf .ride-chip[aria-expanded="true"] { border-color: var(--life); }
.mwf .ride-panel { width: min(300px, calc(100vw - 32px)); display: grid; gap: 10px; padding: 14px; background: var(--panel); backdrop-filter: blur(8px); border: 1px solid var(--rule); border-top: 2px solid var(--life); border-radius: 2px; }
.mwf .ride-panel[hidden] { display: none; }
.mwf .rp-row { display: flex; justify-content: space-between; align-items: baseline; }
.mwf .rp-l { font-size: 12px; color: var(--muted); }
.mwf .rp-v { font: 500 13px var(--f-mono); }
.mwf .rp-v b { font-size: 26px; font-weight: 500; font-variant-numeric: tabular-nums; }
.mwf .rp-bar { height: 4px; background: var(--rule); border-radius: 2px; overflow: hidden; }
.mwf .rp-bar i { display: block; height: 100%; background: var(--life); box-shadow: 0 0 8px var(--life); }
.mwf .rp-sub { font-size: 12px; color: var(--muted); }
.mwf .rp-sub b { color: var(--fg); font-family: var(--f-mono); font-weight: 500; }
.mwf .rp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.mwf .rp-grid div { background: rgba(6,10,20,.9); padding: 8px 10px; display: grid; gap: 4px; }
.mwf .rp-grid span { font-size: 10px; color: var(--muted); letter-spacing: .04em; }
.mwf .rp-grid b { font: 500 16px/1 var(--f-mono); font-variant-numeric: tabular-nums; }
.mwf .rp-grid small { font-size: 10px; color: var(--muted); margin-left: 2px; }
.mwf .rp-link { color: var(--life); text-decoration: none; font-size: 13px; }
.mwf .rp-link:hover, .mwf .rp-link:focus-visible { text-decoration: underline; }
.mwf .rp-note { font-size: 10px; color: var(--muted); }
.mwf .zone { font: 500 12px/1 var(--f-display); padding: 7px 10px; border: 1px solid var(--rule); border-radius: 2px; color: var(--muted); background: var(--panel); backdrop-filter: blur(6px); transition: color .5s, border-color .5s, box-shadow .5s; }
.mwf .zone.on { color: var(--window); border-color: var(--window); box-shadow: 0 0 14px rgba(255,181,71,.35); }

.mwf .gauges { display: flex; background: var(--panel); backdrop-filter: blur(6px); border: 1px solid var(--rule); border-radius: 2px; pointer-events: auto; }
.mwf .g { padding: 8px 12px; display: grid; gap: 4px; min-width: 78px; }
.mwf .g + .g { border-left: 1px solid var(--rule); }
.mwf .g span { font: 500 10px/1 var(--f-mono); letter-spacing: .12em; color: var(--muted); }
.mwf .g b { font: 500 18px/1 var(--f-mono); font-variant-numeric: tabular-nums; }
.mwf .g small { font: 400 11px var(--f-mono); color: var(--muted); margin-left: 2px; }

.mwf .ctrl { display: flex; gap: 8px; align-items: center; }
.mwf button {
  pointer-events: auto; font: 500 13px/1 var(--f-display); color: var(--fg);
  background: var(--panel); backdrop-filter: blur(6px);
  border: 1px solid var(--rule); border-radius: 2px; padding: 10px 14px; cursor: pointer;
}
.mwf button:hover { border-color: var(--window); }
.mwf button:focus-visible { outline: 2px solid var(--window); outline-offset: 2px; }
.mwf #dive { color: var(--window); border-color: rgba(255,181,71,.5); }

.mwf .left { display: grid; gap: 10px; min-width: 0; max-width: min(620px, 100%); }
.mwf .post {
  pointer-events: auto; display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: 14px; align-items: center; text-decoration: none; color: var(--fg);
  background: var(--panel); backdrop-filter: blur(8px); border: 1px solid var(--rule);
  border-left: 3px solid var(--pc, var(--tech)); border-radius: 2px; padding: 12px 14px;
  transition: opacity .35s, transform .35s;
}
.mwf .post.dim { opacity: 0; transform: translateY(6px); pointer-events: none; }
.mwf .post:hover, .mwf .post:focus-visible { border-color: var(--pc); outline: none; }
.mwf .pbody { display: grid; gap: 6px; min-width: 0; }
.mwf .tw { position: relative; display: block; aspect-ratio: 16 / 9; border: 1px solid var(--pc); overflow: hidden; background: #070b16; }
.mwf .tw canvas { display: block; width: 100%; height: 100%; }
.mwf .tw::before, .mwf .tw::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.mwf .tw::before { background: repeating-linear-gradient(0deg, rgba(0,0,0,.1) 0 1px, transparent 1px 3px); }
.mwf .tw::after { background: linear-gradient(180deg, transparent 0 44%, rgba(255,255,255,.06) 50%, transparent 56%); background-size: 100% 220%; animation: sweep 5s linear infinite; }
.mwf .tw .tag { position: absolute; left: 5px; bottom: 4px; font: 500 9px/1 var(--f-mono); letter-spacing: .1em; color: var(--pc); text-shadow: 0 0 6px currentColor; z-index: 1; }
.mwf .tw.glitch canvas { animation: glitch .45s ease-out both; }
@keyframes sweep { from { background-position: 0 120%; } to { background-position: 0 -120%; } }
@keyframes glitch {                                                  /* 切り替わりは短いずれ+フェードだけ */
  0% { opacity: 0; transform: translateX(-3px); }
  30% { opacity: 1; transform: translateX(2px); }
  100% { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .tw::after, .tw.glitch canvas { animation: none; } }
.mwf .post .meta { display: flex; gap: 10px; align-items: center; font: 500 11px/1 var(--f-mono); letter-spacing: .08em; color: var(--muted); }
.mwf .post .chip, .mwf .post .dist { white-space: nowrap; }
.mwf .post .meta { flex-wrap: wrap; row-gap: 6px; }
.mwf .post .chip { color: var(--pc); border: 1px solid var(--pc); padding: 3px 6px; border-radius: 2px; font-family: var(--f-display); letter-spacing: .04em; }
.mwf .post .dist { margin-left: auto; font-variant-numeric: tabular-nums; }
.mwf .post strong { font-size: 17px; line-height: 1.45; font-weight: 700; text-wrap: balance; }
.mwf .post .go { font: 500 12px/1 var(--f-mono); color: var(--pc); }
.mwf .legend { display: flex; gap: 12px; font: 500 11px/1 var(--f-display); color: var(--muted); flex-wrap: wrap; }
.mwf .legend i { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; background: currentColor; }
.mwf .credit a { color: var(--muted); text-decoration: none; pointer-events: auto; } .mwf .credit a:hover { color: var(--fg); text-decoration: underline; }
.mwf .credit { font: 400 10px/1.4 var(--f-mono); color: var(--muted); opacity: .7; }
.nav { display: flex; gap: 6px; }
.nav small { margin-left: 4px; color: var(--muted); font-weight: 400; }
.btnlink { pointer-events: auto; font: 500 13px/1 var(--f-display); color: var(--fg); background: var(--panel); backdrop-filter: blur(6px); border: 1px solid var(--rule); border-radius: 2px; padding: 10px 14px; text-decoration: none; }
.btnlink:hover { border-color: var(--window); }
.list {
  position: fixed; top: calc(env(safe-area-inset-top, 0px) + 16px); left: max(16px, env(safe-area-inset-left, 0px)); bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  width: min(420px, calc(100vw - 32px)); z-index: 31; display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto; gap: 10px; padding: 14px;
  background: var(--panel); backdrop-filter: blur(12px); border: 1px solid var(--rule); border-top: 2px solid var(--window); border-radius: 2px; animation: lsIn .3s cubic-bezier(.2,.7,.2,1) both;
}
.list[hidden] { display: none; }
@keyframes lsIn { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: none; } }
.ls-top { display: flex; gap: 8px; }
.ls-top input { flex: 1; min-width: 0; font: 400 14px var(--f-display); color: var(--fg); background: rgba(0,0,0,.4); border: 1px solid var(--rule); border-radius: 2px; padding: 9px 11px; }
.ls-top input:focus-visible { outline: 2px solid var(--window); outline-offset: 1px; }
.ls-top button { padding: 6px 10px; font-size: 16px; line-height: 1; }
.ls-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.ls-filters button { padding: 6px 10px; font-size: 12px; color: var(--muted); }
.ls-filters button.on { color: var(--window); border-color: var(--window); }
.ls-meta { font-size: 11px; color: var(--muted); letter-spacing: .06em; }
.ls-items { list-style: none; margin: 0; padding: 0; min-height: 0; overflow: auto; scrollbar-width: thin; display: grid; gap: 2px; align-content: start; }
.ls-items li button { width: 100%; text-align: left; display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center; padding: 8px; border-color: transparent; background: transparent; backdrop-filter: none; }
.ls-items li button:hover, .ls-items li button:focus-visible { background: rgba(255,255,255,.04); border-color: var(--rule); }
.ls-items .th { aspect-ratio: 16 / 9; width: 56px; background: #060a06; border: 1px solid var(--rule); object-fit: cover; }
.ls-items .tt { display: grid; gap: 3px; min-width: 0; }
.ls-items .tt b { font-size: 13px; line-height: 1.4; font-weight: 700; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ls-items .tt span { font: 500 10px/1 var(--f-mono); color: var(--muted); letter-spacing: .06em; }
.ls-items .tt span i { font-style: normal; color: var(--pc); margin-right: 6px; }
.ls-items mark { background: rgba(255,193,77,.25); color: inherit; }
.ls-all { font-size: 13px; color: var(--window); text-decoration: none; }
.ls-all:hover { text-decoration: underline; }
@media (max-width: 900px) { .list { right: max(16px, env(safe-area-inset-right, 0px)); width: auto; } .nav .btnlink { display: none; } }
.reader {
  position: fixed; top: calc(env(safe-area-inset-top, 0px) + 16px); right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  width: min(440px, calc(100vw - 32px)); z-index: 30; display: grid; grid-template-rows: auto auto auto auto minmax(0, 1fr) auto; gap: 12px; padding: 16px;
  background: var(--panel); backdrop-filter: blur(12px); border: 1px solid var(--rule); border-left: 3px solid var(--pc, var(--tech)); border-radius: 2px;
  animation: rdIn .35s cubic-bezier(.2,.7,.2,1) both; overflow: hidden;
}
.reader[hidden] { display: none; }
@keyframes rdIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.rd-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rd-eyebrow { display: flex; gap: 10px; align-items: center; font: 500 11px/1 var(--f-mono); letter-spacing: .08em; color: var(--muted); flex-wrap: wrap; }
.rd-eyebrow .chip { color: var(--pc); border: 1px solid var(--pc); padding: 3px 6px; border-radius: 2px; font-family: var(--f-display); letter-spacing: .04em; white-space: nowrap; }
.rd-close { padding: 6px 10px; font-size: 16px; line-height: 1; }
.rd-thumb { aspect-ratio: 16 / 9; border: 1px solid var(--pc); overflow: hidden; background: #060a06; }
.rd-thumb canvas { display: block; width: 100%; height: 100%; }
.reader h2 { margin: 0; font-size: 18px; line-height: 1.45; font-weight: 700; text-wrap: balance; }
.rd-scroll { min-height: 0; overflow: auto; display: grid; gap: 10px; align-content: start; padding-right: 6px; scrollbar-width: thin; }
.rd-body { min-width: 0; font-size: 14px; line-height: 1.85; color: var(--fg); overflow-wrap: anywhere; }
.reader { overflow: hidden; }
.reader > * { min-width: 0; }
.rd-body p { margin: 0 0 .9em; }
.rd-body h2, .rd-body h3, .rd-body h4 { margin: 1.2em 0 .5em; font-size: 15px; line-height: 1.5; color: var(--pc); padding-left: 10px; border-left: 2px solid var(--pc); }
.rd-body h2:first-child, .rd-body h3:first-child { margin-top: 0; }
.rd-body ul, .rd-body ol { margin: 0 0 .9em; padding-left: 1.4em; }
.rd-body li { margin: .2em 0; }
.rd-body pre { margin: 0 0 1em; padding: 10px 12px; background: rgba(0,0,0,.45); border: 1px solid var(--rule); border-radius: 2px; overflow-x: auto; font: 400 12px/1.6 var(--f-mono); color: var(--fg); white-space: pre; }
.rd-body code { font: 400 .92em var(--f-mono); color: var(--window); background: rgba(255,193,77,.08); padding: .05em .35em; border-radius: 2px; }
.rd-body pre code { color: var(--fg); background: none; padding: 0; }
.rd-body blockquote { margin: 0 0 1em; padding: 6px 12px; border-left: 2px solid var(--rule); color: var(--muted); }
.rd-body a { color: var(--pc); }
.rd-body table { border-collapse: collapse; font-size: 13px; margin: 0 0 1em; }
.rd-body th, .rd-body td { border: 1px solid var(--rule); padding: 4px 8px; }
.rd-body hr { border: 0; border-top: 1px solid var(--rule); margin: 1em 0; }
.rd-body.lead { overflow: hidden; max-height: 12em; -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent); mask-image: linear-gradient(180deg, #000 70%, transparent); }
.rd-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.rd-tags:empty { display: none; }
.rd-tags span { font: 500 11px/1 var(--f-mono); color: var(--muted); border: 1px solid var(--rule); padding: 4px 7px; border-radius: 2px; }
.rd-tags span::before { content: "#"; opacity: .6; margin-right: 2px; }
.rd-more { justify-self: start; display: inline-block; padding: 9px 14px; font: 700 13px/1 var(--f-display); color: var(--pc); border: 1px solid var(--pc); border-radius: 2px; text-decoration: none; background: var(--panel); }
.rd-more:hover, .rd-more:focus-visible { background: var(--pc); color: var(--bg); }
.rd-fade { height: 0; }
.rd-actions { display: grid; gap: 6px; }
.rd-actions a { color: var(--pc); text-decoration: none; font-size: 14px; font-weight: 700; }
.rd-actions a:hover, .rd-actions a:focus-visible { text-decoration: underline; }
.rd-note { font-size: 11px; color: var(--muted); }
body.reading .topright { opacity: 0; pointer-events: none; }
body.reading .hud.bottom .left { max-width: min(620px, calc(100vw - 32px - 456px)); }
@media (max-width: 900px) {
  .reader { grid-template-rows: auto auto auto auto minmax(60px, 1fr) auto; }
  .reader { top: auto; left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); width: auto; max-height: 72vh; grid-template-rows: auto auto auto minmax(80px, 1fr) auto; }
  .reader .rd-thumb { display: none; }
  body.reading .hud.bottom { opacity: 0; pointer-events: none; }
}
.fallback { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 20; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); padding: 16px 18px; background: var(--panel); border: 1px solid var(--window); border-radius: 2px; font-size: 13px; color: var(--fg); }
.fallback span { color: var(--muted); font-size: 12px; } .fallback a { color: var(--window); }

@media (max-width: 560px) {
  .post strong { font-size: 14px; }
  .post { grid-template-columns: 128px minmax(0, 1fr); gap: 10px; padding: 10px; }
  .legend, .credit, .masthead p { display: none; }
  .g { min-width: 0; padding: 7px 9px; }
  .g b { font-size: 15px; }
  .hud.bottom { flex-direction: column; align-items: stretch; }
  .ctrl { justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) { .masthead h1, .masthead p { animation: none; } }
