/* ══════════════════════════════════════════════════════════════
   PERMISSIONS OVERLAY - Character-driven sensor onboarding
   White hat: fun, inviting, "Not now" always respected
   ══════════════════════════════════════════════════════════════ */

.permission-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 25, 20, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 210;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.permission-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.permission-overlay.exiting {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.permission-content {
    width: 90%;
    max-width: 340px;
    background: linear-gradient(180deg, rgba(248, 240, 224, 0.98) 0%, #ece0c8 100%);
    border: 3px solid #4a3728;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: permissionSlideIn 0.3s ease-out;
}

@keyframes permissionSlideIn {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Dialogue area (tappable to advance) */
.permission-dialogue-area {
    padding: 20px;
    cursor: pointer;
    min-height: 120px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    -webkit-tap-highlight-color: transparent;
}

.permission-portrait {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid #4a3728;
    overflow: hidden;
    flex-shrink: 0;
    background: #d8c8a8;
}

.permission-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.permission-text-wrap {
    flex: 1;
}

.permission-speaker {
    font-size: 13px;
    font-weight: 700;
    color: #6a9050;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
    font-family: 'Nunito', sans-serif;
}

.permission-text {
    font-size: 14px;
    line-height: 1.5;
    color: #4a3728;
    font-family: 'Georgia', serif;
}

.permission-tap-hint {
    text-align: center;
    font-size: 13px;
    color: #9a8a7a;
    padding: 0 20px 8px;
    font-family: 'Nunito', sans-serif;
}

/* Buttons (hidden until all dialogue lines shown) */
.permission-buttons {
    display: flex;
    gap: 10px;
    padding: 0 20px 20px;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, max-height 0.3s ease;
}

.permission-buttons.visible {
    opacity: 1;
    max-height: 60px;
    pointer-events: auto;
}

.permission-btn-allow {
    flex: 1;
    background: linear-gradient(180deg, #6a9050 0%, #4a7030 100%);
    color: white;
    border: 2px solid #3a5020;
    border-radius: 10px;
    padding: 12px 12px;
    min-height: 48px;
    box-sizing: border-box;
    font-size: 13px;
    font-weight: bold;
    font-family: 'Georgia', serif;
    cursor: pointer;
    transition: transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    text-align: center;
    min-width: 0;
}

.permission-btn-allow:active {
    transform: scale(0.96);
}

.permission-btn-skip {
    flex: 0 0 auto;
    background: transparent;
    color: #7a6a5a;
    border: 2px solid rgba(90, 70, 50, 0.3);
    border-radius: 10px;
    padding: 12px 16px;
    min-height: 48px;
    box-sizing: border-box;
    font-size: 13px;
    font-family: 'Georgia', serif;
    cursor: pointer;
    transition: transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}

.permission-btn-skip:active {
    transform: scale(0.96);
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    .permission-content {
        background: linear-gradient(180deg, rgba(40, 35, 30, 0.98) 0%, #2a2520 100%);
        border-color: rgba(180, 160, 130, 0.5);
    }
    .permission-text {
        color: #e0d5c5;
    }
    .permission-speaker {
        color: #8ab860;
    }
    .permission-portrait {
        border-color: rgba(180, 160, 130, 0.5);
        background: #3a3530;
    }
    .permission-tap-hint {
        color: #6a5a4a;
    }
    .permission-btn-skip {
        color: #d0c0b0;
        border-color: rgba(180, 160, 130, 0.3);
    }
}
