/* ═══════════════════════════════════════════════════════════════════════════
   🚀 PİLOT GİRİŞİ (pilot-intro.js) — senaryo, pilot adı, tarz seçimi, lisans
   Yatay telefon öncelikli: yükseklik 320px'e kadar sığar.
   Sadece transform/opacity animasyonu (GPU) — blur/backdrop-filter yok.
   ═══════════════════════════════════════════════════════════════════════════ */

.pi-root {
    position: fixed;
    inset: 0;
    z-index: 10020; /* modallerin üstü, oyun içi onay penceresinin (10050) altı */
    background: #02040a;
    color: #e8fbff;
    font-family: 'Orbitron', sans-serif;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    animation: pi-fade-in 0.6s ease-out;
}
.pi-root.pi-out { animation: pi-fade-out 0.5s ease-in forwards; pointer-events: none; }

/* Giriş açıkken alttaki lobi görünmez → tarayıcı onu ve sürekli animasyonlarını boyamaz */
body.pi-open .main-screen-wrapper { visibility: hidden; }

.pi-stars { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pi-vignette {
    position: absolute; inset: 0; pointer-events: none;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(80, 0, 140, 0.18), transparent 55%),
        radial-gradient(ellipse at 80% 75%, rgba(0, 90, 160, 0.16), transparent 55%),
        radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.75) 100%);
}

/* ── Üst çubuk ─────────────────────────────────────────────────────────── */
.pi-top {
    position: absolute; top: 0; left: 0; right: 0; z-index: 3;
    display: flex; justify-content: space-between; align-items: center;
    padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
}
.pi-top button {
    font-family: inherit; font-size: 11px; letter-spacing: 1px;
    color: rgba(232, 251, 255, 0.75);
    background: rgba(0, 20, 35, 0.55);
    border: 1px solid rgba(0, 234, 255, 0.25);
    border-radius: 20px; padding: 7px 14px; cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}
.pi-top button:hover { color: #fff; border-color: rgba(0, 234, 255, 0.7); }

.pi-dots {
    position: absolute; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 3;
    transform: translateX(-50%); display: flex; gap: 7px;
}
.pi-dots span { width: 6px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.18); transition: all 0.3s; }
.pi-dots span.done { background: rgba(0, 234, 255, 0.5); }
.pi-dots span.on { width: 20px; background: #00eaff; box-shadow: 0 0 8px #00eaff; }

/* ── Sahne ─────────────────────────────────────────────────────────────── */
.pi-stage {
    position: absolute; inset: 0; z-index: 2;
    display: flex; align-items: center; justify-content: center;
    padding: 44px max(16px, env(safe-area-inset-right)) 26px max(16px, env(safe-area-inset-left));
    box-sizing: border-box;
}
.pi-enter { animation: pi-rise 0.55s cubic-bezier(.2, .9, .3, 1.15) both; }

/* ── Senaryo ───────────────────────────────────────────────────────────── */
.pi-story { max-width: 720px; text-align: center; cursor: pointer; }
.pi-story-title {
    font-size: clamp(26px, 7vh, 54px); font-weight: 900; letter-spacing: 0.18em;
    color: #fff;
    text-shadow: 0 0 18px rgba(0, 234, 255, 0.85), 0 0 42px rgba(0, 140, 255, 0.45);
    animation: pi-title-in 1s ease-out both;
}
.pi-story-line {
    height: 2px; width: 0; margin: 2.2vh auto;
    background: linear-gradient(90deg, transparent, #00eaff, transparent);
    animation: pi-line 0.9s 0.3s ease-out forwards;
}
.pi-rest { visibility: hidden; } /* daktilo: henüz yazılmamış kısım yer tutar */
.pi-story-text {
    min-height: 3.4em; margin: 0;
    font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
    font-size: clamp(15px, 3.6vh, 22px); line-height: 1.55; letter-spacing: 0.02em;
    color: rgba(232, 251, 255, 0.92);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
}
.pi-tap {
    margin-top: 3vh; font-size: 11px; letter-spacing: 3px; text-transform: uppercase;
    color: rgba(0, 234, 255, 0.85); opacity: 0; transition: opacity 0.4s;
}
.pi-tap.show { opacity: 1; animation: pi-blink 1.6s ease-in-out infinite; }

/* ── Ortak panel parçaları ─────────────────────────────────────────────── */
.pi-panel {
    width: min(420px, 92vw); padding: 22px 26px; box-sizing: border-box; text-align: center;
    background: linear-gradient(180deg, rgba(0, 28, 48, 0.92), rgba(0, 10, 22, 0.94));
    border: 1px solid rgba(0, 234, 255, 0.35); border-radius: 16px;
    box-shadow: 0 0 40px rgba(0, 160, 255, 0.18), inset 0 0 24px rgba(0, 234, 255, 0.06);
}
.pi-kicker { font-size: 10px; letter-spacing: 3px; color: rgba(0, 234, 255, 0.7); margin-bottom: 8px; }
.pi-title {
    font-size: clamp(16px, 4.6vh, 24px); font-weight: 900; letter-spacing: 0.12em; color: #fff;
    text-shadow: 0 0 14px rgba(0, 234, 255, 0.6);
}
.pi-sub {
    margin: 0.8vh 0 2vh; font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
    font-size: clamp(11px, 2.6vh, 14px); color: rgba(232, 251, 255, 0.65);
}
.pi-label {
    display: block; margin: 14px 0 8px; font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
    font-size: 14px; color: rgba(232, 251, 255, 0.8);
}
.pi-input {
    width: 100%; box-sizing: border-box; padding: 12px 14px;
    font-family: 'Orbitron', sans-serif; font-size: 18px; letter-spacing: 3px; text-align: center; text-transform: uppercase;
    color: #fff; background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(0, 234, 255, 0.45); border-radius: 10px; outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.pi-input:focus { border-color: #00eaff; box-shadow: 0 0 16px rgba(0, 234, 255, 0.35); }
.pi-input::placeholder { color: rgba(232, 251, 255, 0.3); letter-spacing: 2px; }
.pi-input.err { border-color: #ff3366; animation: pi-shake 0.4s; }

.pi-btn {
    margin-top: 16px; padding: 12px 28px; min-height: 44px;
    font-family: 'Orbitron', sans-serif; font-size: 13px; font-weight: 900; letter-spacing: 2px;
    color: #001018; background: linear-gradient(135deg, #00eaff, #0090ff);
    border: none; border-radius: 10px; cursor: pointer;
    box-shadow: 0 0 22px rgba(0, 200, 255, 0.45);
    transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
}
.pi-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 0 32px rgba(0, 220, 255, 0.7); }
.pi-btn:active:not(:disabled) { transform: scale(0.97); }
.pi-btn:disabled { opacity: 0.4; cursor: default; box-shadow: none; filter: grayscale(0.6); }

/* ── Tarz seçimi ───────────────────────────────────────────────────────── */
.pi-class { width: 100%; max-width: 920px; text-align: center; }
.pi-cards { display: flex; gap: clamp(8px, 1.6vw, 16px); justify-content: center; }
.pi-card {
    --c: #00eaff; --cr: 0, 234, 255;
    flex: 1 1 0; min-width: 0; max-width: 210px;
    display: flex; flex-direction: column; align-items: stretch;
    padding: 1.4vh 10px 1.6vh; box-sizing: border-box;
    font-family: inherit; color: inherit; text-align: center; cursor: pointer;
    background: linear-gradient(180deg, rgba(0, 24, 42, 0.92), rgba(0, 8, 18, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 14px;
    position: relative; overflow: hidden;
    transition: transform 0.25s cubic-bezier(.2, .9, .3, 1.3), border-color 0.25s, box-shadow 0.25s;
}
.pi-card::before { /* tarz rengiyle üst parıltı */
    content: ''; position: absolute; left: 0; right: 0; top: 0; height: 45%;
    background: radial-gradient(ellipse at 50% 0%, var(--c), transparent 70%);
    opacity: 0.14; transition: opacity 0.25s; pointer-events: none;
}
.pi-cards .pi-card:nth-child(1) { animation: pi-rise 0.5s 0.05s both; }
.pi-cards .pi-card:nth-child(2) { animation: pi-rise 0.5s 0.12s both; }
.pi-cards .pi-card:nth-child(3) { animation: pi-rise 0.5s 0.19s both; }
.pi-cards .pi-card:nth-child(4) { animation: pi-rise 0.5s 0.26s both; }
.pi-card:hover { border-color: var(--c); transform: translateY(-4px); }
.pi-card.sel {
    border-color: var(--c); transform: translateY(-6px) scale(1.03);
    box-shadow: 0 0 26px rgba(var(--cr), 0.55), inset 0 0 18px rgba(var(--cr), 0.18);
}
.pi-card.sel::before { opacity: 0.38; }
.pi-cards.has-sel .pi-card:not(.sel) { opacity: 0.6; }

.pi-card-role {
    font-size: clamp(11px, 2.8vh, 15px); font-weight: 900; letter-spacing: 0.1em; color: var(--c);
    text-shadow: 0 0 10px rgba(var(--cr), 0.6);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative;
}
.pi-card-ship { height: clamp(56px, 20vh, 130px); display: flex; align-items: center; justify-content: center; position: relative; }
.pi-card-ship img {
    height: 100%; max-width: 100%; object-fit: contain; position: relative; /* parıltının (::before) üstünde */
    transform: rotate(-90deg); /* sprite sağa bakıyor → yukarı */
}
/* Sadece seçili gemi süzülür (4 gemi birden zayıf telefonda pahalı); gölge yerine sabit parıltı */
.pi-card-ship::before {
    content: ''; position: absolute; width: 70%; aspect-ratio: 1; border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--cr), 0.28), transparent 65%);
}
.pi-card.sel .pi-card-ship img { animation: pi-float 1.8s ease-in-out infinite; will-change: transform; }
.pi-card-desc {
    font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
    font-size: clamp(10px, 2.4vh, 12.5px); line-height: 1.35; color: rgba(232, 251, 255, 0.75);
    min-height: 2.7em; margin-bottom: 0.8vh; position: relative;
}
.pi-stats { display: flex; flex-direction: column; gap: 0.6vh; position: relative; }
.pi-stat { display: flex; align-items: center; gap: 6px; font-size: 8.5px; letter-spacing: 0.5px; color: rgba(232, 251, 255, 0.55); }
.pi-stat span { width: 42%; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-stat i { flex: 1; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.pi-stat b { display: block; height: 100%; border-radius: 3px; background: var(--c); transform-origin: left; animation: pi-bar 0.9s 0.35s cubic-bezier(.2, .9, .3, 1) both; }
.pi-class .pi-btn { margin-top: 2.2vh; }

/* ── Pilot lisansı ─────────────────────────────────────────────────────── */
.pi-license-wrap { display: flex; flex-direction: column; align-items: center; }
.pi-license {
    --c: #00eaff; --cr: 0, 234, 255;
    width: min(440px, 88vw); padding: 16px 18px; box-sizing: border-box; position: relative; overflow: hidden;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 40%),
        linear-gradient(180deg, #0a2236, #04111d);
    border: 1px solid rgba(var(--cr), 0.6); border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(var(--cr), 0.25);
    animation: pi-card-flip 0.8s cubic-bezier(.2, .9, .3, 1.1) both;
}
.pi-lic-head { display: flex; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 1px dashed rgba(255, 255, 255, 0.15); }
.pi-lic-head > i { font-size: 26px; color: var(--c); }
.pi-lic-academy { font-size: 9px; letter-spacing: 2px; color: rgba(232, 251, 255, 0.55); }
.pi-lic-title { font-size: 16px; font-weight: 900; letter-spacing: 3px; color: #fff; }
.pi-lic-body { display: flex; gap: 14px; padding-top: 12px; align-items: center; }
.pi-lic-photo {
    width: clamp(70px, 22vh, 104px); aspect-ratio: 1; flex: none; position: relative;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle, rgba(var(--cr), 0.22), rgba(0, 0, 0, 0.35));
    border: 1px solid rgba(var(--cr), 0.4); border-radius: 10px;
}
.pi-lic-photo img { width: 88%; transform: rotate(-90deg); }
.pi-lic-photo > i { position: absolute; right: 5px; bottom: 5px; font-size: 13px; color: var(--c); }
.pi-lic-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.pi-lic-row { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); padding-bottom: 4px; }
.pi-lic-row span { font-size: 9px; letter-spacing: 1px; color: rgba(232, 251, 255, 0.5); white-space: nowrap; }
.pi-lic-row b { font-size: 12px; letter-spacing: 1px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-lic-row:nth-child(2) b { color: var(--c); }
.pi-lic-stamp {
    position: absolute; right: 16px; top: 12px;
    padding: 4px 10px; font-size: 13px; font-weight: 900; letter-spacing: 2px;
    color: #3dff8f; border: 2px solid #3dff8f; border-radius: 6px;
    text-shadow: 0 0 8px rgba(61, 255, 143, 0.6); box-shadow: 0 0 10px rgba(61, 255, 143, 0.35);
    transform: rotate(-12deg); opacity: 0;
    animation: pi-stamp 0.45s 0.85s cubic-bezier(.3, 1.6, .5, 1) forwards;
}
.pi-lic-shine { /* hologram parıltısı bir kez geçer */
    position: absolute; top: 0; bottom: 0; width: 40%; left: -60%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.16), transparent);
    animation: pi-shine 1.2s 1.3s ease-in-out both; pointer-events: none;
}
.pi-go { animation: pi-rise 0.5s 1.4s both; }

/* ── Kısa ekran (yatay telefon) ────────────────────────────────────────── */
@media (max-height: 430px) {
    .pi-stage { padding-top: 38px; padding-bottom: 20px; }
    .pi-panel { padding: 14px 20px; }
    .pi-label { margin: 8px 0 6px; font-size: 12px; }
    .pi-input { padding: 9px 12px; font-size: 16px; }
    .pi-btn { margin-top: 10px; padding: 9px 22px; min-height: 40px; font-size: 12px; }
    .pi-card { padding-left: 7px; padding-right: 7px; }
    .pi-stat { font-size: 7.5px; }
    .pi-license { padding: 12px 14px; }
    .pi-lic-body { padding-top: 8px; }
    .pi-lic-fields { gap: 5px; }
}
/* Dar ve dik ekran: kartlar 2x2 */
@media (max-width: 560px) and (min-height: 600px) {
    .pi-cards { flex-wrap: wrap; }
    .pi-card { flex: 1 1 40%; max-width: none; }
}

@keyframes pi-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pi-fade-out { to { opacity: 0; transform: scale(1.04); } }
@keyframes pi-rise { from { opacity: 0; transform: translateY(18px) scale(0.97); } to { opacity: 1; transform: none; } }
/* Harf aralığı sabit (eskiden daralıyordu → yazı sağa sola kayıyordu); yerinde netleşerek belirir */
@keyframes pi-title-in { from { opacity: 0; transform: scale(1.06); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes pi-line { to { width: min(60%, 360px); } }
@keyframes pi-blink { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@keyframes pi-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes pi-float { 0%, 100% { transform: rotate(-90deg) translateX(0); } 50% { transform: rotate(-90deg) translateX(6px); } }
@keyframes pi-bar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes pi-card-flip { from { opacity: 0; transform: perspective(800px) rotateY(-70deg) scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes pi-stamp { from { opacity: 0; transform: rotate(-12deg) scale(2.6); } to { opacity: 1; transform: rotate(-12deg) scale(1); } }
@keyframes pi-shine { from { left: -60%; } to { left: 120%; } }

@media (prefers-reduced-motion: reduce) {
    .pi-root *, .pi-root { animation-duration: 0.01ms !important; animation-delay: 0s !important; }
}
