/* ============================================================
   SIMULATOR (simulator.html) — 滑走路と Environment の設定
   ------------------------------------------------------------
   ここで決めた設定を Traffic Pattern / Circling が読む。
   .subnav と .sim-* は circling.css / tfc.css からも使うため、
   将来この3ページで共有する部品が増えるなら style.css へ移すこと。
   ============================================================ */

.lead {
    max-width: 860px;
}

/* --- Simulator 配下のサブナビ -------------------------------- */
.subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin: 0 0 26px;
    padding: 4px;
    background: rgba(255, 255, 255, .025);
    border: 1px solid var(--line);
    border-radius: var(--r);
}

.subnav a {
    padding: 7px 14px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .14em;
    color: var(--muted);
    text-decoration: none;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 3px;
    transition: color .16s ease, background .16s ease;
}

.subnav a:hover,
.subnav a:focus-visible {
    color: var(--green);
    background: rgba(18, 245, 140, .08);
}

.subnav a.current {
    color: var(--amber);
    background: rgba(255, 176, 32, .10);
    border-color: rgba(255, 176, 32, .35);
}

/* --- 入力表 -------------------------------------------------- */
#rwyTable,
#envTable,
#windTable {
    width: 100%;
    max-width: 860px;
}

table td {
    padding: 7px 8px;
    text-align: center;
}

table td input[type="number"] {
    display: block;
    width: 100%;
    min-width: 0;
    margin: 0;
    text-align: right;
}

#envTable th[colspan] {
    text-align: center;
    color: var(--text);
}

/* --- 空港検索（tfc / circling と同じ部品） ------------------- */
#ap_lookup {
    max-width: 860px;
    margin: 0 0 22px;
    padding: 16px 18px;
    background: rgba(67, 210, 255, .04);
    border: 1px solid var(--line);
    border-left: 3px solid var(--cyan);
    border-radius: var(--r);
}

#ap_lookup[hidden] {
    display: none;
}

#ap_lookup .ap-lead {
    margin: 0 0 8px;
    font-size: .82rem;
    color: var(--muted);
}

#ap_lookup code {
    padding: 1px 5px;
    color: var(--cyan);
    background: rgba(67, 210, 255, .10);
    border-radius: 3px;
}

#ap_lookup .ap-note {
    margin: 0 0 14px;
    padding: 8px 10px;
    font-size: .74rem;
    line-height: 1.65;
    color: var(--faint);
    background: rgba(255, 176, 32, .05);
    border-left: 2px solid rgba(255, 176, 32, .5);
    border-radius: 0 var(--r) var(--r) 0;
}

#ap_lookup .ap-note strong {
    color: var(--amber);
}

#ap_lookup .ap-note a {
    color: var(--muted);
    border-bottom-color: rgba(130, 150, 171, .4);
}

.ap-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
}

.ap-combo {
    position: relative;
    flex: 0 0 auto;
}

#ap_icao {
    width: 132px;
    text-align: left;
    letter-spacing: .22em;
    text-transform: uppercase;
}

#ap_rwy {
    min-width: 260px;
}

#ap_rwy:disabled {
    opacity: .45;
    cursor: not-allowed;
}

#ap_list {
    position: absolute;
    z-index: 40;
    top: calc(100% + 4px);
    left: 0;
    width: 340px;
    max-width: 78vw;
    max-height: 300px;
    margin: 0;
    padding: 4px;
    overflow-y: auto;
    list-style: none;
    background: var(--panel-2);
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    box-shadow: 0 14px 32px rgba(0, 0, 0, .6);
}

#ap_list[hidden] {
    display: none;
}

#ap_list li {
    padding: 7px 10px;
    cursor: pointer;
    border-radius: 3px;
    line-height: 1.45;
}

#ap_list li b {
    display: inline-block;
    min-width: 4.6em;
    color: var(--cyan);
    letter-spacing: .12em;
}

#ap_list li span {
    font-size: .82rem;
    color: var(--text);
}

#ap_list li i {
    display: block;
    margin-left: 4.6em;
    font-size: .72rem;
    font-style: normal;
    color: var(--faint);
}

#ap_list li:hover,
#ap_list li.on {
    background: rgba(18, 245, 140, .12);
}

#ap_list li:hover b,
#ap_list li.on b {
    color: var(--green);
}

.ap-status {
    margin: 10px 0 0;
    min-height: 1.4em;
    font-size: .78rem;
    color: var(--muted);
}

.ap-status.ok {
    color: var(--green);
}

.ap-status.warn {
    color: var(--amber);
}

.ap-status.ng {
    color: var(--red);
}

input.ap-filled {
    border-color: var(--green);
    box-shadow: 0 0 0 2px rgba(18, 245, 140, .22), var(--glow-green);
}

/* --- Aircraft Setting ---------------------------------------- */
#acTable {
    width: auto;
    min-width: 240px;
}

#acTable td select {
    width: 100%;
    min-width: 0;
    margin: 0;
}

/* まだ計算に使っていないことを明示する注記 */
.ac-note {
    max-width: 860px;
    margin: 12px 0 0;
    padding: 10px 12px;
    font-size: .76rem;
    line-height: 1.7;
    color: var(--muted);
    background: rgba(255, 176, 32, .05);
    border-left: 2px solid rgba(255, 176, 32, .5);
    border-radius: 0 var(--r) var(--r) 0;
}

.ac-note strong {
    color: var(--amber);
    font-weight: 400;
}

/* --- 保存・読込 ---------------------------------------------- */
.sim-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 22px 0 0;
}

#sim_save {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 168px;
    height: 40px;
    padding: 0 22px;
    cursor: pointer;
    font-family: var(--font);
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .12em;
    line-height: 1;
    color: #04120c;
    background: linear-gradient(180deg, #37ffae, var(--green));
    border: 1px solid rgba(18, 245, 140, .6);
    border-radius: var(--r);
    box-shadow: 0 0 18px rgba(18, 245, 140, .22);
    transition: filter .15s ease, box-shadow .15s ease;
}

#sim_save:hover {
    filter: brightness(1.1);
    box-shadow: 0 0 28px rgba(18, 245, 140, .42);
}

#sim_load,
#sim_clear {
    height: 40px;
    padding: 0 16px;
    cursor: pointer;
    font-family: var(--font);
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .1em;
    color: var(--cyan);
    background: rgba(67, 210, 255, .07);
    border: 1px solid var(--line-2);
    border-radius: var(--r);
}

#sim_load:hover,
#sim_clear:hover {
    border-color: var(--cyan);
    box-shadow: var(--glow-cyan);
}

#sim_save:focus-visible,
#sim_load:focus-visible,
#sim_clear:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 2px;
}

.sim-status {
    margin: 12px 0 0;
    min-height: 1.4em;
    font-size: .8rem;
    color: var(--muted);
}

.sim-status.ok {
    color: var(--green);
}

.sim-status.warn {
    color: var(--amber);
}

/* --- 高度ごとの風 -------------------------------------------- */
#windTable td {
    color: var(--green);
    text-shadow: var(--glow-green);
}

#windTable th {
    text-align: center;
}

#windTable tbody th {
    color: var(--cyan);
    text-shadow: none;
    text-align: right;
}

#windTable td[colspan] {
    color: var(--muted);
    text-shadow: none;
    text-align: left;
}

/* --- Environment パネル（circling / tfc 側で表示） ------------ */
#sim_env {
    max-width: 860px;
    margin: 0 0 24px;
    padding: 16px 18px;
    background: rgba(255, 176, 32, .04);
    border: 1px solid var(--line);
    border-left: 3px solid var(--amber);
    border-radius: var(--r);
}

#sim_env[hidden] {
    display: none;
}

.se-title {
    margin: 0 0 12px;
    font-size: .68rem;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--amber);
}

.seTable {
    width: 100%;
    max-width: 620px;
    margin: 0;
}

.seTable th,
.seTable td {
    padding: 5px 10px;
    border: none;
    font-size: .8rem;
    text-align: left;
    white-space: normal;
}

.seTable th {
    width: 11em;
    background: none;
    font-size: .7rem;
    color: var(--muted);
}

.seTable td {
    color: var(--text);
}

/* 実際に計算へ渡す風。ここが読めれば根拠が追える。 */
.seTable tr.se-used th {
    color: var(--amber);
}

.seTable tr.se-used td {
    color: var(--green);
    text-shadow: var(--glow-green);
    font-size: .92rem;
}

.se-ratio {
    color: var(--faint);
    font-size: .72rem;
    text-shadow: none;
}

.se-toggle {
    display: block;
    margin: 12px 0 0;
    font-size: .78rem;
    color: var(--muted);
    cursor: pointer;
}

.se-toggle input {
    margin-right: 6px;
}

/* 滑走路データの出典と AIP ではない旨。空港検索をこのページから
   外したので、データが表示されるこのパネルに但し書きを置いている。 */
.se-note {
    margin: 10px 0 0;
    padding: 8px 10px;
    font-size: .72rem;
    line-height: 1.65;
    color: var(--faint);
    background: rgba(255, 176, 32, .05);
    border-left: 2px solid rgba(255, 176, 32, .5);
    border-radius: 0 var(--r) var(--r) 0;
}

.se-note strong {
    color: var(--amber);
}

.se-note a {
    color: var(--muted);
    border-bottom-color: rgba(130, 150, 171, .4);
}

.se-link {
    margin: 8px 0 0;
    font-size: .76rem;
}

.se-none {
    max-width: 860px;
    margin: 0 0 24px;
    padding: 12px 14px;
    font-size: .8rem;
    color: var(--muted);
    background: rgba(255, 255, 255, .02);
    border: 1px dashed var(--line-2);
    border-radius: var(--r);
}

.se-none[hidden] {
    display: none;
}

/* Environment から自動入力されている欄は触れないことを見せる */
input.sim-locked {
    color: var(--faint);
    background: rgba(255, 176, 32, .05);
    border-color: rgba(255, 176, 32, .28);
    cursor: not-allowed;
}

/* --- 算出値のカード（tfc / circling が共有） ------------------
   図の下に「バンク角」「Final の距離・高度」などを並べる部品。
   もとは circling.css だけにあったが、Traffic Pattern でも
   同じ形で出すようになったのでこの共有シートへ移した。
   囲みの枠（#maxdist_box / #tfc_box）は各ページ側に置く。 */
.md-label {
    margin: 0 0 14px;
    font-size: .7rem;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--amber);
}

.md-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin: 0 0 16px;
}

.md-item {
    padding: 12px 14px;
    background: rgba(0, 0, 0, .25);
    border: 1px solid var(--line);
    border-radius: var(--r);
}

.md-cap {
    margin: 0 0 4px;
    font-size: .7rem;
    line-height: 1.5;
    color: var(--muted);
}

.md-value {
    margin: 0 0 6px;
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--amber);
    text-shadow: var(--glow-amber);
}

.md-unit {
    margin-left: .25em;
    font-size: .8rem;
    font-weight: 400;
    letter-spacing: .1em;
}

.md-sub {
    margin: -4px 0 6px;
    font-size: .9rem;
    color: var(--amber);
    opacity: .8;
}

.md-detail {
    margin: 0;
    font-size: .72rem;
    line-height: 1.6;
    color: var(--faint);
}

.md-note {
    margin: 0;
    font-size: .74rem;
    line-height: 1.7;
    color: var(--muted);
}

.md-note strong {
    color: var(--amber);
    font-weight: 400;
}

/* --- 参考表（tfc / circling が共有） --------------------------
   他の入力は固定したまま、風だけ Cross Wind / Head-Tail Wind に
   振った一覧。列数が風の刻み数ぶんあるので、狭い画面では
   .ref-scroll だけを横スクロールさせる（ページ本体は横に伸ばさない）。 */
.ref-table {
    max-width: 860px;
    margin: 0 0 18px;
}

.ref-cap {
    margin: 0 0 8px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .1em;
    color: var(--cyan);
}

.ref-scroll {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--r);
}

.ref-scroll table {
    width: 100%;
    border-collapse: collapse;
}

.ref-scroll caption {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.ref-scroll th,
.ref-scroll td {
    padding: 7px 10px;
    text-align: center;
    white-space: nowrap;
    border-bottom: 1px solid var(--line);
}

.ref-scroll thead th {
    font-size: .74rem;
    font-weight: 400;
    color: var(--muted);
    background: rgba(0, 0, 0, .2);
}

.ref-scroll tbody th {
    text-align: left;
    font-size: .78rem;
    font-weight: 400;
    color: var(--text);
    white-space: nowrap;
}

.ref-scroll tbody td {
    color: var(--green);
    text-shadow: var(--glow-green);
    font-size: .9rem;
}

.ref-note {
    max-width: 860px;
    margin: -6px 0 28px;
    font-size: .76rem;
    line-height: 1.7;
    color: var(--muted);
}

/* --- 配下ページへの導線 -------------------------------------- */
.sim-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
    max-width: 860px;
    margin: 20px 0 0;
    padding: 0;
}

.sim-links li {
    padding: 16px 18px;
    font-size: .85rem;
    line-height: 1.75;
    color: var(--muted);
    background: linear-gradient(180deg, var(--panel-2), var(--panel));
    border: 1px solid var(--line);
    border-radius: var(--r);
    transition: border-color .18s ease, transform .18s ease;
}

.sim-links li:hover {
    border-color: rgba(18, 245, 140, .4);
    transform: translateY(-2px);
}

.sim-links li a {
    display: block;
    margin: 0 0 6px;
    font-size: .98rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--green);
    text-shadow: var(--glow-green);
    border-bottom: none;
}

/* --- 地上風の成分 ---------------------------------------------
   Environment のすぐ下。地上風を入れた時点で自動で出る。
   以前は独立した風の入力欄を持つ Reference だったが、同じ風を
   2度入れることになるので入力を1つにまとめた。 */
.wind-comp {
    max-width: 860px;
    margin: -8px 0 24px;
    padding: 14px 18px;
    text-align: left;
    background: linear-gradient(180deg, var(--panel-2), var(--panel));
    border: 1px solid var(--line);
    border-left: 3px solid var(--cyan);
    border-radius: var(--r);
}

.wc-cap {
    margin: 0 0 10px;
    font-size: .68rem;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--cyan);
}

.wc-row {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
}

.wc-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.wc-label {
    font-size: .78rem;
    color: var(--muted);
}

.wc-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--green);
    text-shadow: var(--glow-green);
}

.wc-unit {
    font-size: .78rem;
    color: var(--muted);
}

/* 横風の向き。R = 右から / L = 左から */
.wc-side {
    min-width: 1.1em;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--amber);
    text-shadow: 0 0 12px rgba(255, 176, 32, .45);
}

.wc-note {
    margin: 10px 0 0;
    font-size: .78rem;
    color: var(--muted);
}

.wc-note strong {
    color: var(--amber, #ffb020);
}

@media (max-width:480px) {

    .subnav {
        margin-bottom: 20px;
    }

    .wind-comp {
        padding: 12px 14px;
    }

    .wc-row {
        gap: 6px 22px;
    }

    .subnav a {
        flex: 1 1 auto;
        text-align: center;
        padding: 9px 8px;
        font-size: .68rem;
    }

    .sim-actions {
        display: block;
    }

    .sim-actions > * {
        width: 100%;
        margin-bottom: 10px;
    }

    .sim-links {
        grid-template-columns: 1fr;
    }
}
