/* ===== D&D Sanctum — Base Styles ===== */

/* --- CSS Custom Properties --- */
:root {
    /* Colors — Dark theme (default) */
    --bg-base: #1a1a2e;
    --bg-surface: #16213e;
    --bg-elevated: #1f2b47;
    --bg-overlay: rgba(0, 0, 0, 0.6);

    --text-primary: #e8e8e8;
    --text-secondary: #a0a0b0;
    --text-dim: #6a6a7a;
    --text-bright: #ffffff;

    --accent: #e94560;
    --accent-hover: #ff6b81;
    --accent-dim: rgba(233, 69, 96, 0.15);

    --success: #4ecca3;
    --warning: #f0a500;
    --error: #e94560;
    --info: #4a9eff;

    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    /* Typography */
    --font-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Fira Code', 'Consolas', monospace;
    --font-display: 'Cinzel', serif;

    --text-xs: 0.75rem;
    --text-sm: 0.85rem;
    --text-md: 1rem;
    --text-lg: 1.25rem;
    --text-xl: 1.5rem;
    --text-2xl: 2rem;

    /* Z-Index (see docs/Z-INDEX.md) */
    --z-base: 0;
    --z-elevated: 1;
    --z-sticky: 10;
    --z-dropdown: 20;
    --z-overlay: 30;
    --z-modal: 40;
    --z-toast: 50;
    --z-popover: 60;
    --z-critical: 100;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;

    /* Layout */
    --header-height: 56px;
    --nav-height: 56px;
    --content-max-width: 1200px;
    --sidebar-width: 280px;
}

/* --- Reset --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-base);
    font-size: var(--text-md);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-base);
    min-height: 100dvh;
    overflow-x: hidden;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-hover);
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
    font-size: inherit;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-bright);
    line-height: 1.3;
}

/* --- App Layout --- */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

#app-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    z-index: var(--z-sticky);
    display: flex;
    align-items: center;
    padding: 0 var(--space-md);
}

#app-main {
    flex: 1;
    padding: var(--space-md);
    max-width: var(--content-max-width);
    margin: 0 auto;
    width: 100%;
}

#app-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    z-index: var(--z-sticky);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 var(--space-md);
}

/* Account for fixed nav */
#app-main {
    padding-bottom: calc(var(--nav-height) + var(--space-md));
}

/* --- Loading --- */
.loading-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    color: var(--text-dim);
}

/* --- Utilities --- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.text-dim { color: var(--text-dim); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
