/* 羽田スカイライブ
   フラップ式の発着案内板（左）・管制の運航票（右）・レーダーの機体情報（地図）の 3 つで組む。
   動きは、案内板の文字がめくれる 1 か所に絞る。 */

:root {
  --night: 0;
  --flip-half: 60; /* 反転フラップの羽根が半分動く時間（ms） */
  /* 案内板 */
  --flap-text: #ffd23f;
  --flap-tile: #24272c;
  --flap-gap: #08090a;
  --housing: #16181b;
  --bezel: #2c3036;
  /* 意味の色（青と橙は、色覚の違いがあっても見分けやすい組み合わせ） */
  --arrival: #6ec8ff;
  --departure: #ffa14a;
  --other: #e6e9ee;
  --spot: #ff7aa8;
  /* 運航票の紙とインク */
  --paper: #e9e4d4;
  --paper-line: #cfc8b4;
  --ink: #1d2733;
  /* 文字 */
  --text: #f1f3f6;
  --muted: #a7aeb8;
  --halo: 0 0 2px #000, 0 0 3px #000, 0 0 6px rgba(0, 0, 0, 0.8);
  --ui: "BIZ UDPGothic", "Hiragino Sans", "Meiryo", sans-serif;
  --dot: "DotGothic16", "BIZ UDPGothic", monospace;
  --data: "B612 Mono", "Consolas", monospace;
  --s: clamp(12px, 0.92vw, 19px);
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: var(--text);
  font-family: var(--ui);
  font-size: var(--s);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--flap-text);
  outline-offset: 2px;
}

/* ================================================================ 地図 */
#map {
  position: absolute;
  inset: 0;
  background: #000;
}
.leaflet-container {
  background: #000;
  font-family: var(--ui);
}
/* 上と左右の端を暗くして、地図の上の文字を読みやすくする */
.vignette {
  position: absolute;
  inset: 0;
  z-index: 450;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.72), transparent 11%),
    linear-gradient(to right, rgba(0, 0, 0, 0.45), transparent 22%, transparent 78%, rgba(0, 0, 0, 0.45));
}
.sat-tiles {
  filter: brightness(calc(0.98 - 0.5 * var(--night))) saturate(calc(1.08 - 0.4 * var(--night))) contrast(1.1)
    hue-rotate(calc(-14deg * var(--night)));
}
.night-lights {
  opacity: calc(0.8 * var(--night));
  mix-blend-mode: color-dodge;
  filter: sepia(1) hue-rotate(205deg) saturate(1.8) brightness(0.6) contrast(1.6);
}
/* 拡大図は夜景を重ねないので、暗くしすぎない */
#inset .sat-tiles {
  filter: brightness(calc(0.98 - 0.36 * var(--night))) saturate(calc(1.08 - 0.45 * var(--night))) contrast(1.1)
    hue-rotate(calc(-14deg * var(--night)));
}
.gsi-tiles {
  filter: brightness(0.78) saturate(0.9) contrast(1.06);
}

/* 通信が切れているあいだ、地図の機体を薄くする（最後に分かった位置のまま止まっているため） */
body.stale .leaflet-marker-pane,
body.stale .leaflet-overlay-pane {
  opacity: 0.4;
  transition: opacity 0.6s;
}

/* 画面には出さず、読み上げだけに使う */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ================================================================ 上の帯（箱にせず、地図の上に直接置く） */
#topbar {
  position: absolute;
  z-index: 1001;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 1.4em;
  padding: 0.7em 1.2em;
  text-shadow: var(--halo);
}
.brand {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 0.35em;
  line-height: 1;
  white-space: nowrap;
}
.brand-ja {
  font-size: 1.9em;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.brand-en {
  font-family: var(--dot);
  font-size: 1.05em;
  color: var(--flap-text);
  letter-spacing: 0.12em;
}
.mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.86em;
  white-space: nowrap;
}
.mode-chip i {
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}
.mode-chip.live {
  color: #ff6b6b;
}
.mode-chip.live i {
  animation: blink 1.8s steps(2, jump-none) infinite;
}
.mode-chip.demo {
  color: var(--flap-text);
}
.mode-chip.stale {
  color: var(--departure);
}
@keyframes blink {
  50% {
    opacity: 0.2;
  }
}
.flow {
  flex: 1;
  margin: 0;
  text-align: center;
  font-size: 1.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.flow b,
.flow em {
  font-family: var(--data);
  font-style: normal;
  font-weight: 700;
}
.flow b {
  color: var(--arrival);
}
.flow em {
  color: var(--departure);
}
.flow small {
  font-size: 0.85em;
  color: var(--muted);
  margin-left: 0.6em;
}
.wx {
  display: flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.9em;
  white-space: nowrap;
}
.wx[hidden] {
  display: none;
}
.wx svg {
  width: 1.5em;
  height: 1.5em;
  fill: var(--text);
  filter: drop-shadow(0 0 2px #000);
  transition: transform 1s;
}
.wx b {
  font-weight: 700;
  margin-right: 0.6em;
}
.wx #wx-temp {
  color: var(--muted);
}
.clock {
  text-align: right;
  line-height: 1.05;
}
.clock .time {
  font-family: var(--dot);
  font-size: 1.7em;
  color: var(--flap-text);
  text-shadow: none;
}
.clock .time .f {
  min-width: 0.66em;
  padding: 0 0.04em;
  box-shadow: 0 0 0 1px #000;
}
.clock .time .colon {
  display: inline-block;
  width: 0.35em;
  text-align: center;
  text-shadow: var(--halo);
}
.clock .date {
  font-size: 0.78em;
  color: var(--muted);
}
.buttons {
  display: flex;
  gap: 0.2em;
}
.buttons button {
  background: none;
  border: none;
  padding: 0.3em 0.55em;
  cursor: pointer;
  color: #d4d9e0;
  font-size: 0.86em;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  text-shadow: var(--halo);
}
.buttons button:hover {
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.4);
}
.buttons button[aria-pressed="true"] {
  color: var(--flap-text);
  border-bottom-color: var(--flap-text);
}

/* ================================================================ 発着案内板（この画面でいちばん目立つもの） */
.board {
  /* 列の幅は、案内板の文字（--row）の大きさを基準にする */
  --row: 1.32em;
  --cols: 3.5em 5.2em minmax(0, 1fr) 2.6em 2.5em;
  position: absolute;
  z-index: 1000;
  top: 4.6em;
  left: 1.2em;
  width: clamp(380px, 32vw, 680px);
  max-height: calc(100% - 8.4em);
  display: flex;
  flex-direction: column;
  background: var(--housing);
  border: 0.45em solid var(--bezel);
  border-radius: 3px;
  box-shadow:
    inset 0 0 0 1px #000,
    0 0 0 1px #000,
    0 22px 50px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.board-head span {
  font-size: 0.56em;
}
.board-head,
.board li .row {
  display: grid;
  grid-template-columns: var(--cols);
  column-gap: 0.55em;
  align-items: center;
}
.board-head {
  padding: 0.35em 0.6em 0.25em;
  font-size: var(--row);
  color: #8e949d;
  border-bottom: 1px solid #000;
  box-shadow: 0 1px 0 var(--bezel);
}
#log {
  list-style: none;
  margin: 0;
  padding: 0.2em 0;
  overflow: hidden;
}
#log li {
  padding: 0.4em 0.6em 0.35em;
  border-bottom: 1px solid #000;
  box-shadow: 0 1px 0 #202327;
  cursor: pointer;
}
#log li:hover {
  background: #1b1d21;
}
#log li:not([data-hex]) {
  cursor: default;
}
#log li:not([data-hex]):hover {
  background: none;
}
.board li .row {
  font-size: var(--row);
}
.row > span {
  font-family: var(--dot);
  line-height: 1.25;
  color: var(--flap-text);
  white-space: nowrap;
  overflow: hidden;
}
.row .st.arrival {
  color: var(--arrival);
}
.row .st.departure {
  color: var(--departure);
}
.row .st.spot {
  color: var(--spot);
}
.row .st.sequence {
  color: var(--other);
}
.row .st.plan {
  color: var(--other);
}
/* ここから下が「これから着陸する便」。上の過去の行との境目に、いまを示す線を引く */
#log li.next {
  border-top: 1px solid rgba(255, 210, 63, 0.55);
}
/* 1 文字ずつのフラップ。上下の板の境目を線で描く（空白も板として見せる） */
.f {
  display: inline-block;
  min-width: 0.64em;
  text-align: center;
  margin-right: 1px;
  white-space: pre;
  background: linear-gradient(
    to bottom,
    var(--flap-tile) 0 48%,
    var(--flap-gap) 48% 53%,
    var(--flap-tile) 53% 100%
  );
  border-radius: 1px;
}
.c-place .f,
.c-status .f {
  min-width: 1em;
}
/* 1 回めくれる動き：上の板が手前に倒れてくる */
/* めくれる羽根。上半分は手前に倒れて消え、下半分は手前から降りてきて止まる（軸は板の真ん中） */
.f {
  position: relative;
}
.leaf {
  position: absolute;
  inset: 0;
  background: inherit;
  border-radius: inherit;
  text-align: center;
  white-space: pre;
  pointer-events: none;
}
.leaf.under {
  clip-path: inset(50% 0 0 0);
}
.leaf.top {
  clip-path: inset(0 0 50% 0);
  animation: leaf-fall calc(var(--flip-half) * 1ms) ease-in forwards;
}
.leaf.bottom {
  clip-path: inset(50% 0 0 0);
  transform: perspective(5em) rotateX(90deg);
  animation: leaf-land calc(var(--flip-half) * 1ms) ease-out calc(var(--flip-half) * 1ms) both;
}
@keyframes leaf-fall {
  to {
    transform: perspective(5em) rotateX(-90deg);
    filter: brightness(1.5);
  }
}
@keyframes leaf-land {
  from {
    transform: perspective(5em) rotateX(90deg);
    filter: brightness(0.5);
  }
  to {
    transform: none;
    filter: none;
  }
}
.detail {
  display: block;
  margin-top: 0.15em;
  padding-left: calc((3.5em + 0.55em) * 1.32 / 0.82);
  font-family: var(--data);
  font-size: 0.82em;
  color: #9aa1aa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.board-empty {
  margin: 0;
  padding: 0.6em 0.8em 0.2em;
  font-family: var(--dot);
  font-size: 1.1em;
  color: #6f747b;
}
.board-foot {
  margin-top: auto;
  padding: 0.6em 0.8em 0.5em;
  border-top: 1px solid #000;
  box-shadow: inset 0 1px 0 var(--bezel);
}
.foot-row {
  display: flex;
  align-items: baseline;
  gap: 1.2em;
  font-size: 0.86em;
  color: #8e949d;
}
.foot-title {
  margin-right: auto;
}
.foot-row b {
  font-family: var(--data);
  font-size: 1.35em;
  color: var(--text);
  margin-left: 0.15em;
}
.count.arr b {
  color: var(--arrival);
}
.count.dep b {
  color: var(--departure);
}
.chart {
  display: block;
  width: 100%;
  height: 2.4em;
  margin-top: 0.4em;
}
.chart .a {
  fill: var(--arrival);
}
.chart .d {
  fill: var(--departure);
}
.chart .now {
  fill: rgba(255, 210, 63, 0.18);
}
.chart-axis {
  display: flex;
  justify-content: space-between;
  font-family: var(--data);
  font-size: 0.68em;
  color: #6f747b;
}

/* ================================================================ 右：運航票（紙の短冊） */
#side {
  position: absolute;
  z-index: 1000;
  top: 4.6em;
  right: 1.2em;
  width: clamp(280px, 21vw, 420px);
  max-height: calc(100% - 8.6em - min(29vh, 290px));
  overflow: hidden;
}
#side h2 {
  margin: 0 0 0.45em;
  font-size: 0.92em;
  font-weight: 700;
  text-shadow: var(--halo);
}
#side h2:not(:first-child) {
  margin-top: 1em;
}
.empty {
  margin: 0;
  font-size: 0.9em;
  color: #d4d9e0;
  text-shadow: var(--halo);
}
.strips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3em;
}
.strips li {
  --edge: var(--arrival);
  display: grid;
  grid-template-columns: 1fr auto auto;
  grid-template-areas:
    "call rwy eta"
    "sub sub sub";
  column-gap: 0.6em;
  align-items: center;
  padding: 0.35em 0.6em 0.3em 0.75em;
  background: var(--paper);
  color: var(--ink);
  border-left: 0.55em solid var(--edge);
  border-radius: 2px;
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.5),
    0 8px 16px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}
.strips li:hover {
  background: #f3efe2;
}
.strips li.spot {
  --edge: var(--spot);
}
.strips li.dep {
  --edge: var(--departure);
}
.strips li.oth {
  --edge: #9aa1aa;
}
.s-call {
  grid-area: call;
  font-family: var(--data);
  font-weight: 700;
  font-size: 1.12em;
  letter-spacing: 0.02em;
}
.s-rwy {
  grid-area: rwy;
  font-family: var(--data);
  font-weight: 700;
  font-size: 0.92em;
  padding: 0 0.3em;
  border: 1.5px solid var(--ink);
  border-radius: 1px;
}
.s-rwy.guess {
  border-style: dashed;
}
.s-eta {
  grid-area: eta;
  font-family: var(--data);
  font-weight: 700;
  min-width: 3.4em;
  text-align: right;
}
.s-sub {
  grid-area: sub;
  font-size: 0.8em;
  color: #4a5563;
  border-top: 1px solid var(--paper-line);
  margin-top: 0.2em;
  padding-top: 0.15em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 着陸の順番：滑走路ごとの棚（管制の運航票の棚と同じく、滑走路の札の下に短冊を差す） */
.lanes {
  display: flex;
  flex-direction: column;
  gap: 0.55em;
}
.lane-head {
  display: flex;
  align-items: baseline;
  gap: 0.55em;
  margin: 0 0 0.3em;
  font-size: 0.84em;
  font-weight: 400;
  color: #c9cfd7;
  text-shadow: var(--halo);
  white-space: nowrap;
}
.lane-rwy {
  align-self: center;
  min-width: 2.6em;
  padding: 0.05em 0.35em;
  background: var(--housing);
  border: 1px solid var(--bezel);
  border-bottom: 2px solid var(--arrival);
  color: var(--arrival);
  font-family: var(--data);
  font-weight: 700;
  font-size: 1.18em;
  text-align: center;
  text-shadow: none;
}
.lane-rwy.dep {
  border-bottom-color: var(--departure);
  color: var(--departure);
}
.lane-note {
  overflow: hidden;
  text-overflow: ellipsis;
}
.lane-note b {
  font-family: var(--data);
  font-weight: 700;
  color: var(--text);
}
.lane-rate {
  margin-left: auto;
  font-family: var(--data);
  color: var(--text);
}
.lane-label {
  color: #c9cfd7;
}
.lane .strips {
  margin-left: 0.4em;
  padding-left: 0.5em;
  border-left: 2px solid rgba(110, 200, 255, 0.45);
}
.lane-others .strips {
  border-left-color: rgba(201, 207, 215, 0.35);
}
.lane-empty {
  margin: 0 0 0 0.4em;
  padding: 0.3em 0 0.3em 0.6em;
  border-left: 2px dashed rgba(110, 200, 255, 0.4);
  font-size: 0.82em;
  color: #aeb5bf;
  text-shadow: var(--halo);
}
.dep-lanes {
  list-style: none;
  margin: 0.1em 0 0;
  padding: 0.45em 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  flex-direction: column;
  gap: 0.25em;
}
.dep-lanes .lane-head {
  margin: 0;
}
.lane-kind {
  color: var(--departure);
  font-weight: 700;
}

#runways[hidden] {
  display: none;
}
#runways {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.15em 1em;
  text-shadow: var(--halo);
}
#runways li {
  display: flex;
  align-items: baseline;
  gap: 0.5em;
  font-size: 0.86em;
  color: #c3c9d1;
}
#runways li b {
  font-family: var(--data);
  font-weight: 700;
  color: var(--text);
  min-width: 5.2em;
}
#runways li.arr span {
  color: var(--arrival);
}
#runways li.dep span {
  color: var(--departure);
}
#runways li.both span {
  color: var(--text);
}

/* ================================================================ 羽田空港の拡大図（モニター） */
#inset {
  position: absolute;
  z-index: 1000;
  right: 1.2em;
  bottom: 2.2em;
  width: clamp(280px, 21vw, 420px);
  height: min(29vh, 290px);
  margin: 0;
  background: #000;
  border: 1px solid #000;
  outline: 1px solid #3a3f47;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}
#inset-map {
  position: absolute;
  inset: 0;
}
#inset figcaption {
  position: absolute;
  z-index: 500;
  left: 0;
  top: 0;
  padding: 0.15em 0.6em;
  font-size: 0.8em;
  background: #000;
  color: #d4d9e0;
}
#inset.following {
  outline-color: var(--spot);
}
#inset.following figcaption {
  background: var(--spot);
  color: #1a0710;
  font-weight: 700;
}

/* ================================================================ 凡例・ひとこと・出典・通知 */
#legend {
  position: absolute;
  z-index: 1000;
  left: 1.2em;
  bottom: 2.3em;
  display: flex;
  gap: 1.2em;
  font-size: 0.86em;
  text-shadow: var(--halo);
}
.lg.arrival {
  color: var(--arrival);
}
.lg.departure {
  color: var(--departure);
}
.lg.other {
  color: var(--other);
}
.lg.spot {
  color: var(--spot);
}

/* 電光の案内表示のように、黒い帯にドット文字 */
#ticker {
  position: absolute;
  z-index: 1000;
  bottom: 2.2em;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 2 * clamp(280px, 21vw, 420px) - 6em);
  padding: 0.25em 1em;
  background: #000;
  border: 1px solid #2c3036;
  font-family: var(--dot);
  font-size: 1.05em;
  color: var(--flap-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#ticker[hidden] {
  display: none;
}
#ticker-text {
  transition: opacity 0.4s;
}
#ticker-text.out {
  opacity: 0;
}

#credit {
  position: absolute;
  z-index: 1000;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.3em 1.2em;
  font-size: 10.5px;
  color: #848b95;
  background: #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#credit a {
  color: inherit;
}

#toast {
  position: absolute;
  z-index: 1002;
  left: 50%;
  bottom: 5em;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1em;
  padding: 0.7em 1em;
  background: #000;
  border-left: 0.4em solid var(--flap-text);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}
#toast[hidden] {
  display: none;
}
#toast button {
  padding: 0.35em 0.9em;
  border: none;
  border-radius: 2px;
  background: var(--flap-text);
  color: #111;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

/* ================================================================ 機体（レーダーの機体情報の作法：引き出し線とデータ） */
.ac {
  --c: var(--other);
  background: none;
  border: none;
}
.ac.arrival {
  --c: var(--arrival);
}
.ac.departure {
  --c: var(--departure);
}
.ac.spot {
  --c: var(--spot);
}
.ac svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: var(--c);
  stroke: #000;
  stroke-width: 0.8;
  filter: drop-shadow(0 0 2px #000);
}
.ac .tag {
  position: absolute;
  left: calc(100% + 10px);
  bottom: calc(100% - 2px);
  font-family: var(--data);
  line-height: 1.15;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: var(--halo);
}
/* 引き出し線 */
.ac .tag::before {
  content: "";
  position: absolute;
  left: -13px;
  bottom: -4px;
  width: 14px;
  height: 1px;
  background: var(--c);
  transform: rotate(-42deg);
  transform-origin: 100% 0;
  box-shadow: 0 0 2px #000;
}
.ac .tag b {
  display: block;
  font-size: clamp(11px, 0.8vw, 16px);
  font-weight: 700;
  color: var(--c);
}
.ac .tag i {
  display: block;
  font-style: normal;
  font-size: clamp(10px, 0.68vw, 14px);
  color: #eef1f5;
}
.ac.high .tag {
  opacity: 0.75;
}
.ac.notag .tag {
  display: none;
}
.ac.ground svg {
  opacity: 0.85;
}
.ac.spot svg {
  animation: spot-glow 1.6s ease-in-out infinite;
}
@keyframes spot-glow {
  50% {
    filter: drop-shadow(0 0 2px #000) drop-shadow(0 0 10px var(--spot));
  }
}
.ac.mini .tag {
  left: calc(100% + 2px);
  bottom: auto;
  top: 0;
}
.ac.mini .tag::before {
  display: none;
}
.ac.mini .tag b {
  font-size: 10px;
}

/* 着陸・離陸の瞬間の輪 */
.pulse {
  --c: var(--arrival);
  background: none;
  border: none;
  pointer-events: none;
}
.pulse.departure {
  --c: var(--departure);
}
.pulse.spot {
  --c: var(--spot);
}
.pulse::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--c);
  animation: ripple 2.2s ease-out forwards;
}
@keyframes ripple {
  from {
    transform: scale(0.3);
    opacity: 1;
  }
  to {
    transform: scale(3);
    opacity: 0;
  }
}

.ring-label {
  background: none;
  border: none;
  color: rgba(235, 240, 246, 0.7);
  font-size: 11px;
  font-family: var(--data);
  text-shadow: var(--halo);
  white-space: nowrap;
}

/* 詳細（押したとき）：運航票と同じ紙 */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--paper);
  color: var(--ink);
  border-radius: 2px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.leaflet-popup-content {
  margin: 0.7em 0.9em;
  font-family: var(--ui);
  font-size: 13px;
  line-height: 1.55;
}
.pop b {
  font-family: var(--data);
  font-size: 1.3em;
}
.pop dl {
  display: grid;
  grid-template-columns: auto auto;
  gap: 0 1em;
  margin: 0.3em 0 0;
  border-top: 1px solid var(--paper-line);
  padding-top: 0.3em;
}
.pop dt {
  color: #5a6472;
}
.pop dd {
  margin: 0;
  font-family: var(--data);
  font-size: 0.95em;
}

/* ================================================================ 使い方 */
#help-backdrop {
  position: absolute;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.6);
}
#help-backdrop[hidden] {
  display: none;
}
#help {
  width: min(640px, 92vw);
  max-height: 92vh;
  overflow: auto;
  padding: 1.6em 1.8em 1.4em;
  font-size: max(14px, 0.95vw);
  background: var(--housing);
  border: 0.45em solid var(--bezel);
  border-radius: 3px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
}
#help h1 {
  margin: 0 0 0.5em;
  font-family: var(--dot);
  font-weight: 400;
  font-size: 1.9em;
  color: var(--flap-text);
  letter-spacing: 0.04em;
}
#help .lead {
  margin: 0 0 1em;
  line-height: 1.8;
}
.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35em 1em;
  margin-bottom: 0.9em;
}
.help-grid b {
  display: inline-block;
  width: 1.4em;
  margin-right: 0.4em;
  text-align: center;
}
.h-arr {
  color: var(--arrival);
}
.h-dep {
  color: var(--departure);
}
.h-oth {
  color: var(--other);
}
.h-spot {
  color: var(--spot);
}
#help ul {
  margin: 0 0 0.9em;
  padding-left: 1.2em;
  line-height: 1.8;
}
#help .narrow {
  display: none;
}
#help .keys {
  color: var(--muted);
  font-size: 0.9em;
}
kbd {
  font-family: var(--data);
  padding: 0 0.35em;
  border: 1px solid #4a4f57;
  border-bottom-width: 2px;
  border-radius: 2px;
}
#help-close {
  margin-top: 0.4em;
  width: 100%;
  padding: 0.65em;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1.05em;
  color: #111;
  background: var(--flap-text);
}

/* ================================================================ 見るだけの画面・狭い画面・動きを減らす */
body.kiosk .buttons,
body.kiosk #toast,
body.kiosk #help-backdrop {
  display: none;
}
body.kiosk {
  cursor: none;
}

@media (max-width: 1300px) {
  .date,
  #wx-temp {
    display: none;
  }
  .buttons button {
    padding: 0.3em 0.4em;
  }
}

@media (max-width: 900px) {
  #topbar {
    flex-wrap: wrap;
    gap: 0.4em 0.9em;
    padding: 0.6em 0.8em;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.5));
  }
  .flow {
    order: 4;
    flex-basis: 100%;
    text-align: left;
    font-size: 0.92em;
  }
  .wx {
    display: none;
  }
  .clock {
    margin-left: auto;
  }
  .buttons {
    order: 5;
    flex-basis: 100%;
    overflow-x: auto;
  }
  .board {
    top: auto;
    bottom: 1.9em;
    left: 0.5em;
    right: 0.5em;
    width: auto;
    max-height: 40vh;
  }
  /* スマホでは地図を広く見せるため、案内板は新しい 4 行だけ */
  #log li:nth-child(n + 5) {
    display: none;
  }
  .board-foot,
  #side,
  #inset,
  #legend,
  #ticker {
    display: none;
  }
  #help .wide,
  #help .keys {
    display: none;
  }
  #help .narrow {
    display: list-item;
  }
  .help-grid {
    grid-template-columns: 1fr;
  }
}

/* 横向きのスマホなど、高さが低い画面：上の帯を 1 行にし、案内板は 2 行だけ */
@media (max-height: 500px) and (max-width: 1000px) {
  #topbar {
    flex-wrap: nowrap;
    padding: 0.35em 0.8em;
  }
  .brand-ja {
    font-size: 1.4em;
  }
  .brand-en,
  .flow {
    display: none;
  }
  .buttons {
    order: 0;
    flex-basis: auto;
  }
  #log li:nth-child(n + 3) {
    display: none;
  }
  .board-head {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before {
    animation: none !important;
    transition: none !important;
  }
}
