/* Escadrille — styles (le jeu est sur canvas, les écrans sont des surcouches HTML) */
:root { --top: #0b1e2b; --panel: rgba(8, 22, 32, .88); --line: rgba(242, 210, 75, .35); --gold: #f2d24b; --text: #f3efe4; --muted: #b9c3c9; --green: #7cff9a; --red: #e0574b; --sab: env(safe-area-inset-bottom, 0px); --sat: env(safe-area-inset-top, 0px); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--top); overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--text); -webkit-user-select: none; user-select: none; touch-action: none; overscroll-behavior: none; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h1, h2 { margin: 0; font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: 2px; }
[hidden] { display: none !important; }

/* splash */
#splash { position: fixed; inset: 0; z-index: 50; background: linear-gradient(180deg, #1f6f9a, #0b1e2b); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; transition: opacity .45s; }
#splash.hide { opacity: 0; pointer-events: none; }
canvas.splash-plane { width: 190px; height: 150px; display: block; filter: drop-shadow(0 8px 14px rgba(0,0,0,.5)); }
@keyframes fly { from { transform: rotate(-90deg) translateX(-6px); } to { transform: rotate(-90deg) translateX(6px); } }
.splash-title { font-family: ui-monospace, Menlo, monospace; font-size: 30px; letter-spacing: 6px; color: var(--gold); text-shadow: 0 2px 0 #000; }
.splash-bar { width: 160px; height: 4px; background: rgba(255, 255, 255, .15); border-radius: 2px; overflow: hidden; }
.splash-bar i { display: block; height: 100%; width: 40%; background: var(--gold); animation: bar 1.1s ease-in-out infinite; }
@keyframes bar { 0% { transform: translateX(-100%); } 100% { transform: translateX(400%); } }

/* surcouches */
.screen { position: fixed; inset: 0; z-index: 10; display: none; align-items: center; justify-content: center; padding: calc(var(--sat) + 16px) 16px calc(var(--sab) + 16px); background: rgba(3, 10, 16, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.screen.active { display: flex; }
#screen-title { background: rgba(3, 10, 16, .35); }
.box, .title-box { width: min(92vw, 380px); background: var(--panel); border: 2px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; box-shadow: 0 16px 50px rgba(0, 0, 0, .6); max-height: 92vh; overflow-y: auto; }
canvas.title-plane { width: 150px; height: 120px; display: block; margin: -6px auto -10px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.45)); }
.plane-name { margin: 0; font-family: ui-monospace, Menlo, monospace; font-size: 11px; letter-spacing: 3px; color: var(--muted); text-transform: uppercase; }
.title-box h1 { font-size: 34px; letter-spacing: 8px; color: var(--gold); text-shadow: 0 3px 0 #000; }
.sub { margin: 0; font-family: ui-monospace, Menlo, monospace; letter-spacing: 3px; color: var(--muted); font-size: 13px; }
.best { margin: 0; color: var(--gold); font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.foot { margin: 4px 0 0; font-size: 11px; color: var(--muted); } .foot a { color: var(--gold); }
.btn { padding: 12px 18px; border-radius: 10px; font-weight: 800; font-size: 15px; background: rgba(255, 255, 255, .1); border: 2px solid rgba(255, 255, 255, .18); font-family: ui-monospace, Menlo, monospace; letter-spacing: 1px; }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(180deg, #7cff9a, #2fa85c); color: #06210f; border-color: transparent; }
.btn.gold { background: linear-gradient(180deg, #f3d27a, #cfa03a); color: #3b2a00; border-color: transparent; }
.btn.danger { color: #ff8b80; }
.btn.big { width: 100%; font-size: 20px; padding: 16px; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(124, 255, 154, .15); } }
.btn.wide { width: 100%; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; width: 100%; }
.row-btns .btn { flex: 1; min-width: 100px; font-size: 13px; padding: 10px 8px; }
.row { display: flex; justify-content: space-between; align-items: center; width: 100%; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, .1); font-size: 14px; }
.switch { appearance: none; -webkit-appearance: none; width: 46px; height: 26px; border-radius: 13px; background: #3d4a45; position: relative; flex: 0 0 auto; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch:checked { background: #2fa85c; } .switch:checked::after { transform: translateX(20px); }
input[type=range] { width: 130px; }
.muted { color: var(--muted); font-size: 13px; margin: 0; }
.over-score { display: flex; flex-direction: column; align-items: center; font-family: ui-monospace, Menlo, monospace; }
.over-score b { font-size: 36px; color: var(--gold); }
.newbest { margin: 0; color: var(--green); font-weight: 800; letter-spacing: 2px; animation: pulse 1.2s infinite; }
.submit { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.submit input { font: inherit; padding: 12px; border-radius: 10px; border: 2px solid rgba(255, 255, 255, .2); background: rgba(0, 0, 0, .3); color: var(--text); text-align: center; -webkit-user-select: text; user-select: text; }
.ok { margin: 0; color: var(--green); font-size: 13px; }
.lb { width: 100%; border-collapse: collapse; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.lb td { padding: 6px 4px; border-top: 1px solid rgba(255, 255, 255, .1); text-align: left; }
.lb td:nth-child(3) { text-align: right; color: var(--gold); }
.lb tr.me td { background: rgba(242, 210, 75, .12); font-weight: 800; }
#btn-pause { position: fixed; top: calc(var(--sat) + 34px); right: 10px; z-index: 5; width: 36px; height: 36px; border-radius: 10px; background: rgba(0, 0, 0, .4); color: #fff; font-family: ui-monospace, Menlo, monospace; font-weight: 900; border: 1px solid rgba(255, 255, 255, .25); }
#toast { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); z-index: 62; background: rgba(0, 0, 0, .65); border: 2px solid var(--line); color: var(--gold); font-family: ui-monospace, Menlo, monospace; font-weight: 800; letter-spacing: 1px; padding: 8px 14px; border-radius: 10px; max-width: 90vw; text-align: center; pointer-events: none; animation: toastIn .25s ease-out; }
.ac-msg { margin: 10px 0 0; min-height: 15px; font-size: 12px; line-height: 1.4; text-align: center; color: #9fe0b4; }
.ac-msg.bad { color: #ff9a8a; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }
#ad-modal { position: fixed; inset: 0; z-index: 60; background: #000; display: flex; align-items: center; justify-content: center; color: #fff; text-align: center; }
.ad-box { width: min(90vw, 340px); }
.ad-title { font-size: 12px; letter-spacing: 3px; color: #888; margin-bottom: 12px; }
.ad-fake { border: 1px dashed #444; border-radius: 12px; padding: 36px 16px; font-size: 40px; background: #111; } .ad-fake small { font-size: 13px; color: #aaa; }
#ad-count { margin-top: 12px; color: #aaa; font-family: ui-monospace, Menlo, monospace; }

.diff { display: flex; gap: 6px; justify-content: center; margin: 8px 0 2px; }
.diff button { background: rgba(255,255,255,0.08); color: #cfe2ee; border: 1px solid rgba(255,255,255,0.18); border-radius: 999px; padding: 6px 14px; font-size: 12px; font-weight: 700; cursor: pointer; }
.diff button.on { background: #ffd84a; color: #2b2100; border-color: #ffd84a; }
.diff-hint { font-size: 10px; color: rgba(207,226,238,0.7); margin: 0 0 10px; text-align: center; line-height: 1.4; }

/* Carte de campagne et hangar */
.coins { font-size: 13px; color: #ffd84a; font-weight: 700; margin: 2px 0 6px; letter-spacing: .04em; }
.wide-box { max-width: 460px; width: 100%; }
.map-sum { color: #ffd84a; font-weight: 700; font-size: 13px; margin: 0 0 10px; }
.mcard { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; text-align: left; }
.mcard.locked { opacity: .5; }
.mcard header { display: flex; align-items: baseline; gap: 8px; font-size: 13px; margin-bottom: 8px; }
.mcard header b { color: #ffd84a; letter-spacing: .05em; font-size: 11px; }
.mcard header span { flex: 1; font-weight: 600; }
.mcard header i { font-style: normal; color: #cfe2ee; font-size: 12px; }
.dots { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
button.dot { cursor: pointer; font: inherit; }
button.dot:hover { border-color: rgba(255,216,74,0.9); }
.dot { background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.14); border-radius: 10px; padding: 5px 8px; text-align: center; min-width: 52px; }
.dot b { display: block; font-size: 11px; color: #cfe2ee; }
.dot i { font-style: normal; font-size: 10px; color: rgba(255,255,255,0.4); letter-spacing: 1px; }
.dot.done { border-color: rgba(255,216,74,0.6); } .dot.done i { color: #ffd84a; }
.dot.off { opacity: .55; }
#shop-content h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: #9fc0d6; margin: 14px 0 8px; text-align: left; }
.shop-row { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); border-radius: 12px; padding: 9px 11px; margin-bottom: 8px; text-align: left; }
.shop-row .si { flex: 1; min-width: 0; }
.shop-row .si b { display: block; font-size: 13px; }
.shop-row .si small { color: rgba(207,226,238,0.75); font-size: 11px; line-height: 1.4; display: block; }
.shop-row .pips { color: #ffd84a; font-size: 11px; letter-spacing: 2px; margin-top: 2px; }
.shop-row .owned { color: #7cff9a; font-size: 12px; font-weight: 700; }
.shop-row .btn { white-space: nowrap; }
.shop-row canvas.pv { width: 64px; height: 64px; flex: 0 0 64px; background: radial-gradient(ellipse at 40% 30%, rgba(42,127,174,0.5), rgba(23,85,127,0.5)); border-radius: 10px; }
.small { font-size: 11px; line-height: 1.5; }

/* Écran quotidien */
.dstreak { display: flex; align-items: center; gap: 10px; justify-content: space-between; background: rgba(255,216,74,0.10); border: 1px solid rgba(255,216,74,0.35); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.dstreak b { color: #ffd84a; font-size: 13px; }
.dcard { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); border-radius: 12px; padding: 12px; margin-bottom: 12px; text-align: left; }
.dcard h3 { margin: 0 0 4px; font-size: 14px; }
.dinfo { color: #cfe2ee; font-size: 13px; font-weight: 600; margin: 8px 0; }
.dscore { color: #7cff9a; font-weight: 700; font-size: 14px; margin: 6px 0 2px; }
.dsec { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: #9fc0d6; margin: 14px 0 8px; text-align: left; }
.pbar { height: 5px; background: rgba(0,0,0,0.35); border-radius: 3px; margin: 5px 0 3px; overflow: hidden; }
.pbar i { display: block; height: 100%; background: #ffd84a; }
.btn.badge { position: relative; }
.btn.badge::after { content: ''; position: absolute; top: 4px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: #ff5a5a; box-shadow: 0 0 0 2px rgba(0,0,0,0.35); }

/* Écran de résultats */
.res-stage { font-size: 13px; color: #cfe2ee; font-weight: 600; margin: 0 0 4px; }
.res-stars { font-size: 30px; color: #ffd84a; letter-spacing: 6px; margin: 2px 0 10px; }
table.res { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 8px; }
table.res td { padding: 6px 4px; border-bottom: 1px solid rgba(255,255,255,0.1); text-align: left; }
table.res td:last-child { text-align: right; font-weight: 700; color: #ffd84a; }
.res-near { color: #9fd3ff; font-size: 12px; font-weight: 600; margin: 8px 0; }

#screen-title { background: linear-gradient(180deg, rgba(3,10,16,.15), rgba(3,10,16,.55)); }
.title-box { backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }

/* Hangar : onglets, grille, fiche avion */
.tabs { display: flex; gap: 4px; margin: 0 0 12px; border-bottom: 1px solid rgba(255,255,255,.14); width: 100%; }
.tab { flex: 1; padding: 9px 6px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: 1px; border-bottom: 2px solid transparent; font-family: ui-monospace, Menlo, monospace; }
.tab.on { color: var(--gold); border-bottom-color: var(--gold); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; width: 100%; }
.tile { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; padding: 8px 6px; display: flex; flex-direction: column; align-items: center; gap: 3px; position: relative; }
.tile.cur { border-color: rgba(255,216,74,.7); background: rgba(255,216,74,.10); }
.tile b { font-size: 12px; } .tile span { font-size: 11px; color: var(--gold); font-weight: 700; }
.tile small { font-size: 10px; color: var(--muted); line-height: 1.35; text-align: center; }
.tile .lv { position: absolute; top: 6px; right: 8px; font-style: normal; font-size: 10px; color: #7cff9a; font-weight: 800; }
.tile .btn { padding: 6px 10px; font-size: 11px; margin-top: 2px; }
.tile .owned { font-size: 11px; color: #7cff9a; font-weight: 700; }
.sheet { text-align: center; width: 100%; }
.sheet h3 { margin: 4px 0 2px; font-size: 16px; }
.sheet canvas.big { width: 128px; height: 128px; }
.stat { display: flex; align-items: center; gap: 8px; margin: 5px 0; font-size: 11px; color: var(--muted); }
.stat span { width: 92px; text-align: left; text-transform: uppercase; letter-spacing: .05em; }
.stat i { flex: 1; height: 7px; background: rgba(0,0,0,.35); border-radius: 4px; overflow: hidden; }
.stat i b { display: block; height: 100%; background: linear-gradient(90deg, #f2d24b, #7cff9a); }
.btn.ghost { background: rgba(255,255,255,.06); }
.btn.back { align-self: flex-start; padding: 6px 12px; font-size: 12px; margin-bottom: 6px; }

.code { font-family: ui-monospace, Menlo, monospace; font-size: 24px; letter-spacing: 4px; color: var(--gold); margin: 8px 0; text-align: center; }
#sync-content input { width: 100%; background: rgba(0,0,0,.3); border: 1px solid rgba(255,255,255,.2); border-radius: 8px; color: #fff; padding: 10px; font-family: ui-monospace, Menlo, monospace; font-size: 16px; letter-spacing: 3px; text-align: center; text-transform: uppercase; margin-bottom: 8px; }
#sync-content .dcard h3 { font-size: 13px; margin-bottom: 6px; }

.user { font-size: 12px; color: #9fd3ff; font-weight: 700; margin: 0 0 4px; }
#account-content input { width: 100%; background: rgba(0,0,0,.3); border: 1px solid rgba(255,255,255,.2); border-radius: 8px; color: #fff; padding: 11px; font-size: 15px; margin-bottom: 8px; }
#account-content .dcard { padding: 12px; }
#account-content .row-btns { margin-top: 8px; }
