:root {
    --primary-color: #ff4757;
    --accent-color: #ffd32a;
    --bg-dark: #1e272e;
    --panel-bg: #2f3640;
    --text-light: #f1f2f6;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    overflow: hidden;
}

#app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
}

/* --- Visual Area (Top) --- */
#visual-area {
    position: relative;
    flex: 1;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    width: 100%;
}

#camera-feed {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    overflow: hidden;
    transition: width 0.3s, height 0.3s;
}

#camera-feed video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* AI Overlay */
/* AI Chat Bubble Style - PREMIUM */


#pose-guide-overlay {
    position: absolute;
    bottom: 22%;
    left: 20px;
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 12px;
    z-index: 9999;
    pointer-events: auto;
    cursor: grab;
    user-select: none;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s;
}

#pose-guide-overlay.visible {
    opacity: 1 !important;
}

/* 2D Person Avatar Style */
.ai-avatar-wrapper {
    width: 48px;
    height: 48px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 2px solid #0076FF;
    flex-shrink: 0;
}

/* Chat Bubble - White & Perfectly Rounded */
.ai-chat-bubble {
    background: #ffffff;
    padding: 14px 22px;
    border-radius: 20px 20px 20px 4px;
    color: #000000 !important;
    font-weight: 800;
    font-size: 1.05rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    position: relative;
    line-height: 1.4;
    min-width: 150px;
    max-width: 270px;
    margin-top: -45px;
}

/* Bubble Tail */
.ai-chat-bubble::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: -10px;
    width: 20px;
    height: 20px;
    background: #ffffff;
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

#ai-message-text {
    display: block;
    color: #000000 !important;
}

/* Success state bubble */
#pose-guide-overlay[data-status="success"] .ai-chat-bubble {
    background: #2ed573;
    color: #ffffff !important;
}

#pose-guide-overlay[data-status="success"] .ai-chat-bubble #ai-message-text {
    color: #ffffff !important;
}


#pose-guide-overlay[data-status="success"] .ai-chat-bubble::after {
    background: #2ed573;
}


.canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 60;
}

.privacy-banner {
    position: absolute;
    top: 10px;
    width: 100%;
    text-align: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    pointer-events: none;
    z-index: 20;
}

/* ========================================
   MODERN CAMERA CONTROLS
   ======================================== */

#controls-area {
    position: relative;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.9) 30%);
    padding: 20px 0 30px 0;
    z-index: 100;
}

/* Scenario Selector (Horizontal Scroll) */
.scenario-selector {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Firefox */
    margin-bottom: 20px;
}

.scenario-selector::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari */
}

.scenario-scroll {
    display: flex;
    gap: 12px;
    padding: 0 20px;
    min-width: min-content;
}

.scenario-btn {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 12px;
}

.scenario-btn.active {
    background: rgba(255, 255, 255, 0.15);
}

.scenario-icon {
    font-size: 1.8rem;
    filter: grayscale(100%);
    opacity: 0.6;
    transition: all 0.3s ease;
}

.scenario-btn.active .scenario-icon {
    filter: grayscale(0%);
    opacity: 1;
    transform: scale(1.1);
}

.scenario-name {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.scenario-btn.active .scenario-name {
    color: #fff;
    font-weight: 600;
}

/* Modern Bottom Controls */
.modern-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    max-width: 500px;
    margin: 0 auto;
}

.btn-control-modern {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.btn-control-modern:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.2);
}

.control-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Capture Group (Center) */
.capture-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* Aspect Ratio Button */
.btn-aspect-ratio {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.aspect-text {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.btn-aspect-ratio:active {
    transform: scale(0.95);
    background: rgba(0, 0, 0, 0.7);
}

/* Capture Button */
.btn-capture-modern {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #fff;
    border: 4px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.btn-capture-modern::before {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background: #fff;
    transition: all 0.2s ease;
}

.btn-capture-modern:active {
    transform: scale(0.9);
}

.btn-capture-modern:active::before {
    inset: 10px;
}

/* Editor Controls (Hidden by default) */
#editor-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--panel-bg);
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 200;
}

#editor-controls.active {
    transform: translateY(0);
}

.editor-menu {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    overflow-x: auto;
}

.btn-tab {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.btn-tab.active {
    background: var(--primary-color);
    color: #fff;
}

.tools-panel {
    display: none;
    gap: 10px;
    flex-wrap: wrap;
}

.tools-panel.active {
    display: flex;
}

.btn-filter,
.btn-sticker {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-filter:active,
.btn-sticker:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0.95);
}

.editor-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    gap: 10px;
}

.btn-text {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary-color);
    border: none;
    color: #fff;
    padding: 12px 32px;
    border-radius: 24px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:active {
    transform: scale(0.95);
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Share Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.modal-content {
    background: var(--panel-bg);
    border-radius: 20px;
    padding: 30px;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
}

.modal-header h2 {
    margin: 0 0 20px 0;
    font-size: 1.5rem;
}

.modal-preview img {
    max-width: 100%;
    border-radius: 12px;
    margin-bottom: 20px;
}

.share-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-share-option {
    padding: 14px 20px;
    border-radius: 12px;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-native {
    background: var(--primary-color);
    color: #fff;
}

.btn-copy {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-download {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-close-modal {
    margin-top: 20px;
    padding: 12px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    border-radius: 12px;
    cursor: pointer;
}