/* css/styles.css */

/* Utilities */
.pt-safe {
    padding-top: calc(env(safe-area-inset-top) + 0.75rem) !important;
}

.pb-safe {
    padding-bottom: env(safe-area-inset-bottom) !important;
}
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.dense-grid { grid-auto-flow: dense; }

/* -----------------------------
   CORE LAYOUT (STRICT FIX)
   ----------------------------- */
/* Locking body to fixed prevents iOS from miscalculating height on rotation */
html, body {
    margin: 0;
    padding: 0;
    background-color: #0a0a0a;
    overscroll-behavior: none; /* Prevents "bounce" */
    touch-action: manipulation;
    
    /* THE FIX: Pin document to window edges */
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; 
    z-index: 0;
}

#app {
    /* App fills the pinned body */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Only the main section scrolls */
    z-index: 1;
}

main {
    flex: 1; /* Fills all available space between Header and Nav */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    padding-bottom: 20px;
    width: 100%;
}

/* Transitions */
.fade-enter-active, .fade-leave-active { transition: opacity 0.2s ease; }
.fade-enter-from, .fade-leave-to { opacity: 0; }
.slide-up-enter-active, .slide-up-leave-active { transition: transform 0.3s ease-out; }
.slide-up-enter-from, .slide-up-leave-to { transform: translateY(100%); }

/* Modal Fixes */
.landscape-modal { width: 90vw !important; max-width: 800px !important; height: auto !important; max-height: 80vh !important; }

/* Grid Headers */
.group-header { grid-column: 1 / -1; margin-top: 1.5rem; margin-bottom: 0.5rem; border-bottom: 1px solid #333; padding-bottom: 0.25rem; }
.group-header h3 { font-size: 0.85rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; color: #9ca3af; }

/* Card Placeholder */
.card-placeholder { width: 100%; height: 100%; background: #1a1a1a; border: 2px solid #333; border-radius: 0.5rem; display: flex; flex-direction: column; padding: 0.5rem; position: absolute; top: 0; left: 0; box-sizing: border-box; overflow: hidden; }
.cp-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #444; padding-bottom: 0.25rem; margin-bottom: 0.25rem; }
.cp-cost { background: #ec1d24; color: white; font-weight: bold; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; flex-shrink: 0; }
.cp-title { font-size: 0.7rem; font-weight: bold; color: #fff; text-transform: uppercase; text-align: right; line-height: 1; }
.cp-type { font-size: 0.6rem; color: #888; text-align: center; font-style: italic; margin-bottom: 0.5rem; flex-shrink: 0; }
.cp-text { flex-grow: 1; font-size: 0.6rem; color: #ccc; background: #252525; padding: 0.25rem; border-radius: 0.25rem; overflow: hidden; line-height: 1.3; }

/* Modal Placeholder Overrides */
.modal-placeholder { position: relative !important; z-index: 10; }
.modal-placeholder .cp-cost { width: 40px; height: 40px; font-size: 1.2rem; }
.modal-placeholder .cp-title { font-size: 1.2rem; }
.modal-placeholder .cp-type { font-size: 1rem; margin-bottom: 1rem; }
.modal-placeholder .cp-text { font-size: 0.9rem; padding: 1rem; line-height: 1.5; }

/* Mockup Stats Overlay */
.mockup-stats-overlay {
    position: absolute;
    top: 60px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 20;
    pointer-events: none; 
}

.mockup-stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    color: black;
    border: 2px solid rgba(0,0,0,0.2);
    box-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

/* Aspects */
.border-Aggression { border-color: #dc2626; } .border-Justice { border-color: #eab308; } .border-Leadership { border-color: #3b82f6; } .border-Protection { border-color: #16a34a; } .border-Basic { border-color: #9ca3af; } .border-Pool { border-color: #ec4899; }
.bg-aspect-Aggression { background-color: #dc2626; } .bg-aspect-Justice { background-color: #eab308; } .bg-aspect-Leadership { background-color: #3b82f6; } .bg-aspect-Protection { background-color: #16a34a; } .bg-aspect-Basic { background-color: #6b7280; } .bg-aspect-Pool { background-color: #ec4899; } .bg-aspect-Hero { background-color: #ec1d24; }

/* Stat Colors */
.stat-thw { background-color: #93c5fd; }
.stat-atk { background-color: #fca5a5; }
.stat-def { background-color: #86efac; }
.stat-hp  { background-color: #d1d5db; }

/* Mobile Viewport */
.h-screen-safe { height: 100vh; height: 100dvh; }

.header-toggler { display: none; }

.custom-modal-input { background: #2d2d2d; border: 1px solid #444; color: white; padding: 0.5rem; border-radius: 0.25rem; width: 100%; margin-top: 0.5rem; }
.custom-modal-input:focus { outline: none; border-color: #ec1d24; }

.install-step { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; text-align: left; font-size: 0.9rem; color: #ccc; }
.install-icon { font-size: 1rem; background: #333; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 6px; flex-shrink: 0; color: #fff; }

.deck-list-placeholder {
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
}

/* -----------------------------
   TRANSLATION OVERLAY
   ----------------------------- */
/* Base Overlay Style */
/* Base Overlay Style */
.translation-overlay {
    position: absolute;
    z-index: 25;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(3px);
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    pointer-events: none;
    overflow: hidden;
}

/* Vertical Cards: Bottom 40% (2/5ths) */
.overlay-vertical {
    top: 60%;
    bottom: 0;
    left: 0;
    right: 0;
    border-top: 1px solid rgba(255,255,255,0.15);
}

/* Horizontal Cards: Right 50% (Halfway) */
.overlay-horizontal {
    top: 0;
    bottom: 0;
    left: 50%; /* CHANGED: Starts halfway */
    right: 0;
    border-left: 1px solid rgba(255,255,255,0.15);
}


/* -----------------------------
   NAV & PWA SPACING (COMPACT FIX)
   ----------------------------- */

/* 1. Default Behavior (Browser View) 
   We keep the +16px padding here so browser toolbars don't cover the buttons. */
.pwa-nav-fix {
    padding-bottom: calc(env(safe-area-inset-bottom) + 16px) !important;
    flex-shrink: 0;
    width: 100%;
    z-index: 50;
    background-color: rgba(10, 10, 10, 0.95);
    border-top: 1px solid #1f2937;
}

/* 2. PWA Specific Overrides (Only when installed) */
html.is-pwa-context .pwa-nav-fix {
    /* CHANGE THIS LINE: 
       Use a small fixed number (e.g., 10px or 15px) instead of 'env(...)'.
       This pushes the buttons down into the swipe-bar area. */
    padding-bottom: 0px !important;
    
    padding-top: 10px !important;
}

/* Target the SVG Icon inside the PWA nav to remove the gap */
html.is-pwa-context .pwa-nav-fix svg {
    margin-bottom: 0px !important;
}

/* Adjust text position slightly to feel tighter */
html.is-pwa-context .pwa-nav-fix span {
    margin-top: 1px;
}