:root {
  color-scheme: light;
  --orange: #F08C28;
  --orange-dark: #D4761A;
  --ink: #26303B;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #15171c;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", sans-serif;
  overscroll-behavior: none;
  /* 連點兩下不要縮放。meta 的 user-scalable=no 被 iOS Safari 忽略，真正有效的是這個。
     設在畫布上還不夠 —— 點在 HUD、面板或畫面周圍的留白就管不到了，
     而瀏覽器是看觸控點那一路祖先的交集，所以掛在最外層一次擋完。
     manipulation 只拿掉雙擊縮放，捲動與雙指縮放都還在，面板裡的長清單照樣滑得動。 */
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

#stage {
  --pad: 12px;
  /* 加到主畫面後狀態列與 Home indicator 會疊在畫面上方／下方，要先把那兩條讓出來，
     否則廣告列會被 Home indicator 壓住。桌機兩個值都是 0。 */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--pad) + var(--safe-t)) var(--pad) calc(var(--pad) + var(--safe-b));
}

/* 遊戲畫面 + 廣告列。
   尺寸要從視窗直接算出來，不能讓 frame 的寬度參照 screen、screen 的高度又參照 frame ——
   那是循環依賴，瀏覽器會把廣告列壓成 0 高。
   先算出遊戲畫面能用多高（扣掉廣告列、超寬螢幕時改以寬度為準），寬度再由 9:16 推回去。 */
#frame {
  --ad-h: 50px;          /* 標準行動橫幅高度；要改成大橫幅就設 100px */
  /* 這裡不能用 %：同一個變數拿去算 width 時，百分比會改成參照父元素的「寬度」，
     算出來的畫面比例會整個歪掉。一律用視口單位。 */
  --avail-h: calc(100vh - var(--pad) * 2 - var(--safe-t) - var(--safe-b));
  --avail-h: calc(100dvh - var(--pad) * 2 - var(--safe-t) - var(--safe-b));   /* 支援的瀏覽器用動態視口高，行動裝置才不會被位址列影響 */
  --game-h: min(calc(var(--avail-h) - var(--ad-h)), calc((100vw - var(--pad) * 2) * 16 / 9));
  display: flex;
  flex-direction: column;
  width: calc(var(--game-h) * 9 / 16);
  height: calc(var(--game-h) + var(--ad-h));
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 12px 44px rgba(0, 0, 0, 0.55);
}

#screen {
  position: relative;
  flex: none;
  width: 100%;
  height: var(--game-h);
  overflow: hidden;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
  cursor: pointer;
}

/* 廣告位。空的時候是一條深色底，不會看起來像破圖 */
#adslot {
  flex: none;
  width: 100%;
  height: var(--ad-h);
  background: #101922;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#adslot > * {
  max-width: 100%;
  max-height: 100%;
}

#hud-btns {
  position: absolute;
  top: 3.2%;
  right: 4%;
  display: flex;
  gap: 8px;
  align-items: center;
  /* 要蓋在 overlay 之上 —— 音效開關在主選單也必須點得到 */
  z-index: 20;
}

#back, #mute, #reload {
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.34);
  color: #fff;
  font: 600 15px/1 inherit;
  cursor: pointer;
  backdrop-filter: blur(3px);
}
#back { padding: 0; width: 46px; height: 46px; font-size: 24px; line-height: 1; }
#mute { width: 38px; height: 34px; font-size: 16px; }
/* 跟音效鈕同尺寸。字級要大一些 —— ⟳ 是一般字元，同樣 16px 看起來比 emoji 小一圈 */
#reload { width: 38px; height: 34px; font-size: 20px; }
#back:hover, #mute:hover, #reload:hover { background: rgba(0, 0, 0, 0.5); }

/* ── Overlay ── */

#overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 7%;
  background: rgba(18, 26, 20, 0.74);
  backdrop-filter: blur(6px);
}
#overlay.is-open { display: flex; }

.panel {
  width: 100%;
  max-width: 460px;
  padding: 30px 26px 26px;
  border-radius: 26px;
  background: #FBFDF6;
  text-align: center;
  color: var(--ink);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
}

.panel h1 {
  margin: 0 0 6px;
  font-size: clamp(22px, 5.4vw, 30px);
  letter-spacing: 0.5px;
}
.panel h2 { margin: 10px 0 4px; font-size: clamp(20px, 5vw, 27px); }
.panel .sub { margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #6B7A69; }
.panel .hint { margin: 18px 0 4px; font-size: 14px; color: #8A968A; }

/* 機場列表。一列一座 —— 路線圖的亞洲有十八座，橫排到第五座就開始換行了。
   整列可捲動，上下用遮罩淡出暗示還有內容。 */
.airport-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 46vh;
  overflow-y: auto;
  margin-bottom: 14px;
  scrollbar-width: none;
}

.airport-list::-webkit-scrollbar { display: none; }

.ap-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: 1px solid rgba(60, 76, 92, 0.14);
  background: #FFFFFF;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  text-align: left;
}

.ap-row:disabled {
  background: #F3F5F7;
  border-color: transparent;
  cursor: default;
}

.ap-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.ap-name {
  font-size: 16px;
  font-weight: 700;
  color: #27323D;
}

.ap-row:disabled .ap-name { color: #A7B1BB; }

.ap-meta {
  font-size: 12px;
  color: #8A98A8;
}

.ap-progress {
  flex: none;
  font-size: 13px;
  font-weight: 700;
  color: #E8701A;
}

.acts {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.airport {
  flex: 1;
  padding: 11px 4px;
  border: 2px solid #E3E9DC;
  border-radius: 15px;
  background: #fff;
  color: var(--ink);
  font: 600 14px/1.3 inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.airport small { font-size: 11px; color: #9AA698; font-weight: 500; }
.airport.is-active { border-color: var(--orange); background: #FFF6EC; }
.airport:disabled { opacity: 0.45; cursor: not-allowed; }

.levels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 9px;
}
.lv {
  aspect-ratio: 1;
  border: 0;
  border-radius: 14px;
  background: #E8EFE0;
  color: var(--ink);
  font: 700 19px/1 inherit;
  cursor: pointer;
}
.lv:hover { background: #DCE6D2; }
.lv.is-done { background: var(--orange); color: #fff; }
.lv.is-locked { background: #F0F2EE; color: #C3CCBF; cursor: not-allowed; }

/* ── 結算 ── */

.panel--result .badge {
  width: 66px;
  height: 66px;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 30px;
  color: #fff;
}
.panel--result.is-win .badge { background: #4FAE5A; }
.panel--result.is-lose .badge { background: #E05B4B; }

.panel .score {
  margin: 4px 0 22px;
  font-size: 40px;
  font-weight: 800;
  color: var(--orange);
}
.panel .score span { font-size: 19px; color: #A9B4A6; font-weight: 600; }

.actions { display: flex; flex-direction: column; gap: 9px; }
.actions button {
  padding: 14px;
  border: 0;
  border-radius: 15px;
  font: 700 16px/1 inherit;
  cursor: pointer;
}
.actions .primary { background: var(--orange); color: #fff; }
.actions .primary:hover { background: var(--orange-dark); }
.actions .ghost { background: #EDF1E8; color: #5C6A5A; }
.actions .ghost:hover { background: #E982DC22; background-color: #E2E8DC; }

@media (max-width: 760px) {
  #stage { --pad: 0px; padding: 0; }
  #frame { border-radius: 0; box-shadow: none; }
}

/* 語言切換。放在選單最下面，字小、低調 —— 大部分人設定一次就不會再碰。 */
/* 國家列。機場會越加越多，先用國家分層，選單才不會被按鈕淹掉。
   超過一行就橫向捲動，不要讓它把關卡格擠下去。 */
.countries {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.countries::-webkit-scrollbar { display: none; }

.country {
  flex: none;
  border: none;
  background: transparent;
  color: #8A98A8;
  font-size: 14px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.country.is-active {
  background: rgba(46, 155, 230, 0.14);
  color: #1F7FC2;
}

.country:disabled {
  color: #BFC8D2;
  cursor: default;
}

.langs {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
}

.lang {
  border: 1px solid rgba(60, 76, 92, 0.22);
  background: transparent;
  color: #6B7A8C;
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.lang.is-active {
  background: #2E9BE6;
  border-color: #2E9BE6;
  color: #fff;
}

/* 結算的星等。比分數更早被看到，所以放在標題正下方。 */
.stars-row {
  margin: 6px 0 2px;
  font-size: 30px;
  letter-spacing: 6px;
  color: #F0A82E;
}

.stars-note {
  margin: 0 0 4px;
  font-size: 13px;
  color: #8A98A8;
}

/* 關卡格：通關的顯示關卡號與拿到的星數 */
.lv-num { display: block; font-size: 15px; line-height: 1.1; }

.lv-stars {
  display: block;
  font-size: 10px;
  letter-spacing: 1px;
  color: #C98A1F;
  margin-top: 2px;
}

/* 通關的格子是橘底，星星要用白色才看得清楚 */
.lv.is-done .lv-num { color: #FFFFFF; }
.lv.is-done .lv-stars { color: #FFFFFF; }

/* 圖示按鈕。文字只留在 aria-label —— 玩的人可能還不識字，
   但點擊區一定要夠大（48px 是手指的下限）。
   選擇器要比 `.actions button` 更明確，否則會被舊的那條整個蓋掉。 */
.icon-btn,
.actions .icon-btn,
.acts .icon-btn {
  box-sizing: border-box;
  padding: 0;                   /* .actions button 的 padding 會把尺寸撐開 */
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  border: 1px solid rgba(60, 76, 92, 0.16);
  background: #FFFFFF;
  color: #5A6A7A;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn.is-primary,
.actions .icon-btn.is-primary {
  background: #E8701A;
  border-color: #E8701A;
  color: #FFFFFF;
}

.icon-btn:active { transform: scale(0.95); }

.panel--result .actions {
  display: flex;
  flex-direction: row;          /* .actions 預設是直排，圖示按鈕要並排 */
  justify-content: center;
  gap: 12px;
}

/* ─────────────── 機庫 ─────────────── */

/* 金幣。畫一個圓就夠了，用 emoji 在各平台長得不一樣，大小也對不齊。 */
.coin {
  display: inline-block;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: linear-gradient(160deg, #FFDF72, #EFA417);
  border: 2px solid #D4870F;
  box-shadow: inset 0 -2px 0 rgba(160, 100, 6, 0.25);
  flex: none;
}

/* 主選單的入口：金幣數字本身就是按鈕，不另外放「機庫」兩個字 */
.coin-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;            /* 手指點擊區的下限 */
  padding: 0 20px;
  border-radius: 18px;
  border: 1px solid rgba(60, 76, 92, 0.16);
  background: #FFFFFF;
  color: #3C4A3A;
  font-size: 19px;
  font-weight: 800;
  cursor: pointer;
}
.coin-btn:active { transform: scale(0.96); }

/* 買得起新機型時在金幣按鈕上掛一顆紅點。
   第二階以上的飛機全部要花錢，玩家得先知道「現在買得起了」才會點進機庫 ——
   這是不靠文字就能傳達的提示。脈動放得很慢，不是閃光。 */
.coin-btn.has-deal { position: relative; }
.coin-btn.has-deal::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 8px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #E2574C;
  box-shadow: 0 0 0 2px #FFFFFF;
  animation: deal-pulse 1.8s ease-in-out infinite;
}
@keyframes deal-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.22); opacity: 0.78; }
}
@media (prefers-reduced-motion: reduce) {
  .coin-btn.has-deal::after { animation: none; }
}

.panel--hangar .coins-big {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 2px 0 16px;
  font-size: 27px;
  font-weight: 800;
  color: #3C4A3A;
}
.panel--hangar .coins-big .coin { width: 23px; height: 23px; }

.fleet { display: flex; flex-direction: column; gap: 10px; }

.fleet-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 2px solid #E3E9DC;
  border-radius: 16px;
  background: #FFFFFF;
}

/* 機型就靠剪影大小分辨，所以三種的差距要拉得夠開才看得出來 */
.plane {
  flex: none;
  width: 58px;
  display: flex;
  justify-content: center;
}
.plane svg {
  /* 直接乘 scale，不加基底值 —— 加了基底就把三種機型的差距壓掉，
     看起來一樣大。這裡的比例跟場上的飛機完全一致。 */
  width: calc(var(--s) * 48px);
  fill: #6B7C8C;
}

.cap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 68px;
  font-size: 21px;
  font-weight: 800;
  color: #3C4A3A;
}
.cap .person { width: 15px; height: 15px; fill: #E8701A; flex: none; }

/* 主選單只顯示存了多少，不是入口 —— 機庫按鈕在各機場的關卡頁 */
.coins-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 10px 0 0;
  font-size: 19px;
  font-weight: 800;
  color: #5A6A7A;
}

/* 還沒解鎖的那幾列淡一點，一眼分得出「已經會來」跟「花錢才會來」 */
.fleet-row.is-locked { background: #F7F8F4; border-color: #EDF0E8; }
.fleet-row.is-locked .plane svg { fill: #AEB8C2; }
.fleet-row.is-locked .cap { color: #94A0AC; }
.fleet-row.is-locked .cap .person { fill: #B6BFC8; }

.buy {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 15px;
  border-radius: 14px;
  border: none;
  background: #E8701A;
  color: #FFFFFF;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
}
.buy:active { transform: scale(0.96); }
/* 買不起就看得出來是買不起，而不是沒反應 */
.buy.is-poor {
  background: #E6E9E3;
  color: #9AA69C;
  cursor: default;
}
.buy.is-poor .coin { filter: grayscale(1); opacity: 0.55; }

.owned {
  min-width: 74px;
  text-align: center;
  font-size: 22px;
  color: #5BA85B;
}

/* 結算畫面那行「這一關賺到多少」 */
.panel--result .earned {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 6px 0 0;
  font-size: 22px;
  font-weight: 800;
  color: #3C4A3A;
}


/* ─────────────── 教學小動畫 ─────────────── */

.panel--tutorial { text-align: center; }

.tut-scene {
  width: 100%;
  border-radius: 16px;
  background: #A8D96B;          /* 跟遊戲裡的草地同一個綠 */
  overflow: hidden;
}
.tut-scene svg { display: block; width: 100%; height: auto; }

.tut-runway { fill: #8D99A3; }
.tut-taxi { stroke: #8D99A3; stroke-width: 20; stroke-linecap: round; fill: none; }
.tut-stand { fill: #F0F3EA; stroke: #D7DED0; stroke-width: 2; }
.tut-plane { fill: #F0F3EA; stroke: #3C4A3A; stroke-width: 1.6; stroke-linejoin: round; }
.tut-plane-mil { fill: #5D7A52; }
.tut-pax { fill: #E8701A; }
.tut-ring { fill: none; stroke: #E04A3A; stroke-width: 3; }
/* 跟遊戲裡的指令按鈕同一個樣子：藍色圓角方塊加白箭頭。
   畫成空心圓圈的話，說明寫「點箭頭」但畫面上根本沒有箭頭。 */
.tut-tap rect { fill: #2E9BE6; }
.tut-tap .tut-arrow { fill: #FFFFFF; }
/* 指派登機門的箭頭指向登機門（左），起飛的指向跑道外（上，path 本來就朝上） */
.tut-gate .tut-arrow { transform: rotate(-90deg); }

.tut-say {
  margin: 12px 0 0;
  font-size: 16px;
  font-weight: 700;
  color: #3C4A3A;
}

.tut-dots { display: flex; justify-content: center; gap: 7px; margin-top: 10px; }
.tut-dots span {
  width: 7px; height: 7px; border-radius: 50%;
  background: #D7DED0;
}
.tut-dots span.is-on { background: #E8701A; }

/* 每一步的動作。飛機的機鼻朝上（rotate 0），所以往下飛是 180、往左滑是 -90。
   全部 infinite：玩家看不懂可以一直看，不用倒帶。 */
.tut-plane { animation-iteration-count: infinite; animation-timing-function: ease-in-out; }

.tut-land .tut-plane { animation-name: tut-land; animation-duration: 2.8s; }
@keyframes tut-land {
  0%   { transform: translate(190px, -24px) rotate(180deg); }
  55%  { transform: translate(190px, 92px) rotate(180deg); }
  100% { transform: translate(190px, 92px) rotate(180deg); }
}

.tut-gate .tut-plane { animation-name: tut-gate; animation-duration: 3s; }
@keyframes tut-gate {
  /* 朝下是 180、朝左是 270。寫成 -90 的話最終朝向雖然一樣，
     但 CSS 是照數值插值的 —— 180 → -90 會一路往回繞，變成逆時針轉 270 度。
     飛機頭朝南、右轉進滑行道，就是順時針 +90。 */
  0%   { transform: translate(190px, 92px) rotate(180deg); }
  20%  { transform: translate(190px, 92px) rotate(180deg); }
  32%  { transform: translate(190px, 92px) rotate(270deg); }
  80%  { transform: translate(86px, 92px) rotate(270deg); }
  100% { transform: translate(86px, 92px) rotate(270deg); }
}
.tut-gate .tut-tap { animation: tut-tap-gate 3s infinite; }
@keyframes tut-tap-gate {
  0%, 8%    { transform: translate(53px, 92px) scale(0); opacity: 0; }
  16%       { transform: translate(53px, 92px) scale(1); opacity: 1; }
  24%       { transform: translate(53px, 92px) scale(0.84); opacity: 1; }   /* 被按下去 */
  32%       { transform: translate(53px, 92px) scale(1); opacity: 1; }
  44%, 100% { transform: translate(53px, 92px) scale(1); opacity: 0; }
}

.tut-board .tut-plane { transform: translate(86px, 92px) rotate(270deg); animation: none; }
.tut-board .tut-pax { animation: tut-board-pax 2.2s infinite; }
@keyframes tut-board-pax {
  0%   { transform: translate(53px, 92px); opacity: 1; }
  70%  { transform: translate(72px, 92px); opacity: 1; }
  100% { transform: translate(72px, 92px); opacity: 0; }
}

.tut-takeoff .tut-plane { animation-name: tut-takeoff; animation-duration: 2.8s; }
@keyframes tut-takeoff {
  0%   { transform: translate(190px, 92px) rotate(0deg); }
  25%  { transform: translate(190px, 92px) rotate(0deg); }
  100% { transform: translate(190px, -26px) rotate(0deg); }
}
.tut-takeoff .tut-tap { animation: tut-tap-takeoff 2.8s infinite; }
@keyframes tut-tap-takeoff {
  0%, 4%    { transform: translate(190px, 126px) scale(0); opacity: 0; }
  12%       { transform: translate(190px, 126px) scale(1); opacity: 1; }
  18%       { transform: translate(190px, 126px) scale(0.84); opacity: 1; }
  24%       { transform: translate(190px, 126px) scale(1); opacity: 1; }
  34%, 100% { transform: translate(190px, 126px) scale(1); opacity: 0; }
}

.tut-urgent .tut-plane { animation-name: tut-gate; animation-duration: 3.2s; }
.tut-urgent .tut-ring { animation: tut-ring 1.1s infinite; }
@keyframes tut-ring { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

.tut-transfer .tut-plane { transform: translate(86px, 92px) rotate(270deg); animation: none; }
.tut-transfer .tut-pax { animation: tut-walk 3.4s infinite; }
@keyframes tut-walk {
  0%   { transform: translate(72px, 92px); opacity: 0; }
  12%  { transform: translate(72px, 92px); opacity: 1; }
  50%  { transform: translate(100px, 68px); opacity: 1; }
  88%  { transform: translate(60px, 44px); opacity: 1; }
  100% { transform: translate(60px, 44px); opacity: 0; }
}

/* 軍機先佔住跑道，客機在等待線上停著 */
.tut-military .tut-plane:not(.tut-plane-mil) {
  transform: translate(86px, 92px) rotate(270deg);
  animation: none;
}
.tut-military .tut-plane-mil { animation-name: tut-mil; animation-duration: 3.4s; }
@keyframes tut-mil {
  0%   { transform: translate(190px, 130px) rotate(0deg); opacity: 1; }
  30%  { transform: translate(190px, 92px) rotate(0deg); opacity: 1; }
  45%  { transform: translate(190px, 92px) rotate(0deg); opacity: 1; }
  100% { transform: translate(190px, -26px) rotate(0deg); opacity: 1; }
}

.tut-list { display: flex; flex-direction: column; gap: 8px; }
.tut-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border: 2px solid #E3E9DC;
  border-radius: 15px;
  background: #fff;
  font-size: 16px;
  font-weight: 700;
  color: #3C4A3A;
  cursor: pointer;
  text-align: left;
}
.tut-row:active { transform: scale(0.98); }
.tut-row-icon { font-size: 20px; width: 26px; text-align: center; }

/* 隱私權政策的連結。投放廣告的硬性要求，但它不是遊戲功能，所以放得很輕 */
.privacy-link {
  display: block;
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  color: #9AA69C;
  text-decoration: none;
}
.privacy-link:hover { text-decoration: underline; }

/* 選跑道（關西）：飛機停在兩條跑道中間，左右各閃一次，表示兩邊都能走 */
.tut-runway .tut-plane { transform: translate(110px, 92px) rotate(0deg); animation: none; }
.tut-runway .tut-tap { animation: tut-tap-pick 3s infinite; }
@keyframes tut-tap-pick {
  0%, 6%    { transform: translate(150px, 92px) scale(0); opacity: 0; }
  14%       { transform: translate(150px, 92px) scale(1); opacity: 1; }
  28%       { transform: translate(150px, 92px) scale(1); opacity: 1; }
  34%, 46%  { transform: translate(150px, 92px) scale(1); opacity: 0; }
  54%       { transform: translate(70px, 92px) scale(1); opacity: 1; }
  74%       { transform: translate(70px, 92px) scale(1); opacity: 1; }
  82%, 100% { transform: translate(70px, 92px) scale(1); opacity: 0; }
}

/* 已經全破的機場：沉在清單後段，顏色也退一階 —— 它仍然點得進去重玩，
   只是不該跟「接下來要打的」搶注意力 */
.ap-row.is-cleared { background: #F7F8F4; border-color: #E8ECE2; }
.ap-row.is-cleared .ap-name { color: #7D8A78; }
.ap-row.is-cleared .ap-progress { color: #9AA69C; }


/* ── 塗裝圖鑑 ──
   一格一家航空，沒見過的留成灰影。
   格子排成網格，手機上一列三個 —— 一眼看得出「還有多少沒收集」。 */
.lang--icon { padding: 0 12px; }
.lang--icon svg { width: 20px; height: 20px; display: block; fill: currentColor; }

.liveries {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 4px 0 14px;
}
.livery {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px 8px;
  border-radius: 14px;
  background: #F4F2EC;
}
 /* 52px 是尾翼那一小塊還看得出顏色的下限 —— 塗裝的辨識度一半在它身上 */
.livery svg { width: 52px; height: 52px; display: block; }
.livery span {
  font-size: 11px;
  font-weight: 700;
  color: #5A6152;
  text-align: center;
  line-height: 1.25;
}
/* 還沒見過：整格壓灰，問號代替名字 —— 不必寫字就知道這格是空的 */
.livery.is-locked { background: #ECEAE4; }
.livery.is-locked span { color: #A8ACA2; }


/* ── 無盡模式入口 ──
   只在這座機場全破之後出現。用 ∞ 當圖示，旁邊是最佳紀錄 ——
   沒有紀錄時放一條短槓，不寫「尚未挑戰」那種句子。 */
.endless-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  margin: 4px 0 2px;
  padding: 0 18px;
  border: none;
  border-radius: 18px;
  background: linear-gradient(135deg, #3C4A6B, #5B6E99);
  color: #FFFFFF;
  cursor: pointer;
}
.endless-btn:active { transform: scale(0.98); }
.endless-icon { font-size: 26px; font-weight: 800; line-height: 1; }
.endless-best { font-size: 19px; font-weight: 800; opacity: 0.92; }

/* 結算畫面的最佳紀錄 */
.panel--result .best {
  margin: -4px 0 10px;
  font-size: 16px;
  font-weight: 700;
  color: #7A8168;
}
.panel--result .best.is-new { color: #E8A317; }


/* ── 結算畫面：這一局新發現的塗裝 ──
   彈進來一下就停。玩家可能是小孩，不要做會持續閃動的東西。 */
.new-liveries {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 2px 0 10px;
}
.new-livery {
  display: block;
  padding: 6px;
  border-radius: 12px;
  background: #FFF6DC;
  animation: livery-pop 0.42s ease-out both;
}
.new-livery:nth-child(2) { animation-delay: 0.1s; }
.new-livery:nth-child(3) { animation-delay: 0.2s; }
.new-livery svg { width: 34px; height: 34px; display: block; }
@keyframes livery-pop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .new-livery { animation: none; }
}


/* ── 塗裝詳細頁 ── */
.panel--livery .side-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px 0 16px;
  padding: 10px 6px;
  border-radius: 18px;
  background: linear-gradient(170deg, #DCEFF8, #EFF6EC);
}
.panel--livery .side { width: 100%; max-width: 330px; height: auto; display: block; }

/* 圖鑑的格子現在可以點開 */
.livery { border: none; font: inherit; cursor: pointer; }
.livery:disabled { cursor: default; }
.livery:not(:disabled):active { transform: scale(0.96); }

/* ── 結算畫面：點一下才冒出名字 ── */
.new-livery { position: relative; border: none; font: inherit; cursor: pointer; }
.new-livery .bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 7px);
  transform: translateX(-50%) scale(0.8);
  padding: 4px 10px;
  border-radius: 10px;
  background: #3C4A3A;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
/* 泡泡下緣的小三角 */
.new-livery .bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #3C4A3A;
}
.new-livery.is-open .bubble { opacity: 1; transform: translateX(-50%) scale(1); }


/* ── 隱藏機場 ──
   沒買的只顯示問號：買之前就知道是哪座機場的話，那個「？」就白放了。 */
.secrets { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 14px; }
.secret-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #F4F2EC;
}
.secret-row.is-owned { background: #EAF4E4; }
.secret-text { display: flex; flex-direction: column; gap: 2px; }
.secret-name { font-size: 16px; font-weight: 800; color: #3C4A3A; }
.secret-meta { font-size: 12px; font-weight: 700; color: #7A8168; }
.secret-buy, .secret-go {
  min-height: 40px;
  padding: 0 16px;
  border: none;
  border-radius: 14px;
  background: #E8A317;
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}
.secret-go { background: #4C9A3F; padding: 0 20px; }
.secret-buy:active, .secret-go:active { transform: scale(0.96); }
.secret-buy.is-poor { background: #D8D4CA; color: #9A9A92; cursor: default; }
.lang--icon.has-deal { position: relative; }
.lang--icon.has-deal::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #E2574C;
  box-shadow: 0 0 0 2px #FFFFFF;
}


/* ── 景點卡 ── */
.panel--spot .spot-art {
  margin: 0 0 12px;
  padding: 8px;
  border-radius: 20px;
  background: linear-gradient(170deg, #EDF5FA, #F7F4E9);
}
.panel--spot .spot-canvas { width: 100%; display: block; }
/* 說明是兩三句話，置中會變成一行一行對不齊，靠左才讀得順 */
.panel--spot .spot-text {
  margin: 6px 2px 18px;
  font-size: 15px;
  line-height: 1.78;
  color: #5A6B5C;
  text-align: left;
}
