/* Global Variables & Theme */
:root {
    /* Colors */
    --bg-primary: #0a0a0a;
    --bg-secondary: #121212;
    --bg-tertiary: #1a1a1a;

    --text-primary: #f0f0f0;
    --text-secondary: #a0a0a0;
    --text-muted: #525252;

    --border-color: rgba(255, 255, 255, 0.1);

    /* D&D 5e Theme */
    --dnd-red: #8B0000;
    --dnd-gold: #C0A040;

    /* Daggerheart Theme */
    --dh-purple: #6b21a8;
    --dh-teal: #14b8a6;

    /* Typography */
    --font-heading: 'Cinzel', serif;
    --font-body: 'Inter', sans-serif;
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    line-height: 1.2;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Utilities */
.glass-panel {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.text-dnd-gold {
    color: var(--dnd-gold);
}

.text-dnd-red {
    color: var(--dnd-red);
}

.text-dh-teal {
    color: var(--dh-teal);
}

.text-dh-purple {
    color: var(--dh-purple);
}

.bg-dnd-red {
    background-color: var(--dnd-red);
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hidden {
    display: none !important;
}

/* Components */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* Ensures text is centered */
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background-color: var(--dnd-red);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(139, 0, 0, 0.39);
}

.btn-primary:hover {
    background-color: #a50000;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.input-field {
    width: 100%;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    border-radius: 0.5rem;
    color: white;
    font-family: var(--font-body);
    transition: border-color 0.2s;
}

/* Device Control Specifics */
.control-card {
    transition: transform 0.2s, opacity 0.3s, filter 0.3s;
}

.control-card.offline {
    opacity: 0.5;
    filter: grayscale(1);
    pointer-events: none;
    /* Optional: prevent interaction with offline devices */
    border-color: #444 !important;
}

.control-card.offline h3 {
    color: #888 !important;
}

.control-card.offline .status-dot {
    background: #666 !important;
    box-shadow: none !important;
}

/* View Switcher Component */
.view-switcher-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    width: fit-content;
}

.view-label {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    color: var(--dnd-gold);
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.8;
}

.view-switcher {
    display: inline-flex;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.view-btn {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--text-muted);
    padding: 0.5rem 1.25rem;
    border-radius: 50px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.view-btn.active {
    background: var(--dnd-gold);
    color: var(--bg-primary);
    box-shadow: 0 0 20px rgba(192, 160, 64, 0.3);
}

.view-btn:hover:not(.active) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.input-field:focus {
    outline: none;
    border-color: var(--dnd-gold);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

/* Decor */
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    pointer-events: none;
    z-index: -1;
}

/* Cinematic Landing Page */
.landing-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.6;
    filter: brightness(0.7);
}

.input-field-sm {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 4px;
    width: 100%;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-family: monospace;
}

/* Vignette & Gradient Overlay */
.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(0, 0, 0, 0) 20%, rgba(0, 0, 0, 0.8) 90%);
    z-index: -1;
}

.hero-content {
    text-align: center;
    z-index: 10;
}

.main-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    /* Reduced from 3.5rem */
    color: white;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
    letter-spacing: 4px;
    margin: 0;
    line-height: 1;
}

.main-title .divider {
    color: var(--dnd-gold);
    font-size: 3rem;
    /* Reduced from 4rem */
    vertical-align: middle;
    margin: 0 1rem;
    text-shadow: 0 0 15px var(--dnd-gold);
}

.subtitle {
    font-family: var(--font-heading);
    font-size: 1rem;
    /* Reduced from 1.5rem */
    color: var(--dnd-gold);
    text-transform: uppercase;
    letter-spacing: 6px;
    /* Reduced spacing */
    margin-top: 1rem;
    opacity: 0.9;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 1);
}

.login-area {
    margin-top: 3rem;
    /* Reduced margin */
}

.btn-large {
    font-size: 1rem;
    /* Reduced from 1.5rem */
    padding: 0.75rem 2rem;
    /* Reduced padding */
    border-radius: 50px;
    /* Pill shape */
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: bold;
}

.glow-effect:hover {
    box-shadow: 0 0 40px rgba(212, 175, 55, 0.8);
    transform: scale(1.05);
}

/* --- Responsive Design Overhaul --- */

/* Utility: Responsive Grid */
.grid-responsive {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1.5rem;
    align-items: start;
}

.control-card {
    max-width: 600px;
    margin: 0;
}

/* Snapping Polish */
.control-card.floating,
.control-card.resizing {
    transition: none !important;
    z-index: 9999 !important;
}

.control-card.offline {
    filter: grayscale(0.8) opacity(0.6);
    border-color: rgba(255, 255, 255, 0.05) !important;
    pointer-events: none;
    cursor: default;
}

.control-card.offline .status-dot {
    background: #f44336 !important;
    box-shadow: 0 0 5px #f44336 !important;
}

/* Mobile Devices (Phones & Tablets) */
@media (max-width: 768px) {

    /* Typography Scaling */
    html {
        font-size: 14px;
        /* Lower base size */
    }

    .main-title {
        font-size: 2.5rem;
        letter-spacing: 2px;
    }

    .main-title .divider {
        font-size: 3rem;
        display: block;
        /* Stack on mobile */
        margin: 0.5rem 0;
        transform: rotate(90deg);
        /* Vertical divider becomes separator */
    }

    .subtitle {
        font-size: 1rem;
        letter-spacing: 3px;
        padding: 0 1rem;
    }

    /* Layout Adjustments */
    .landing-container {
        padding: 1rem;
    }

    .glass-panel {
        padding: 1rem !important;
        /* Force tighter padding */
    }

    /* Navigation */
    nav {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    nav>div {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Tab Switchers */
    .tabs,
    .tab-nav {
        flex-direction: column;
    }

    .tabs button,
    .tab-nav button {
        width: 100%;
        border-bottom: 1px solid var(--border-color);
    }

    /* Buttons */
    .btn-large {
        width: 100%;
        font-size: 1.2rem;
        padding: 1rem;
    }

    /* Hide complex decorations */
    .orb {
        display: none;
    }
}