/* Map Engine — shared layout and auth styles.
   Apps layer their own theme CSS on top. */

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

:root {
    --me-bg: #111;
    --me-surface: #1a1a1a;
    --me-border: #333;
    --me-text: #ccc;
    --me-text-muted: #888;
    --me-accent: #4ade80;
    --me-error: #ef4444;
    --me-font: system-ui, -apple-system, sans-serif;
    --me-font-mono: 'Courier New', monospace;
}

body { font-family: var(--me-font); color: var(--me-text); background: var(--me-bg); }

/* --- Layout primitives --- */

.ui-shell { min-height: 100vh; display: flex; flex-direction: column; }
.ui-shell-main { flex: 1; display: flex; }
.ui-layout { display: flex; flex-direction: column; }
.ui-stack { display: flex; gap: 0.5rem; }
.ui-vertical { flex-direction: column; }
.ui-horizontal { flex-direction: row; align-items: center; }

/* --- Auth pages --- */

.me-auth-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 1rem;
}

.me-auth-card {
    width: 100%; max-width: 24rem; padding: 2rem;
    border: 1px solid var(--me-border); border-radius: 0.5rem;
    background: var(--me-surface);
}

.me-auth-title {
    font-size: 1.5rem; font-weight: 700; text-align: center;
    color: var(--me-accent);
}

.me-auth-subtitle {
    text-align: center; color: var(--me-text-muted); font-size: 0.875rem;
    margin-top: 0.25rem;
}

.me-auth-form {
    display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1.5rem;
}

.me-auth-form label {
    font-size: 0.875rem; color: var(--me-text-muted);
}

.me-auth-form input {
    padding: 0.5rem 0.75rem; font-size: 0.875rem;
    background: var(--me-bg); border: 1px solid var(--me-border);
    border-radius: 0.25rem; color: var(--me-text);
}
.me-auth-form input:focus {
    outline: none; border-color: var(--me-accent);
}

.me-auth-form button {
    margin-top: 0.5rem; padding: 0.5rem 1rem; font-size: 0.875rem;
    background: transparent; border: 1px solid var(--me-accent);
    color: var(--me-accent); border-radius: 0.25rem; cursor: pointer;
}
.me-auth-form button:hover { background: rgba(74, 222, 128, 0.1); }

.me-auth-hint { font-size: 0.75rem; color: var(--me-text-muted); }

.me-auth-error-slot { margin-top: 1rem; }
.me-auth-error {
    padding: 0.75rem 1rem; font-size: 0.875rem;
    background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--me-error); border-radius: 0.25rem;
}

.me-auth-footer {
    text-align: center; font-size: 0.875rem; color: var(--me-text-muted);
    margin-top: 1.5rem;
}
.me-auth-footer a { color: var(--me-accent); text-decoration: none; }
.me-auth-footer a:hover { text-decoration: underline; }

/* --- Chat --- */

.me-chat-msg {
    margin-bottom: 0.25rem; padding-bottom: 0.25rem; font-size: 0.875rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.me-chat-msg strong { color: #fff; }

/* --- Canvas container --- */

.me-canvas-wrap {
    position: relative; flex: 1; overflow: hidden;
    background: #000;
}
.me-canvas-wrap canvas {
    display: block; width: 100%; height: 100%;
    image-rendering: pixelated;
}
