/**
 * SuiteDnD — Master Foundation Stylesheet
 * Location: /home/spreeywl/suitednd_com/css/suitednd.css
 * 
 * Structural CSS foundation for the entire SuiteDnD platform.
 * Basic color scheme and component library — full design pass comes later.
 * 
 * Created: February 7, 2026 — Phase 0
 * 
 * TABLE OF CONTENTS
 * =================
 * 1.  CSS Variables (Theming)
 * 2.  Reset & Base
 * 3.  Typography
 * 4.  Layout Utilities
 * 5.  Top Navigation Bar
 * 6.  Sidebar + Dashboard Layout
 * 7.  Cards & Panels
 * 8.  Forms
 * 9.  Buttons
 * 10. Tables
 * 11. Alerts & Flash Messages
 * 12. Badges & Tags
 * 13. Modals
 * 14. Loading & Spinners
 * 15. Tooltips
 * 16. Tabs
 * 17. Pagination
 * 18. Empty States
 * 19. Component Stubs: Dice Roller
 * 20. Component Stubs: Initiative Tracker
 * 21. Component Stubs: Session Panel
 * 22. Component Stubs: Character Sheet
 * 23. Component Stubs: AI Generator
 * 24. Component Stubs: Video Panel
 * 25. Component Stubs: Chat
 * 26. Utility Classes
 * 27. Responsive
 */


/* ==========================================================================
   1. CSS VARIABLES (THEMING)
   
   All colors, spacing, and sizing use variables.
   Swap these to re-theme the entire platform.
   ========================================================================== */

:root {
    /* ── Backgrounds ── */
    --bg-body:      #1f1f1b;   /* dark stone */
    --bg-surface:   #2b2a24;   /* panel background */
    --bg-elevated:  #343228;   /* raised surfaces */
    --bg-input:     #3c3a30;   /* input fields */
    --bg-hover:     #403e34;   /* hover state */
    --bg-overlay:   rgba(0, 0, 0, 0.65);

    /* ── Borders ── */
    --border-color:     #3c3a33;
    --border-light:     #4e4b40;
    --border-focus:     var(--accent);

    /* ── Accent ── */
    --accent:       #c6a45a;   /* aged gold */
    --accent-hover: #d8bc7a;
    --accent-muted: rgba(198, 164, 90, 0.15);

    /* ── Text ── */
    --text:         #f4f1e6;   /* warm off-white */
    --text-secondary: #cfc8b3;
    --text-muted:   #a89f8a;
    --text-dim:     #706a58;

    /* ── Semantic Colors ── */
    --success:      #7ab87a;   /* muted forest green */
    --success-bg:   rgba(122, 184, 122, 0.12);
    --success-border: rgba(122, 184, 122, 0.3);

    --warning:      #c6a45a;   /* reuse gold for warnings */
    --warning-bg:   rgba(198, 164, 90, 0.12);
    --warning-border: rgba(198, 164, 90, 0.3);

    --danger:       #b85c5c;   /* earthy crimson */
    --danger-bg:    rgba(184, 92, 92, 0.12);
    --danger-border: rgba(184, 92, 92, 0.3);

    --info:         #6b9ab8;   /* muted steel blue */
    --info-bg:      rgba(107, 154, 184, 0.12);
    --info-border:  rgba(107, 154, 184, 0.3);

    /* ── Spacing Scale ── */
    --space-xs:  0.25rem;   /* 4px */
    --space-sm:  0.5rem;    /* 8px */
    --space-md:  1rem;      /* 16px */
    --space-lg:  1.5rem;    /* 24px */
    --space-xl:  2rem;      /* 32px */
    --space-2xl: 3rem;      /* 48px */

    /* ── Border Radius ── */
    --radius-sm:  4px;
    --radius-md:  8px;
    --radius-lg:  12px;
    --radius-full: 9999px;

    /* ── Font ── */
    --font-family:  'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono:    'Consolas', 'Monaco', 'Courier New', monospace;

    /* ── Font Sizes ── */
    --text-xs:   0.75rem;   /* 12px */
    --text-sm:   0.85rem;   /* ~14px */
    --text-base: 1rem;      /* 16px */
    --text-lg:   1.125rem;  /* 18px */
    --text-xl:   1.25rem;   /* 20px */
    --text-2xl:  1.5rem;    /* 24px */
    --text-3xl:  2rem;      /* 32px */
    --text-4xl:  2.5rem;    /* 40px */

    /* ── Shadows ── */
    --shadow-sm:   0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md:   0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg:   0 4px 16px rgba(0, 0, 0, 0.4);

    /* ── Transitions ── */
    --transition-fast:   0.15s ease;
    --transition-normal: 0.2s ease;
    --transition-slow:   0.3s ease;

    /* ── Z-Index Scale ── */
    --z-dropdown:  100;
    --z-sticky:    200;
    --z-overlay:   300;
    --z-modal:     400;
    --z-toast:     500;

    /* ── Layout ── */
    --sidebar-width:  240px;
    --topnav-height:  56px;
    --content-max:    1200px;
}


/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-family);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--text);
    background: var(--bg-body);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

img, video, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
}

ul, ol {
    list-style: none;
}

::selection {
    background: var(--accent);
    color: #fff;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}


/* ==========================================================================
   3. TYPOGRAPHY
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
    margin-bottom: var(--space-sm);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); }
h6 { font-size: var(--text-sm); }

p {
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
}

p:last-child {
    margin-bottom: 0;
}

small, .text-sm {
    font-size: var(--text-sm);
}

.text-xs {
    font-size: var(--text-xs);
}

.text-muted {
    color: var(--text-muted);
}

.text-dim {
    color: var(--text-dim);
}

.text-accent {
    color: var(--accent);
}

.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.text-info    { color: var(--info); }

code, .code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--bg-input);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
}

pre {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    background: var(--bg-input);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: var(--space-md);
}

hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: var(--space-lg) 0;
}

/* Brand text helpers */
.brand-suite { color: var(--text-muted); }
.brand-dnd   { color: var(--accent); }


/* ==========================================================================
   4. LAYOUT UTILITIES
   ========================================================================== */

.container {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.container-narrow {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.container-wide {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

/* Flexbox */
.flex        { display: flex; }
.flex-col    { display: flex; flex-direction: column; }
.flex-wrap   { flex-wrap: wrap; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-start  { display: flex; align-items: flex-start; }
.flex-end    { display: flex; align-items: center; justify-content: flex-end; }
.flex-1      { flex: 1; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.items-end    { align-items: flex-end; }
.gap-xs  { gap: var(--space-xs); }
.gap-sm  { gap: var(--space-sm); }
.gap-md  { gap: var(--space-md); }
.gap-lg  { gap: var(--space-lg); }
.gap-xl  { gap: var(--space-xl); }

/* Grid */
.grid {
    display: grid;
    gap: var(--space-md);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Auto-fit responsive grid */
.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-md);
}


/* ==========================================================================
   5. TOP NAVIGATION BAR
   ========================================================================== */

.topnav {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    height: var(--topnav-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
}

.topnav-brand {
    font-size: var(--text-xl);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.topnav-links {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.topnav-links a {
    color: var(--text-muted);
    font-size: var(--text-sm);
    transition: color var(--transition-fast);
}

.topnav-links a:hover,
.topnav-links a.active {
    color: var(--text);
}

.topnav-user {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-muted);
    font-size: var(--text-sm);
}


/* ==========================================================================
   6. SIDEBAR + DASHBOARD LAYOUT
   ========================================================================== */

/* Full dashboard shell: sidebar + main content */
.dashboard {
    display: flex;
    min-height: calc(100vh - var(--topnav-height));
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    padding: var(--space-lg) 0;
    flex-shrink: 0;
    overflow-y: auto;
    height: calc(100vh - var(--topnav-height));
    position: sticky;
    top: var(--topnav-height);
}

.sidebar-section {
    padding: 0 var(--space-md);
    margin-bottom: var(--space-lg);
}

.sidebar-section-title {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    padding: 0 var(--space-sm);
    margin-bottom: var(--space-sm);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-sm);
    color: var(--text-muted);
    font-size: var(--text-sm);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.sidebar-link:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.sidebar-link.active {
    background: var(--accent-muted);
    color: var(--accent);
}

/* Main content area next to sidebar */
.main-content {
    flex: 1;
    padding: var(--space-xl);
    overflow-x: hidden;
    min-width: 0;
}

/* Page header within main content */
.page-header {
    margin-bottom: var(--space-xl);
}

.page-header h1 {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-xs);
}

.page-header p {
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin: 0;
}

/* Simple centered layout (for login, landing, etc.) */
.layout-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--space-xl);
}


/* ==========================================================================
   7. CARDS & PANELS
   ========================================================================== */

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.card-sm {
    padding: var(--space-md);
    border-radius: var(--radius-md);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-color);
}

.card-header h2,
.card-header h3 {
    margin-bottom: 0;
}

.card-body {
    /* Default — for explicit section separation */
}

.card-footer {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
}

/* Stat cards for dashboards */
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.stat-card .stat-value {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* Panel — slightly different from card, used for tool/control areas */
.panel {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}


/* ==========================================================================
   8. FORMS
   ========================================================================== */

.form-group {
    margin-bottom: var(--space-lg);
}

.form-group label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text);
    font-family: var(--font-family);
    font-size: var(--text-base);
    outline: none;
    transition: border-color var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--border-focus);
}

.form-input::placeholder {
    color: var(--text-dim);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a0a0b0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.25rem;
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-help {
    font-size: var(--text-xs);
    color: var(--text-dim);
    margin-top: var(--space-xs);
}

.form-error {
    font-size: var(--text-xs);
    color: var(--danger);
    margin-top: var(--space-xs);
}

/* Checkbox / Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
    cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.form-check label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: 0;
    cursor: pointer;
}

/* Inline form row */
.form-row {
    display: flex;
    gap: var(--space-md);
}

.form-row .form-group {
    flex: 1;
}

/* Input group (input + button side by side) */
.input-group {
    display: flex;
    gap: 0;
}

.input-group .form-input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    white-space: nowrap;
}

/* Range slider */
.form-range {
    width: 100%;
    accent-color: var(--accent);
}


/* ==========================================================================
   9. BUTTONS
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.6rem 1.2rem;
    font-family: var(--font-family);
    font-size: var(--text-sm);
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Primary */
.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

/* Secondary */
.btn-secondary {
    background: var(--bg-input);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--border-light);
}

/* Ghost */
.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text);
}

/* Danger */
.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
    background: #9e4a4a;
    border-color: #9e4a4a;
    color: #fff;
}

/* Success */
.btn-success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}

.btn-success:hover:not(:disabled) {
    background: #5e9e5e;
    border-color: #5e9e5e;
    color: #fff;
}

/* Outline variants */
.btn-outline {
    background: transparent;
    color: var(--accent);
    border-color: var(--accent);
}

.btn-outline:hover:not(:disabled) {
    background: var(--accent-muted);
}

/* Sizes */
.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: var(--text-xs);
}

.btn-lg {
    padding: 0.8rem 1.6rem;
    font-size: var(--text-base);
}

.btn-block {
    width: 100%;
}

/* Button group */
.btn-group {
    display: flex;
    gap: var(--space-sm);
}


/* ==========================================================================
   10. TABLES
   ========================================================================== */

.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table th {
    background: var(--bg-elevated);
    font-weight: 600;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: var(--bg-hover);
}

.table-compact td,
.table-compact th {
    padding: var(--space-xs) var(--space-sm);
}


/* ==========================================================================
   11. ALERTS & FLASH MESSAGES
   ========================================================================== */

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    margin-bottom: var(--space-md);
    border: 1px solid;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success-border);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: var(--warning-border);
}

.alert-danger,
.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger-border);
}

.alert-info {
    background: var(--info-bg);
    color: var(--info);
    border-color: var(--info-border);
}

/* Phase / dev note callout */
.callout {
    padding: var(--space-md);
    background: var(--accent-muted);
    border: 1px solid rgba(233, 69, 96, 0.3);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    color: var(--text-muted);
}


/* ==========================================================================
   12. BADGES & TAGS
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    line-height: 1.4;
}

.badge-accent  { background: var(--accent-muted); color: var(--accent); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }
.badge-info    { background: var(--info-bg); color: var(--info); }
.badge-muted   { background: rgba(160, 160, 176, 0.15); color: var(--text-muted); }

.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    font-size: var(--text-xs);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
}


/* ==========================================================================
   13. MODALS
   ========================================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: var(--z-modal);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: var(--text-xl);
    cursor: pointer;
    padding: var(--space-xs);
    line-height: 1;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: var(--space-lg);
}

.modal-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

/* Wide modal variant */
.modal-wide {
    max-width: 720px;
}


/* ==========================================================================
   14. LOADING & SPINNERS
   ========================================================================== */

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Loading overlay for sections */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(26, 26, 46, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-overlay);
    border-radius: inherit;
}

/* Skeleton loading placeholder */
.skeleton {
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--border-color) 50%, var(--bg-elevated) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1em;
    margin-bottom: var(--space-sm);
}

.skeleton-heading {
    height: 1.5em;
    width: 60%;
    margin-bottom: var(--space-md);
}

.skeleton-block {
    height: 80px;
    margin-bottom: var(--space-md);
}


/* ==========================================================================
   15. TOOLTIPS
   ========================================================================== */

[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--text);
    font-size: var(--text-xs);
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: var(--z-tooltip, 100);
}

[data-tooltip]:hover::after {
    opacity: 1;
}


/* ==========================================================================
   16. TABS
   ========================================================================== */

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--space-lg);
    gap: 0;
}

.tab {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-sm);
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color var(--transition-fast), border-color var(--transition-fast);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: var(--font-family);
}

.tab:hover {
    color: var(--text);
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}


/* ==========================================================================
   17. PAGINATION
   ========================================================================== */

.pagination {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-top: var(--space-lg);
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 var(--space-sm);
    font-size: var(--text-sm);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.pagination a:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.pagination .active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.pagination .disabled {
    opacity: 0.4;
    pointer-events: none;
}


/* ==========================================================================
   18. EMPTY STATES
   ========================================================================== */

.empty-state {
    text-align: center;
    padding: var(--space-2xl) var(--space-md);
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: var(--text-4xl);
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.empty-state p {
    font-size: var(--text-sm);
    color: var(--text-dim);
    max-width: 360px;
    margin: 0 auto var(--space-md);
}


/* ==========================================================================
   19. COMPONENT STUBS: DICE ROLLER
   
   Classes for the dice rolling UI (Phase 1).
   The JS component will build upon these.
   ========================================================================== */

.dice-panel {
    /* Container for the dice rolling interface */
}

.dice-input-row {
    /* Row: expression input + roll button */
    display: flex;
    gap: var(--space-sm);
}

.dice-quick-buttons {
    /* Quick-roll buttons (d4, d6, d8, d10, d12, d20, d100) */
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.dice-quick-btn {
    /* Individual quick-roll button */
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-xs);
    font-weight: 600;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.dice-quick-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.dice-result {
    /* Single dice roll result display */
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-xs);
}

.dice-result-total {
    font-size: var(--text-xl);
    font-weight: 700;
}

.dice-result-breakdown {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.dice-result.critical {
    border-color: var(--success);
}

.dice-result.fumble {
    border-color: var(--danger);
}

.dice-log {
    /* Scrollable dice roll history */
    max-height: 300px;
    overflow-y: auto;
}

.dice-private {
    /* Private roll indicator */
    opacity: 0.6;
    font-style: italic;
}


/* ==========================================================================
   20. COMPONENT STUBS: INITIATIVE TRACKER
   
   Classes for the initiative order UI (Phase 1).
   ========================================================================== */

.initiative-panel {
    /* Container for initiative tracker */
}

.initiative-list {
    /* Ordered list of initiative entries */
}

.initiative-entry {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-color);
    font-size: var(--text-sm);
}

.initiative-entry.current-turn {
    background: var(--accent-muted);
    border-left: 3px solid var(--accent);
}

.initiative-entry.inactive {
    opacity: 0.4;
}

.initiative-roll {
    font-weight: 700;
    min-width: 28px;
    text-align: center;
}

.initiative-name {
    flex: 1;
}

.initiative-hp {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.initiative-conditions {
    display: flex;
    gap: var(--space-xs);
}


/* ==========================================================================
   21. COMPONENT STUBS: SESSION PANEL
   
   Classes for the live game session UI (Phase 1).
   ========================================================================== */

.session-layout {
    /* Full session view — map + sidebar panels */
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 0;
    height: calc(100vh - var(--topnav-height));
}

.session-map-area {
    /* Canvas container for the map */
    position: relative;
    overflow: hidden;
    background: var(--bg-body);
}

.session-sidebar {
    /* Right sidebar: dice, initiative, chat, notes */
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-color);
    background: var(--bg-surface);
    overflow: hidden;
}

.session-sidebar-panel {
    /* Individual collapsible panel in sidebar */
    border-bottom: 1px solid var(--border-color);
}

.session-sidebar-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
}

.session-sidebar-panel-body {
    padding: var(--space-sm) var(--space-md) var(--space-md);
}

/* Session state indicators */
.session-state {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.session-state-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.session-state.lobby    .session-state-dot { background: var(--text-dim); }
.session-state.setup    .session-state-dot { background: var(--info); }
.session-state.playing  .session-state-dot { background: var(--success); }
.session-state.encounter .session-state-dot { background: var(--warning); }
.session-state.paused   .session-state-dot { background: var(--warning); }
.session-state.complete .session-state-dot { background: var(--text-dim); }

/* DM control bar */
.dm-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-color);
}

/* Player presence bar */
.presence-bar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
    font-size: var(--text-xs);
}

.presence-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
}

.presence-dot.offline {
    background: var(--text-dim);
}


/* ==========================================================================
   22. COMPONENT STUBS: CHARACTER SHEET
   
   Classes for character sheet display (Phase 4).
   ========================================================================== */

.character-sheet {
    /* Character sheet container */
}

.character-stat-block {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--space-sm);
    text-align: center;
}

.character-stat {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
}

.character-stat .stat-abbr {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.character-stat .stat-score {
    font-size: var(--text-xl);
    font-weight: 700;
}

.character-stat .stat-mod {
    font-size: var(--text-sm);
    color: var(--text-muted);
}


/* ==========================================================================
   23. COMPONENT STUBS: AI GENERATOR
   
   Classes for AI content generation UI (Phase 3).
   ========================================================================== */

.ai-panel {
    /* AI generation panel container */
}

.ai-prompt-area {
    /* Prompt input/context area */
}

.ai-output {
    /* Generated content display */
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    min-height: 120px;
}

.ai-output.generating {
    opacity: 0.7;
}

.ai-credits {
    font-size: var(--text-xs);
    color: var(--text-dim);
}


/* ==========================================================================
   24. COMPONENT STUBS: VIDEO PANEL
   
   Classes for Daily.co video integration (Phase 1).
   ========================================================================== */

.video-panel {
    /* Video container */
    position: relative;
    background: #0d0c09;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.video-panel iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-sm);
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
}

/* Mini video view (picture-in-picture style) */
.video-mini {
    position: fixed;
    bottom: var(--space-md);
    right: var(--space-md);
    width: 240px;
    height: 160px;
    z-index: var(--z-sticky);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}


/* ==========================================================================
   25. COMPONENT STUBS: CHAT
   
   Classes for in-session text chat (Phase 4).
   ========================================================================== */

.chat-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-sm);
}

.chat-message {
    margin-bottom: var(--space-sm);
    font-size: var(--text-sm);
}

.chat-message-name {
    font-weight: 600;
    font-size: var(--text-xs);
    color: var(--accent);
}

.chat-message-text {
    color: var(--text-secondary);
}

.chat-input-row {
    display: flex;
    gap: var(--space-xs);
    padding: var(--space-sm);
    border-top: 1px solid var(--border-color);
}


/* ==========================================================================
   26. UTILITY CLASSES
   ========================================================================== */

/* Display */
.hidden   { display: none !important; }
.block    { display: block; }
.inline   { display: inline; }
.relative { position: relative; }

/* Text alignment */
.text-left   { text-align: left; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* Font weight */
.font-normal   { font-weight: 400; }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

/* Margin utilities */
.mt-0  { margin-top: 0; }
.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-0  { margin-bottom: 0; }
.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }

/* Padding utilities */
.p-0  { padding: 0; }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

/* Width */
.w-full { width: 100%; }
.w-auto { width: auto; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-grab    { cursor: grab; }

/* Truncate text */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}


/* ==========================================================================
   27. RESPONSIVE
   ========================================================================== */

/* Tablet (768px and below) */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 200px;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .form-row {
        flex-direction: column;
    }

    .session-layout {
        grid-template-columns: 1fr;
    }

    .session-sidebar {
        border-left: none;
        border-top: 1px solid var(--border-color);
        max-height: 50vh;
    }

    .character-stat-block {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Hamburger button: visible on mobile only */
    .topnav-hamburger {
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: 1px solid var(--border-color);
        color: var(--text);
        font-size: 1.25rem;
        width: 36px;
        height: 36px;
        border-radius: var(--radius-sm);
        cursor: pointer;
        transition: background var(--transition-fast), border-color var(--transition-fast);
        order: -1;
        margin-right: var(--space-sm);
        flex-shrink: 0;
    }

    .topnav-hamburger:hover {
        background: var(--bg-hover);
        border-color: var(--border-light);
    }

    /* Mobile nav dropdown */
    .topnav-links {
        display: none;
        position: absolute;
        top: var(--topnav-height);
        left: 0;
        right: 0;
        background: var(--bg-surface);
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        padding: var(--space-sm) 0;
        z-index: var(--z-dropdown, 100);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    .topnav.nav-open .topnav-links {
        display: flex;
    }

    .topnav-links a {
        padding: var(--space-sm) var(--space-lg);
        font-size: var(--text-base, 1rem);
        border-left: 3px solid transparent;
    }

    .topnav-links a:hover {
        background: var(--bg-hover);
    }

    .topnav-links a.active {
        border-left-color: var(--accent);
        background: var(--bg-hover);
    }

    .topnav-user {
        margin-left: auto;
    }

    .container-narrow {
        padding: 0 var(--space-sm);
    }

}

/* Mobile (480px and below) */
@media (max-width: 480px) {
    html {
        font-size: 15px;
    }

    .sidebar {
        display: none; /* Replaced by slide-out drawer in future */
    }

    .dashboard {
        display: block;
    }

    .main-content {
        padding: var(--space-md);
    }

    .topnav {
        padding: 0 var(--space-md);
    }

    .topnav-user > span {
        display: none;
    }

    .modal {
        max-width: 100%;
        margin: var(--space-sm);
        max-height: 90vh;
    }

    .btn-group {
        flex-direction: column;
    }

    .character-stat-block {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Hamburger hidden on desktop */
.topnav-hamburger {
    display: none;
}