/* Estilos generales */
#guerra-silmarils-style {
    display: block;
    max-width: 1240px;
    margin: 0 auto 36px;
    padding: 0 18px 32px;
    box-sizing: border-box;
    color: #2d1a0b;
}

#guerra-silmarils-container {
    width: 100%;
    max-width: 100%;
    min-height: calc(100vh - 260px);
    height: auto;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

body.guerra-silmarils-fullscreen-activo {
    overflow: hidden;
}

body.guerra-silmarils-fullscreen-activo #eau-mensajero {
    z-index: 1000 !important;
}

/* Pantalla de introducción */
#guerra-silmarils-page-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
    gap: 24px;
    align-items: start;
    padding-top: 20px;
}

#guerra-silmarils-main {
    min-width: 0;
}

#guerra-silmarils-page-layout .site-sidebar {
    background: #d9c18f;
    color: #2d1a0b;
    border: 2px solid #6d421f;
    border-radius: 8px;
    padding: 14px;
    box-shadow: 0 4px 14px rgba(45, 26, 11, 0.18);
}

#intro-guerra-silmarils,
#estado-partida,
#crear-partida {
    background: #f4ead1;
    color: #2d1a0b;
    border: 0;
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(45, 26, 11, 0.13);
    margin: 0 0 18px;
    padding: 22px;
}

#intro-guerra-silmarils,
#estado-partida {
    text-align: center;
}

#intro-guerra-silmarils h1,
#estado-partida h2,
#crear-partida h2 {
    color: #3a2110;
    margin-top: 0;
}

#intro-guerra-silmarils h1 {
    font-size: clamp(2rem, 4vw, 3.15rem);
    line-height: 1.05;
    margin-bottom: 14px;
}

.guerra-silmarils-hero-art {
    display: block;
    margin: 0 auto 14px;
    max-width: min(420px, 76vw);
}

.guerra-silmarils-hero-art img {
    display: block;
    height: auto;
    margin: 0 auto;
    width: 100%;
}

.guerra-silmarils-lead {
    color: #4b2f17;
    font-size: 1.08rem;
    line-height: 1.55;
    margin: 0 auto 18px;
    max-width: 620px;
}

#intro-guerra-silmarils a,
#crear-partida a {
    color: #456321;
    font-weight: 700;
}

.guerra-silmarils-community-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 18px;
    margin: 10px auto 4px;
    text-align: center;
}

.guerra-silmarils-community-links a {
    border: 1px solid rgba(95, 116, 56, .45);
    border-radius: 999px;
    color: #456321;
    display: inline-flex;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
    line-height: 1.2;
    padding: .42rem .78rem;
    text-decoration: none;
}

.guerra-silmarils-community-links a:hover {
    background: rgba(95, 116, 56, .12);
    color: #2f4217;
}

.guerra-silmarils-credit {
    margin: 14px auto 0;
    color: #4b2f17;
    font-size: .95rem;
    line-height: 1.45;
}

#estado-partida {
    text-align: left;
}

.guerra-silmarils-dashboard {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 1fr);
    gap: 24px;
}

.guerra-silmarils-dashboard-col {
    min-width: 0;
}

.guerra-silmarils-dashboard-col h2 {
    text-align: center;
}

.partidas-activas-lista {
    display: grid;
    gap: 16px;
}

.partida-activa-item p {
    margin: 0 0 8px;
}

.guerra-silmarils-estadisticas h3 {
    color: #3a2110;
    font-size: 1.05rem;
    margin: 18px 0 8px;
}

.guerra-silmarils-estadisticas ol {
    margin: 0 0 14px;
    padding-left: 24px;
}

.guerra-silmarils-estadisticas li {
    margin: 5px 0;
}

#crear-partida label {
    display: inline-block;
    margin: 8px 0 4px;
    font-weight: 700;
    color: #3a2110;
}

#crear-partida summary {
    cursor: pointer;
    color: #3a2110;
    font-size: 1.35rem;
    font-weight: 800;
    text-align: center;
    list-style: none;
}

#crear-partida summary::-webkit-details-marker {
    display: none;
}

#crear-partida summary::after {
    content: '+';
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin-left: 10px;
    border: 1px solid #7a5529;
    border-radius: 999px;
    color: #fff4d2;
    background: #5f7438;
    font-size: 1rem;
    vertical-align: middle;
}

#crear-partida[open] summary {
    margin-bottom: 18px;
}

#crear-partida[open] summary::after {
    content: '-';
}

#crear-partida input,
#crear-partida select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    background: #f4e6bd;
    color: #2d1a0b;
    border: 1px solid #7a5529;
    border-radius: 5px;
    padding: 8px;
}

#intro-guerra-silmarils button,
#crear-partida button,
#mensaje-partida-creada button,
.entrar-partida-link {
    background: #5f7438;
    color: #fff4d2;
    border: 1px solid #3f2613;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 700;
    padding: .55rem .9rem;
    text-decoration: none;
}

#intro-guerra-silmarils button:hover,
#crear-partida button:hover,
#mensaje-partida-creada button:hover,
.entrar-partida-link:hover {
    background: #79512d;
    color: #fff4d2;
}

/* Estilos del contenedor del juego */
#juego-guerra-silmarils {
    display: none;
    width: 100vw;
    height: 100vh;
    flex-direction: row;
    position: fixed;
    top: 0;
    left: 0;
    background-color: #1d140c;
    z-index: 20000;
    overflow: hidden;
}

#juego-guerra-silmarils.fullscreen {
    display: flex;
}

body.admin-bar #juego-guerra-silmarils {
    top: 32px;
    height: calc(100vh - 32px);
}

/* Estilos del mapa */
#mapa-juego {
    flex: 2;
    overflow: auto;
    position: relative;
    cursor: grab;
    background: url('../../images/beleriand.jpg') no-repeat center;
    background-size: cover;
}

#mapa {
    position: relative;
    width: max-content;
    min-width: 100%;
}

#mapa-beleriand {
    display: block;
    max-width: none;
}

#mapa-juego:active {
    cursor: grabbing;
}

/* Panel derecho con chat y zona de interacción */
#panel-derecho {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #b89158;
    border-left: 3px solid #5b3518;
    color: #231609;
    min-width: 330px;
    max-width: none;
    overflow: hidden;
}

#chat {
    flex: 1;
    overflow-y: auto;
    border-bottom: 2px solid #444;
    padding: 10px;
}

/* 📌 Chat con un fondo más claro y borde */
.chat-container {
    height: 200px;
    overflow-y: auto;
    background-color: #1a1a1a;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #444;
}

/* 📌 Estilos diferenciados para mensajes de jugadores y eventos */
.mensaje-jugador {
    color: #f4f7fb;
    font-weight: bold;
}

.evento-juego {
    color: #ffa500;
    font-style: italic;
    border-left: 3px solid #ffa500;
    padding-left: 5px;
    margin-bottom: 5px;
}


#zona-interaccion {
    flex: 1 1 52%;
    min-height: 0;
    padding: 10px;
    overflow-y: auto;
    background: #d2b17a;
    border-top: 2px solid #6d421f;
}

/* Botón de cerrar partida */
.close-game {
    position: absolute;
    top: 10px;
    left: 10px;
    background: red;
    color: white;
    padding: 5px 10px;
    border: none;
    cursor: pointer;
}

body.admin-bar .close-game {
    top: 12px;
}

.entrar-partida-link {
    display: inline-block;
    background: #5f7438;
    color: #fff4d2;
    border: 1px solid #3f2613;
    padding: 7px 10px;
    text-decoration: none;
    font-weight: 700;
    border-radius: 5px;
}


/* Botón interactivo */
button {
    background: green;
	color: white;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 5px;
}

button:hover {
    background: red;
}

#tooltip-territorio {
    position: absolute;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 14px;
    display: none;
    pointer-events: none;
    z-index: 1000;
}

/* Estilos chat */
.chat-container {
    height: 200px;
    overflow-y: auto;
    background-color: #222;
    padding: 10px;
    border-radius: 5px;
}

.mensaje-jugador {
    color: #f4f7fb; /* Mensajes normales en color claro */
    font-weight: 600;
}

.close-game-bottom {
    position: absolute;
    left: 16px;
    bottom: 16px;
    z-index: 100;
    background: #7a1e12;
    color: #fff7dd;
    border: 2px solid #f0d79a;
    padding: 9px 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

#panel-partida {
    flex: 0 0 48%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 48%;
    padding: 8px;
    gap: 8px;
}

#panel-personaje {
    background: #e4c990;
    border: 2px solid #6d421f;
    padding: 7px 8px;
    font-weight: 700;
}

.panel-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
}

.panel-tab {
    background: #79512d;
    color: #fff4d2;
    border: 1px solid #3f2613;
    padding: 7px 5px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    min-width: 0;
    white-space: normal;
    line-height: 1.15;
}

.panel-tab.active {
    background: #efe0ad;
    color: #261507;
}

.panel-tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    background: #d9bd7e;
    border: 2px solid #6d421f;
    padding: 6px;
    min-height: 0;
}

.panel-tab-content.active {
    display: block;
}

#panel-registro {
    color: #2d1a0b;
}

#panel-registro .evento-juego,
#panel-registro .fecha-mensaje {
    color: #3a2110;
}

#panel-chat.panel-tab-content.active {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#panel-chat .chat-container {
    flex: 0 1 130px;
    height: 130px;
    min-height: 90px;
    overflow-y: auto;
    background: transparent;
    color: #2d1a0b;
    border-color: rgba(93, 55, 24, 0.55);
    margin-bottom: 8px;
}

#panel-chat .mensaje-jugador,
#panel-chat .mensaje-jugador strong,
#panel-chat .mensaje-jugador .fecha-mensaje,
#panel-chat .mensaje-info,
#panel-chat .evento-juego {
    color: #2d1a0b;
}

#panel-chat #mensaje-input {
    width: 100%;
    box-sizing: border-box;
    flex: 0 0 auto;
    background: #ead3a0;
    color: #2d1a0b;
    border: 1px solid #7a5529;
}

.modal-canje-cartas {
    position: fixed;
    inset: 0;
    z-index: 30050;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
}

.modal-canje-contenido {
    width: min(760px, 92vw);
    max-height: 86vh;
    overflow: auto;
    background: #d9bd7e;
    color: #2d1a0b;
    border: 3px solid #5b3518;
    padding: 14px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

.modal-canje-contenido h3 {
    margin: 0 0 6px;
}

.modal-conquista {
    position: fixed;
    inset: 0;
    z-index: 30060;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.58);
}

.modal-conquista-contenido {
    width: min(560px, 92vw);
    background: #d9bd7e;
    color: #2d1a0b;
    border: 3px solid #5b3518;
    padding: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

.modal-conquista-contenido h3 {
    margin: 0 0 8px;
}

.modal-conquista-acciones,
.modal-conquista-cantidad {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}

.modal-conquista button {
    background: #5b3518;
    color: #fff4d6;
    border: 1px solid #2d1a0b;
    padding: 8px 10px;
    cursor: pointer;
}

.modal-conquista button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.modal-conquista input {
    width: 74px;
    background: #ead3a0;
    color: #2d1a0b;
    border: 1px solid #7a5529;
    padding: 7px;
}

.modal-conquista-error {
    min-height: 18px;
    color: #7c160f;
    font-weight: bold;
}

.canje-cartas-lista {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 8px;
    margin: 10px 0;
}

.canje-carta {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    background: rgba(255, 244, 209, 0.85);
    color: #2d1a0b;
    border: 2px solid #7a5529;
    padding: 5px;
    cursor: pointer;
    font-size: 11px;
    line-height: 1.15;
}

.canje-carta img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
}

.canje-carta.seleccionada {
    background: #f0d79a;
    border-color: #7a1e12;
    box-shadow: 0 0 0 3px rgba(122, 30, 18, 0.25);
}

.canje-cartas-acciones {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.lista-cartas {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.carta-panel {
    background: rgba(255, 244, 209, 0.75);
    border: 1px solid #7a5529;
    padding: 4px;
    font-size: 11px;
    line-height: 1.15;
}

.carta-panel img {
    width: 100%;
    max-height: 130px;
    object-fit: contain;
    display: block;
    margin-bottom: 4px;
}

.tabla-resumen {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tabla-resumen th,
.tabla-resumen td {
    border-bottom: 1px solid rgba(81, 50, 22, 0.45);
    padding: 5px;
    text-align: left;
}

.mensaje-jugador .fecha-mensaje {
    color: #b8c2d1;
    font-weight: 400;
}

.mensaje-jugador strong {
    color: #ffffff;
}

.evento-juego {
    color: #ffa500; /* Color naranja para eventos */
    font-style: italic;
    border-left: 3px solid #ffa500;
    padding-left: 5px;
    margin-bottom: 5px;
}

#mensaje-input {
    width: calc(100% - 60px);
    padding: 5px;
    border-radius: 5px;
    border: none;
    background: #f7fafc;
    color: #111827;
}

#enviar-mensaje {
    background-color: #007bff;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
}

#chat textarea {
    width: 100%;
    height: 50px;
    background: #222;
    border: 1px solid #555;
    color: white;
    padding: 5px;
}

/* 📌 Marcadores de tropas en el mapa */
.territorio-marker {
    position: absolute;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
    min-width: 76px;
    min-height: 76px;
    pointer-events: auto;
}

.territorio-flag-marker {
    min-width: 54px;
    min-height: 54px;
}

.territorio-info-marker {
    min-width: 76px;
    min-height: 48px;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.mostrar-cajas-territorios-propios .territorio-info-marker.territorio-marker-propio {
    padding: 4px 6px;
    background: rgba(239, 224, 173, 0.86);
    border: 2px solid rgba(91, 53, 24, 0.85);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.territorio-marker::before {
    display: none;
    content: "";
    position: absolute;
    top: 38px;
    left: 50%;
    width: 76px;
    height: 62px;
    border-radius: 10px;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.42);
    border: 2px solid rgba(255, 255, 255, 0.38);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
    z-index: -1;
}

.territorio-marker-propio {
    z-index: 20;
    cursor: pointer;
}

.territorio-marker-propio::before {
    display: none;
}

.territorio-info-marker::before {
    display: none;
}

.territorio-marker-seleccionado::before {
    display: none;
}

.bandera-territorio {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 42px;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.65));
}

.bandera-territorio .icono-bandera {
    width: 44px;
    height: 36px;
    object-fit: contain;
}

.tropas-total {
    position: absolute;
    right: -6px;
    bottom: -3px;
    min-width: 20px;
    padding: 1px 4px;
    border-radius: 10px;
    background: rgba(20, 12, 5, 0.88);
    color: #fff7d6;
    border: 1px solid rgba(255, 231, 174, 0.85);
    font-size: 12px;
    font-weight: 700;
}

.mis-armadas {
    margin-top: 0;
    white-space: nowrap;
}

.grupo-armada {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    margin: 0 3px;
    vertical-align: top;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.65));
}

/* 📌 Iconos de ejércitos */
.icono-ejercito {
    width: 32px;
    height: 36px;
    display: block;
    margin: 0 auto;
}

/* 📌 Iconos de banderas */
.icono-bandera {
    width: 44px;
    height: 36px;
    display: block;
    margin: 1px auto;
}

/* 📌 Número de tropas */
.tropas-numero {
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
    padding: 1px 5px;
    border-radius: 3px;
    display: inline-block;
}

/* 📌 Modal para mensajes en el centro de la pantalla */
.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    z-index: 30001;
    width: 400px;
    max-width: 90%;
}

/* 📌 Contenedor de la modal */
.modal-contenido {
    padding: 10px;
}

/* 📌 Botón dentro de la modal */
.modal button {
    margin-top: 10px;
    background: #28a745;
    padding: 8px 12px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
}

.modal button:hover {
    background: #218838;
}

/* 📌 Para asegurar que la modal está por encima de todo */
.modal-fondo {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    z-index: 30000;
}

.popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ead7a8;
    color: #2d1a0b;
    padding: 20px;
    border: 3px solid #6d421f;
    border-radius: 8px;
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
    width: min(88vw, 720px);
    max-height: 88vh;
    z-index: 30020;
}

.popup-content {
    text-align: left;
}

.popup-content h2,
.popup-content h3 {
    color: #3a2110;
}

.popup-scroll {
    max-height: 68vh;
    overflow-y: auto;
    padding: 10px;
    background: rgba(255, 244, 209, 0.45);
    border: 1px solid rgba(93, 55, 24, 0.35);
}

.popup-img {
    width: 100%;
    max-width: 620px;
    display: block;
    margin: 12px auto;
    border: 2px solid #6d421f;
}

.close-popup {
    cursor: pointer;
    float: right;
    font-size: 22px;
    font-weight: bold;
    color: #5b3518;
}

.popup-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.popup-table th,
.popup-table td {
    border: 1px solid #7a5529;
    padding: 8px;
    text-align: center;
}

.popup-table th {
    background-color: #5f7438;
    color: #fff4d2;
}

@media (max-width: 900px) {
    #guerra-silmarils-page-layout {
        grid-template-columns: 1fr;
    }

    .guerra-silmarils-dashboard {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    #guerra-silmarils-page-layout .site-sidebar {
        display: none;
    }

    #intro-guerra-silmarils,
    #estado-partida,
    #crear-partida {
        padding: 18px;
    }

    .guerra-silmarils-hero-art {
        max-width: min(320px, 78vw);
    }

    .guerra-silmarils-lead {
        font-size: 1rem;
    }
}
