/* Reset */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
    overscroll-behavior: none;
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: fixed; /* Lock the root container to prevent rubber-banding */
    touch-action: none; /* Block default browser gestures at the root */
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100dvh;
    transition: background-color 0.4s ease;
}


/* Corner Glows (Blurred Shapes simulating Radial Gradients) */
.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(180px);
    z-index: -1;
    opacity: 0.4;
}
.bg-shape-1 {
    width: 300px; height: 300px;
    top: -50px; left: -50px;
    background: var(--primary);
}
.bg-shape-2 {
    width: 400px; height: 400px;
    bottom: -100px; right: -100px;
    background: #ff9800;
}
.dark-mode .bg-shape-2 { background: #03dac6; }

/* Main App Container */
#app-container {
    padding: 0;
    padding-left: env(safe-area-inset-left, 10px);
    padding-right: env(safe-area-inset-right, 10px);
    height: 100dvh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}


/* Generic Screen Hiding/Showing */
.screen { 
    display: none; 
    flex-direction: column; 
    height: 100%; 
    transition: opacity 0.3s; 
    padding-bottom: 30px; 
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch; 
    touch-action: pan-y; 
    flex: 1; 
}
.screen.show { display: flex; opacity: 1; animation: fade-in 0.4s ease-out; }

.hide { display: none !important; }

/* Common UI Elements */
.app-header { text-align: center; margin-bottom: 2rem; margin-top: 2rem; }
.app-header h1 { font-size: 3rem; font-weight: 300; }
.app-header .highlight { font-weight: 600; color: var(--primary); }

.highlight-input {
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--primary);
    color: var(--primary);
    font-weight: 600;
    font-size: inherit;
    width: 100%;
    outline: none;
    text-align: center;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2rem;
    margin: 0 auto;
    width: 100%;
    display: flex; flex-direction: column;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.input-group { margin-bottom: 1rem; display: flex; flex-direction: column; }
.input-group label { margin-bottom: 0.5rem; font-size: 0.9rem; opacity: 0.8; }
.input-group input, .input-group select {
    padding: 12px 16px; border-radius: 12px; border: 1px solid var(--border-color); background: var(--card-bg); color: var(--text-color); font-size: 1rem; font-family: inherit; outline: none; transition: box-shadow 0.2s;
}
.input-group input:focus, .input-group select:focus { box-shadow: 0 0 0 2px var(--primary); }

/* Base Buttons */
button { font-family: inherit; cursor: pointer; border: none; outline: none; transition: transform 0.1s, background 0.2s; }
button:active { transform: scale(0.95); }

.icon-btn { background: transparent; color: var(--text-color); padding: 5px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.icon-btn:hover { background: rgba(128,128,128,0.2); }

.primary-btn, .secondary-btn { width: 100%; padding: 14px; border-radius: 12px; font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
.primary-btn { background: var(--primary); color: #fff; box-shadow: 0 4px 15px rgba(0,0,0,0.2); }
.primary-btn:hover { background: var(--primary-hover); }
.secondary-btn { background: transparent; color: var(--primary); border: 2px solid var(--primary); }

/* Host-Only UI Toggle */
.host-only { display: none !important; }
.is-host .host-only { display: block !important; }

.status-msg { text-align: center; font-size: 0.9rem; opacity: 0.8; margin-bottom: 1rem; min-height: 1.2rem;}

/* Modals & Toasts */
.modal { position: absolute; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 200; display:flex; align-items:center; justify-content:center; }
.modal.bottom-sheet { align-items: flex-end; }
.modal-content { background: var(--card-bg); border-radius: 20px; padding: 30px; text-align: center; width: 90%; max-width: 350px; }
.modal-content h2 { margin-bottom: 10px;}
.modal-content p { margin-bottom: 20px;}
#toast-container { position: absolute; bottom: calc(20px + var(--safe-bottom)); left:50%; transform: translateX(-50%); z-index: 300; display:flex; flex-direction:column; gap:10px; }
.toast-notification { background: var(--text-color); color: var(--bg-color); padding: 12px 20px; border-radius: 30px; font-size: 0.9rem; font-weight: 600; box-shadow: 0 4px 15px rgba(0,0,0,0.3); opacity: 0; transform: translateY(20px); transition: all 0.3s; }
.toast-notification.show { opacity: 1; transform: translateY(0); }

/* Global Animations */
@keyframes fade-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scale-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
@keyframes pulse-btn { 0%, 100% { transform: scale(1); box-shadow: 0 4px 15px rgba(0,0,0,0.2); } 50% { transform: scale(1.03); box-shadow: 0 0 20px var(--primary); } }