:root {
  --bg-main: #1a0b2e;
  --bg-header-footer: #2d1b4e;
  --bg-card: #24133d;
  --texto: #f0e6ff;
  --texto-suave: #c9b8e0;
  --acento: #9b5de5;
  --borde-rgb: linear-gradient(90deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3, #ff0000);
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-main);
  background-image:
    radial-gradient(circle at 20% 30%, rgba(155, 93, 229, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(75, 0, 130, 0.2) 0%, transparent 45%),
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 20px,
      rgba(155, 93, 229, 0.03) 20px,
      rgba(155, 93, 229, 0.03) 40px
    );
  color: var(--texto);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}

header {
  background-color: var(--bg-header-footer);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  z-index: 10;
}

.logo-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(155, 93, 229, 0.25);
  border: 2px solid rgba(155, 93, 229, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: absolute;
  left: 1.5rem;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.logo-circle:hover {
  transform: scale(1.08);
  border-color: #c77dff;
}

.logo-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.logo-circle:empty::after,
.logo-circle img[src=""] {
  content: "";
}

header h1 {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 6px;
  background: linear-gradient(135deg, #e0aaff 0%, #c77dff 35%, #9b5de5 70%, #7b2cbf 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.2s ease;
  text-shadow: 0 0 30px rgba(199, 125, 255, 0.3);
}

header h1:hover {
  filter: brightness(1.15);
  transform: scale(1.03);
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

#vista-menu {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: center;
}

.btn-rgb {
  position: relative;
  width: 100%;
  max-width: 340px;
  padding: 1.1rem 1.5rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--texto);
  background: var(--bg-card);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  z-index: 1;
  transition: transform 0.2s ease, background 0.2s ease;
  text-align: center;
}

.btn-rgb::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 14px;
  padding: 3px;
  background: var(--borde-rgb);
  background-size: 300% 100%;
  animation: rgb-border 4s linear infinite;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  z-index: -1;
}

.btn-rgb:hover {
  transform: scale(1.03);
  background: #2e1a4d;
}

.btn-rgb:active {
  transform: scale(0.98);
}

@keyframes rgb-border {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

#vista-editor {
  display: none;
  width: 100%;
  max-width: 700px;
  flex-direction: column;
  gap: 1.5rem;
}

#vista-editor.active {
  display: flex;
}

.zona-subida {
  border: 2px dashed rgba(155, 93, 229, 0.5);
  border-radius: 16px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: rgba(36, 19, 61, 0.6);
  transition: border-color 0.3s, background 0.3s;
  cursor: pointer;
}

.zona-subida:hover,
.zona-subida.dragover {
  border-color: #9b5de5;
  background: rgba(155, 93, 229, 0.15);
}

.zona-subida p {
  color: var(--texto-suave);
  margin-bottom: 1rem;
  font-size: 1rem;
}

.zona-subida .formatos {
  font-size: 0.85rem;
  color: #a78bfa;
  margin-top: 0.5rem;
}

input[type="file"] {
  display: none;
}

.btn-secundario {
  background: transparent;
  border: 1px solid rgba(155, 93, 229, 0.6);
  color: var(--texto);
  padding: 0.7rem 1.4rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.2s;
}

.btn-secundario:hover {
  background: rgba(155, 93, 229, 0.2);
}

#contenedor-editor {
  display: none;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

#contenedor-editor.active {
  display: flex;
}

.info-archivo {
  background: var(--bg-card);
  padding: 0.9rem 1.2rem;
  border-radius: 10px;
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.info-archivo span {
  color: #c4b5fd;
}

.lista-nbt {
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  max-height: 55vh;
  overflow-y: auto;
}

.item-nbt {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid rgba(155, 93, 229, 0.12);
  gap: 0.7rem;
  flex-wrap: wrap;
}

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

.item-nbt:hover {
  background: rgba(155, 93, 229, 0.08);
}

.item-nbt .tipo {
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(155, 93, 229, 0.28);
  color: #e9d5ff;
  padding: 0.18rem 0.45rem;
  border-radius: 4px;
  min-width: 42px;
  text-align: center;
  letter-spacing: 0.3px;
}

.item-nbt .nombre {
  flex: 1;
  font-weight: 500;
  min-width: 110px;
  word-break: break-all;
  font-size: 0.95rem;
}

.item-nbt input,
.item-nbt select {
  background: #1a0b2e;
  border: 1px solid rgba(155, 93, 229, 0.4);
  color: var(--texto);
  padding: 0.38rem 0.65rem;
  border-radius: 6px;
  font-size: 0.92rem;
  min-width: 130px;
  max-width: 240px;
}

.item-nbt input:focus,
.item-nbt select:focus {
  outline: none;
  border-color: #9b5de5;
  box-shadow: 0 0 0 2px rgba(155, 93, 229, 0.3);
}

.seccion-nbt {
  background: rgba(155, 93, 229, 0.12);
  padding: 0.55rem 1.1rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #c77dff;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(155, 93, 229, 0.2);
}

.nombre-mundo {
  background: linear-gradient(135deg, rgba(155, 93, 229, 0.25), rgba(123, 44, 191, 0.2));
  padding: 1rem 1.2rem;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.nombre-mundo label {
  font-size: 0.8rem;
  color: #c9b8e0;
  font-weight: 600;
}

.nombre-mundo input {
  background: #1a0b2e;
  border: 1px solid rgba(155, 93, 229, 0.5);
  color: #fff;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  font-size: 1.15rem;
  font-weight: 600;
  width: 100%;
}

.nombre-mundo input:focus {
  outline: none;
  border-color: #c77dff;
  box-shadow: 0 0 0 2px rgba(199, 125, 255, 0.3);
}

.acciones-editor {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.btn-guardar {
  background: linear-gradient(135deg, #7b2cbf, #9b5de5);
  color: white;
  border: none;
  padding: 0.9rem 2rem;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-guardar:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(155, 93, 229, 0.4);
}

footer {
  background-color: var(--bg-header-footer);
  padding: 1.5rem 1rem;
  text-align: center;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.3);
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.2rem;
  margin-bottom: 1rem;
}

.footer-links a {
  color: var(--texto-suave);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s;
  cursor: pointer;
}

.footer-links a:hover {
  color: #c77dff;
}

.redes-sociales {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.redes-sociales a {
  color: var(--texto-suave);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.redes-sociales a:hover {
  color: #9b5de5;
}

.copyright {
  font-size: 0.8rem;
  color: #8b7aa8;
  margin-top: 0.5rem;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.active {
  display: flex;
}

.modal-contenido {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 2rem;
  max-width: 560px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-contenido h2 {
  margin-bottom: 1rem;
  color: #c77dff;
}

.modal-contenido p,
.modal-contenido ul {
  margin-bottom: 0.8rem;
  color: var(--texto-suave);
}

.modal-contenido ul {
  padding-left: 1.5rem;
}

.cerrar-modal {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  background: none;
  border: none;
  color: var(--texto-suave);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.cerrar-modal:hover {
  color: #fff;
}

@media (max-width: 600px) {
  header h1 {
    font-size: 1.7rem;
    letter-spacing: 2px;
  }

  .logo-circle {
    width: 42px;
    height: 42px;
    left: 1rem;
  }

  .btn-rgb {
    font-size: 1.05rem;
    padding: 1rem 1.2rem;
  }

  .item-nbt {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .item-nbt input,
  .item-nbt select {
    width: 100%;
    max-width: none;
  }

  .acciones-editor {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-guardar,
  .btn-secundario {
    width: 100%;
  }
}

@media (min-width: 768px) {
  main {
    padding: 3rem 1rem;
  }
}

main:has(#vista-editor.active) { max-width: 920px; }
#vista-editor { max-width: 900px; }
#contenedor-editor { min-width: 0; }
.info-archivo span { overflow-wrap: anywhere; }
[hidden] { display: none !important; }

.aviso-editor {
  background: rgba(255, 170, 60, 0.12);
  border: 1px solid rgba(255, 170, 60, 0.45);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-size: 0.88rem;
}
.caja-selector { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8rem; font-weight: 600; color: var(--texto-suave); }

.barra-editor { display: flex; gap: 0.7rem; flex-wrap: wrap; align-items: center; }
.caja-selector select,
#buscar-nbt,
#form-tag input,
#form-tag select {
  background: #1a0b2e; color: var(--texto); border: 1px solid rgba(155, 93, 229, 0.4);
  border-radius: 8px; padding: 0.5rem 0.7rem; font-size: 0.92rem; width: 100%; min-width: 0;
}
#buscar-nbt { flex: 1 1 200px; width: auto; }

.lista-nbt { max-height: 60vh; min-height: 220px; border: 1px solid rgba(155, 93, 229, 0.2); }
.item-nbt { flex-wrap: nowrap; padding: 0.55rem 0.9rem; }
.item-nbt .tipo { flex: 0 0 78px; }
.item-nbt .nombre { min-width: 0; overflow-wrap: anywhere; word-break: normal; }
.item-nbt .nombre small { display: block; font-size: 0.74rem; color: #8b7aa8; font-weight: 400; }
.item-nbt .campo { display: flex; flex-direction: column; width: 230px; max-width: 50%; }
.item-nbt .campo input { width: 100%; max-width: none; min-width: 0; }
.item-nbt > select { width: 230px; max-width: 50%; min-width: 0; }
.item-nbt input.invalido, .nombre-mundo input.invalido { border-color: #ff5c7a; box-shadow: 0 0 0 2px rgba(255, 92, 122, 0.25); }
.msg-error { color: #ff8fa3; font-size: 0.76rem; }
.msg-error:empty { display: none; }

.hijos { margin-left: 0.8rem; border-left: 1px solid rgba(155, 93, 229, 0.25); }
.btn-plegar, .sin-plegar { flex: 0 0 22px; width: 22px; }
.btn-plegar { background: none; border: none; color: #c77dff; cursor: pointer; font-size: 1rem; }
.conteo { font-size: 0.8rem; color: #8b7aa8; white-space: nowrap; }
.acciones-tag { display: flex; gap: 0.25rem; justify-content: flex-end; flex: 0 0 auto; min-width: 92px; }
.btn-mini {
  background: transparent; color: var(--texto-suave); cursor: pointer; width: 28px; height: 28px; flex: 0 0 28px;
  border: 1px solid rgba(155, 93, 229, 0.35); border-radius: 6px;
}
.btn-mini:hover { background: rgba(155, 93, 229, 0.25); color: #fff; }
.btn-mas { display: block; width: 100%; padding: 0.6rem; background: rgba(155, 93, 229, 0.1); color: #c77dff; border: none; cursor: pointer; }
.vacio { padding: 1.2rem; color: var(--texto-suave); text-align: center; }

.estado-editor { font-size: 0.88rem; color: var(--texto-suave); min-height: 1.4em; overflow-wrap: anywhere; }
.estado-editor.error { color: #ff8fa3; }
.btn-guardar:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

#dialogo-tag {
  margin: auto; background: var(--bg-card); color: var(--texto); border: 1px solid rgba(155, 93, 229, 0.5);
  border-radius: 14px; padding: 1.4rem; width: min(380px, 92vw);
}
#dialogo-tag::backdrop { background: rgba(0, 0, 0, 0.65); }
#form-tag { display: flex; flex-direction: column; gap: 0.8rem; }
#form-tag label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; }

@media (max-width: 600px) {
  .item-nbt { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .item-nbt .nombre { flex: 1 1 40%; }
  .item-nbt .campo, .item-nbt > select { width: 100%; max-width: none; flex: 1 1 100%; order: 5; }
  .item-nbt input, .item-nbt select { width: auto; }
  .item-nbt .campo input, .item-nbt > select { width: 100%; }
  .acciones-tag { min-width: 0; margin-left: auto; }
  #buscar-nbt { flex-basis: 100%; }
}

.info-archivo { justify-content: center; text-align: center; }
.info-archivo span { max-width: 100%; min-width: 0; }

main:has(.vista-mundo:not([hidden])) { max-width: 700px; }
.vista-mundo, .panel-mundo { width: 100%; display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.vista-mundo > .btn-secundario, #btn-volver-editor { align-self: center; }
.vista-mundo:has(.panel-mundo:not([hidden])) > .btn-volver-abajo { display: none; }
#vista-editor:has(#contenedor-editor.active) > #btn-volver-editor { display: none; }
.tarjeta-centrada { text-align: center; overflow-wrap: anywhere; }
.tarjeta-centrada h2 { font-size: 1.5rem; color: #fff; }
.tarjeta-centrada small { color: var(--texto-suave); }
.tarjeta-modo {
  background: var(--bg-card); border: 1px solid rgba(155, 93, 229, 0.2); border-radius: 12px;
  padding: 1.2rem; display: flex; flex-direction: column; gap: 0.7rem; text-align: center;
}
.tarjeta-modo strong { color: #c77dff; }
.tarjeta-modo strong.es-hardcore { color: #ff5c7a; }
.tarjeta-modo label { font-size: 0.8rem; font-weight: 700; color: #c77dff; text-transform: uppercase; letter-spacing: 0.5px; }
.tarjeta-modo select {
  width: 100%; background: #1a0b2e; color: var(--texto); border: 1px solid rgba(155, 93, 229, 0.4);
  border-radius: 8px; padding: 0.7rem; font-size: 1rem;
}
.tarjeta-modo select:focus { outline: none; border-color: #9b5de5; box-shadow: 0 0 0 2px rgba(155, 93, 229, 0.3); }

.titulo-inicio {
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  font-size: clamp(1.7rem, 7vw, 3rem); font-weight: 800; line-height: 1.15;
  text-align: center; text-transform: uppercase; letter-spacing: 0.04em; color: #fff;
  text-shadow: 0 3px 0 #3c1470, 0 0 22px rgba(155, 93, 229, 0.55);
  margin-bottom: 0.5rem; max-width: 100%;
}
.titulo-inicio span { display: block; color: #c77dff; }

.tarjeta-modo input {
  width: 100%; background: #1a0b2e; color: var(--texto); border: 1px solid rgba(155, 93, 229, 0.4);
  border-radius: 8px; padding: 0.7rem; font-size: 1.1rem; text-align: center;
}
.tarjeta-modo input:focus { outline: none; border-color: #9b5de5; box-shadow: 0 0 0 2px rgba(155, 93, 229, 0.3); }
.tarjeta-modo small { color: var(--texto-suave); }

.logo-circle:has(img) { background: none; border: 0; width: 60px; height: 60px; overflow: visible; }
.logo-circle img { width: 100%; height: 100%; object-fit: contain; border-radius: 0; }

.intro-seccion { width: 100%; text-align: center; margin-bottom: 0.25rem; }
.intro-seccion h2 {
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  font-size: clamp(1.6rem, 6.5vw, 2.5rem); font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.03em; line-height: 1.15; color: #fff; margin-bottom: 0.75rem;
  text-shadow: 0 3px 0 #3c1470, 0 0 20px rgba(155, 93, 229, 0.55);
}
.intro-seccion p { color: var(--texto-suave); max-width: 60ch; margin: 0 auto 0.5rem; font-size: 0.95rem; }
.vista-mundo:has(.panel-mundo:not([hidden])) > .intro-seccion,
#vista-editor:has(#contenedor-editor.active) > .intro-seccion { display: none; }

.anuncio { width: min(100% - 2rem, 970px); margin: 1.5rem auto; text-align: center; min-height: 100px; }
.anuncio small { display: block; color: var(--texto-suave); font-size: 0.7rem; margin-bottom: 0.25rem; }
.anuncio ins { display: block; }
.pagina-legal { display: block; width: min(100% - 2rem, 760px); margin: 0 auto; padding: 1.5rem 0 3rem; }
.pagina-legal section { background: var(--bg-card); border-radius: 12px; padding: 1.25rem; margin-top: 1.25rem; overflow-wrap: anywhere; }
.pagina-legal h2, .pagina-legal h3, .modal-contenido h3 { color: #c77dff; margin: 0.5rem 0; }
.pagina-legal p, .pagina-legal ul { margin-bottom: 0.6rem; }
.pagina-legal ul, .modal-contenido ul { padding-left: 1.25rem; }
.pagina-legal section a, .modal-contenido a { color: #c77dff; }
.modal-contenido { max-height: 85vh; overflow-y: auto; overflow-wrap: anywhere; }
.enlace-inicio { display: inline-block; text-decoration: none; }
