:root {
  --bg-dark: #0f1117;
  --bg-panel: #161922;
  --bg-card: #1e222d;
  --border: #2a2f3d;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: system-ui, -apple-system, sans-serif; }
body { background: var(--bg-dark); color: var(--text); height: 100vh; overflow: hidden; }
.hidden { display: none !important; }

/* Auth */
.centered-screen { display: flex; align-items: center; justify-content: center; height: 100vh; padding: 1rem; }
.auth-card { background: var(--bg-panel); border: 1px solid var(--border); padding: 2rem; border-radius: 12px; width: 100%; max-width: 380px; text-align: center; }
.auth-card h1 { letter-spacing: 2px; margin-bottom: 0.4rem; color: var(--accent); }
.subtitle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }
.auth-buttons { display: flex; gap: 0.5rem; margin-top: 1rem; }
.auth-buttons button { flex: 1; }
.error-msg { color: #f87171; font-size: 0.85rem; margin-top: 0.8rem; }

/* Inputs y Botones */
input, textarea { width: 100%; background: var(--bg-dark); border: 1px solid var(--border); color: var(--text); padding: 0.7rem; border-radius: 8px; margin-top: 0.3rem; margin-bottom: 0.8rem; outline: none; }
input:focus, textarea:focus { border-color: var(--accent); }
button { cursor: pointer; border: none; border-radius: 8px; padding: 0.65rem 1rem; font-weight: 600; transition: 0.2s; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #282d3c; }
.btn-text { background: transparent; color: var(--text-muted); padding: 0.3rem; }
.btn-text:hover { color: white; }
.full-width { width: 100%; }

/* Layout Principal */
.app-layout { display: flex; height: 100vh; }
.sidebar { width: 260px; background: var(--bg-panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.sidebar-header { padding: 1.2rem; border-bottom: 1px solid var(--border); }
.sidebar-header h2 { font-size: 1.1rem; margin-bottom: 0.8rem; letter-spacing: 1px; }
.worlds-list { flex: 1; overflow-y: auto; padding: 0.8rem; }
.world-item { padding: 0.75rem; border-radius: 8px; cursor: pointer; margin-bottom: 0.4rem; color: var(--text-muted); }
.world-item:hover, .world-item.active { background: var(--bg-card); color: white; }
.sidebar-footer { padding: 1rem; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; color: var(--text-muted); }

/* Área Central */
.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.empty-state { margin: auto; text-align: center; color: var(--text-muted); }
.form-container { max-width: 650px; width: 100%; margin: auto; padding: 2rem; overflow-y: auto; }
.form-container h2 { margin-bottom: 1.2rem; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; justify-content: flex-end; gap: 0.8rem; margin-top: 1rem; }

/* Chat */
.chat-container { display: flex; flex-direction: column; height: 100%; }
.chat-header { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--bg-panel); }
.meta-text { font-size: 0.8rem; color: var(--text-muted); }
.chat-messages { flex: 1; overflow-y: auto; padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.msg { max-width: 78%; padding: 1rem; border-radius: 12px; line-height: 1.5; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--accent); color: white; }
.msg.assistant { align-self: flex-start; background: var(--bg-card); border: 1px solid var(--border); }
.msg em { color: #a5b4fc; font-style: italic; }
.swipe-bar { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.6rem; padding-top: 0.4rem; border-top: 1px solid var(--border); font-size: 0.75rem; color: var(--text-muted); }
.swipe-btn { background: var(--bg-dark); color: var(--text); padding: 0.2rem 0.5rem; font-size: 0.75rem; border-radius: 4px; }
.typing { padding: 0.5rem 1.5rem; font-size: 0.85rem; color: var(--accent); font-style: italic; }
.chat-input-box { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; gap: 0.8rem; background: var(--bg-panel); }
.chat-input-box textarea { margin: 0; resize: none; }

/* Panel Recuerdos */
.memories-panel { width: 300px; background: var(--bg-panel); border-left: 1px solid var(--border); padding: 1.2rem; display: flex; flex-direction: column; }
.memories-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.add-mem-box { display: flex; gap: 0.4rem; margin: 0.8rem 0; }
.add-mem-box input { margin: 0; }
.memories-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 0.5rem; }
.mem-item { background: var(--bg-card); padding: 0.6rem; border-radius: 6px; font-size: 0.85rem; display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
