/* Reset and general minimal styling */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg-base);
    color: var(--color-text-primary);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Thin minimal scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--color-bg-base);
}
::-webkit-scrollbar-thumb {
    background: var(--color-border-hover);
    border-radius: var(--border-radius-sm);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-secondary-accent);
}

/* Container spacing: Mobile first */
.container {
    width: 100%;
    margin-right: auto;
    margin-left: auto;
    padding-right: var(--grid-gap-base);
    padding-left: var(--grid-gap-base);
}

/* Global Navigation bar: Iconless and minimal */
.global-navbar {
    background-color: var(--color-bg-surface);
    border-bottom: 1px solid var(--color-border);
    height: 56px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.global-navbar .container {
    display: flex;
    align-items: center;
}

.home-logo {
    font-weight: 700;
    text-decoration: none;
    color: var(--color-text-primary);
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}

.navbar-divider {
    color: var(--color-secondary-accent);
    margin: 0 8px;
    font-size: 0.85rem;
    user-select: none;
}

.helper-active-title {
    font-weight: 500;
    color: var(--color-text-muted);
    font-size: 0.95rem;
    text-decoration: none;
}

/* Submenu Navigation Bar (for subroutes) */
.submenu-navbar {
    background-color: var(--color-bg-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 6px 0;
}

.submenu-navbar .container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none; /* Hide scrollbar in Firefox */
}

.submenu-navbar .container::-webkit-scrollbar {
    display: none; /* Hide scrollbar in Chrome/Safari */
}

.submenu-link {
    text-decoration: none;
    color: var(--color-text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 6px 12px;
    border-radius: var(--border-radius-sm);
    transition: background-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.submenu-link:hover {
    color: var(--color-text-primary);
}

.submenu-link.active {
    background-color: var(--color-neutral-shaded);
    color: var(--color-text-primary);
}

/* Viewport structure */
.viewport-wrapper {
    flex: 1;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
}

/* Hero Section of Dashboard */
.hub-hero {
    margin-bottom: 20px;
    padding: 8px 0;
    text-align: left;
}

.hub-hero h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
    color: var(--color-text-primary);
}

.hub-hero p {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Game List Grid - Mobile First: Stacked list items */
.game-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

/* Game Card Component (Minimalist List Item style) */
.game-card {
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    padding: 16px;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease;
}

.game-card:hover {
    border-color: var(--color-border-hover);
}

.game-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.game-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.game-card-description {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    line-height: 1.4;
}

.game-card-arrow {
    font-size: 0.95rem;
    color: var(--color-secondary-accent);
}

/* Card Submenu Styles (no #ffffff or #000000) */
.card-submenu-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}

.card-submenu-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: var(--color-text-primary);
    padding: 8px 12px;
    background-color: var(--color-bg-base);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.card-submenu-link:hover {
    background-color: var(--color-neutral-shaded);
    border-color: var(--color-border-hover);
}

/* Interactive Components Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--interactive-height);
    padding: 0 16px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    text-decoration: none;
    border: 1px solid transparent;
    user-select: none;
}

.btn-primary {
    background-color: var(--color-primary-accent);
    color: var(--color-bg-surface);
}

.btn-primary:hover {
    background-color: var(--color-text-primary);
}

.btn-secondary {
    background-color: var(--color-bg-surface);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background-color: var(--color-neutral-shaded);
    border-color: var(--color-border-hover);
}

/* Form layouts: optimized for mobile inputs */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    height: var(--interactive-height);
    padding: 0 12px;
    font-family: inherit;
    font-size: 0.95rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--color-border);
    background-color: var(--color-bg-surface);
    color: var(--color-text-primary);
    transition: border-color 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary-accent);
}

/* Scoped layout components */
.panel {
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    padding: 16px;
    margin-bottom: 16px;
}

.panel-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

/* Global Footer Layout */
.global-footer {
    border-top: 1px solid var(--color-border);
    padding: 20px 0;
    text-align: center;
    background-color: var(--color-bg-surface);
    color: var(--color-text-muted);
    font-size: 0.75rem;
    margin-top: auto;
}

/* Error Pages Styling */
.error-container {
    padding: 40px 0;
    text-align: center;
    max-width: 320px;
    margin: 0 auto;
}

.error-container h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--color-destructive);
}

.error-container p {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* Responsive Desktop Optimizations: media query scaling up */
@media (min-width: 769px) {
    .container {
        max-width: 800px;
        padding-right: 24px;
        padding-left: 24px;
    }
    
    .hub-hero {
        text-align: center;
        margin-bottom: 32px;
        padding: 20px 0 8px 0;
    }
    
    .hub-hero h1 {
        font-size: 2rem;
    }
    
    .game-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .game-card {
        padding: 20px;
        min-height: 110px;
        justify-content: center;
    }
    
    .viewport-wrapper {
        padding: 32px 0;
    }
    
    .panel {
        padding: 24px;
    }
}

/* Mobile responsive layout (max-width: 768px) */
@media (max-width: 768px) {
    .viewport-wrapper {
        padding-top: 0;
    }
    
    .viewport-wrapper:not(#helper-hub) .container {
        padding-left: 0;
        padding-right: 0;
    }
    
    .panel {
        border: none !important;
        border-radius: 0 !important;
        margin-bottom: 0;
    }
}

.help-btn:hover {
    color: var(--color-text-primary) !important;
    background-color: var(--color-neutral-shaded) !important;
}

/* Global Modal Overlays */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(39, 39, 42, 0.6); /* backdrop shade of grey */
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    box-sizing: border-box;
}

.custom-modal-content {
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    width: 100%;
    max-width: 400px;
    padding: 24px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}
