:root {
    --primary-color: #1a73e8;
    --primary-hover: #1557b0;
    --bg-color: #f8f9fa;
    --text-color: #3c4043;
    --white: #ffffff;
    --border-color: #dadce0;
    --shadow: 0 1px 3px rgba(60,64,67,0.3);
    --cell-size: 40px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* --- NAVEGACIÓN --- */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    padding: 0.8rem 2rem;
    box-shadow: var(--shadow);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-logo { font-size: 1.4rem; font-weight: bold; color: var(--primary-color); }
.nav-links a { text-decoration: none; color: var(--text-color); margin-left: 1.5rem; font-weight: 500; }
.nav-links a.active { color: var(--primary-color); border-bottom: 2px solid var(--primary-color); }

/* --- CONTENEDOR PRINCIPAL --- */
.container {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.app-view {
    background: var(--white);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.field { display: flex; flex-direction: column; gap: 0.5rem; }
input[type="text"], textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    text-transform: uppercase;
}

/* --- BOTONES --- */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

button {
    padding: 10px 18px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}

.btn-main { background: var(--primary-color); color: white; }
.btn-view { background: #e8f0fe; color: var(--primary-color); }
.btn-export { background: #34a853; color: white; }
.btn-clear { background: #f1f3f4; color: #d93025; border: 1px solid var(--border-color); }

/* --- ÁREA DE EXPORTACIÓN --- */
.export-area {
    margin-top: 2rem;
    padding: 30px; /* Margen para que el PNG no esté pegado al borde */
    background: white;
    border: 1px dashed var(--border-color);
    overflow-x: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* CLAVE: el contenedor se ajusta al ancho del contenido real */
    width: 100%;
    min-width: fit-content;
}

/* El tablero recibe las columnas dinámicamente desde el JS */
.acrostic-container {
    display: grid;
    gap: 0px;
    background: transparent; 
    border: none;
    /* CLAVE: Evita que el grid se estire al 100% innecesariamente */
    width: fit-content; 
    margin: 0 auto;
}

.cell {
    width: var(--cell-size);
    height: var(--cell-size);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.2rem;
    background: white;
    /* Dibujamos la rejilla con bordes individuales */
    border: 0.5px solid #ccc; 
    box-sizing: border-box;
    user-select: none;
}

.central-cell {
    background-color: #e8f0fe;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    z-index: 1;
}

.cell.is-letter.hidden-content {
    color: transparent !important;
}

/* --- LISTA DE PALABRAS --- */
.sidebar {
    margin-top: 2rem;
    text-align: center;
}

.word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    list-style: none;
    font-weight: bold;
    color: #555;
}

/* --- TOASTS --- */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.toast {
    background: #323232;
    color: white;
    padding: 12px 20px;
    border-radius: 4px;
    margin-top: 10px;
    box-shadow: var(--shadow);
}

.is-hidden { display: none; }