/* 紙飛行機 管制塔：管制塔の操作卓。地は暗い緑灰、計器は緑の燐光、警告は赤。橙・琥珀は使わない */
:root {
  --bg: #0a1210;
  --bg2: #0e1916;
  --panel: #101c19;
  --panel2: #142320;
  --line: #233630;
  --line2: #31503f;
  --txt: #e9f2ed;
  --dim: #b0c4bb;
  --mute: #8aa198;
  --g: #3fe08d;
  --g-dim: #2a9a62;
  --g-ink: #06140d;
  --cy: #6fdcea;
  --red: #ff6a6a;
  --strip: #e1ece5;
  --strip2: #cfddd4;
  --strip-ink: #0d1c15;
  --paper: #f3f1ea;
  --mono: 'B612 Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --sans: 'IBM Plex Sans JP', 'Hiragino Sans', 'Noto Sans JP', system-ui, sans-serif;
  --top: 56px;
  --r: 3px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--txt); font-family: var(--sans); font-size: 14px; line-height: 1.55; -webkit-text-size-adjust: 100%; }
body { overflow: hidden; word-break: keep-all; overflow-wrap: anywhere; line-break: strict; }
button, input, select { font: inherit; color: inherit; }
.mono { font-family: var(--mono); letter-spacing: .04em; }
#app { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* ---- 上の帯 */
.top { height: var(--top); flex: none; display: flex; align-items: center; gap: 18px; padding: 0 14px; background: linear-gradient(#0f1b18, #0b1412); border-bottom: 1px solid var(--line); position: relative; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 26px; height: 26px; flex: none; border: 1.5px solid var(--g); border-radius: 50%; position: relative; box-shadow: 0 0 10px rgba(63, 224, 141, .35) inset; }
.brand-mark::before { content: ''; position: absolute; left: 50%; top: 50%; width: 11px; height: 1.5px; background: var(--g); transform-origin: 0 50%; animation: sweep 3s linear infinite; }
.brand-mark::after { content: ''; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; background: var(--g); border-radius: 50%; }
@keyframes sweep { to { transform: rotate(360deg); } }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; gap: 1px; min-width: 0; }
.brand-name { font-weight: 700; font-size: 15px; white-space: nowrap; }
.brand-sub { font-size: 10px; color: var(--mute); white-space: nowrap; }
.tabs { display: flex; gap: 2px; height: 100%; align-items: stretch; margin-left: 8px; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 0 14px; display: flex; align-items: center; gap: 8px; color: var(--dim); cursor: pointer; white-space: nowrap; font-weight: 500; }
.tab-code { font-size: 10px; color: var(--mute); }
.tab:hover { color: var(--txt); background: rgba(255, 255, 255, .03); }
.tab.on { color: var(--txt); border-bottom-color: var(--g); background: linear-gradient(transparent, rgba(63, 224, 141, .08)); }
.tab.on .tab-code { color: var(--g); }
.status { margin-left: auto; display: flex; gap: 16px; font-size: 12px; color: var(--dim); white-space: nowrap; }
.st-item { display: flex; gap: 6px; align-items: center; }
.st-k { color: var(--mute); }
.lamp { width: 9px; height: 9px; border-radius: 50%; background: #2c3f38; box-shadow: 0 0 0 1px #3a5248 inset; }
.lamp.on { background: var(--g); box-shadow: 0 0 8px var(--g); }
.lamp.warn { background: var(--red); box-shadow: 0 0 8px var(--red); }

main { flex: 1; position: relative; min-height: 0; }
.view { position: absolute; inset: 0; display: none; }
.view.on { display: grid; }
.view-scroll.on { display: block; overflow-y: auto; }
#gl { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; }
#gl.parked { display: none; }

/* ---- 部品 */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px 12px; position: relative; }
.panel::before { content: ''; position: absolute; left: -1px; top: -1px; width: 10px; height: 10px; border-left: 2px solid var(--g-dim); border-top: 2px solid var(--g-dim); }
.ph { margin: 0 0 8px; font-size: 13px; font-weight: 700; display: flex; gap: 8px; align-items: baseline; }
.ph .mono { font-size: 10px; color: var(--g); font-weight: 400; }
.btn { background: var(--panel2); border: 1px solid var(--line2); color: var(--txt); padding: 7px 12px; border-radius: var(--r); cursor: pointer; white-space: nowrap; min-height: 36px; }
.btn:hover { border-color: var(--g-dim); background: #18302a; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-go { background: var(--g); color: var(--g-ink); border-color: var(--g); font-weight: 700; }
.btn-go:hover { background: #63eba4; border-color: #63eba4; }
.btn-wide { width: 100%; margin-top: 10px; }
.row2 { display: flex; gap: 6px; margin-top: 8px; }
.row2 > * { flex: 1; min-width: 0; }
.sel, .txt { width: 100%; background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--r); padding: 7px 8px; min-height: 36px; }
.sel-sm { width: auto; min-width: 0; max-width: 220px; }
.seg { display: flex; margin-top: 8px; border: 1px solid var(--line2); border-radius: var(--r); overflow: hidden; }
.seg button { flex: 1; background: var(--bg2); border: 0; padding: 6px 8px; cursor: pointer; color: var(--dim); white-space: nowrap; min-height: 34px; }
.seg button + button { border-left: 1px solid var(--line2); }
.seg button.on { background: #173a2b; color: var(--txt); box-shadow: inset 0 -2px 0 var(--g); }
.seg-sm { margin-top: 0; }
.seg-sm button { padding: 4px 9px; min-height: 32px; }
.chk { display: flex; gap: 8px; align-items: center; margin-top: 10px; cursor: pointer; color: var(--dim); }
.chk input { accent-color: var(--g); width: 16px; height: 16px; }

/* スライダー（計器の目盛り） */
.sliders { display: grid; gap: 3px; }
.sl { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; }
.sl label { font-size: 12.5px; color: var(--dim); }
.sl output { font-family: var(--mono); font-size: 12.5px; color: var(--txt); text-align: right; min-width: 64px; }
.sl input[type=range] { grid-column: 1 / -1; width: 100%; height: 22px; -webkit-appearance: none; appearance: none; background: transparent; margin: 0; }
.sl input[type=range]::-webkit-slider-runnable-track { height: 4px; background: linear-gradient(90deg, var(--g-dim) var(--p, 50%), #263b33 var(--p, 50%)); border-radius: 2px; }
.sl input[type=range]::-moz-range-track { height: 4px; background: #263b33; border-radius: 2px; }
.sl input[type=range]::-moz-range-progress { height: 4px; background: var(--g-dim); }
.sl input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 18px; margin-top: -7px; background: var(--txt); border: 2px solid var(--g); border-radius: 2px; }
.sl input[type=range]::-moz-range-thumb { width: 12px; height: 16px; background: var(--txt); border: 2px solid var(--g); border-radius: 2px; }

/* ---- 01 折り台 */
#view-fold.on { grid-template-columns: 272px minmax(0, 1fr) 332px; gap: 10px; padding: 10px; }
.col { min-height: 0; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.col-tools, .col-spec { padding-right: 2px; }
.panel-grow { flex: 1; min-height: 140px; display: flex; flex-direction: column; }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tool { display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--r); padding: 8px 4px; cursor: pointer; color: var(--dim); font-size: 12px; line-height: 1.3; text-align: center; min-height: 64px; }
.tool:hover { border-color: var(--g-dim); color: var(--txt); }
.tool.on { border-color: var(--g); color: var(--txt); background: #13302a; box-shadow: 0 0 0 1px var(--g) inset; }
.ti { width: 30px; height: 22px; position: relative; display: block; }
.ti::before, .ti::after { content: ''; position: absolute; }
.ti-line::before { left: 2px; right: 2px; top: 10px; border-top: 2px dashed currentColor; transform: rotate(-24deg); }
.ti-line::after { left: 0; top: 15px; width: 5px; height: 5px; border-radius: 50%; background: var(--g); box-shadow: 24px -11px 0 var(--g); }
.ti-p2p::before { left: 3px; top: 3px; width: 6px; height: 6px; border-radius: 50%; border: 2px solid currentColor; }
.ti-p2p::after { right: 3px; bottom: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--g); }
.ti-p2l::before { left: 15px; top: 0; bottom: 0; border-left: 2px solid currentColor; }
.ti-p2l::after { left: 2px; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--g); }
.ti-crease::before { left: 3px; right: 3px; top: 10px; border-top: 1.5px dotted currentColor; }
.ti-cut::before { left: 4px; top: 3px; width: 7px; height: 7px; border: 2px solid currentColor; border-radius: 50%; box-shadow: 0 9px 0 -0px transparent; }
.ti-cut::after { left: 4px; top: 13px; width: 7px; height: 7px; border: 2px solid currentColor; border-radius: 50%; }
.ti-finish::before { left: 14px; top: 1px; width: 2px; height: 20px; background: var(--cy); }
.ti-finish::after { left: 6px; top: 1px; width: 2px; height: 20px; background: currentColor; transform: skewX(-12deg); box-shadow: 16px 0 0 currentColor; }
.steps { margin: 0; padding: 0 0 0 26px; font-size: 12px; color: var(--dim); overflow-y: auto; flex: 1; }
.steps li { padding: 3px 4px; cursor: pointer; border-radius: 2px; }
.steps li:hover { background: rgba(63, 224, 141, .08); color: var(--txt); }
.steps li.cur { color: var(--txt); }
.steps li.future { opacity: .45; }
.steps li::marker { color: var(--mute); }
.col-table { gap: 8px; position: relative; }
.table-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; min-height: 40px; }
.hint { font-size: 14px; color: var(--txt); padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--g); border-radius: var(--r); flex: 1; min-width: 0; }
.coord { font-size: 12px; color: var(--dim); white-space: nowrap; }
.table-wrap { position: relative; flex: 1; min-height: 300px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #0c1715; touch-action: none; }
#fold-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
.confirm { z-index: 5; position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 6px; align-items: center; background: rgba(10, 20, 17, .94); border: 1px solid var(--line2); border-radius: var(--r); padding: 8px; width: max-content; max-width: calc(100% - 20px); flex-wrap: wrap; justify-content: center; }
.confirm-t { color: var(--dim); font-size: 13px; padding: 0 6px; }
.preview { height: 168px; margin: -2px -4px 0; border: 1px solid var(--line); border-radius: var(--r); background: radial-gradient(circle at 50% 40%, #16302a, #0b1513); position: relative; overflow: hidden; }
.preview canvas { display: block; width: 100%; height: 100%; }
.spec { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 12.5px; }
.spec dt { color: var(--dim); font-family: var(--sans); letter-spacing: 0; }
.spec dd { margin: 0; text-align: right; color: var(--txt); white-space: nowrap; }
.spec dd.ok::after, .spec dd.ng::after { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-left: 6px; vertical-align: 1px; }
.spec dd.ok::after { background: var(--g); }
.spec dd.ng::after { background: var(--red); }
.spec .wide { grid-column: 1 / -1; font-family: var(--sans); letter-spacing: 0; color: var(--dim); font-size: 12.5px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--r); margin-top: 4px; }
.spec .wide.ng { border-color: #6b2f2f; color: var(--txt); }

/* ---- 02 試験飛行・03 大会の舞台 */
#view-flight.on { display: block; }
.stage { position: absolute; inset: 0; overflow: hidden; }
.hud { position: absolute; z-index: 2; background: rgba(12, 22, 19, .86); backdrop-filter: none; }
.hud-tl { left: 12px; top: 12px; width: 236px; }
.hud-tr { right: 12px; top: 12px; width: 214px; text-align: center; }
.hud-bl { left: 12px; bottom: 12px; width: 300px; }
.hud-br { right: 12px; bottom: 12px; width: 326px; }
.tele { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 13px; }
.tele dt { color: var(--dim); font-family: var(--sans); letter-spacing: 0; font-size: 12.5px; }
.tele dd { margin: 0; text-align: right; color: var(--g); }
#wind-dial { display: block; margin: 0 auto; width: 132px; height: 132px; }
.wind-read { font-size: 12.5px; margin: 4px 0 8px; color: var(--txt); }
.btn-throw { width: 100%; margin-top: 10px; min-height: 46px; font-size: 16px; letter-spacing: .1em; }
#profile { display: block; width: 100%; height: 120px; background: #0b1513; border: 1px solid var(--line); border-radius: 2px; }
.result { font-size: 12.5px; margin-top: 8px; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; color: var(--dim); }
.result b { color: var(--txt); font-weight: 400; text-align: right; }
.cam-bar { position: absolute; z-index: 2; left: 50%; top: 12px; transform: translateX(-50%); display: flex; border: 1px solid var(--line2); border-radius: var(--r); overflow: hidden; background: rgba(12, 22, 19, .86); }
.cam-bar button { background: none; border: 0; padding: 6px 12px; color: var(--dim); cursor: pointer; white-space: nowrap; min-height: 34px; }
.cam-bar button + button { border-left: 1px solid var(--line2); }
.cam-bar button.on { color: var(--txt); box-shadow: inset 0 -2px 0 var(--g); background: #173a2b; }
.alert { position: absolute; z-index: 3; left: 50%; top: 60px; transform: translateX(-50%); padding: 6px 16px; border: 1.5px solid var(--red); color: #fff; background: rgba(90, 16, 16, .82); font-weight: 700; letter-spacing: .2em; animation: blink 1s steps(2) infinite; white-space: nowrap; }
@keyframes blink { 50% { border-color: transparent; } }
.land-tag { position: absolute; z-index: 2; transform: translate(-50%, -100%); padding: 3px 8px; background: rgba(8, 18, 15, .9); border: 1px solid var(--g); color: var(--g); font-size: 12px; pointer-events: none; white-space: nowrap; }

/* ---- 03 世界大会 */
#view-cup.on { display: block; }
.cup-grid { position: absolute; inset: 0; display: grid; grid-template-columns: 330px minmax(0, 1fr) 300px; gap: 10px; padding: 10px; }
.cup-radar { display: flex; flex-direction: column; min-height: 0; }
#radar { width: 100%; aspect-ratio: 1; display: block; background: #07100d; border-radius: 50%; }
.cup-stage { position: relative; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; min-height: 0; }
.cup-bar { position: absolute; z-index: 2; left: 10px; right: 10px; top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px; background: rgba(12, 22, 19, .9); }
.cup-bar::before { display: none; }
.cup-clock { margin-left: auto; color: var(--g); font-size: 15px; }
#cam-cup { top: auto; bottom: 12px; }
#cup-gust { top: auto; bottom: 60px; }
.cup-msg { position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(440px, calc(100% - 24px)); max-height: calc(100% - 140px); overflow-y: auto; background: rgba(12, 22, 19, .96); }
.cup-board { display: flex; flex-direction: column; min-height: 0; }
.strips { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.strip { display: grid; grid-template-columns: 30px 1fr auto; gap: 0 8px; align-items: center; background: var(--strip); color: var(--strip-ink); border-left: 5px solid #7d9a8c; border-radius: 2px; padding: 3px 8px 3px 6px; font-size: 12px; line-height: 1.35; }
.strip .rk { font-weight: 700; text-align: right; }
.strip .cs { font-weight: 700; }
.strip .sub { grid-column: 2; font-size: 11px; color: #3b5247; font-family: var(--sans); letter-spacing: 0; }
.strip .v { text-align: right; font-weight: 700; grid-row: 1 / span 2; grid-column: 3; }
.strip.fly { background: var(--strip2); }
.strip.mine { border-left-color: var(--g); background: #f4fbf7; box-shadow: 0 0 0 2px var(--g) inset; }
.strip.top3 .rk { color: #0b5c34; }
.msg-h { font-size: 18px; margin: 0 0 6px; }
.msg-list { margin: 8px 0 0; padding-left: 20px; font-family: var(--mono); font-size: 12.5px; color: var(--dim); }
.msg-list li.me { color: var(--g); }

/* ---- 04 レシピ・05 遊び方 */
.recipes { padding: 14px; max-width: 1400px; margin: 0 auto; display: grid; gap: 12px; }
.recipes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.rc-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rc-fam { flex-wrap: wrap; }
.rc-tags { display: flex; flex-wrap: wrap; gap: 6px; font-size: 11.5px; }
.rc-tags span { border: 1px solid var(--line2); border-radius: 2px; padding: 1px 6px; color: var(--dim); }
.rc-steps { min-height: 110px; }
.rc-more summary { cursor: pointer; color: var(--dim); font-size: 13px; }
.rc-more[open] summary { color: var(--txt); }
.rc { display: flex; flex-direction: column; gap: 8px; }
.rc-steps { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.rc-steps canvas { flex: none; width: 84px; height: 108px; background: #0c1715; border: 1px solid var(--line); border-radius: 2px; }
.rc-name { font-size: 16px; font-weight: 700; margin: 0; }
.rc-desc { color: var(--dim); margin: 0; font-size: 13.5px; }
.rc-spec { font-size: 12px; color: var(--dim); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.rc-spec b { color: var(--txt); font-weight: 400; }
.rc-list { margin: 0; padding-left: 22px; color: var(--dim); font-size: 13px; }
.howto { max-width: 920px; margin: 0 auto; padding: 16px 14px 40px; display: grid; gap: 12px; }
.howto h2 { margin: 0 0 6px; font-size: 16px; }
.howto p { margin: 0; color: var(--dim); }
.howto .panel p + p { margin-top: 6px; }
.howto dl { margin: 6px 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; }
.howto dt { color: var(--txt); }
.howto dd { margin: 0; color: var(--dim); }

.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); color: var(--g); z-index: 50; letter-spacing: .3em; transition: opacity .4s; }
.boot.done { opacity: 0; pointer-events: none; }

/* ---- 狭い画面 */
@media (max-width: 1180px) {
  #view-fold.on { grid-template-columns: 240px minmax(0, 1fr) 290px; }
  .cup-grid { grid-template-columns: 260px minmax(0, 1fr) 250px; }
  .status .st-wind { display: none; }
}
.dock-tabs, .btn-more, .x-close, .board-toggle { display: none; }
.sel-paper { margin-top: 8px; }
.btn-sm { min-height: 28px; padding: 3px 10px; font-size: 12px; margin-left: auto; }
.x-close { position: absolute; right: 6px; top: 6px; width: 32px; height: 32px; background: none; border: 1px solid var(--line2); border-radius: var(--r); cursor: pointer; }
.x-close::before, .x-close::after { content: ''; position: absolute; left: 8px; right: 8px; top: 15px; height: 1.5px; background: var(--dim); transform: rotate(45deg); }
.x-close::after { transform: rotate(-45deg); }

/* ---- スマホ・タブレットの縦（960px 以下）：画面いっぱいの道具の配置 */
@media (max-width: 960px) {
  :root { --top: 48px; }
  .top { padding: 0 4px 0 8px; gap: 4px; }
  .brand-text, .status { display: none; }
  .brand-mark { width: 24px; height: 24px; }
  .tabs { margin: 0; flex: 1; height: 100%; min-width: 0; }
  .tab { flex: 1; padding: 0 2px; justify-content: center; font-size: 13px; min-width: 0; }
  .tab-code { display: none; }

  /* 折り台：上に紙、下に引き出し（道具・仕上げ・諸元・機体・手順） */
  #view-fold.on { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 44px minmax(170px, 40%); gap: 0; padding: 0; }
  .col-tools, .col-spec { display: contents; }
  .col-table { grid-row: 1; grid-column: 1; padding: 6px 6px 4px; gap: 4px; overflow: hidden; }
  .table-head { min-height: 0; }
  .hint { font-size: 12.5px; padding: 6px 10px; line-height: 1.45; }
  .coord { display: none; }
  .table-wrap { min-height: 0; flex: 1; }
  .table-head { min-height: 58px; }
  .confirm { top: 6px; bottom: auto; left: 6px; right: 6px; transform: none; width: auto; max-width: none; min-height: 58px; padding: 4px 6px; gap: 4px; flex-wrap: nowrap; z-index: 4; }
  .confirm .btn { flex: 1 1 auto; min-width: 0; white-space: normal; line-height: 1.2; font-size: 13px; }
  .confirm-t { display: none; }
  .confirm .btn { min-height: 40px; padding: 6px 10px; }
  .confirm-t { width: 100%; text-align: center; padding: 0; font-size: 12px; }
  .dock-tabs { display: flex; grid-row: 2; grid-column: 1; border-top: 1px solid var(--line); background: var(--bg2); }
  .dock-tabs button { flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--dim); font-size: 13.5px; cursor: pointer; min-width: 0; }
  .dock-tabs button.on { color: var(--txt); border-bottom-color: var(--g); background: #12241f; }
  #view-fold .panel[data-dock] { grid-row: 3; grid-column: 1; display: none; overflow-y: auto; border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0; min-height: 0; margin: 0; }
  #view-fold .panel[data-dock] .ph { display: none; }
  #view-fold.dk-tools .panel[data-dock=tools], #view-fold.dk-finish .panel[data-dock=finish], #view-fold.dk-spec .panel[data-dock=spec],
  #view-fold.dk-model .panel[data-dock=model], #view-fold.dk-log .panel[data-dock=log] { display: block; }
  .tools { grid-template-columns: repeat(3, 1fr); gap: 5px; }
  .tool { min-height: 54px; padding: 5px 2px; font-size: 11.5px; }
  #seg-mode, #seg-scope { display: inline-flex; width: calc(50% - 3px); }
  #seg-scope { margin-left: 6px; }
  .chk { margin-top: 8px; }
  .preview { height: 140px; }
  .steps { max-height: none; }
  .sl label { font-size: 12px; }

  /* 試験飛行：3D を全面に、計器は小さく、投げるボタンは下 */
  #view-flight.on { display: block; }
  .stage { position: absolute; inset: 0; }
  .hud { padding: 6px 8px 8px; }
  .hud .ph { margin-bottom: 4px; font-size: 11.5px; }
  .hud-tl { left: 6px; top: 48px; width: 148px; }
  .tele { font-size: 11px; gap: 1px 8px; }
  .tele dt { font-size: 11px; }
  .tele dt:nth-of-type(n+6), .tele dd:nth-of-type(n+6) { display: none; }
  .hud-tr { right: 6px; top: 48px; width: 112px; }
  .hud-tr .ph { display: none; }
  #wind-dial { width: 76px; height: 76px; }
  .wind-read { font-size: 10px; margin: 2px 0 0; line-height: 1.35; }
  #seg-wind { display: none; }
  .hud-bl { left: 6px; right: 6px; bottom: 6px; width: auto; display: grid; grid-template-columns: minmax(0, 1fr) 104px; gap: 4px 8px; align-items: end; }
  .hud-bl .ph { display: none; }
  #launch { grid-column: 1; }
  #launch .sl:nth-child(n+3) { display: none; }
  .hud-bl .chk { display: none; grid-column: 1 / -1; }
  .btn-throw { grid-column: 2; grid-row: 1; margin: 0; min-height: 74px; font-size: 17px; align-self: stretch; }
  .btn-more { display: block; grid-column: 1 / -1; min-height: 32px; padding: 4px; font-size: 12.5px; color: var(--dim); background: none; }
  .stage.more #launch .sl { display: grid; }
  .stage.more .hud-bl .chk, .stage.more #seg-wind { display: flex; }
  .stage.more #seg-wind { margin-top: 6px; }
  .stage.more .hud-tr { width: 168px; }
  .hud-br { left: 6px; right: 6px; width: auto; bottom: calc(var(--dock-h, 140px) + 12px); display: none; }
  .stage.show-result .hud-br { display: block; }
  .x-close { display: block; }
  #profile { height: 96px; }
  .cam-bar { top: 6px; max-width: calc(100% - 12px); }
  .cam-bar button { padding: 5px 9px; font-size: 12.5px; min-height: 32px; }
  .alert { top: 92px; font-size: 13px; }

  /* 世界大会：3D を全面に、レーダーと順位は小さく重ねる */
  .cup-grid { display: block; padding: 0; }
  .cup-stage { position: absolute; inset: 0; border: 0; border-radius: 0; }
  .cup-bar { left: 6px; right: 6px; top: 6px; padding: 6px; gap: 6px; }
  .cup-bar .sel-sm { max-width: none; flex: 1 1 150px; }
  .cup-clock { font-size: 13px; }
  .cup-radar { position: absolute; z-index: 3; left: 6px; bottom: 54px; width: 136px; padding: 4px; background: rgba(12, 22, 19, .9); }
  .cup-radar .ph { display: none; }
  .cup-board { position: absolute; z-index: 3; right: 6px; bottom: 54px; width: 188px; max-height: 34%; padding: 6px; background: rgba(12, 22, 19, .92); }
  .cup-board .ph { font-size: 12px; margin-bottom: 4px; }
  .board-toggle { display: inline-block; }
  .cup-board.open { left: 6px; width: auto; top: 112px; max-height: none; }
  .strip { font-size: 11px; padding: 2px 6px 2px 4px; grid-template-columns: 24px 1fr auto; }
  .strip .sub { display: none; }
  .cup-board.open .strip .sub { display: block; }
  #cam-cup { bottom: 6px; }
  #cup-gust { bottom: auto; top: 120px; }
  .cup-msg { top: 54%; }
  .recipes { padding: 8px; }
  .recipes-grid { grid-template-columns: 1fr; }
  .rc-bar .seg { width: 100%; }
  .rc-bar .seg button { flex: 1 1 auto; }
  .howto { padding: 10px 8px 30px; }
  .howto dl { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .tab { font-size: 12px; }
  .dock-tabs button { font-size: 12.5px; }
  .hud-tl { width: 136px; }
}
/* 横向きのスマホ（高さが低い） */
@media (max-height: 500px) and (max-width: 960px) {
  #view-fold.on { grid-template-columns: minmax(0, 1fr) 46%; grid-template-rows: 40px minmax(0, 1fr); }
  .col-table { grid-row: 1 / span 2; grid-column: 1; }
  .dock-tabs { grid-row: 1; grid-column: 2; border-top: 0; }
  #view-fold .panel[data-dock] { grid-row: 2; grid-column: 2; }
  .hud-tl { top: 46px; }
  .tele dt:nth-of-type(n+4), .tele dd:nth-of-type(n+4) { display: none; }
  .hud-bl { left: auto; width: 360px; }
}
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: rgba(10, 22, 18, .96); border: 1px solid var(--g); color: var(--txt); padding: 8px 14px; border-radius: var(--r); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); font-size: 13px; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ===== 動き ===== */
/* 起動：中央の線が走って上下に開く */
.boot { overflow: hidden; }
.boot-line { position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: var(--g); box-shadow: 0 0 18px var(--g); transform-origin: 50% 50%; animation: bootLine .5s cubic-bezier(.2, .8, .2, 1) forwards; }
@keyframes bootLine { 0% { transform: scaleX(0); } 60% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1) scaleY(40); opacity: 0; } }
.boot-box { position: relative; width: min(420px, 86vw); font-size: 12px; letter-spacing: .12em; opacity: 0; animation: fadeIn .2s .25s forwards; }
.boot-title { font-size: 18px; letter-spacing: .3em; color: var(--txt); min-height: 26px; margin-bottom: 10px; border-bottom: 1px solid var(--line2); padding-bottom: 8px; }
.boot-row { display: flex; justify-content: space-between; color: var(--dim); animation: rowIn .18s ease-out; }
.boot-row b { color: var(--g); font-weight: 400; }
@keyframes rowIn { from { opacity: 0; transform: translateX(-12px); } }
@keyframes fadeIn { to { opacity: 1; } }
.boot.done { transition: opacity .45s .1s, transform .55s .1s; transform: scaleY(.02); }

/* パネルが差し込まれる */
.in { animation: panelIn .55s cubic-bezier(.16, .84, .24, 1) backwards; animation-delay: var(--d, 0ms); }
@keyframes panelIn {
  0% { opacity: 0; transform: translateY(16px); clip-path: inset(0 100% 0 0); }
  55% { opacity: 1; clip-path: inset(0 0 0 0); }
  70% { filter: brightness(1.6); }
  100% { transform: none; filter: none; }
}
.panel::before { transition: width .4s, height .4s; }
.panel.in::before { animation: bracket .7s ease-out backwards; animation-delay: calc(var(--d, 0ms) + 200ms); }
@keyframes bracket { from { width: 0; height: 0; } }
/* 走査線と、ゆっくり下りる光の帯（文字は暗くしない） */
.panel::after, .hud::after { content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(180deg, transparent 0, rgba(63, 224, 141, .07) 50%, transparent 100%) 0 -120px / 100% 120px no-repeat,
              repeating-linear-gradient(180deg, transparent 0 2px, rgba(63, 224, 141, .022) 2px 3px);
  animation: scan 7s linear infinite; mix-blend-mode: screen; }
@keyframes scan { to { background-position: 0 calc(100% + 120px), 0 0; } }
/* 押す所の光 */
.btn, .tool, .seg button, .tab, .cam-bar button, .dock-tabs button { position: relative; overflow: hidden; }
.btn::after, .tool::after { content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .14), transparent); transform: skewX(-20deg); pointer-events: none; }
.btn:hover::after, .tool:hover::after { animation: sheen .7s ease-out; }
@keyframes sheen { to { left: 130%; } }
.btn:active, .tool:active { transform: translateY(1px); filter: brightness(1.25); }
.btn-go { box-shadow: 0 0 0 0 rgba(63, 224, 141, .55); animation: pulse 2.2s ease-out infinite; }
.btn-go:disabled { animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(63, 224, 141, .5); } 70% { box-shadow: 0 0 0 12px rgba(63, 224, 141, 0); } 100% { box-shadow: 0 0 0 0 rgba(63, 224, 141, 0); } }
.tab.on::after { content: ''; position: absolute; left: 10%; right: 10%; bottom: 0; height: 2px; background: #b6ffd8; box-shadow: 0 0 10px var(--g); animation: tabBar .45s cubic-bezier(.2, .8, .2, 1); }
@keyframes tabBar { from { transform: scaleX(0); } }
.tool.on { animation: toolOn .35s ease-out; }
@keyframes toolOn { 0% { box-shadow: 0 0 0 6px rgba(63, 224, 141, .5) inset; } }
/* 案内の行：打っている所に四角いカーソル */
.hint::after { content: ''; display: inline-block; width: .55em; height: 1em; margin-left: 3px; vertical-align: -2px; background: var(--g); animation: caret 1s steps(2) infinite; }
@keyframes caret { 50% { opacity: 0; } }
/* 値が変わった数字 */
.chg { animation: chg .9s ease-out; }
@keyframes chg { 0% { color: #06140d; background: var(--g); } 100% { background: transparent; } }
.lamp.on { animation: lamp 2.4s ease-in-out infinite; }
@keyframes lamp { 50% { box-shadow: 0 0 3px var(--g); opacity: .75; } }
/* 大きな文字（LAUNCH・NEW RECORD・秒読み） */
.slam { position: absolute; z-index: 8; left: 50%; top: 42%; transform: translate(-50%, -50%); font-family: var(--mono); font-weight: 700; font-size: clamp(34px, 8vw, 96px); letter-spacing: .14em; color: #eafff3; text-shadow: 0 0 22px rgba(63, 224, 141, .9), 0 0 2px #000; pointer-events: none; white-space: nowrap; animation: slam 1.1s cubic-bezier(.2, .9, .2, 1) forwards; }
.slam.red { color: #fff0f0; text-shadow: 0 0 24px rgba(255, 106, 106, .95), 0 0 2px #000; }
.slam.small { font-size: clamp(22px, 4.6vw, 52px); top: 30%; }
.slam.count { font-size: clamp(80px, 18vw, 200px); animation-duration: .8s; }
@keyframes slam {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(2.6); letter-spacing: .6em; filter: blur(6px); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(.94); letter-spacing: .14em; filter: none; }
  28% { transform: translate(-50%, -50%) scale(1.03); }
  75% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -58%) scale(1); }
}
.flash { position: absolute; inset: 0; z-index: 7; background: radial-gradient(circle at 50% 60%, rgba(220, 255, 236, .55), rgba(63, 224, 141, .12) 60%, transparent 80%); pointer-events: none; animation: flash .6s ease-out forwards; }
@keyframes flash { to { opacity: 0; } }
/* 突風：画面の縁が赤く脈打つ */
.stage::after, .cup-stage::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 6; box-shadow: inset 0 0 0 0 rgba(255, 70, 70, 0); transition: box-shadow .4s; }
.stage.gust::after, .cup-stage.gust::after { animation: gustEdge 1s ease-in-out infinite; }
@keyframes gustEdge { 50% { box-shadow: inset 0 0 60px 6px rgba(255, 70, 70, .45); } }
.alert:not([hidden]) { animation: alertIn .35s cubic-bezier(.2, .9, .2, 1), blink 1s steps(2) .35s infinite; }
@keyframes alertIn { from { transform: translate(-50%, -30px); opacity: 0; } }
/* 結果のカード */
.stage.show-result .hud-br, .hud-br.pop { animation: pop .5s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pop { from { transform: translateY(24px) scale(.96); opacity: 0; } }
.result b { transition: color .3s; }
.cup-msg:not([hidden]) { animation: msgIn .6s cubic-bezier(.2, .9, .3, 1.1); }
@keyframes msgIn { from { transform: translate(-50%, -40%) scale(.9); opacity: 0; } }
.msg-list li { animation: rowIn .3s ease-out backwards; }
.msg-list li:nth-child(1) { animation-delay: .25s; } .msg-list li:nth-child(2) { animation-delay: .32s; } .msg-list li:nth-child(3) { animation-delay: .39s; }
.msg-list li:nth-child(4) { animation-delay: .46s; } .msg-list li:nth-child(5) { animation-delay: .53s; } .msg-list li:nth-child(6) { animation-delay: .6s; }
.msg-list li:nth-child(7) { animation-delay: .67s; } .msg-list li:nth-child(8) { animation-delay: .74s; } .msg-list li:nth-child(9) { animation-delay: .81s; } .msg-list li:nth-child(10) { animation-delay: .88s; }
.strip.fly .v { animation: caret 1s steps(2) infinite; }
.land-tag:not([hidden]) { animation: tagIn .5s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes tagIn { from { transform: translate(-50%, -60%) scale(.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* 音の入り切り */
.snd { margin-left: auto; display: flex; align-items: center; gap: 6px; background: none; border: 1px solid var(--line2); border-radius: var(--r); color: var(--txt); padding: 4px 9px; min-height: 32px; cursor: pointer; font-size: 11px; }
.snd + .status { margin-left: 0; }
.snd i { width: 14px; height: 12px; position: relative; display: block; }
.snd i::before { content: ''; position: absolute; left: 0; top: 3px; width: 4px; height: 6px; background: currentColor; box-shadow: 4px 0 0 0 transparent; }
.snd i::after { content: ''; position: absolute; left: 5px; top: 0; border: 6px solid transparent; border-right: 5px solid currentColor; border-left: 0; }
.snd.off { color: var(--mute); }
.snd.off span::after { content: ' OFF'; }
.snd:not(.off) { border-color: var(--g-dim); }
.snd:not(.off) span::after { content: ' ON'; color: var(--g); }
@media (max-width: 960px) { .snd { margin-left: 0; padding: 4px 6px; } .snd span { display: none; } }
.rc-bar .seg { flex-wrap: wrap; overflow: visible; border: 0; gap: 4px; }
.rc-bar .seg button { flex: 1 1 auto; border: 1px solid var(--line2); border-radius: var(--r); }
.rc-bar .seg button + button { border-left: 1px solid var(--line2); }
.rc .row2 .btn { white-space: normal; line-height: 1.3; }
.recipes > *, .recipes-grid > *, .rc > * { min-width: 0; }
.recipes-grid { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.rc-spec { min-width: 0; }
.cup-bar .seg-sm button { flex: none; }
.howto dd a { color: var(--g); }
