/* ═══════════════════════════════════════════════════════════
   高雄國際機場 數位管家 — Style v7
   與官網 www.kia.gov.tw 同一套品牌色票（海洋→夕陽 十色）
   ─ 官網用沉穩端；管家用完整光譜，色彩＝方位識別
   ─ 東翼暖色（日出．#ee9b00）／西翼冷色（海．#0a9396）
   ─ 明亮通透的日間介面，適合航廈大面採光環境
   ─ 圓角 12px、字體 Roboto + Noto Sans TC，與官網一致
   ═══════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&family=Noto+Sans+TC:wght@400;500;700;900&family=JetBrains+Mono:wght@400;600;800&display=swap');

:root {
    /* ═══════════════════════════════════════════════════════════════
       品牌色票 —— 與官網同源
       官網 (www.kia.gov.tw) 取用「海洋→夕陽」十色色票的沉穩端：
       #005f73 主色、#94d2bd 輔色、#ee9b00 強調色。
       數位管家取用【完整光譜】，並讓色彩承擔「方位識別」的功能：
       東翼＝暖色（日出）、西翼＝冷色（海），顏色本身就是指路。
       ═══════════════════════════════════════════════════════════════ */
    --ink:        #001219;
    --brand:      #005f73;   /* 官網主色 */
    --brand-deep: #0a3d4a;   /* 官網深色 */
    --cyan:       #0a9396;
    --cyan-deep:  #076f72;   /* 承載白字時使用 */
    --mint:       #94d2bd;   /* 官網輔色 */
    --sand:       #e9d8a6;
    --amber:      #ee9b00;   /* 官網強調色 */
    --orange:     #ca6702;
    --rust:       #bb3e03;
    --auburn:     #9b2226;

    /* 方位識別（與地圖、登機門標記共用） */
    --wing-east:  #ee9b00;   /* 東翼 Gate 21–26．日出 */
    --wing-west:  #0a9396;   /* 西翼 Gate 27–32．海 */

    /* 介面表面 */
    --bg-sky:        #f4f7f6;   /* 官網 --bg-light */
    --bg-surface:    #ffffff;
    --bg-card:       #ffffff;
    --bg-card-solid: #ffffff;
    --bg-input:      #f1f6f5;
    --border:        #d7e3e1;
    --border-light:  #e8efed;
    --glass:         rgba(10, 147, 150, 0.05);

    --text-primary:   #14262b;
    --text-secondary: #4a636a;
    --text-muted:     #5f767c;

    /* 舊有變數別名（沿用既有 194 處引用，避免大規模改寫） */
    --teal:         #0a9396;
    --teal-light:   #067d7f;
    --teal-glow:    rgba(10, 147, 150, 0.10);
    --gold:         #ee9b00;
    --gold-soft:    #8a5a00;
    --gold-glow:    rgba(238, 155, 0, 0.12);
    --sky-blue:     #005f73;
    --coral:        #bb3e03;
    --purple:       #9b2226;

    /* 狀態色（皆通過白底 AA 對比） */
    --status-ontime:   #0a7d5f;
    --status-boarding: #8a5a00;
    --status-departed: #52686e;
    --status-delayed:  #a8420a;
    --status-cancelled:#8e1f22;
    --status-checkin:  #005f73;
    --status-diverted: #0a3d4a;

    --radius:    12px;   /* 對齊官網 --radius */
    --radius-sm: 8px;
    --font-sans: 'Roboto', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-sans);
    background: linear-gradient(170deg, #f7fbfa 0%, var(--bg-sky) 45%, #eef4f3 100%);
    color: var(--text-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Ambient glow — like runway lights at night */
body::before {
    content: '';
    position: fixed;
    top: -30%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(238, 155, 0, 0.13) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}
body::after {
    content: '';
    position: fixed;
    bottom: -20%;
    left: -15%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(10, 147, 150, 0.11) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; position: relative; z-index: 1; }

/* ═══ Header ═══ */
#header {
    background: linear-gradient(135deg, var(--brand-deep) 0%, var(--brand) 60%, var(--cyan) 100%);
    border-bottom: 3px solid var(--amber);
    padding: 10px 16px;
    flex-shrink: 0;
    z-index: 100;
}
.header-inner { display: flex; justify-content: space-between; align-items: center; max-width: 600px; margin: 0 auto; }
.logo-group { display: flex; align-items: center; gap: 10px; }
.logo-icon {
    font-size: 20px;
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--amber), var(--orange));
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.25);
}
.logo-title { display: block; font-weight: 700; font-size: 14px; letter-spacing: 0.5px; color: #fff; }
.logo-sub { display: block; font-size: 10px; color: var(--mint); letter-spacing: 0.3px; }
.header-status { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 13px; color: var(--mint); }
.live-dot { width: 6px; height: 6px; background: var(--mint); border-radius: 50%; animation: softPulse 2.5s ease-in-out infinite; }
@keyframes softPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(148, 210, 189, 0.5); }
    50% { opacity: 0.6; box-shadow: 0 0 0 5px rgba(148, 210, 189, 0); }
}

/* ═══ Tabs ═══ */
#tabBar {
    display: flex;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 18, 25, 0.05);
    flex-shrink: 0;
}
.tab {
    flex: 1; padding: 8px 0; background: none; border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted); font-family: var(--font-sans); font-size: 11px; font-weight: 500;
    cursor: pointer; transition: all 0.25s;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tab:hover { color: var(--text-secondary); }
.tab.active { color: var(--brand); font-weight: 700; border-bottom-color: var(--amber); }
.tab-icon { font-size: 16px; } .tab-label { font-size: 10px; }

.panel { display: none; flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.panel.active { display: flex; flex-direction: column; }

/* Search panel: needs inner scroll wrapper because flex+overflow has issues on mobile */
#panel-search { padding: 0; max-width: 600px; margin: 0 auto; width: 100%; overflow-y: auto; }
#panel-search > * { flex-shrink: 0; margin-left: 14px; margin-right: 14px; }
#panel-search > *:first-child { margin-top: 14px; }
#panel-search > *:last-child { margin-bottom: 80px; } /* extra space so gate guide is never cut off */
#panel-search .result-card,
#panel-search .gate-guide,
#panel-search .bcbp-info,
#panel-search .direction-toggle,
#panel-search .search-box { margin-bottom: 12px; }

/* ═══ Direction Toggle ═══ */
.direction-toggle {
    display: flex;
    background: var(--bg-input);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    backdrop-filter: blur(6px);
}
.dir-btn {
    flex: 1; padding: 10px 0; background: none; border: none;
    color: var(--text-muted); font-family: var(--font-sans); font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all 0.25s;
}
.dir-btn.active {
    background: linear-gradient(135deg, var(--cyan-deep), var(--brand));
    color: #fff;
    box-shadow: 0 2px 12px rgba(7, 111, 114, 0.2);
}
.dir-btn:not(.active):hover { color: var(--text-secondary); }

/* ═══ Search ═══ */
@media (min-width: 640px) { #panel-search > * { margin-left: 20px; margin-right: 20px; } #panel-search > *:first-child { margin-top: 20px; } }
.input-wrapper {
    display: flex; gap: 5px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    backdrop-filter: blur(6px);
    transition: all 0.25s;
}
.input-wrapper:focus-within {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px var(--teal-glow), 0 4px 20px rgba(14, 165, 161, 0.08);
}
.input-wrapper input {
    flex: 1; background: none; border: none; color: var(--text-primary);
    font-family: var(--font-mono); font-size: 16px; padding: 10px; outline: none;
    text-transform: uppercase; letter-spacing: 1px; min-width: 0;
}
.input-wrapper input::placeholder { color: var(--text-muted); font-family: var(--font-sans); font-size: 13px; text-transform: none; letter-spacing: 0; }
#scanBtn {
    background: var(--bg-card-solid); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 6px 10px; font-size: 18px; cursor: pointer; flex-shrink: 0; transition: all 0.2s;
}
#scanBtn:hover { border-color: var(--teal); background: var(--teal-glow); }
#searchBtn {
    background: linear-gradient(135deg, var(--cyan-deep), var(--brand));
    color: #fff; border: none; border-radius: var(--radius-sm);
    padding: 10px 16px; font-family: var(--font-sans); font-size: 14px; font-weight: 700;
    cursor: pointer; white-space: nowrap; flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(7, 111, 114, 0.2);
    transition: all 0.2s;
}
#searchBtn:hover { box-shadow: 0 4px 18px rgba(7, 111, 114, 0.3); transform: translateY(-1px); }
#searchBtn:active { transform: scale(0.97); }
.search-hint { padding: 4px 10px 0; font-size: 11px; color: var(--text-muted); min-height: 16px; }
.search-hint.error { color: var(--coral); }

/* ═══ BCBP Info ═══ */
.bcbp-info {
    background: linear-gradient(135deg, var(--teal-glow), var(--gold-glow));
    border: 1px solid rgba(7, 111, 114, 0.2);
    border-radius: var(--radius); padding: 10px 12px;
    font-size: 12px; line-height: 1.6; color: var(--text-secondary);
    animation: cardIn 0.4s ease-out;
}
.bcbp-info strong { color: var(--text-primary); }
.bcbp-info .bcbp-name { font-size: 13px; font-weight: 700; color: var(--teal-light); margin-bottom: 3px; display: block; }
.bcbp-info .bcbp-detail { display: flex; flex-wrap: wrap; gap: 3px 14px; }

/* ═══ Result Cards ═══ */
.result-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    animation: cardIn 0.4s ease-out;
    box-shadow: 0 4px 20px rgba(0, 18, 25, 0.08);
}
@keyframes cardIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.card-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px; border-bottom: 1px solid var(--border-light);
}
.flight-badge { display: flex; align-items: center; gap: 10px; }
.airline-code {
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--bg-input), var(--bg-card-solid));
    border-radius: var(--radius-sm);
    font-family: var(--font-mono); font-weight: 600; font-size: 12px;
    color: var(--teal-light);
    border: 1px solid var(--border);
}
.flight-num { font-family: var(--font-mono); font-size: 17px; font-weight: 600; letter-spacing: 1px; }
.airline-name { font-size: 11px; color: var(--text-secondary); }

/* Status badges */
.status-badge { padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.status-badge.ontime    { background: rgba(10, 125, 95, 0.12); color: var(--status-ontime); }
.status-badge.checkin   { background: rgba(96, 165, 250, 0.12); color: var(--status-checkin); }
.status-badge.boarding  { background: rgba(238, 155, 0, 0.18); color: var(--status-boarding); }
.status-badge.departed  { background: rgba(82, 104, 110, 0.12); color: var(--status-departed); }
.status-badge.lateboard { background: rgba(240, 160, 60, 0.12);  color: #f0a03c; }
.status-badge.delayed   { background: rgba(187, 62, 3, 0.12); color: var(--status-delayed); }
.status-badge.cancelled { background: rgba(239, 68, 68, 0.15);   color: var(--status-cancelled); }
.status-badge.arrived   { background: rgba(45, 212, 191, 0.12);  color: var(--status-ontime); }
.status-badge.diverted  { background: rgba(167, 139, 250, 0.12); color: var(--status-diverted); }

/* Route visualization */
.card-route { display: flex; align-items: center; padding: 18px 14px; gap: 10px; }
.route-point { text-align: center; min-width: 55px; }
.route-code { display: block; font-family: var(--font-mono); font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.route-name { display: block; font-size: 10px; color: var(--text-secondary); margin-top: 2px; }
.route-line {
    flex: 1; height: 1px; position: relative;
    background: linear-gradient(90deg, var(--teal) 0%, var(--gold) 50%, var(--sky-blue) 100%);
    opacity: 0.4;
}
.route-plane {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 15px; background: var(--bg-card-solid); padding: 0 6px; color: var(--gold);
}
.arr-plane { color: var(--teal-light); }

/* Details grid */
.card-details {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 1px; background: var(--border-light);
    border-top: 1px solid var(--border-light);
}
.card-details.details-4col { grid-template-columns: repeat(4, 1fr); }
.detail-item { background: var(--bg-card-solid); padding: 10px 8px; text-align: center; }
.detail-label { display: block; font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px; }
.detail-value { font-family: var(--font-mono); font-size: 14px; font-weight: 600; color: var(--text-primary); word-break: break-all; }
.hl-warm { color: var(--rust); font-weight: 700; } .hl-orange { color: var(--rust); font-size: 18px; font-weight: 700; } .hl-accent { color: var(--brand); font-weight: 700; } .hl-green { color: var(--status-ontime); font-size: 13px; }

/* ═══ Wait Inline (in flight card) ═══ */
.wait-inline {
    border-top: 1px solid var(--border-light);
    padding: 12px 14px;
    background: linear-gradient(180deg, var(--teal-glow), transparent);
}
.wait-inline-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.wait-inline-row { display: flex; gap: 12px; }
.wait-inline-item { display: flex; flex-direction: column; align-items: center; flex: 1; }
.wait-inline-label { font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 2px; }
.wait-inline-val { font-family: var(--font-mono); font-size: 22px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.wait-inline-unit { font-size: 9px; color: var(--text-muted); }

.navigate-btn {
    display: block; width: 100%; padding: 12px;
    background: linear-gradient(135deg, rgba(14, 165, 161, 0.08), rgba(56, 163, 212, 0.05));
    border: none; border-top: 1px solid var(--border-light);
    color: var(--teal-light); font-family: var(--font-sans); font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
}
.navigate-btn:hover { background: linear-gradient(135deg, rgba(14, 165, 161, 0.15), rgba(56, 163, 212, 0.1)); }

/* ═══ Customs Notice ═══ */
.customs-notice {
    border-top: 1px solid var(--border-light);
    padding: 14px;
    background: linear-gradient(180deg, var(--gold-glow), transparent);
}
.notice-title { font-size: 12px; font-weight: 700; margin-bottom: 8px; color: var(--gold); }
.notice-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.notice-list li { font-size: 11px; line-height: 1.5; color: var(--text-secondary); }
.notice-list li strong { color: var(--text-primary); }

/* ═══ Gate Guide ═══ */
.gate-guide {
    background: var(--bg-card); backdrop-filter: blur(8px);
    border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; animation: cardIn 0.4s;
    box-shadow: 0 4px 16px rgba(0, 18, 25, 0.08);
}
.guide-header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border-light); flex-wrap: wrap; }
.guide-gate { font-family: var(--font-mono); font-size: 18px; font-weight: 700; }
.guide-wing { padding: 2px 7px; border-radius: 4px; font-size: 10px; font-weight: 600; }
.guide-time { font-size: 12px; color: var(--text-secondary); margin-left: auto; }
.guide-steps { list-style: none; padding: 14px; counter-reset: step; }
.guide-steps li {
    position: relative; padding: 8px 0 8px 34px;
    font-size: 12px; line-height: 1.5; color: var(--text-secondary);
    border-left: 2px solid var(--border); margin-left: 11px;
    counter-increment: step;
}
.guide-steps li::before {
    content: counter(step); position: absolute; left: -12px; top: 6px;
    width: 22px; height: 22px;
    background: var(--bg-input); border: 2px solid var(--border); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-mono); font-size: 10px; font-weight: 600; color: var(--teal-light);
}
.guide-steps li:last-child { border-left-color: transparent; }
.guide-steps li:last-child::before { border-color: var(--cyan-deep); background: var(--cyan-deep); color: #fff; }
.guide-map-btn {
    display: block; width: 100%; padding: 10px;
    background: none; border: none; border-top: 1px solid var(--border-light);
    color: var(--text-muted); font-family: var(--font-sans); font-size: 12px; cursor: pointer;
}
.guide-map-btn:hover { color: var(--teal-light); }

/* ═══ Wait Panel ═══ */
#panel-wait { padding: 0; }
.wait-panel-header { padding: 16px; text-align: center; border-bottom: 1px solid var(--border); background: var(--glass); }
.wait-panel-header h2 { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.wait-panel-sub { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

.wait-now-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border-light); border-bottom: 1px solid var(--border); }
.wait-now-card { background: var(--bg-card-solid); padding: 16px 10px; text-align: center; }
.wait-now-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 4px; display: block; }
.wait-now-value { font-family: var(--font-mono); font-size: 28px; font-weight: 700; line-height: 1.1; }
.wait-now-unit { font-size: 10px; color: var(--text-muted); display: block; margin-top: 2px; }
.wait-now-slot { font-size: 10px; color: var(--text-muted); display: block; margin-top: 4px; }
.wait-color-green  { color: var(--status-ontime); }
.wait-color-yellow { color: var(--gold-soft); }
.wait-color-orange { color: #f0a03c; }
.wait-color-red    { color: var(--coral); }

.wait-timeline-title { padding: 14px 16px 8px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.wait-timeline { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 12px 16px; }
.wait-tl-row { display: grid; grid-template-columns: 52px 1fr 1fr 1fr; gap: 6px; padding: 8px 6px; border-bottom: 1px solid rgba(56, 120, 160, 0.1); font-size: 11px; align-items: center; }
.wait-tl-row.is-now { background: var(--teal-glow); border-radius: 6px; border-bottom: none; box-shadow: 0 0 0 1px rgba(7, 111, 114, 0.2); }
.wait-tl-head { color: var(--text-muted); font-weight: 600; font-size: 9px; text-transform: uppercase; letter-spacing: 0.3px; padding: 4px 6px; position: sticky; top: 0; background: var(--bg-sky); z-index: 2; }
.wait-tl-slot { font-family: var(--font-mono); color: var(--text-secondary); font-weight: 500; }
.wait-tl-val { text-align: center; font-family: var(--font-mono); font-weight: 600; }

/* ═══ Scanner ═══ */
.scanner-modal { position: fixed; inset: 0; z-index: 9999; background: var(--bg-sky); display: flex; flex-direction: column; }
.scanner-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: var(--bg-surface); border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 600; }
.scanner-header button { background: none; border: none; color: var(--text-primary); font-size: 20px; cursor: pointer; }
#scannerView { flex: 1; overflow: hidden; }
.scanner-hint { padding: 10px; text-align: center; font-size: 11px; color: var(--text-muted); background: var(--bg-surface); }

/* ═══ Board ═══ */
#panel-board { padding: 0; }
.board-controls { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; background: var(--bg-surface); border-bottom: 1px solid var(--border); flex-shrink: 0; gap: 8px; }
.board-controls select { background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; font-family: var(--font-sans); font-size: 12px; cursor: pointer; outline: none; }
.board-legend { display: flex; gap: 6px; font-size: 10px; flex-wrap: wrap; }
.legend-item { color: var(--text-muted); white-space: nowrap; }
.legend-item.ontime { color: var(--status-ontime); } .legend-item.boarding { color: var(--status-boarding); }
.legend-item.departed { color: var(--status-departed); } .legend-item.delayed { color: var(--status-delayed); }
.board-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; gap: 10px; color: var(--text-muted); font-size: 12px; }
.spinner { width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: var(--teal); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.board-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.board-row {
    display: grid; grid-template-columns: 68px 1fr 60px 38px 56px;
    align-items: center; padding: 9px 14px;
    border-bottom: 1px solid rgba(56, 120, 160, 0.1);
    font-size: 12px; gap: 6px; cursor: pointer;
    transition: background 0.15s;
}
.board-row:hover { background: var(--glass); }
.board-row:active { background: rgba(14, 165, 161, 0.08); }
.board-row-arr {
    display: grid; grid-template-columns: 68px 1fr 60px 38px 32px 52px;
    align-items: center; padding: 9px 14px;
    border-bottom: 1px solid rgba(56, 120, 160, 0.1);
    font-size: 12px; gap: 5px; cursor: pointer;
    transition: background 0.15s;
}
.board-row-arr:hover { background: var(--glass); }
.board-row-arr:active { background: rgba(14, 165, 161, 0.08); }

.br-flight { font-family: var(--font-mono); font-weight: 600; font-size: 12px; }
.br-dest { display: flex; flex-direction: column; min-width: 0; }
.br-dest-code { font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.br-dest-name { font-size: 10px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.br-time { font-family: var(--font-mono); font-size: 12px; text-align: center; color: var(--text-secondary); }
.br-gate { font-family: var(--font-mono); font-weight: 600; text-align: center; color: var(--gold); }
.br-bhs  { font-family: var(--font-mono); font-weight: 700; text-align: center; color: #f0a03c; font-size: 13px; }
.br-status { text-align: right; font-size: 10px; font-weight: 600; white-space: nowrap; }
.br-status.s-ontime { color: var(--status-ontime); } .br-status.s-checkin { color: var(--status-checkin); }
.br-status.s-boarding { color: var(--status-boarding); } .br-status.s-departed { color: var(--status-departed); }
.br-status.s-lateboard { color: #f0a03c; } .br-status.s-delayed { color: var(--status-delayed); }
.br-status.s-cancelled { color: var(--status-cancelled); } .br-status.s-arrived { color: var(--status-ontime); }
.br-status.s-diverted { color: var(--status-diverted); }

.board-header {
    display: grid; padding: 6px 14px; font-size: 9px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
    background: var(--bg-sky); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 5;
}
.board-header.dep-header { grid-template-columns: 68px 1fr 60px 38px 56px; gap: 6px; }
.board-header.arr-header { grid-template-columns: 68px 1fr 60px 38px 32px 52px; gap: 5px; }
.board-header span:nth-child(n+3) { text-align: center; }
.board-header span:last-child { text-align: right; }

/* ═══ Map ═══ */
#panel-map { position: relative; }
#map { flex: 1; width: 100%; z-index: 1; background: #f2f2f2; }

.floor-switch {
    display: flex; gap: 2px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 8px; padding: 3px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.floor-btn {
    padding: 6px 12px; background: none; border: none;
    color: #666; font-family: var(--font-sans); font-size: 11px; font-weight: 600;
    cursor: pointer; border-radius: 6px; transition: all 0.2s; white-space: nowrap;
}
.floor-btn.active { background: var(--cyan-deep); color: #fff; box-shadow: 0 1px 6px rgba(7, 111, 114, 0.3); }
.floor-btn:hover:not(.active) { color: #333; background: rgba(0, 0, 0, 0.05); }

/* Leaflet popup overrides — light style for Positron tiles */
.leaflet-popup-content-wrapper {
    background: #fff !important; color: #333 !important;
    border: 1px solid #ddd !important; border-radius: 8px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important;
}
.leaflet-popup-tip { background: #fff !important; }
.leaflet-popup-content { font-family: var(--font-sans) !important; font-size: 12px !important; margin: 8px 12px !important; }

/* ═══ Misc ═══ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(56, 120, 160, 0.3); border-radius: 2px; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; color: var(--text-muted); text-align: center; gap: 6px; }
.empty-state .empty-icon { font-size: 32px; } .empty-state .empty-title { font-size: 14px; font-weight: 500; color: var(--text-secondary); }



/* ===== Locate + Compass Control ===== */
.locate-control { margin-bottom: 8px !important; }
.locate-btn {
    width: 40px; height: 40px;
    background: #fff;
    border: 2px solid rgba(0,0,0,0.15);
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: all 0.2s;
}
.locate-btn:hover { background: #f5f5f5; }
.locate-btn.active { border-color: #4285F4; box-shadow: 0 0 0 2px rgba(66,133,244,0.2), 0 2px 8px rgba(0,0,0,0.12); }
.locate-btn.compass { border-color: var(--amber); box-shadow: 0 0 0 2px rgba(238,155,0,0.28), 0 2px 8px rgba(0,0,0,0.12); }

/* ── Blue direction cone (follow mode) — like Google Maps sector ── */
.loc-cone-icon { background: none !important; border: none !important; }
.loc-cone {
    width: 60px; height: 60px;
    position: relative;
    display: none;
    transition: transform 0.15s linear;
}
.loc-cone::before {
    content: '';
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 0; height: 0;
    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
    border-bottom: 28px solid rgba(66,133,244,0.3);
    filter: drop-shadow(0 0 3px rgba(66,133,244,0.2));
}

/* ── Compass Rose (top-left corner, compass mode only) ── */
.compass-rose {
    position: absolute;
    top: 12px; left: 12px;
    z-index: 1000;
    width: 52px; height: 52px;
    pointer-events: none;
    transition: opacity 0.3s;
}
.compass-rose.hidden { opacity: 0; pointer-events: none; }
.compass-ring {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: rgba(255,255,255,0.92);
    border: 2px solid rgba(0,0,0,0.12);
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    position: relative;
    transition: transform 0.15s linear;
}
.compass-n {
    position: absolute;
    top: 3px; left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 800;
    color: #d32f2f;
    line-height: 1;
}
.compass-needle {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 4px; height: 30px;
}
.compass-needle::before {
    content: '';
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 0; height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 14px solid #d32f2f;
}
.compass-needle::after {
    content: '';
    position: absolute;
    bottom: 0; left: 50%;
    transform: translateX(-50%);
    width: 0; height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 12px solid rgba(0, 95, 115, 0.95);
}

/* Map rotation */
#panel-map { overflow: hidden; position: relative; }
#map { transition: transform 0.15s linear; will-change: transform; }
.leaflet-control-container { transition: transform 0.15s linear; }

/* ===== Location Hint Overlay ===== */
.loc-hint {
    position: absolute; bottom: 60px; left: 50%; transform: translateX(-50%);
    z-index: 1000; width: calc(100% - 32px); max-width: 320px;
    animation: hintFadeIn 0.3s ease-out;
}
@keyframes hintFadeIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
.loc-hint-inner {
    background: rgba(0, 95, 115, 0.95); backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.25); border-radius: 12px;
    padding: 14px 16px; color: #fff;
}
.loc-hint-title { font-size: 13px; font-weight: 700; margin-bottom: 10px; color: var(--teal-light); }
.loc-hint-steps { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.loc-hint-step { display: flex; align-items: center; gap: 8px; font-size: 12px; line-height: 1.4; color: var(--text-secondary); }
.loc-hint-step b { color: var(--text-primary); }
.loc-hint-icon { font-size: 16px; flex-shrink: 0; width: 24px; text-align: center; }
.loc-hint-note { font-size: 10px; color: var(--text-muted); margin-bottom: 10px; padding-left: 32px; }
.loc-hint-close {
    display: block; width: 100%; padding: 8px;
    background: var(--cyan-deep); color: #fff; border: none; border-radius: 8px;
    font-family: var(--font-sans); font-size: 13px; font-weight: 600; cursor: pointer;
}

/* ═══ 方位識別徽章 —— 東翼暖／西翼冷 ═══
   登機門號碼本身帶色，旅客一眼就知道要往哪個方向走。 */
.wing-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 700; line-height: 1.6;
    color: #fff;
}
.wing-pill.east { background: var(--wing-east); color: var(--ink); }
.wing-pill.west { background: #076f72; color: #fff; }
.wing-pill.none { background: var(--text-muted); }

/* 登機門指引步驟依方位著色 */
.gate-guide.east { border-left: 4px solid var(--wing-east); }
.gate-guide.west { border-left: 4px solid var(--wing-west); }

/* 地圖圖例 */
.map-legend {
    position: absolute; left: 10px; bottom: 22px; z-index: 500;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--border); border-radius: 10px;
    padding: 8px 10px; font-size: 11px; line-height: 1.9;
    box-shadow: 0 2px 10px rgba(0, 18, 25, 0.12);
    max-width: 45vw;
}
.map-legend b { display: block; font-size: 11px; color: var(--text-secondary); margin-bottom: 2px; font-weight: 700; }
.map-legend i {
    display: inline-block; width: 10px; height: 10px; border-radius: 3px;
    margin-right: 5px; vertical-align: -1px; border: 1px solid rgba(0,0,0,0.15);
}
@media (max-width: 380px) { .map-legend { font-size: 10px; padding: 6px 8px; } }

/* ═══ Header 右側：回官網 ═══ */
.header-right { display: flex; align-items: center; gap: 10px; }
.back-site {
    color: #fff; text-decoration: none;
    font-size: 11px; font-weight: 500;
    padding: 3px 10px; border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    white-space: nowrap;
}
.back-site:hover, .back-site:focus-visible { background: rgba(255, 255, 255, 0.18); }
.back-site:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
