/* ============================================
   AUTONOMOUS ARENA - RENAISSANCE DESIGN SYSTEM
   Elegant, classical, warm and approachable
   ============================================ */

/* ========== CSS CUSTOM PROPERTIES ========== */
:root {
    /* Colors - Warm Renaissance Palette */
    --bg-primary: #faf8f5;
    --bg-secondary: #f5f2ed;
    --bg-tertiary: #ebe7e0;
    --bg-card: #ffffff;

    /* Gold Accents */
    --gold-primary: #c9a227;
    --gold-dark: #a68523;
    --gold-light: #e8d48a;
    --gold-pale: #f7f0d8;

    /* Text Colors */
    --text-primary: #2c2416;
    --text-secondary: #5a4d3a;
    --text-muted: #8c7d68;
    --text-light: #b3a690;

    /* Accent Colors */
    --accent-success: #4a7c59;
    --accent-error: #a64b4b;
    --accent-warning: #b8860b;
    --accent-info: #4a6b8a;

    /* Compatibility aliases for older page modules */
    --accent-primary: var(--gold-primary);
    --accent-secondary: var(--gold-dark);
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: var(--border-gold);
    --border-subtle: var(--border-light);
    --bg-glass: rgba(255, 255, 255, 0.92);

    /* Borders */
    --border-light: #e8e4dc;
    --border-medium: #d4cfc4;
    --border-gold: rgba(201, 162, 39, 0.4);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(44, 36, 22, 0.08);
    --shadow-md: 0 4px 12px rgba(44, 36, 22, 0.1);
    --shadow-lg: 0 8px 24px rgba(44, 36, 22, 0.12);
    --shadow-gold: 0 4px 16px rgba(201, 162, 39, 0.2);

    /* Typography */
    --font-display: 'Cormorant Garamond', 'Playfair Display', 'Georgia', serif;
    --font-primary: 'Crimson Text', 'Times New Roman', serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Welcome + Dashboard evolution tokens */
    --hero-overlay-strong: rgba(21, 17, 11, 0.58);
    --hero-overlay-soft: rgba(21, 17, 11, 0.24);
    --heading-contrast: #20180f;
    --body-contrast: #4a3c2c;
    --surface-emphasis: rgba(255, 252, 244, 0.96);
    --card-gap-tight: 10px;
    --card-gap-regular: 14px;
}

/* ========== RESET & BASE ========== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========== TYPOGRAPHY ========== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

.text-muted { color: var(--text-muted); }
.text-gold { color: var(--gold-primary); }
.text-center { text-align: center; }

/* ========== DECORATIVE ELEMENTS ========== */
.ornament {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    margin: var(--space-lg) 0;
}

.ornament::before,
.ornament::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-medium), transparent);
}

/* ========== CANVAS SHELL ========== */
.canvas-shell {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.canvas-shell canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* ========== CARDS & PANELS ========== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card--gold {
    border-color: var(--border-gold);
    box-shadow: var(--shadow-gold);
}

.card__header {
    border-bottom: 1px solid var(--border-light);
    padding-bottom: var(--space-md);
    margin-bottom: var(--space-md);
}

.card__title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card__subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.btn--primary {
    background: linear-gradient(135deg, var(--gold-primary), var(--gold-dark));
    color: white;
    border-color: var(--gold-dark);
    box-shadow: var(--shadow-sm);
}

.btn--primary:hover {
    background: linear-gradient(135deg, var(--gold-light), var(--gold-primary));
    box-shadow: var(--shadow-gold);
    transform: translateY(-1px);
}

.btn--secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.btn--secondary:hover {
    border-color: var(--gold-primary);
    color: var(--gold-dark);
}

.btn--ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn--ghost:hover {
    background: var(--bg-secondary);
    color: var(--gold-dark);
}

.btn--success {
    background: var(--accent-success);
    color: white;
    border-color: var(--accent-success);
}

.btn--sm {
    padding: var(--space-xs) var(--space-md);
    font-size: 0.85rem;
}

.btn--lg {
    padding: var(--space-md) var(--space-xl);
    font-size: 1.1rem;
}

/* ========== FORM CONTROLS ========== */
.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
    letter-spacing: 0.02em;
}

.form-input,
.form-select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-primary);
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 3px var(--gold-pale);
}

.form-input::placeholder {
    color: var(--text-light);
}

/* ========== STATUS BADGES ========== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-md);
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--radius-xl);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
}

.status-badge__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-light);
}

.status-badge--online .status-badge__dot {
    background: var(--accent-success);
    box-shadow: 0 0 6px var(--accent-success);
}

.status-badge--offline .status-badge__dot {
    background: var(--accent-error);
}

.status-badge--loading .status-badge__dot {
    background: var(--gold-primary);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ========== LANDING PAGE ========== */
.landing {
    min-height: 100vh;
    padding: var(--space-xl);
    background: var(--bg-primary);
}

.landing__header {
    text-align: center;
    padding: var(--space-2xl) 0;
}

.landing__logo {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.15em;
    margin-bottom: var(--space-sm);
}

.landing__tagline {
    font-family: var(--font-primary);
    font-size: 1.1rem;
    color: var(--text-muted);
    font-style: italic;
}

.landing__content {
    max-width: 1200px;
    margin: 0 auto;
}

/* ========== FEATURE CARDS ========== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-align: center;
    transition: all 0.3s ease;
}

.feature-card:hover {
    border-color: var(--gold-primary);
    box-shadow: var(--shadow-gold);
    transform: translateY(-4px);
}

.feature-card__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gold-pale);
    border: 2px solid var(--border-gold);
    border-radius: 50%;
}

.feature-card__icon img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.feature-card__title {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.feature-card__desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    line-height: 1.6;
}

/* ========== STATS DISPLAY ========== */
.stats-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.stats-panel__title {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gold-dark);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-light);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--space-md);
}

.stat-item {
    text-align: center;
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.stat-item__value {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gold-dark);
}

.stat-item__label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* ========== HUD SYSTEM ========== */
.hud-player {
    position: fixed;
    top: var(--space-md);
    left: var(--space-md);
    display: flex;
    gap: var(--space-md);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    box-shadow: var(--shadow-md);
    z-index: 100;
}

.hud-player__avatar {
    width: 48px;
    height: 48px;
    background: var(--gold-pale);
    border: 2px solid var(--gold-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hud-player__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hud-player__info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hud-player__name {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.hud-player__title {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

.hud-bars {
    margin-top: var(--space-xs);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hud-bar {
    width: 140px;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.hud-bar__fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.hud-bar--health .hud-bar__fill {
    background: linear-gradient(90deg, var(--accent-error), #c75050);
}

.hud-bar--stamina .hud-bar__fill {
    background: linear-gradient(90deg, var(--gold-primary), var(--gold-light));
}

.hud-bar__label {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* ========== HUD LOCATION ========== */
.hud-location {
    position: fixed;
    top: var(--space-md);
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-sm) var(--space-lg);
    box-shadow: var(--shadow-md);
    z-index: 100;
}

.hud-location__name {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.hud-location__coords {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========== HUD STATS ========== */
.hud-stats {
    position: fixed;
    top: var(--space-md);
    right: var(--space-md);
    display: flex;
    gap: var(--space-sm);
    z-index: 100;
}

.hud-stat {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    box-shadow: var(--shadow-sm);
}

.hud-stat__icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hud-stat__icon img {
    width: 20px;
    height: 20px;
}

.hud-stat__value {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gold-dark);
}

.hud-stat__label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ========== CHALLENGE FEED ========== */
.challenge-feed {
    position: fixed;
    right: var(--space-md);
    top: 80px;
    width: 300px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    z-index: 100;
    overflow: hidden;
}

.challenge-feed__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
}

.challenge-feed__title {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.challenge-feed__live {
    width: 8px;
    height: 8px;
    background: var(--accent-success);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.challenge-feed__list {
    max-height: 250px;
    overflow-y: auto;
    padding: var(--space-sm);
}

.challenge-item {
    padding: var(--space-sm);
    border-bottom: 1px solid var(--border-light);
}

.challenge-item:last-child {
    border-bottom: none;
}

.challenge-item__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xs);
}

.challenge-item__type {
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

.challenge-item__type--created {
    background: var(--gold-pale);
    color: var(--gold-dark);
}

.challenge-item__type--accepted {
    background: rgba(74, 124, 89, 0.15);
    color: var(--accent-success);
}

.challenge-item__type--declined {
    background: rgba(166, 75, 75, 0.15);
    color: var(--accent-error);
}

.challenge-item__type--resolved {
    background: rgba(184, 134, 11, 0.15);
    color: var(--accent-warning);
}

.challenge-item__time {
    font-size: 0.7rem;
    color: var(--text-light);
}

.challenge-item__players {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    font-size: 0.85rem;
}

.challenge-item__player {
    display: flex;
    align-items: center;
    gap: 4px;
}

.challenge-item__avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
}

.challenge-item__avatar--agent {
    border-color: var(--gold-primary);
}

.challenge-item__avatar--human {
    border-color: var(--accent-info);
}

.challenge-item__vs {
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-light);
}

/* ========== HUD CONTROLS ========== */
.hud-controls {
    position: fixed;
    bottom: var(--space-md);
    left: var(--space-md);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    box-shadow: var(--shadow-md);
    z-index: 100;
}

.hud-controls__title {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gold-dark);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-sm);
}

.hud-controls__row {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-xs);
}

.hud-controls__row:last-child {
    margin-bottom: 0;
}

.hud-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 22px;
    padding: 0 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.hud-controls__desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: var(--space-xs);
}

/* ========== HUD SPEED ========== */
.hud-speed {
    position: fixed;
    bottom: var(--space-md);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-sm) var(--space-lg);
    box-shadow: var(--shadow-md);
    text-align: center;
    z-index: 100;
}

.hud-speed__value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gold-dark);
}

.hud-speed__unit {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: 2px;
}

.hud-speed__mode {
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ========== HUD MINIMAP ========== */
.hud-minimap {
    position: fixed;
    bottom: var(--space-md);
    right: var(--space-md);
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid var(--gold-primary);
    border-radius: 50%;
    box-shadow: var(--shadow-md);
    z-index: 100;
    overflow: hidden;
}

.hud-minimap__compass {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gold-dark);
}

.hud-minimap__inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    background: var(--bg-secondary);
    border-radius: 50%;
    border: 1px solid var(--border-light);
}

.hud-minimap__player {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    background: var(--gold-primary);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 6px var(--gold-primary);
}

.hud-minimap__direction {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 12px solid var(--text-primary);
    transform-origin: center bottom;
}

/* ========== CHALLENGE POPUP ========== */
.challenge-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card);
    border: 2px solid var(--gold-primary);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    box-shadow: var(--shadow-lg), var(--shadow-gold);
    text-align: center;
    z-index: 200;
    min-width: 320px;
}

.challenge-popup__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-md);
    background: var(--gold-pale);
    border: 2px solid var(--gold-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.challenge-popup__title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.challenge-popup__challenger {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

.challenge-popup__timer {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gold-dark);
    margin-bottom: var(--space-lg);
}

.challenge-popup__actions {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
}

/* ========== TOAST NOTIFICATIONS ========== */
.toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    box-shadow: var(--shadow-md);
    animation: slideIn 0.3s ease;
    max-width: 350px;
}

.toast--success { border-left: 4px solid var(--accent-success); }
.toast--error { border-left: 4px solid var(--accent-error); }
.toast--warning { border-left: 4px solid var(--accent-warning); }
.toast--info { border-left: 4px solid var(--accent-info); }

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast__icon {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
}

/* ========== Global Shell Nav/Auth ========== */
.global-shell {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 251, 243, 0.93);
    border: 1px solid rgba(182, 139, 36, 0.38);
    border-radius: 999px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
    padding: 6px 10px;
    backdrop-filter: blur(8px);
}

.global-shell__links {
    display: flex;
    align-items: center;
    gap: 6px;
}

.global-shell__links a {
    text-decoration: none;
    color: #463616;
    font: 700 11px/1 "IBM Plex Mono", monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 999px;
    padding: 6px 8px;
    border: 1px solid transparent;
}

.global-shell__links a.active {
    border-color: rgba(182, 139, 36, 0.45);
    background: rgba(236, 220, 172, 0.45);
}

.global-shell__auth {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 26px;
}

.global-shell__email-auth {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.global-shell__input {
    width: 132px;
    max-width: 132px;
    border-radius: 999px;
    border: 1px solid rgba(182, 139, 36, 0.5);
    background: rgba(255, 255, 255, 0.95);
    color: #392b11;
    font: 11px/1 "IBM Plex Sans", sans-serif;
    padding: 6px 8px;
}

.global-shell__user {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #5d4920;
    font: 700 11px/1 "IBM Plex Sans", sans-serif;
}

.global-shell__auth button {
    border-radius: 999px;
    border: 1px solid rgba(182, 139, 36, 0.5);
    background: linear-gradient(120deg, #c9a542 0%, #e9d391 55%, #bc8e22 100%);
    color: #2f230f;
    font: 700 10px/1 "IBM Plex Mono", monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 6px 8px;
    cursor: pointer;
}

.global-shell__hint {
    color: #6d5a34;
    font: 11px/1 "IBM Plex Sans", sans-serif;
}

.toast--success .toast__icon { color: var(--accent-success); }
.toast--error .toast__icon { color: var(--accent-error); }
.toast--warning .toast__icon { color: var(--accent-warning); }
.toast--info .toast__icon { color: var(--accent-info); }

.toast__content {
    flex: 1;
}

.toast__title {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.toast__message {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ========== TABLES ========== */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: var(--bg-secondary);
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-light);
}

.table td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

.table tbody tr:hover {
    background: var(--bg-secondary);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ========== Shell Pages ========== */
.shell-page {
    max-width: 1160px;
    margin: 72px auto 24px;
    padding: 0 16px;
}

.welcome-hero {
    padding: 22px;
}

.welcome-cta {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.dashboard-wrap {
    padding-bottom: 18px;
}

.dashboard-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.dashboard-head__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dashboard-grid {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.dashboard-kv {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-light);
}

.dashboard-kv span {
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 0.9rem;
}

.dashboard-kv strong {
    color: var(--text-primary);
    font: 600 0.85rem/1.2 "IBM Plex Mono", monospace;
    text-align: right;
}

.dashboard-inline {
    display: flex;
    gap: 8px;
}

.dashboard-bot {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    margin-bottom: 8px;
}

.dashboard-bot strong {
    font-family: var(--font-display);
    color: var(--text-primary);
}

.dashboard-bot span {
    color: var(--text-secondary);
    font: 500 0.75rem/1.2 "IBM Plex Mono", monospace;
}

.dashboard-bot-edit {
    margin-top: 6px;
    display: grid;
    grid-template-columns: 1fr 1fr 120px 110px 110px auto;
    gap: 6px;
}

.dashboard-bot-edit select,
.dashboard-bot-edit input {
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    padding: 6px 8px;
    font: 13px/1.2 var(--font-primary);
}

/* ========== Welcome Page ========== */
.welcome-page {
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px 16px 30px;
}

.welcome-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.welcome-header h1 {
    margin: 0;
    font-size: 2rem;
}

.welcome-hero-card {
    position: relative;
    overflow: hidden;
    padding: 26px;
    border-color: rgba(201, 162, 39, 0.48);
    background:
      linear-gradient(160deg, var(--hero-overlay-soft) 0%, rgba(27, 20, 10, 0.08) 50%, rgba(255, 252, 244, 0.94) 100%),
      radial-gradient(circle at 85% 15%, rgba(255, 235, 170, 0.34) 0%, rgba(255, 255, 255, 0) 42%),
      var(--surface-emphasis);
    box-shadow: 0 12px 28px rgba(44, 36, 22, 0.15);
}

.welcome-hero-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0) 45%);
    pointer-events: none;
}

.welcome-hero-card > * {
    position: relative;
    z-index: 1;
}

.welcome-kicker {
    color: var(--gold-dark);
    letter-spacing: 0.14em;
}

.welcome-hero-title {
    margin-top: 4px;
    margin-bottom: 10px;
    font-size: 2.2rem;
    line-height: 1.05;
    color: var(--heading-contrast);
    max-width: 800px;
}

.welcome-hero-subtitle {
    color: var(--body-contrast);
    font-size: 1.08rem;
    max-width: 760px;
    line-height: 1.58;
    margin-bottom: 2px;
}

.welcome-cta {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.welcome-cta .btn--primary {
    box-shadow: 0 8px 20px rgba(166, 133, 35, 0.3);
}

.welcome-cta #google-signin-welcome {
    min-width: 260px;
}

.welcome-email-auth {
    display: grid;
    gap: 8px;
    min-width: 280px;
    max-width: 360px;
}

.welcome-email-auth__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.welcome-auth-error {
    margin-top: 6px;
    color: var(--accent-error);
    min-height: 18px;
}

.welcome-grid {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--card-gap-regular);
}

.welcome-grid .card {
    padding: 16px;
    border-color: var(--border-medium);
}

.welcome-grid .card__title {
    color: var(--heading-contrast);
    font-size: 1.38rem;
}

.welcome-steps,
.welcome-checks {
    margin: 10px 0 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: var(--card-gap-tight);
    color: var(--body-contrast);
    line-height: 1.55;
}

.welcome-steps li {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 8px;
    align-items: start;
}

.welcome-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 24px;
    border-radius: 999px;
    background: rgba(201, 162, 39, 0.16);
    color: #8b6916;
    font: 700 0.78rem/1 var(--font-mono);
    letter-spacing: 0.05em;
}

.welcome-step-copy {
    display: block;
}

.welcome-checks li {
    position: relative;
    padding-left: 20px;
}

.welcome-checks li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--gold-dark);
}

.welcome-journey-card {
    margin-top: 12px;
    border-color: var(--border-medium);
    background: rgba(255, 255, 255, 0.9);
}

.welcome-journey-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.welcome-admin-area {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.welcome-admin-toggle {
    background: transparent;
    border: none;
    color: var(--text-muted);
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font: 600 0.92rem/1 var(--font-display);
}

.welcome-admin-panel {
    width: 100%;
    border: 1px dashed var(--border-medium);
    border-radius: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.6);
}

.welcome-admin-form {
    margin-top: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
}

/* ========== GLASS PANEL (legacy support) ========== */
.glass-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .landing {
        padding: var(--space-md);
    }

    .landing__logo {
        font-size: 2.5rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .hud-controls {
        display: none;
    }

    .challenge-feed {
        width: 250px;
    }

    .hud-stats {
        flex-direction: column;
    }

    .welcome-hero-title {
        font-size: 1.78rem;
        line-height: 1.08;
    }

    .welcome-hero-card {
        padding: 20px;
    }

    .welcome-hero-subtitle {
        font-size: 1rem;
    }

    .welcome-steps li {
        grid-template-columns: 30px 1fr;
        gap: 6px;
    }

    .welcome-admin-form {
        grid-template-columns: 1fr;
    }

    .dashboard-bot-edit {
        grid-template-columns: 1fr;
    }
}
